mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
0.1.13
This commit is contained in:
parent
5881c52339
commit
c392515b21
@ -26,6 +26,7 @@ module.exports = {
|
|||||||
openwheater_apiKey:'2acf34be0b8f033b89ba4de1e674d42a',
|
openwheater_apiKey:'2acf34be0b8f033b89ba4de1e674d42a',
|
||||||
},
|
},
|
||||||
Endpoints: {
|
Endpoints: {
|
||||||
|
get_user_posts: "https://api.ragestudio.net/RS-YIBTP/yid/posts?access_token=",
|
||||||
find_user: "https://api.ragestudio.net/RS-YIBTP/yid/find_user?access_token=",
|
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=",
|
||||||
|
@ -41,6 +41,13 @@ export const UIFxList = {
|
|||||||
notifySuccess: (ycore_worker.FXapiProvider + 'notifySuccess.wav')
|
notifySuccess: (ycore_worker.FXapiProvider + 'notifySuccess.wav')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function booleanFix(e){
|
||||||
|
if(e == 1){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
export const crouter = {
|
export const crouter = {
|
||||||
native: (e) =>{
|
native: (e) =>{
|
||||||
umiRouter.push({
|
umiRouter.push({
|
||||||
@ -116,6 +123,32 @@ export function SeachKeywords(key, callback){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function GetUserPosts(id, callback) {
|
||||||
|
let formdata = new FormData();
|
||||||
|
formdata.append("server_key", yConfig.server_key);
|
||||||
|
formdata.append("type", "get_user_posts");
|
||||||
|
formdata.append("id", id)
|
||||||
|
const urlOBJ = `${endpoints.get_user_posts}${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();
|
||||||
@ -135,8 +168,6 @@ export function GetFeedPosts(callback) {
|
|||||||
return callback( null, result)
|
return callback( null, result)
|
||||||
})
|
})
|
||||||
.catch(error => console.log('error', error));
|
.catch(error => console.log('error', error));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const get_app_session = {
|
export const get_app_session = {
|
||||||
|
@ -9,7 +9,6 @@ import styles from './Header.less'
|
|||||||
import { config } from 'utils'
|
import { config } from 'utils'
|
||||||
|
|
||||||
import * as ycore from 'ycore'
|
import * as ycore from 'ycore'
|
||||||
import router from 'umi/router'
|
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
|
||||||
@withI18n()
|
@withI18n()
|
||||||
@ -112,7 +111,7 @@ class Header extends PureComponent {
|
|||||||
<Layout.Header id='layoutHeader' className={classnames(styles.header, {[styles.fixed]: fixed}, {[styles.collapsed]: !collapsed} )} >
|
<Layout.Header id='layoutHeader' className={classnames(styles.header, {[styles.fixed]: fixed}, {[styles.collapsed]: !collapsed} )} >
|
||||||
<div className={classnames(styles.containersWrappers, {[styles.collapsed]: !collapsed})} >
|
<div className={classnames(styles.containersWrappers, {[styles.collapsed]: !collapsed})} >
|
||||||
<div className={styles.leftContainer}>
|
<div className={styles.leftContainer}>
|
||||||
<Tooltip title={'Main'}><Icon type="home" className={styles.iconButton} style={{ fontSize: '15px' }} /></Tooltip>
|
<Tooltip title={'Main'}><Icon type="home" className={styles.iconButton} onClick={() => ycore.crouter.native('main')} style={{ fontSize: '15px' }} /></Tooltip>
|
||||||
<Tooltip title={'Search'}><Icon type="search" className={styles.iconButton} style={{ fontSize: '15px' }} /></Tooltip>
|
<Tooltip title={'Search'}><Icon type="search" className={styles.iconButton} style={{ fontSize: '15px' }} /></Tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.rightContainer}>
|
<div className={styles.rightContainer}>
|
||||||
|
@ -169,7 +169,7 @@ class L_Sider extends PureComponent {
|
|||||||
<div className={styles.siderhead}>
|
<div className={styles.siderhead}>
|
||||||
<antd.Avatar size={collapsed? "small" : "large"} shape={collapsed? "circle" : "square"} src={userData.avatar} className={collapsed? styles.avatar : styles.avatarFull} />
|
<antd.Avatar size={collapsed? "small" : "large"} shape={collapsed? "circle" : "square"} src={userData.avatar} className={collapsed? styles.avatar : styles.avatarFull} />
|
||||||
</div>
|
</div>
|
||||||
{collapsed? null : <div className={styles.userInfo}><h2>@{userData.username}</h2></div> }
|
{collapsed? null : <div className={styles.userInfo}><a href={`/@${userData.username}`}><h2>@{userData.username}</h2></a></div> }
|
||||||
</div>
|
</div>
|
||||||
</ScrollBar>
|
</ScrollBar>
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,7 +69,7 @@ class PostCard extends React.PureComponent{
|
|||||||
<antd.Card actions={actions} >
|
<antd.Card actions={actions} >
|
||||||
<Meta
|
<Meta
|
||||||
avatar={<div className={styles.postAvatar}><antd.Avatar shape="square" size={50} src={avatar} /></div>}
|
avatar={<div className={styles.postAvatar}><antd.Avatar shape="square" size={50} src={avatar} /></div>}
|
||||||
title={<div><h4 className={styles.titleUser}>@{user} {this.isVerifiedAccount(publisher)? <antd.Icon style={{ color: 'blue' }} component={CustomIcons.VerifiedBadge} /> : null}</h4></div>}
|
title={<div><a href={`/@${user}`}><h4 className={styles.titleUser}>@{user} {this.isVerifiedAccount(publisher)? <antd.Icon style={{ color: 'blue' }} component={CustomIcons.VerifiedBadge} /> : null}</h4></a></div>}
|
||||||
description={<span className={styles.textAgo}>{ago}</span>}
|
description={<span className={styles.textAgo}>{ago}</span>}
|
||||||
bordered="false"
|
bordered="false"
|
||||||
/>
|
/>
|
||||||
|
@ -3,7 +3,7 @@ import styles from './styles.less'
|
|||||||
import * as ycore from 'ycore'
|
import * as ycore from 'ycore'
|
||||||
import * as antd from 'antd'
|
import * as antd from 'antd'
|
||||||
import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
||||||
import { string } from 'prop-types';
|
import {CustomIcons, PostCard} from 'components'
|
||||||
|
|
||||||
const userData = ycore.SDCP();
|
const userData = ycore.SDCP();
|
||||||
|
|
||||||
@ -23,13 +23,12 @@ const UserHeader = ({ values }) => {
|
|||||||
</div>
|
</div>
|
||||||
<PageHeaderWrapper content={
|
<PageHeaderWrapper content={
|
||||||
<div className={styles.pageHeaderContent}>
|
<div className={styles.pageHeaderContent}>
|
||||||
|
|
||||||
<div className={styles.avatar}>
|
<div className={styles.avatar}>
|
||||||
<antd.Avatar shape="square" size="large" src={values.avatar} />
|
<antd.Avatar shape="square" size="large" src={values.avatar} />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<div className={styles.contentTitle}>
|
<div className={styles.contentTitle}>
|
||||||
<h1 style={{ marginBottom: '0px' }} >{values.username}</h1>
|
<h1 style={{ marginBottom: '0px' }} >{values.username}<antd.Tooltip title="User Verified">{ycore.booleanFix(values.verified)? <antd.Icon style={{ color: 'blue', verticalAlign:'top' }} component={CustomIcons.VerifiedBadge} /> : null}</antd.Tooltip></h1>
|
||||||
<span style={{ fontSize: '14px', fontWeight: '100', lineHeight: '0', marginBottom: '5px' }}>{values.about}</span>
|
<span style={{ fontSize: '14px', fontWeight: '100', lineHeight: '0', marginBottom: '5px' }}>{values.about}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -37,7 +36,26 @@ const UserHeader = ({ values }) => {
|
|||||||
} />
|
} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
const UserBody = ({ values }) => {
|
||||||
|
try {
|
||||||
|
const feedParsed = JSON.parse(values)['data']
|
||||||
|
return (
|
||||||
|
feedParsed.map(item=> {
|
||||||
|
const {id, postText, post_time, publisher, postFile, postFileName} = item
|
||||||
|
const paylodd = {user: publisher.username, ago: post_time, avatar: publisher.avatar, content: postText, file: postFile, postFileName: postFileName, publisher: publisher }
|
||||||
|
ycore.DevOptions.ShowFunctionsLogs? console.log([item], paylodd) : null
|
||||||
|
return <PostCard payload={paylodd} key={id} />
|
||||||
|
})
|
||||||
|
)
|
||||||
|
} catch (err) {
|
||||||
|
const paylodd = {user: 'Error', ago: '', avatar: '', content: 'Error displaying data :/', publisher: '' }
|
||||||
|
return <PostCard payload={paylodd} />
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
class UserProfile extends React.Component {
|
class UserProfile extends React.Component {
|
||||||
constructor(props){
|
constructor(props){
|
||||||
super(props),
|
super(props),
|
||||||
@ -46,21 +64,22 @@ class UserProfile extends React.Component {
|
|||||||
loading: true
|
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 selfProfile = { id: userData.id, username: userData.username, avatar: userData.avatar, about: userData.about }
|
|
||||||
|
|
||||||
isOwnProfile(e)? this.setState({RenderValue: selfProfile, loading: false}) : (
|
isOwnProfile(e)? (
|
||||||
ycore.FindUser(string, (exception, response)=> {
|
ycore.GetUserPosts(userData.id, (exception, response) => {
|
||||||
|
this.setState({ RenderValue: userData, rawbody: response, loading: false})
|
||||||
|
}))
|
||||||
|
:
|
||||||
|
(ycore.FindUser(string, (exception, response)=> {
|
||||||
exception? ycore.notifyError(exception) : null
|
exception? ycore.notifyError(exception) : null
|
||||||
try {
|
try {
|
||||||
const rp = JSON.parse(response)
|
const rp = JSON.parse(response)
|
||||||
@ -77,21 +96,31 @@ class UserProfile extends React.Component {
|
|||||||
console.log(`Using aproximate user! => ${c1} / ${c2}`)
|
console.log(`Using aproximate user! => ${c1} / ${c2}`)
|
||||||
ycore.crouter.native(`@${c1}`)
|
ycore.crouter.native(`@${c1}`)
|
||||||
}
|
}
|
||||||
|
ycore.GetUserPosts(rp['0'].user_id, (exception, response) => {
|
||||||
|
exception? ycore.notifyError(exception) : null
|
||||||
|
try {
|
||||||
|
this.setState({ rawbody: response })
|
||||||
|
} catch (err) {
|
||||||
|
core.notifyError(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
this.setState({ RenderValue: rp['0'], loading: false })
|
this.setState({ RenderValue: rp['0'], loading: false })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ycore.notifyError(err)
|
ycore.notifyError(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
render(){
|
render(){
|
||||||
const { loading } = this.state
|
const { loading } = this.state
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
{loading? <antd.Skeleton active /> : <UserHeader values={this.state.RenderValue} />}
|
{loading? <antd.Skeleton active /> :
|
||||||
|
(<div>
|
||||||
|
<UserHeader values={this.state.RenderValue} />
|
||||||
|
<UserBody values={this.state.rawbody} />
|
||||||
|
</div>)
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,10 @@
|
|||||||
.UserCover {
|
.UserCover {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: -32px auto 0 auto;
|
margin: -32px auto auto auto;
|
||||||
padding: 0;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
min-height: 366.1px;
|
max-height: 40%;
|
||||||
max-height: 366.1px;
|
|
||||||
height: 366.1px;
|
|
||||||
img{
|
img{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@ -49,6 +47,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.pageHeaderContent {
|
.pageHeaderContent {
|
||||||
|
vertical-align: top;
|
||||||
display: flex;
|
display: flex;
|
||||||
.avatar {
|
.avatar {
|
||||||
flex: 0 1 72px;
|
flex: 0 1 72px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user