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',
|
||||
},
|
||||
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=",
|
||||
get_sessions: "https://api.ragestudio.net/RS-YIBTP/yid/session_id?access_token=",
|
||||
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 axios from "axios";
|
||||
import {SetControls, CloseControls} from ".././components/Layout/Control"
|
||||
@ -39,6 +41,17 @@ export const UIFxList = {
|
||||
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){
|
||||
antd.notification.error({
|
||||
@ -54,6 +67,56 @@ export function notifyProccess(cust){
|
||||
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) {
|
||||
let formdata = new FormData();
|
||||
formdata.append("server_key", yConfig.server_key);
|
||||
@ -73,6 +136,7 @@ export function GetFeedPosts(callback) {
|
||||
})
|
||||
.catch(error => console.log('error', error));
|
||||
|
||||
|
||||
}
|
||||
|
||||
export const get_app_session = {
|
||||
|
@ -46,14 +46,14 @@
|
||||
z-index: 10;
|
||||
transition: width 0.2s;
|
||||
right: 0;
|
||||
transition: all 0.2s ease;
|
||||
&.collapsed {
|
||||
width: ~'calc(100% - 180px)';
|
||||
background-color: rgb(80, 80, 80);
|
||||
background-color: @LDarkMode-backgroud;
|
||||
color: @DarkMode-color;
|
||||
border-color: transparent;
|
||||
box-shadow: none;
|
||||
transition: box-shadow 1s linear;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
:global {
|
||||
|
||||
|
@ -97,6 +97,7 @@ class L_Sider extends PureComponent {
|
||||
breakpoint="lg"
|
||||
trigger={null}
|
||||
collapsible
|
||||
defaultCollapsed="false"
|
||||
onBreakpoint={isMobile ? null : onCollapseChange}
|
||||
collapsedWidth={this.Balancer()? "35" : "90"}
|
||||
theme={this.StrictMode()}
|
||||
|
@ -9,26 +9,33 @@ const userData = ycore.SDCP();
|
||||
|
||||
function isOwnProfile(id){
|
||||
if(id == userData.username){
|
||||
console.log('Is your own profile !!')
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const UserHeader = ({ inputIO }) => {
|
||||
const UserHeader = ({ values }) => {
|
||||
return (
|
||||
<PageHeaderWrapper content={
|
||||
<div className={styles.pageHeaderContent}>
|
||||
<div className={styles.avatar}>
|
||||
<antd.Avatar shape="square" size="large" src={userData.avatar} />
|
||||
</div>
|
||||
<div className={styles.content}>
|
||||
<div className={styles.contentTitle}>
|
||||
<h1 style={{ marginBottom: '0px' }} >{inputIO.username}</h1>
|
||||
<span style={{ fontSize: '14px', fontWeight: '100', lineHeight: '0', marginBottom: '5px' }}>{userData.about}</span>
|
||||
<div className={styles.userWrapper}>
|
||||
<div className={styles.UserCover}>
|
||||
<img src={values.cover} />
|
||||
</div>
|
||||
<PageHeaderWrapper content={
|
||||
<div className={styles.pageHeaderContent}>
|
||||
|
||||
<div className={styles.avatar}>
|
||||
<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>
|
||||
);
|
||||
};
|
||||
class UserProfile extends React.Component {
|
||||
@ -36,33 +43,55 @@ class UserProfile extends React.Component {
|
||||
super(props),
|
||||
this.state = {
|
||||
RenderValue: {},
|
||||
loading: true
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
const { regx } = this.props
|
||||
this.initUser(regx)
|
||||
|
||||
}
|
||||
initUser = (e) => {
|
||||
const parsed = e.shift()
|
||||
const raw = parsed.toString()
|
||||
const string = raw.replace('/@', "")
|
||||
|
||||
const uservalue = { id: '', userToken: userData.userToken }
|
||||
// ycore.GetUserData()
|
||||
let rendVal = { id: '0', username: string, avatar: '' }
|
||||
this.setState({ RenderValue: rendVal})
|
||||
console.log(`User => ${string} `)
|
||||
const selfProfile = { id: userData.id, username: userData.username, avatar: userData.avatar, about: userData.about }
|
||||
|
||||
isOwnProfile(e)? this.setState({RenderValue: selfProfile, loading: false}) : (
|
||||
ycore.FindUser(string, (exception, response)=> {
|
||||
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(){
|
||||
const { regx } = this.props;
|
||||
console.log( regx )
|
||||
const { loading } = this.state
|
||||
return(
|
||||
<div>
|
||||
{isOwnProfile(regx)? <h1>Your profile</h1> : null}
|
||||
<UserHeader inputIO={this.state.RenderValue} />
|
||||
{loading? <antd.Skeleton active /> : <UserHeader values={this.state.RenderValue} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -1,5 +1,19 @@
|
||||
@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() {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
@ -22,6 +22,7 @@ class PrimaryLayout extends PureComponent {
|
||||
constructor(props){
|
||||
super(props)
|
||||
this.state = {
|
||||
collapsed: store.get('collapsed') || false,
|
||||
isMobile: false,
|
||||
resbypass: store.get('resbypass') || false,
|
||||
RemByPass: false,
|
||||
@ -48,11 +49,10 @@ class PrimaryLayout extends PureComponent {
|
||||
unenquireScreen(this.enquireHandler)
|
||||
}
|
||||
|
||||
onCollapseChange = collapsed => {
|
||||
this.props.dispatch({
|
||||
type: 'app/handleCollapseChange',
|
||||
payload: collapsed,
|
||||
})
|
||||
onCollapseChange = () => {
|
||||
this.setState({ collapsed: !this.state.collapsed })
|
||||
store.set('collapsed', this.state.collapsed)
|
||||
|
||||
}
|
||||
|
||||
ResByPassHandler() {
|
||||
@ -76,8 +76,8 @@ class PrimaryLayout extends PureComponent {
|
||||
|
||||
render() {
|
||||
const { app, location, dispatch, children } = this.props
|
||||
const { theme, routeList, collapsed, notifications } = app
|
||||
const { isMobile, resbypass, rememberbypass } = this.state
|
||||
const { theme, routeList, notifications } = app
|
||||
const { isMobile, resbypass, collapsed ,rememberbypass } = this.state
|
||||
const { onCollapseChange } = this
|
||||
// Localized route name.
|
||||
const lang = langFromPath(location.pathname)
|
||||
|
@ -27,7 +27,6 @@ export default {
|
||||
AppSettings: store.get('app_settings') || config.defaultSettings,
|
||||
locationQuery: {},
|
||||
theme: store.get('theme') || 'light',
|
||||
collapsed: store.get('collapsed') || false,
|
||||
notifications: [
|
||||
{
|
||||
title: 'Hey! Test notification',
|
||||
@ -120,11 +119,6 @@ export default {
|
||||
state.theme = payload
|
||||
},
|
||||
|
||||
handleCollapseChange(state, { payload }) {
|
||||
store.set('collapsed', payload)
|
||||
state.collapsed = payload
|
||||
},
|
||||
|
||||
allNotificationsRead(state) {
|
||||
state.notifications = []
|
||||
},
|
||||
|
@ -43,14 +43,23 @@ class Main extends React.Component {
|
||||
}
|
||||
|
||||
}
|
||||
getTarget = () => document.getElementById("PostsWrapper")
|
||||
render(){
|
||||
const target = this.getTarget();
|
||||
const { loading, createPost } = this.state;
|
||||
console.log('createPost =>', createPost)
|
||||
return (
|
||||
<div>
|
||||
|
||||
<MainSidebar />
|
||||
{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>
|
||||
)
|
||||
}
|
||||
|
@ -2,5 +2,11 @@
|
||||
margin: auto;
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
:global {
|
||||
.ant-back-top {
|
||||
position: absolute;
|
||||
z-index: 100000000;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
import React, { PureComponent } from 'react'
|
||||
import { UserProfile } from 'components'
|
||||
import { pathMatchRegexp } from 'utils'
|
||||
import styles from './styles.less'
|
||||
import * as ycore from 'ycore'
|
||||
@ -14,25 +13,25 @@ class SearchPageIndexer extends PureComponent {
|
||||
SearchResult: ''
|
||||
}
|
||||
}
|
||||
SeachKeywords(key){
|
||||
let formdata = new FormData();
|
||||
formdata.append("server_key", ycore.yConfig.server_key);
|
||||
formdata.append("search_key", key);
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
body: formdata,
|
||||
|
||||
componentDidMount(){
|
||||
try {
|
||||
const {location} = this.props
|
||||
const matchSearch = pathMatchRegexp("/s/:id", location.pathname);
|
||||
const parsed = matchSearch.shift()
|
||||
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() {
|
||||
const {location} = this.props
|
||||
const matchSearch = pathMatchRegexp("/s/:id", location.pathname);
|
||||
@ -43,7 +42,7 @@ class SearchPageIndexer extends PureComponent {
|
||||
|
||||
|
||||
if (matchSearch) {
|
||||
this.SeachKeywords(string)
|
||||
|
||||
console.log(`Search matched! ${location.pathname}`)
|
||||
return(
|
||||
<div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user