change new render model

This commit is contained in:
srgooglo 2020-04-12 22:36:02 +02:00
parent 4601515f0c
commit cdb4d115c1
20 changed files with 312 additions and 952 deletions

View File

@ -14,7 +14,7 @@ module.exports={
auth_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/auth", auth_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/auth",
new_post: "https://comty.julioworld.club/api/new_post?access_token=", new_post: "https://comty.julioworld.club/api/new_post?access_token=",
get_config_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/get-site-settings?access_token=", get_config_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/get-site-settings?access_token=",
get_userData_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/get-user-data?access_token=", get_userData: "https://api.ragestudio.net/RSA-COMTY/r/get-user-data?access_token=",
update_userData_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/update-user-data?access_token=", update_userData_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/update-user-data?access_token=",
removeToken: "https://api.ragestudio.net/RSA-COMTY/r/delete-access-token?access_token=", removeToken: "https://api.ragestudio.net/RSA-COMTY/r/delete-access-token?access_token=",
register_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/create-account", register_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/create-account",

View File

@ -3,7 +3,7 @@
"UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4", "UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4",
"title": "Comty™", "title": "Comty™",
"DevBuild": true, "DevBuild": true,
"version": "0.3.02", "version": "0.3.09",
"stage": "dev-pre", "stage": "dev-pre",
"description": "", "description": "",
"main": "app/main.js", "main": "app/main.js",
@ -16,19 +16,17 @@
} }
}, },
"dependencies": { "dependencies": {
"@ant-design/compatible": "^1.0.1",
"@ant-design/pro-layout": "^5.0.6",
"@capacitor/android": "^1.5.2", "@capacitor/android": "^1.5.2",
"@capacitor/cli": "^1.5.2", "@capacitor/cli": "^1.5.2",
"@capacitor/core": "^1.5.2", "@capacitor/core": "^1.5.2",
"@lingui/react": "^2.9.1", "@lingui/react": "^2.9.1",
"@material-ui/core": "^4.9.3", "@material-ui/core": "^4.9.9",
"@material-ui/icons": "^4.9.1", "@material-ui/icons": "^4.9.1",
"antd": "^4.1.0", "antd": "^4.1.1",
"axios": "^0.19.2", "axios": "^0.19.2",
"bag.js": "0.0.2", "bag.js": "0.0.2",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"cryptr": "^6.0.1", "cryptr": "^6.0.2",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"dva": "2.4.1", "dva": "2.4.1",
"dva-model-extend": "^0.1.2", "dva-model-extend": "^0.1.2",
@ -43,7 +41,6 @@
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"os-utils": "0.0.14", "os-utils": "0.0.14",
"path-to-regexp": "^6.1.0", "path-to-regexp": "^6.1.0",
"plyr-react": "^2.2.0",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"radium": "^0.26.0", "radium": "^0.26.0",
"react-animations": "^1.0.0", "react-animations": "^1.0.0",
@ -67,7 +64,7 @@
"@lingui/babel-preset-react": "^2.9.1", "@lingui/babel-preset-react": "^2.9.1",
"@lingui/cli": "^2.9.1", "@lingui/cli": "^2.9.1",
"@lingui/loader": "^2.9.1", "@lingui/loader": "^2.9.1",
"@types/react": "^16.9.19", "@types/react": "^16.9.33",
"babel-core": "7.0.0-bridge.0", "babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.3", "babel-eslint": "^10.0.3",
"babel-plugin-dev-expression": "^0.2.2", "babel-plugin-dev-expression": "^0.2.2",
@ -77,24 +74,24 @@
"cross-env": "^7.0.0", "cross-env": "^7.0.0",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-react-app": "^5.2.0", "eslint-config-react-app": "^5.2.0",
"eslint-plugin-flowtype": "^4.6.0", "eslint-plugin-flowtype": "^4.7.0",
"eslint-plugin-import": "^2.20.1", "eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.3", "eslint-plugin-react": "^7.18.3",
"husky": "^4.2.3", "husky": "^4.2.4",
"less-vars-to-js": "^1.3.0", "less-vars-to-js": "^1.3.0",
"lint-staged": "^10.0.7", "lint-staged": "^10.1.3",
"module": "^1.2.5", "module": "^1.2.5",
"now": "^17.0.3", "now": "^17.0.3",
"prettier": "^1.19.1", "prettier": "^1.19.1",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"stylelint": "^13.1.0", "stylelint": "^13.3.1",
"stylelint-config-prettier": "^8.0.1", "stylelint-config-prettier": "^8.0.1",
"stylelint-config-standard": "^20.0.0", "stylelint-config-standard": "^20.0.0",
"typescript": "^3.8.3", "typescript": "^3.8.3",
"umi": "^2.13.3", "umi": "^2.13.12",
"umi-plugin-react": "^1.15.2", "umi-plugin-react": "^1.15.7",
"wait-on": "^4.0.0", "wait-on": "^4.0.2",
"workbox-webpack-plugin": "^5.0.0" "workbox-webpack-plugin": "^5.0.0"
}, },
"engines": { "engines": {

View File

@ -10,7 +10,7 @@ import React from 'react'
export * from './modals.js' export * from './modals.js'
export {SwapMode}
export function QueryRuntime() { export function QueryRuntime() {
const validBackup = ycore.validate.backup() const validBackup = ycore.validate.backup()

View File

@ -62,4 +62,26 @@ export const comty_get = {
) )
}, },
get_user_data: (callback, payload) => {
let formdata = new FormData();
let callOptions = { includeUserID: false };
if (!payload) {
callOptions = { includeUserID: true }
formdata.append('fetch', 'user_data')
}
if (payload) {
payload.user_id? formdata.append('user_id', payload.user_id) : null
payload.fetch? formdata.append('fetch', payload.fetch) : null
}
API_Call(
(err, res) => {
return callback(err, res)
},
endpoints.comty_endpoints.get_userData,
formdata, callOptions
)
}
} }

