mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
0.1.12-T2
This commit is contained in:
parent
bc8124f2f2
commit
5881c52339
@ -26,6 +26,7 @@ module.exports = {
|
|||||||
openwheater_apiKey:'2acf34be0b8f033b89ba4de1e674d42a',
|
openwheater_apiKey:'2acf34be0b8f033b89ba4de1e674d42a',
|
||||||
},
|
},
|
||||||
Endpoints: {
|
Endpoints: {
|
||||||
|
find_user: "https://api.ragestudio.net/RS-YIBTP/yid/find_user?access_token=",
|
||||||
search_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/search?access_token=",
|
search_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/search?access_token=",
|
||||||
get_sessions: "https://api.ragestudio.net/RS-YIBTP/yid/session_id?access_token=",
|
get_sessions: "https://api.ragestudio.net/RS-YIBTP/yid/session_id?access_token=",
|
||||||
auth_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/auth",
|
auth_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/auth",
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { cloneDeep, isString, flow, curry } from 'lodash';
|
||||||
|
import umiRouter from 'umi/router';
|
||||||
import Cookies from "ts-cookies";
|
import Cookies from "ts-cookies";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import {SetControls, CloseControls} from ".././components/Layout/Control"
|
import {SetControls, CloseControls} from ".././components/Layout/Control"
|
||||||
@ -39,6 +41,17 @@ export const UIFxList = {
|
|||||||
notifySuccess: (ycore_worker.FXapiProvider + 'notifySuccess.wav')
|
notifySuccess: (ycore_worker.FXapiProvider + 'notifySuccess.wav')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const crouter = {
|
||||||
|
native: (e) =>{
|
||||||
|
umiRouter.push({
|
||||||
|
pathname: `/${e}`,
|
||||||
|
search: window.location.search,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
default: (e) =>{
|
||||||
|
router.push(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function notifyError(err){
|
export function notifyError(err){
|
||||||
antd.notification.error({
|
antd.notification.error({
|
||||||
@ -54,6 +67,56 @@ export function notifyProccess(cust){
|
|||||||
placement: 'bottomLeft'
|
placement: 'bottomLeft'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function FindUser(key, callback){
|
||||||
|
let formdata = new FormData();
|
||||||
|
formdata.append("server_key", yConfig.server_key);
|
||||||
|
formdata.append("search_key", key);
|
||||||
|
const urlOBJ = `${endpoints.find_user}${GetUserToken.decrypted().UserToken}`
|
||||||
|
const settings = {
|
||||||
|
"url": urlOBJ,
|
||||||
|
"method": "POST",
|
||||||
|
"timeout": 10000,
|
||||||
|
"processData": false,
|
||||||
|
"mimeType": "multipart/form-data",
|
||||||
|
"contentType": false,
|
||||||
|
"data": formdata
|
||||||
|
};
|
||||||
|
jquery.ajax(settings)
|
||||||
|
.done(function (response) {
|
||||||
|
return callback(null, response);
|
||||||
|
})
|
||||||
|
.fail(function (response) {
|
||||||
|
const exception = 'API Bad response';
|
||||||
|
return callback(exception, response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SeachKeywords(key, callback){
|
||||||
|
let formdata = new FormData();
|
||||||
|
formdata.append("server_key", yConfig.server_key);
|
||||||
|
formdata.append("search_key", key);
|
||||||
|
const urlOBJ = `${endpoints.search_endpoint}${GetUserToken.decrypted().UserToken}`
|
||||||
|
const settings = {
|
||||||
|
"url": urlOBJ,
|
||||||
|
"method": "POST",
|
||||||
|
"timeout": 10000,
|
||||||
|
"processData": false,
|
||||||
|
"mimeType": "multipart/form-data",
|
||||||
|
"contentType": false,
|
||||||
|
"data": formdata
|
||||||
|
};
|
||||||
|
jquery.ajax(settings)
|
||||||
|
.done(function (response) {
|
||||||
|
return callback(null, response);
|
||||||
|
})
|
||||||
|
.fail(function (response) {
|
||||||
|
const exception = 'Request Failed';
|
||||||
|
return callback(exception, response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export function GetFeedPosts(callback) {
|
export function GetFeedPosts(callback) {
|
||||||
let formdata = new FormData();
|
let formdata = new FormData();
|
||||||
formdata.append("server_key", yConfig.server_key);
|
formdata.append("server_key", yConfig.server_key);
|
||||||
@ -72,6 +135,7 @@ export function GetFeedPosts(callback) {
|
|||||||
return callback( null, result)
|
return callback( null, result)
|
||||||
})
|
})
|
||||||
.catch(error => console.log('error', error));
|
.catch(error => console.log('error', error));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,14 +46,14 @@
|
|||||||
z-index: 10;
|
z-index: 10;
|
||||||
transition: width 0.2s;
|
transition: width 0.2s;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
transition: all 0.2s ease;
|
||||||
&.collapsed {
|
&.collapsed {
|
||||||
width: ~'calc(100% - 180px)';
|
width: ~'calc(100% - 180px)';
|
||||||
background-color: rgb(80, 80, 80);
|
|
||||||
background-color: @LDarkMode-backgroud;
|
background-color: @LDarkMode-backgroud;
|
||||||
color: @DarkMode-color;
|
color: @DarkMode-color;
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
transition: box-shadow 1s linear;
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
:global {
|
:global {
|
||||||
|
|
||||||
|
@ -97,6 +97,7 @@ class L_Sider extends PureComponent {
|
|||||||
breakpoint="lg"
|
breakpoint="lg"
|
||||||
trigger={null}
|
trigger={null}
|
||||||
collapsible
|
collapsible
|
||||||
|
defaultCollapsed="false"
|
||||||
onBreakpoint={isMobile ? null : onCollapseChange}
|
onBreakpoint={isMobile ? null : onCollapseChange}
|
||||||
collapsedWidth={this.Balancer()? "35" : "90"}
|
collapsedWidth={this.Balancer()? "35" : "90"}
|
||||||
theme={this.StrictMode()}
|
theme={this.StrictMode()}
|
||||||
|
@ -9,26 +9,33 @@ const userData = ycore.SDCP();
|
|||||||
|
|
||||||
function isOwnProfile(id){
|
function isOwnProfile(id){
|
||||||
if(id == userData.username){
|
if(id == userData.username){
|
||||||
|
console.log('Is your own profile !!')
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const UserHeader = ({ inputIO }) => {
|
const UserHeader = ({ values }) => {
|
||||||
return (
|
return (
|
||||||
<PageHeaderWrapper content={
|
<div className={styles.userWrapper}>
|
||||||
<div className={styles.pageHeaderContent}>
|
<div className={styles.UserCover}>
|
||||||
<div className={styles.avatar}>
|
<img src={values.cover} />
|
||||||
<antd.Avatar shape="square" size="large" src={userData.avatar} />
|
</div>
|
||||||
</div>
|
<PageHeaderWrapper content={
|
||||||
<div className={styles.content}>
|
<div className={styles.pageHeaderContent}>
|
||||||
<div className={styles.contentTitle}>
|
|
||||||
<h1 style={{ marginBottom: '0px' }} >{inputIO.username}</h1>
|
<div className={styles.avatar}>
|
||||||
<span style={{ fontSize: '14px', fontWeight: '100', lineHeight: '0', marginBottom: '5px' }}>{userData.about}</span>
|
<antd.Avatar shape="square" size="large" src={values.avatar} />
|
||||||
|
</div>
|
||||||
|
<div className={styles.content}>
|
||||||
|
<div className={styles.contentTitle}>
|
||||||
|
<h1 style={{ marginBottom: '0px' }} >{values.username}</h1>
|
||||||
|
<span style={{ fontSize: '14px', fontWeight: '100', lineHeight: '0', marginBottom: '5px' }}>{values.about}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
} />
|
||||||
} />
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
class UserProfile extends React.Component {
|
class UserProfile extends React.Component {
|
||||||
@ -36,33 +43,55 @@ class UserProfile extends React.Component {
|
|||||||
super(props),
|
super(props),
|
||||||
this.state = {
|
this.state = {
|
||||||
RenderValue: {},
|
RenderValue: {},
|
||||||
|
loading: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(){
|
componentDidMount(){
|
||||||
const { regx } = this.props
|
const { regx } = this.props
|
||||||
this.initUser(regx)
|
this.initUser(regx)
|
||||||
|
|
||||||
}
|
}
|
||||||
initUser = (e) => {
|
initUser = (e) => {
|
||||||
const parsed = e.shift()
|
const parsed = e.shift()
|
||||||
const raw = parsed.toString()
|
const raw = parsed.toString()
|
||||||
const string = raw.replace('/@', "")
|
const string = raw.replace('/@', "")
|
||||||
|
|
||||||
const uservalue = { id: '', userToken: userData.userToken }
|
const selfProfile = { id: userData.id, username: userData.username, avatar: userData.avatar, about: userData.about }
|
||||||
// ycore.GetUserData()
|
|
||||||
let rendVal = { id: '0', username: string, avatar: '' }
|
isOwnProfile(e)? this.setState({RenderValue: selfProfile, loading: false}) : (
|
||||||
this.setState({ RenderValue: rendVal})
|
ycore.FindUser(string, (exception, response)=> {
|
||||||
console.log(`User => ${string} `)
|
exception? ycore.notifyError(exception) : null
|
||||||
|
try {
|
||||||
|
const rp = JSON.parse(response)
|
||||||
|
ycore.DevOptions.ShowFunctionsLogs? console.log(rp) : null
|
||||||
|
if (!rp['0']) {
|
||||||
|
ycore.DevOptions.ShowFunctionsLogs? console.log('Bad response / User not found') : null
|
||||||
|
const val = { id: null, username: 'User not found!'}
|
||||||
|
this.setState({ RenderValue: val, loading: false })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const c1 = rp['0'].username.toLowerCase()
|
||||||
|
const c2 = string.toLowerCase()
|
||||||
|
if (c1 !== c2) {
|
||||||
|
console.log(`Using aproximate user! => ${c1} / ${c2}`)
|
||||||
|
ycore.crouter.native(`@${c1}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({ RenderValue: rp['0'], loading: false })
|
||||||
|
} catch (err) {
|
||||||
|
ycore.notifyError(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
render(){
|
render(){
|
||||||
const { regx } = this.props;
|
const { loading } = this.state
|
||||||
console.log( regx )
|
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
{isOwnProfile(regx)? <h1>Your profile</h1> : null}
|
{loading? <antd.Skeleton active /> : <UserHeader values={this.state.RenderValue} />}
|
||||||
<UserHeader inputIO={this.state.RenderValue} />
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,19 @@
|
|||||||
@import '~themes/default';
|
@import '~themes/default';
|
||||||
|
|
||||||
|
.UserCover {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
margin: -32px auto 0 auto;
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
min-height: 366.1px;
|
||||||
|
max-height: 366.1px;
|
||||||
|
height: 366.1px;
|
||||||
|
img{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.textOverflow() {
|
.textOverflow() {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
@ -22,6 +22,7 @@ class PrimaryLayout extends PureComponent {
|
|||||||
constructor(props){
|
constructor(props){
|
||||||
super(props)
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
|
collapsed: store.get('collapsed') || false,
|
||||||
isMobile: false,
|
isMobile: false,
|
||||||
resbypass: store.get('resbypass') || false,
|
resbypass: store.get('resbypass') || false,
|
||||||
RemByPass: false,
|
RemByPass: false,
|
||||||
@ -48,11 +49,10 @@ class PrimaryLayout extends PureComponent {
|
|||||||
unenquireScreen(this.enquireHandler)
|
unenquireScreen(this.enquireHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
onCollapseChange = collapsed => {
|
onCollapseChange = () => {
|
||||||
this.props.dispatch({
|
this.setState({ collapsed: !this.state.collapsed })
|
||||||
type: 'app/handleCollapseChange',
|
store.set('collapsed', this.state.collapsed)
|
||||||
payload: collapsed,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ResByPassHandler() {
|
ResByPassHandler() {
|
||||||
@ -76,8 +76,8 @@ class PrimaryLayout extends PureComponent {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { app, location, dispatch, children } = this.props
|
const { app, location, dispatch, children } = this.props
|
||||||
const { theme, routeList, collapsed, notifications } = app
|
const { theme, routeList, notifications } = app
|
||||||
const { isMobile, resbypass, rememberbypass } = this.state
|
const { isMobile, resbypass, collapsed ,rememberbypass } = this.state
|
||||||
const { onCollapseChange } = this
|
const { onCollapseChange } = this
|
||||||
// Localized route name.
|
// Localized route name.
|
||||||
const lang = langFromPath(location.pathname)
|
const lang = langFromPath(location.pathname)
|
||||||
|
@ -27,7 +27,6 @@ export default {
|
|||||||
AppSettings: store.get('app_settings') || config.defaultSettings,
|
AppSettings: store.get('app_settings') || config.defaultSettings,
|
||||||
locationQuery: {},
|
locationQuery: {},
|
||||||
theme: store.get('theme') || 'light',
|
theme: store.get('theme') || 'light',
|
||||||
collapsed: store.get('collapsed') || false,
|
|
||||||
notifications: [
|
notifications: [
|
||||||
{
|
{
|
||||||
title: 'Hey! Test notification',
|
title: 'Hey! Test notification',
|
||||||
@ -120,11 +119,6 @@ export default {
|
|||||||
state.theme = payload
|
state.theme = payload
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCollapseChange(state, { payload }) {
|
|
||||||
store.set('collapsed', payload)
|
|
||||||
state.collapsed = payload
|
|
||||||
},
|
|
||||||
|
|
||||||
allNotificationsRead(state) {
|
allNotificationsRead(state) {
|
||||||
state.notifications = []
|
state.notifications = []
|
||||||
},
|
},
|
||||||
|
@ -43,14 +43,23 @@ class Main extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
getTarget = () => document.getElementById("PostsWrapper")
|
||||||
render(){
|
render(){
|
||||||
const { loading, createPost } = this.state;
|
const target = this.getTarget();
|
||||||
console.log('createPost =>', createPost)
|
const { loading, createPost } = this.state;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<MainSidebar />
|
<MainSidebar />
|
||||||
{createPost? <PostCreator refreshPull={() => {this.handleRefreshList()}} /> : null}
|
{createPost? <PostCreator refreshPull={() => {this.handleRefreshList()}} /> : null}
|
||||||
{loading? <antd.Card style={{ maxWidth: '26.5vw', margin: 'auto' }} ><antd.Skeleton avatar paragraph={{ rows: 4 }} active /></antd.Card> : <div className={styles.PostsWrapper}> {this.renderFeedPosts()} </div>}
|
{loading?
|
||||||
|
<antd.Card style={{ maxWidth: '26.5vw', margin: 'auto' }} >
|
||||||
|
<antd.Skeleton avatar paragraph={{ rows: 4 }} active />
|
||||||
|
</antd.Card> :
|
||||||
|
<div id="PostsWrapper" className={styles.PostsWrapper}>
|
||||||
|
<antd.BackTop target={() => document.getElementById("PostsWrapper") } />
|
||||||
|
{this.renderFeedPosts()}
|
||||||
|
</div>}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,11 @@
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
:global {
|
||||||
|
.ant-back-top {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 100000000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react'
|
import React, { PureComponent } from 'react'
|
||||||
import { UserProfile } from 'components'
|
|
||||||
import { pathMatchRegexp } from 'utils'
|
import { pathMatchRegexp } from 'utils'
|
||||||
import styles from './styles.less'
|
import styles from './styles.less'
|
||||||
import * as ycore from 'ycore'
|
import * as ycore from 'ycore'
|
||||||
@ -14,24 +13,24 @@ class SearchPageIndexer extends PureComponent {
|
|||||||
SearchResult: ''
|
SearchResult: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SeachKeywords(key){
|
|
||||||
let formdata = new FormData();
|
componentDidMount(){
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
try {
|
||||||
formdata.append("search_key", key);
|
const {location} = this.props
|
||||||
const requestOptions = {
|
const matchSearch = pathMatchRegexp("/s/:id", location.pathname);
|
||||||
method: 'POST',
|
const parsed = matchSearch.shift()
|
||||||
body: formdata,
|
const raw = parsed.toString()
|
||||||
|
const string = raw.replace('/s/', "")
|
||||||
|
ycore.SeachKeywords(string, (exception, response) => {
|
||||||
|
console.log(response)
|
||||||
|
exception? ycore.notifyError(exception) : null
|
||||||
|
this.setState({ SearchResult: response })
|
||||||
|
})
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
ycore.notifyError(err)
|
||||||
}
|
}
|
||||||
const uriObj = (`${ycore.endpoints.search_endpoint}${ycore.GetUserToken.decrypted().UserToken}`)
|
|
||||||
fetch(uriObj, requestOptions)
|
|
||||||
.then(result => {
|
|
||||||
console.log(result)
|
|
||||||
this.setState({ SearchResult: result })
|
|
||||||
|
|
||||||
})
|
|
||||||
.catch(error => console.log('error', error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {location} = this.props
|
const {location} = this.props
|
||||||
@ -43,7 +42,7 @@ class SearchPageIndexer extends PureComponent {
|
|||||||
|
|
||||||
|
|
||||||
if (matchSearch) {
|
if (matchSearch) {
|
||||||
this.SeachKeywords(string)
|
|
||||||
console.log(`Search matched! ${location.pathname}`)
|
console.log(`Search matched! ${location.pathname}`)
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user