View File

@ -127,6 +127,12 @@ export const comty_post = {
formdata formdata
) )
}, },
hashtag: (callback, payload) => {
if (!payload) return false
const { hashtag } = payload
// DOING
},
getSaved: (callback, payload) => { getSaved: (callback, payload) => {
if (!payload) { if (!payload) {
yconsole.log( yconsole.log(

View File

@ -80,7 +80,7 @@ export const __rscloud = {
return callback(true, error) return callback(true, error)
} }
}, },
ycore.endpoints.comty_endpoints.get_userData_endpoint, ycore.endpoints.comty_endpoints.get_userData,
formdata, formdata,
optionCall, optionCall,
user_token user_token

View File

@ -42,8 +42,6 @@ localforage.config({
storeName: package_json.name, storeName: package_json.name,
}) })
/** /**
* Convert a base64 string in a Blob according to the data and contentType. * Convert a base64 string in a Blob according to the data and contentType.
* *

View File

@ -32,6 +32,8 @@ export default class HeaderSearch extends Component {
openSearcher = () => { openSearcher = () => {
const { value } = this.state const { value } = this.state
if (value.length < 1) return false
if (value == /\s/) return false
ycore.SecondarySwap.openSearch(value); ycore.SecondarySwap.openSearch(value);
} }

View File

@ -5,18 +5,86 @@ import * as Icons from '@ant-design/icons'
import styles from './index.less' import styles from './index.less'
import classnames from 'classnames' import classnames from 'classnames'
import { __priPost, __secComments, __priSearch, __trendings, __pro } from './renders.js' import {
__priPost,
__secComments,
__priSearch,
__trendings,
__pro,
} from './renders.js'
export const SwapMode = { export const SwapMode = {
close: () => { close: () => {
SecondaryLayoutComponent.Swapper.close() SecondaryLayoutComponent.Swapper.close()
}, },
openPost: (a, b) => { openPost: (id, content) => {
SecondaryLayoutComponent.setState({ if (!id) return false
mode: 'post', let d
global_raw: a,
}) if (content) {
SecondaryLayoutComponent.Swapper.open() d = content
} else {
const payload = { post_id: id }
ycore.comty_post.get((err, res) => {
if (err) {
return false
}
const post_data = JSON.parse(res)['post_data']
d = post_data
}, payload)
}
console.log(d)
if (d) {
try {
const pdata = (
<__priPost
isMobile={SecondaryLayoutComponent.props.isMobile}
payload={d}
/>
)
SecondaryLayoutComponent.setState({ rd__pri: pdata, __pri_full: true })
return true
} catch (error) {
console.log(error)
return null
}
}
return false
},
openComments: (id, content) => {
if (!id) return false
let d
if (content) {
d = content
} else {
console.debug('Missing Payload [content]!')
localStorage.setItem('p_back_uid', postID)
const payload = { post_id: id }
ycore.comty_post.get((err, res) => {
if (err) {
return false
}
const post_comments = JSON.parse(res)['get_post_comments']
d = post_comments
}, payload)
}
if (d) {
try {
const pdata = <__secComments post_id={id} payload={d} />
SecondaryLayoutComponent.setState({
rd__sec: pdata,
__sec_active: true,
})
return true
} catch (error) {
console.log(error)
return null
}
}
}, },
openSearch: a => { openSearch: a => {
SecondaryLayoutComponent.setState({ SecondaryLayoutComponent.setState({
@ -31,98 +99,37 @@ export const SwapMode = {
global_raw: fragment, global_raw: fragment,
}) })
SecondaryLayoutComponent.Swapper.unique() SecondaryLayoutComponent.Swapper.unique()
} },
} }
export default class Secondary extends React.PureComponent { export default class Secondary extends React.PureComponent {
constructor(props) { constructor(props) {
super(props), super(props),
window.SecondaryLayoutComponent = this, (window.SecondaryLayoutComponent = this),
this.state = { (this.state = {
loading: true, loading: true,
half: false, gen_data: null,
swap: false, // Lays
mode: '', rd__pri: null,
gen_data: '', rd__sec: null,
global_raw: '', __pri_full: false,
pri_raw: '', __pri_half: false,
sec_raw: '', __sec_active: false,
} __sec_full: false,
})
} }
Swapper = { Swapper = {
close: () => { close: () => {
this.setState({ this.setState({
swap: false, rd__pri: null,
half: false, rd__sec: null,
unique: false, __pri_full: false,
pri_raw: null, __pri_half: false,
sec_raw: null, __sec_active: false,
global_raw: null, __sec_full: false,
mode: null,
}) })
}, },
open: () => {
this.setState({
swap: true,
half: false,
unique: false,
})
},
half : () => {
this.setState({
swap: false,
half: true,
unique: false,
})
},
unique: ()=>{
this.setState({
swap: false,
half: false,
unique: true,
})
}
}
SwapBalanceContent(container) {
switch (container) {
case '__pri': {
return this.__pri()
}
case '__sec': {
return this.__sec()
}
default:
return null
}
}
__pri() {
const dtraw = this.state.pri_raw
switch (this.state.mode) {
case 'post': {
return this.renderPost(this.state.global_raw)
}
case 'search': {
return this.renderSearch(dtraw)
}
case 'fragment': {
return this.renderFragment()
}
default:
return this.renderMain()
}
}
__sec() {
const dtraw = this.state.sec_raw
switch (this.state.mode) {
case 'post': {
return this.renderComments(this.state.global_raw)
}
default:
return null
}
} }
renderSearch = key => { renderSearch = key => {
@ -136,44 +143,26 @@ export default class Secondary extends React.PureComponent {
}, payload) }, payload)
return ( return (
<div className={styles.renderSearch_wrapper}> <div className={styles.renderSearch_wrapper}>
<h2><Icons.SearchOutlined /> Results of {key || '... nothing ?'}</h2> <h2>
<Icons.SearchOutlined /> Results of {key || '... nothing ?'}
</h2>
<__priSearch payload={this.state.global_raw} /> <__priSearch payload={this.state.global_raw} />
</div> </div>
) )
} }
renderPost = payload => {
const post_data = JSON.parse(payload)['post_data']
return <__priPost isMobile={this.props.isMobile} payload={post_data} />
}
renderComments = payload => {
try {
const post_comments = JSON.parse(payload)['post_comments']
const post_data = JSON.parse(payload)['post_data']
return (
<__secComments post_id={post_data.post_id} payload={post_comments} />
)
} catch (error) {
return null
}
}
renderMain = payload => { renderMain = payload => {
try { try {
const trending_data = JSON.parse(this.state.gen_data)['trending_hashtag'] const trending_data = JSON.parse(this.state.gen_data)['trending_hashtag']
return( return (
<div className={styles.secondary_main}> <div className={styles.secondary_main}>
{ycore.IsThisUser.pro() ? <__pro /> : <__pro />}
{ycore.IsThisUser.pro()? <__pro /> : <__pro /> }
<__trendings data={trending_data} /> <__trendings data={trending_data} />
</div> </div>
) )
} catch (error) { } catch (error) {
return null return null
} }
} }
renderFragment = () => { renderFragment = () => {
try { try {
@ -183,46 +172,93 @@ export default class Secondary extends React.PureComponent {
return null return null
} }
} }
componentDidMount(){
ycore.comty_get.general_data((err,res)=> { isOpen() {
if (
this.state.__pri_full ||
this.state.__pri_half ||
this.state.__sec_active ||
this.state.__sec_full
)
return true
return false
}
componentDidUpdate() {
if (this.isOpen()) {
document.addEventListener('keydown', this.escFunction, false)
} else {
document.removeEventListener('keydown', this.escFunction, false)
}
}
componentDidMount() {
ycore.comty_get.general_data((err, res) => {
if (err) return false if (err) return false
const notification_data = JSON.parse(res)['notifications'] const notification_data = JSON.parse(res)['notifications']
this.setState({ loading: false, gen_data: res, notification_data: notification_data }) this.setState({
loading: false,
gen_data: res,
notification_data: notification_data,
})
}) })
} }
escFunction(event) {
if (event.keyCode === 27) {
SwapMode.close()
}
}
componentWillUnmount() {
document.removeEventListener('keydown', this.escFunction, false)
}
renderTarget(target) {
try {
switch (target) {
case '__pri': {
const fragment = this.state.rd__pri
return <React.Fragment>{fragment}</React.Fragment>
}
case '__sec': {
const fragment = this.state.rd__sec
return <React.Fragment>{fragment}</React.Fragment>
}
default:
return <h3>Invalid Render Target</h3>
}
} catch (error) {
console.log(error)
return null
}
}
render() { render() {
const { userData, isMobile } = this.props const { userData, isMobile } = this.props
if (!this.state.loading) return ( if (!this.state.loading)
<> return (
{isMobile? null : <div className={styles.__secondary_colider}></div>} <>
<div {isMobile ? null : <div className={styles.__secondary_colider}></div>}
id="secondary_layout" <div
className={classnames(styles.secondary_wrapper, { id="secondary_layout__wrapper"
[styles.mobile]: isMobile, className={classnames(styles.secondary_wrapper, {
[styles.active]: this.state.swap, [styles.mobile]: isMobile,
[styles.half]: this.state.half, })}
[styles.unique]: this.state.unique, >
})} {isMobile ? null : (
> <div className={styles.secondary_userholder}>
{isMobile? null : <div className={styles.notif_box}>
<div className={styles.secondary_userholder}> <h1>{this.state.notification_data.length}</h1>
<div className={styles.notif_box}> </div>
<h1>{this.state.notification_data.length}</h1> <img
</div> onClick={() => ycore.router.go(`@${userData.username}`)}
<img src={userData.avatar}
onClick={() => ycore.router.go(`@${userData.username}`)} />
src={userData.avatar} </div>
/> )}
</div>}
<div {this.isOpen() ? (
className={styles.secondary_layout_bg}
>
<div className={styles.secondary_container_1}>
{this.state.swap || this.state.half || this.state.unique ? (
<antd.Button <antd.Button
type="ghost" type="ghost"
icon={<Icons.LeftOutlined />} icon={<Icons.LeftOutlined />}
@ -231,24 +267,33 @@ export default class Secondary extends React.PureComponent {
Back Back
</antd.Button> </antd.Button>
) : null} ) : null}
{this.SwapBalanceContent('__pri')}
</div>
<div className={styles.secondary_layout_bg}>
<div
id="secondary_layout_pri"
className={classnames(styles.secondary_container_1, {
[styles.full_open]: this.state.__pri_full,
[styles.half]: this.state.__pri_half,
})}
>
{this.renderTarget('__pri')}
</div>
<div <div
className={classnames(styles.secondary_container_2, { id="secondary_layout__sec"
[styles.mobile]: isMobile, className={classnames(styles.secondary_container_2, {
[styles.active]: this.state.swap, [styles.mobile]: isMobile,
})} [styles.active]: this.state.__sec_active,
> [styles.full_open]: this.state.__sec_full,
{this.SwapBalanceContent('__sec')} })}
</div> >
{this.renderTarget('__sec')}
</div>
</div> </div>
</div>
</>
)
return null
</div>
</>
)
return null
} }
} }

View File

@ -9,7 +9,7 @@
} }
.secondary_wrapper { .secondary_wrapper {
width: @secondary_wrapper_hidden_width; width: auto;
height: 100vh; height: 100vh;
z-index: 50; z-index: 50;
@ -21,17 +21,6 @@
display: flex; display: flex;
&.active {
width: @secondary_wrapper_showFull_width;
>.secondary_container_1 {
padding: @secondary_container_1_padding;
}
//@media (min-width: 1000px) {
// width: 95.4%
//}
}
&.mobile { &.mobile {
width: 100%; width: 100%;
height: 0; height: 0;
@ -153,13 +142,13 @@
overflow: hidden; overflow: hidden;
transition: all @__Global_SwapAnimDuration ease-in-out; transition: all @__Global_SwapAnimDuration ease-in-out;
background-color: @secondary_container_bg_background; background-color: transparent;
border-radius: @__Global_layout_border-rd; border-radius: @__Global_layout_border-rd;
} }
.secondary_container_1 { .secondary_container_1 {
width: 100%; width: @secondary_wrapper_hidden_width;
height: 100%; height: 100%;
position: relative; position: relative;
@ -167,6 +156,14 @@
color: @secondary_container_1_color; color: @secondary_container_1_color;
&.full_opent {
width: @secondary_wrapper_showFull_width;
padding: @secondary_container_1_padding;
}
&.half {
}
:global { :global {
.ant-btn { .ant-btn {
color: @secondary_container_1_btn_color; color: @secondary_container_1_btn_color;

View File

@ -21,7 +21,7 @@ const VerifiedBadge = () => (
</svg> </svg>
) )
export class __priPost extends React.Component { export class __priPost extends React.PureComponent {
renderContent(payload) { renderContent(payload) {
const { id, postText, postFile_full, post_time, publisher } = payload const { id, postText, postFile_full, post_time, publisher } = payload
const {isMobile}= this.props const {isMobile}= this.props
@ -175,7 +175,7 @@ export class __secComments extends React.Component {
return ( return (
<div className={styles.comments_body}> <div className={styles.comments_body}>
<div className={styles.comments_body_title}> <div className={styles.comments_body_title}>
<h1>Comments ({comment_data.length})</h1> {/* <h1>Comments ({comment_data.length})</h1> */}
</div> </div>
<div className={styles.comments_cards_wrapper}> <div className={styles.comments_cards_wrapper}>
{loading ? ( {loading ? (

View File

@ -36,6 +36,7 @@ class MainFeed extends React.PureComponent {
super(props) super(props)
window.MainFeedComponent = this window.MainFeedComponent = this
this.state = { this.state = {
AutoFeed: this.props.auto? true:false,
NewAV: false, NewAV: false,
invalid: false, invalid: false,
loading: false, loading: false,
@ -160,7 +161,7 @@ class MainFeed extends React.PureComponent {
render() { render() {
const { data, loading, isEnd, invalid, NewAV } = this.state const { data, loading, isEnd, invalid, NewAV, AutoFeed } = this.state
const renderFeedPosts_payload = {data: data, loading: loading, isEnd: isEnd, feedGet: this.feedGet} const renderFeedPosts_payload = {data: data, loading: loading, isEnd: isEnd, feedGet: this.feedGet}
if (invalid){ if (invalid){
@ -176,7 +177,7 @@ class MainFeed extends React.PureComponent {
if (!loading) { if (!loading) {
return ( return (
<div className={styles.main_feed_wrapper} id="mainfeed"> <div className={styles.main_feed_wrapper} id="mainfeed">
{NewAV? ComponentNewAV(() => this.feedGet.first()) : null} {AutoFeed? NewAV? ComponentNewAV(() => this.feedGet.first()) : null : null}
{renderFeedPosts(renderFeedPosts_payload)} {renderFeedPosts(renderFeedPosts_payload)}
</div> </div>
) )

View File

@ -38,20 +38,11 @@ class PostCard extends React.PureComponent {
this.setState({visibleMoreMenu: !this.state.visibleMoreMenu}) this.setState({visibleMoreMenu: !this.state.visibleMoreMenu})
} }
goToPost(postID) {
localStorage.setItem('p_back_uid', postID)
const payload = { post_id: postID }
ycore.comty_post.get((err, res) => {
if (err) {
return false
}
ycore.SecondarySwap.openPost(res)
}, payload)
}
render() { render() {
const { payload, customActions } = this.props const { payload, customActions } = this.props
const ActShowMode = ycore.AppSettings.auto_hide_postbar const ActShowMode = ycore.AppSettings.auto_hide_postbar
const post_data = payload || emptyPayload;
const { const {
id, id,
post_time, post_time,
@ -62,7 +53,17 @@ class PostCard extends React.PureComponent {
is_post_pinned, is_post_pinned,
is_liked, is_liked,
post_comments, post_comments,
} = payload || emptyPayload get_post_comments
} = post_data
const SwapThisPost = () => {
localStorage.setItem('p_back_uid', id)
if (postFile){
ycore.SwapMode.openPost(id, post_data)
}
ycore.SwapMode.openComments(id, get_post_comments)
}
const handlePostActions = { const handlePostActions = {
delete: post_id => { delete: post_id => {
const payload = { post_id: post_id } const payload = { post_id: post_id }
@ -119,7 +120,7 @@ class PostCard extends React.PureComponent {
/> />
</div>, </div>,
<antd.Badge dot={post_comments > 0 ? true : false}> <antd.Badge dot={post_comments > 0 ? true : false}>
<MICON.InsertComment key="comments" onClick={() => this.goToPost(id)} /> <MICON.InsertComment key="comments" onClick={() => SwapThisPost()} />
</antd.Badge>, </antd.Badge>,
] ]
const actions = customActions || defaultActions const actions = customActions || defaultActions
@ -174,7 +175,7 @@ class PostCard extends React.PureComponent {
return ( return (
<div className={styles.post_card_wrapper}> <div className={styles.post_card_wrapper}>
<antd.Card <antd.Card
onDoubleClick={() => this.goToPost(id)} onDoubleClick={() => SwapThisPost()}
hoverable hoverable
className={ActShowMode ? null : styles.showMode} className={ActShowMode ? null : styles.showMode}
actions={actions} actions={actions}

View File

@ -2,7 +2,6 @@ import React from 'react'
import styles from './styles.less' 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 { CustomIcons, MainFeed, PostCreator } from 'components' import { CustomIcons, MainFeed, PostCreator } from 'components'
import { SetHeaderSearchType } from 'components/HeaderSearch' import { SetHeaderSearchType } from 'components/HeaderSearch'
import * as Icons from '@ant-design/icons' import * as Icons from '@ant-design/icons'
@ -148,8 +147,8 @@ const moreMenu = (
<img src={RenderValue.cover} /> <img src={RenderValue.cover} />
</div> </div>
<PageHeaderWrapper <div>
content={
<div className={styles.pageHeaderContent}> <div className={styles.pageHeaderContent}>
<div className={styles.avatar}> <div className={styles.avatar}>
<antd.Avatar shape="square" src={RenderValue.avatar} /> <antd.Avatar shape="square" src={RenderValue.avatar} />
@ -215,8 +214,7 @@ const moreMenu = (
</div> </div>
</div> </div>
</div> </div>
} </div>
/>
</div> </div>
)} )}
{ycore.IsThisUser.same(UUID) ? ( {ycore.IsThisUser.same(UUID) ? (

View File

@ -1,240 +0,0 @@
import React, { Component } from 'react'
import { connect } from 'dva'
import { Form, Icon as LegacyIcon } from '@ant-design/compatible'
import { Button, Input, Drawer } from 'antd'
import * as ycore from 'ycore'
import * as Icons from '@ant-design/icons'
import styles from './index.less'
const FormItem = Form.Item
@connect(({ loading }) => ({ loading }))
@Form.create()
class YulioID extends Component {
constructor(props) {
super(props)
this.state = {
// Drawers Visibility (Default on False)
MainLoginVisible: true,
ShowLoading: false,
Answered: false,
transition: false,
}
}
// Handlers & others
handleUsername(text) {
this.setState({ RawUsername: text.target.value })
}
handlePassword(text) {
this.setState({ RawPassword: text.target.value })
}
handleRetry = () => {
this.setState({ ShowLoading: false, StateException: false, StateIcon: '' })
}
handleEnter = e => {
this.handleLogin()
}
handleLogin = () => {
var prefix = '[YID]: '
const { RawUsername, RawPassword } = this.state
var EncPassword = btoa(RawPassword)
var EncUsername = btoa(RawUsername)
if (!EncUsername || !EncPassword) {
var message = 'Incomplete information!'
ycore.yconsole.log(prefix, message)
}
if (EncUsername && EncPassword) {
this.setState({ ShowLoading: true, StateMessage: 'Wait a sec...' })
if (ycore.AppSettings.InfiniteLogin == true) {
ycore.yconsole.log(prefix, 'InfiniteLogin is enabled! Disabled getAuth')
} else {
ycore.yconsole.log(prefix, 'Initialising login process...')
const payload = { EncUsername, EncPassword }
ycore.app_session.login((err, res) => {
this.handleResponse(res)
}, payload)
}
}
}
handleResponse = response => {
if (response == '200') {
ycore.LoginPage.transitionToogle()
this.setState({
StateIcon: 'login',
StateMessage: 'Wait a sec...',
StateException: false,
})
}
if (response == '400') {
this.setState({
StateIcon: 'exclamation-circle',
StateMessage: 'Invalid credentials',
StateException: true,
})
}
if (response == '404') {
this.setState({
StateIcon: 'exclamation-circle',
StateMessage: 'Invalid Data',
StateException: true,
})
}
if (response == '500') {
this.setState({
StateIcon: 'cluster',
StateMessage: 'Server Error',
StateException: true,
})
}
}
render() {
const { visible } = this.props
const { getFieldDecorator } = this.props.form
const { ShowLoading, StateIcon, StateMessage, StateException } = this.state
return (
<div className={styles.loginWrapper}>
<Drawer
width="100%"
mask={false}
getContainer={false}
closable={false}
visible={visible}
className={styles.loginWrapper}
>
<div className={styles.preheader}>
<h6>
<img src={'https://api.ragestudio.net/id.svg'} /> YulioID&trade;
</h6>
</div>
<main className={styles.mainlp}>
<form className={styles.formlogin}>
{ShowLoading ? (
<div style={{ height: '329px' }}>
<div className={styles.spinner__wrapper} id="loadingspn">
{StateIcon ? (
<LegacyIcon
type={StateIcon}
className={
StateException
? styles.StateIcon_exception
: styles.StateIcon
}
/>
) : (
<LegacyIcon
type="loading"
style={{ fontSize: 24, margin: '13px' }}
spin
/>
)}
<div>
<br />
<br />
<br />
<div className={styles.resultbox}>
<h6> {StateMessage} </h6>
{StateException ? (
<div className={styles.retryBTN}>
<Button
style={{ width: '270px' }}
type="dashed"
onClick={() => this.handleRetry()}
>
Retry
</Button>
</div>
) : null}
</div>
</div>
</div>
</div>
) : (
<div>
<div className={styles.input__wrapper}>
<label className={styles.labelform}>
<LegacyIcon type="user" style={{ fontSize: '15px' }} />{' '}
Username
</label>
<FormItem>
{getFieldDecorator('Username', {
rules: [{ required: true }],
})(
<Input
onPressEnter={this.handleEnter}
className={styles.inputform}
type="text"
placeholder="Username"
onChange={text => {
this.handleUsername(text)
}}
/>
)}
</FormItem>
</div>
<div className={styles.input__wrapper}>
<label className={styles.labelform}>
<LegacyIcon type="unlock" style={{ fontSize: '15px' }} />{' '}
Password
</label>
<FormItem>
{getFieldDecorator('Password', {
rules: [{ required: true }],
})(
<Input.Password
onPressEnter={this.handleEnter}
className={styles.inputform}
placeholder="Password"
onChange={text => {
this.handlePassword(text)
}}
/>
)}
</FormItem>
</div>
<div style={{ margin: 'auto' }}>
<a
className={styles.buttonlp}
id="login"
onClick={this.handleLogin}
>
Login
</a>
</div>
<h2
style={{
textAlign: 'center',
margin: '8px',
color: '#666',
}}
>
Or
</h2>
<div className={styles.moreActions}>
<Button type="dashed">
<Icons.QuestionCircleOutlined /> Forgotten password
</Button>
<Button type="dashed">
<Icons.UserAddOutlined /> Create an account
</Button>
</div>
</div>
)}
</form>
</main>
</Drawer>
</div>
)
}
}
export default YulioID

View File

@ -1,485 +0,0 @@
@import '~themes/index.less';
.loginWrapper {
:global {
.ant-drawer-right.ant-drawer-open.no-mask {
right: 1px;
-ms-transform: translateX(1px);
transform: translateX(1px);
width: 100%;
}
.ant-drawer-right.ant-drawer-open .ant-drawer-content-wrapper {
width: 100%;
border-radius: 20px 0 0 20px;
}
.ant-drawer-body {
height: 100%;
}
.ant-drawer {
box-shadow: none;
border-radius: 20px 0 0 20px;
max-width: 512px;
width: 100%;
}
.ant-drawer-content {
background: #ffffff9f;
border-radius: 20px 0 0 20px;
}
}
}
.StateIcon {
font-size: 24px;
margin: 13px;
}
.StateIcon_exception {
font-size: 24px;
margin: 13px;
color: red !important;
:global {
i {
color: red !important;
}
}
}
.mainlp {
flex-direction: column;
justify-content: center;
align-items: center;
display: flex;
width: 100%;
word-break: keep-all;
color: @foregroundColor;
text-align: left;
}
.mainlp .sectionlp {
border: 1px solid @accentColor;
position: relative;
padding: 40px 40px 50px;
}
.mainlp .sectionlp>h6 {
color: @accentColor;
background: @canvasColor;
position: absolute;
top: -10px;
left: 20px;
padding: 0 10px;
}
.mainlp .sectionlp .h6lp.subheader {
color: @grayColor;
margin-top: 20px;
margin-bottom: 20px;
width: 100%;
}
@media (max-width: 992px) {
section:not(:last-child) {
border-width: 0 0 1px;
}
section:last-child {
border-width: 0;
}
}
.buttons {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.buttons>* {
flex: 1 1 calc(50% - 20px);
margin-top: 20px;
}
.buttons>*:nth-child(odd) {
margin-right: 20px;
}
a.buttonlp,
input.buttonlp,
.buttonlp {
outline: none;
width: 100%;
text-align: center;
display: inline-block;
border: none;
font: 500 16px/1 "Poppins", sans-serif;
padding: 20px;
cursor: pointer;
border-radius: @borderRadius;
background: @primaryColor;
color: @backgroundColor;
position: relative;
top: 0;
transition: 0.2s ease;
}
a.buttonlp:hover,
a.buttonlp.hover,
input.buttonlp:hover,
input.buttonlp.hover,
.buttonlp:hover,
.buttonlp.hover {
top: -3px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}
a.buttonlp:active,
a.buttonlp.active,
input.buttonlp:active,
.input.buttonlp.active,
.buttonlp:active,
.buttonlp.active {
background: @primaryShade4;
outline: none;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
top: 0;
}
a.buttonlp.disabled,
input.buttonlp.disabled,
.buttonlp.disabled {
opacity: 0.4;
user-select: none;
pointer-events: none;
}
a.buttonlp.medium,
input.buttonlp.medium,
.buttonlp.medium {
padding: 15px 18px;
width: auto;
}
a.buttonlp.small,
input.buttonlp.small,
.buttonlp.small {
padding: 10px 12px;
width: auto;
font-size: 14px;
font-weight: 500;
}
a.buttonlp.secondary,
input.buttonlp.secondary,
.buttonlp.secondary {
background: @secondaryColor;
}
a.buttonlp.secondary:active,
a.buttonlp.secondary:focus,
a.buttonlp.secondary.active,
input.buttonlp.secondary:active,
input.buttonlp.secondary:focus,
input.buttonlp.secondary.active,
.buttonlp.secondary:active,
.buttonlp.secondary:focus,
.buttonlp.secondary.active {
background: @secondaryShade4;
outline: none;
}
a.buttonlp.accent,
input.buttonlp.accent,
.buttonlp.accent {
background: @accentColor;
}
a.buttonlp.accent:active,
a.buttonlp.accent:focus,
a.buttonlp.accent.active,
input.buttonlp.accent:active,
input.buttonlp.accent:focus,
input.buttonlp.accent.active,
.buttonlp.accent:active,
.buttonlp.accent:focus,
.buttonlp.accent.active {
background: @accentShade4;
}
a.buttonlp.accent2,
input.buttonlp.accent2,
.buttonlp.accent2 {
background: @accent2Color;
}
a.buttonlp.accent2:active,
a.buttonlp.accent2:focus,
a.buttonlp.accent2.active,
input.buttonlp.accent2:active,
input.buttonlp.accent2:focus,
input.buttonlp.accent2.active,
.buttonlp.accent2:active,
.buttonlp.accent2:focus,
.buttonlp.accent2.active {
background: @accent2Shade4;
}
a.buttonlp.accent3,
input.buttonlp.accent3,
.buttonlp.accent3 {
background: @accent3Color;
}
a.buttonlp.accent3:active,
a.buttonlp.accent3:focus,
a.buttonlp.accent3.active,
input.buttonlp.accent3:active,
input.buttonlp.accent3:focus,
input.buttonlp.accent3.active,
.buttonlp.accent3:active,
.buttonlp.accent3:focus,
.buttonlp.accent3.active {
background: @accent3Shade4;
}
/*inputs*/
.input__wrapper {
margin-bottom: 10px;
:global {
.ant-col {
width: 100%;
}
}
}
.inputRG__wrapper {
margin-bottom: 0px;
}
.labelform {
font-weight: 500;
display: block;
margin-bottom: 5px;
}
.inputform,
select,
textarea {
height: 50px;
font-size: 16px;
border: 2px solid @neutralShade3;
width: 100%;
padding: 12px;
font-family: "Poppins";
border-radius: @borderRadius;
color: @foregroundColor;
background: @backgroundColor;
}
.inputform:focus,
.inputform.active,
select:focus,
select.active,
textarea:focus,
textarea.active {
outline: none;
border-color: @primaryColor;
}
.inputform:disabled,
select:disabled,
textarea:disabled {
cursor: not-allowed;
background: @neutralShade1;
opacity: 0.6;
}
Input .inputPasswordform {
height: 50px;
font-size: 16px;
border: 2px solid @neutralShade3;
width: 100%;
padding: 12px;
font-family: "Poppins";
border-radius: @borderRadius;
color: @foregroundColor;
background: @backgroundColor;
}
Input .inputPasswordform:focus {
outline: none;
border-color: @primaryColor;
}
.inputform.input {
height: 56px;
font-size: 18px;
padding: 15px;
}
/*spinner*/
.spinner+.labellp {
font-size: 14px;
font-weight: 500;
margin-top: 8px;
display: inline-block;
text-transform: uppercase;
color: @primaryShade4;
}
.spinner1 .spinner {
max-width: 50px;
margin: auto;
height: 20px;
position: relative;
}
.spinner1 .spinner:after {
content: "";
position: absolute;
width: 20px;
height: 20px;
left: -10%;
background: @primaryColor;
animation: spinnerLeftRight 1s infinite;
}
.spinner1 .spinner:before {
content: "";
position: absolute;
width: 20px;
height: 20px;
left: -10%;
background: @primaryShade2;
opacity: 1;
animation: spinnerLeftRight 1s infinite 0.06s;
}
@keyframes spinnerLeftRight {
0% {
left: 85%;
}
50% {
left: -10%;
}
100% {
left: 85%;
}
}
.formlogin {
width: 95%;
height: auto;
border-radius: 10px;
padding: 30px;
box-shadow: 0 3px 15px rgba(51, 51, 51, 0.2);
background: #ffffff44;
margin: 20px 10px 20px 10px;
position: relative;
overflow: hidden;
vertical-align: middle;
}
.formlogin .checkbox {
margin-bottom: 30px;
}
.formlogin .spinner__wrapper {
place-items: center;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: rgba(255, 255, 255, 0.85);
}
.preheader {
position: relative;
top: 0;
h1 {
font: 700 48px "Nunito", sans-serif;
text-align: center;
margin-bottom: 10px;
}
h6 {
padding: 3em 0 0 0;
line-height: 1px;
display: flex;
font: 500 16px/1 "Poppins", sans-serif;
text-transform: uppercase;
img {
vertical-align: middle;
height: 17px;
}
}
}
.moreActions {
display: flex;
margin: auto;
align-content: center;
position: relative;
width: 100%;
:global {
.ant-btn {
margin: auto;
}
}
}
@media (max-width: 472px) {
.moreActions {
display: grid;
align-content: center;
position: relative;
width: 100%;
:global {
.ant-btn {
margin: 5px;
}
}
}
}
.resultbox {
h6 {
font-family: "Poppins", sans-serif;
text-align: center;
font-size: 16px;
margin: auto;
vertical-align: middle;
}
.retryBTN {
text-align: center;
width: 100%;
position: absolute;
bottom: 0;
margin: auto;
vertical-align: bottom;
}
margin: auto;
}

View File

@ -11,7 +11,6 @@ import App_about from './App_about'
import * as MyLayout from './Layout/index.js' import * as MyLayout from './Layout/index.js'
import HeaderSearch from './HeaderSearch' import HeaderSearch from './HeaderSearch'
import PageTransition from './PageTransition' import PageTransition from './PageTransition'
import YulioID from './YulioID'
// User Components // User Components
import UserBadges from './UserBadges' import UserBadges from './UserBadges'
@ -34,7 +33,6 @@ export {
PageTransition, PageTransition,
SearchCard, SearchCard,
HeaderSearch, HeaderSearch,
YulioID,
UserProfile, UserProfile,
MyLayout, MyLayout,
Loader, Loader,

View File

@ -1,11 +1,9 @@
import React from 'react' import React from 'react'
import { Icon as LegacyIcon } from '@ant-design/compatible'
import { Page } from 'components'
import styles from './404.less' import styles from './404.less'
const Error404 = () => ( const Error404 = () => (
<div className={styles.error}> <div className={styles.error}>
<LegacyIcon type="api" />
<h1>OBA BLYAT</h1> <h1>OBA BLYAT</h1>
<p> <p>
<strong>ERROR 404</strong> <strong>ERROR 404</strong>

View File

@ -8,7 +8,7 @@ export default class Main extends React.Component {
return ( return (
<div className={styles.mainWrapper}> <div className={styles.mainWrapper}>
<PostCreator userData={ycore.userData()} /> <PostCreator userData={ycore.userData()} />
<MainFeed get="feed" /> <MainFeed auto={true} get="feed" />
</div> </div>
) )
} }

View File

@ -3,13 +3,35 @@ import * as ycore from 'ycore'
import * as antd from 'antd' import * as antd from 'antd'
import * as Icons from '@ant-design/icons' import * as Icons from '@ant-design/icons'
export default class Earnings extends React.Component { export default class Earnings extends React.Component {
state = {
loading: true,
}
componentDidMount(){
ycore.comty_get.get_user_data((err,res)=>{
if (err) return false
try {
const a = JSON.parse(res)['user_data']
this.setState({ loading: false, pro_points: a.points })
} catch (error) {
}
})
}
render() { render() {
return ( return (
<div> <div>
<h1> <div>
<Icons.PaperClipOutlined /> Redeem an Code <h1><Icons.PaperClipOutlined /> Redeem an Code</h1>
</h1> <antd.Input placeholder="XXXX-XXXX-XXXX-XXXX" />
</div>
<div>
<h1> Your Pro Points </h1>
{this.state.pro_points}
</div>
</div> </div>
) )
} }