From 1279fcc3db422a79befd206215b61a3cd0f45130 Mon Sep 17 00:00:00 2001 From: srgooglo <38926803+srgooglo@users.noreply.github.com> Date: Sun, 9 Feb 2020 02:20:44 +0100 Subject: [PATCH] 0.1.09T1 --- config/ycore.config.js | 1 - src/components/CustomIcons/index.js | 5 ++-- src/components/Layout/Header.js | 27 +++++++++++++++++---- src/components/Layout/Header.less | 29 +++++++++++++++++++++++ src/components/Layout/R_Sider.js | 4 ++-- src/components/MainSidebar/index.js | 34 +++++++++++---------------- src/components/MainSidebar/index.less | 18 ++++++++++---- src/components/PostCreator/index.js | 14 +++++------ src/components/PostCreator/index.less | 7 +++--- src/layouts/PrimaryLayout.js | 21 +++++------------ src/pages/main/index.js | 16 ++++++------- src/ycore_worker.js | 3 +++ 12 files changed, 110 insertions(+), 69 deletions(-) diff --git a/config/ycore.config.js b/config/ycore.config.js index b8a9bd7e..e4b50416 100644 --- a/config/ycore.config.js +++ b/config/ycore.config.js @@ -44,7 +44,6 @@ module.exports = { }, DevOptions: { defaultSettings: [{id: 'strict_lightMode', value: false}, {id: 'force_collapse', value: false}, {id: 'force_showDevLogs', value: true}], - // Global Behaviors InfiniteLoading: false, InfiniteLogin: false, diff --git a/src/components/CustomIcons/index.js b/src/components/CustomIcons/index.js index f1d55cd5..1662e50b 100644 --- a/src/components/CustomIcons/index.js +++ b/src/components/CustomIcons/index.js @@ -1,5 +1,6 @@ const VerifiedBadge = () => ( ) -const test = () => (' NOthinginhere ') +const CommonThings = () => () -const CustomIcons = {VerifiedBadge, test} + +const CustomIcons = {VerifiedBadge, CommonThings} export default CustomIcons diff --git a/src/components/Layout/Header.js b/src/components/Layout/Header.js index f6b2b7bc..fdc331d1 100644 --- a/src/components/Layout/Header.js +++ b/src/components/Layout/Header.js @@ -1,5 +1,5 @@ import React, { PureComponent, Fragment } from 'react' -import { Menu, Icon, Layout, Avatar, Popover, Badge, List, Switch, Tooltip } from 'antd' +import { Menu, Icon, Layout, Avatar, Popover, Badge, List, Switch, Tooltip, Dropdown, Button } from 'antd' import { Trans, withI18n } from '@lingui/react' import { Ellipsis } from 'ant-design-pro' import classnames from 'classnames' @@ -13,7 +13,12 @@ import moment from 'moment' @withI18n() class Header extends PureComponent { - + constructor(props){ + super(props), + this.state = { + createMenuVisible: false, + } + } isDarkMode = () => { const {theme} = this.props if (theme == "light") { @@ -21,6 +26,19 @@ class Header extends PureComponent { } return true; } + handleCreateMenuVisible() { + this.setState({ createMenuVisible: !this.state.createMenuVisible }); + } + handleOpenMenu() { + let ListControls = [ + (
+ +
+ ) + ] + ycore.ControlBar.set(ListControls) + } + render() { const { i18n, @@ -33,6 +51,7 @@ class Header extends PureComponent { onAllNotificationsRead, } = this.props + const notificationIcon = ( ) - + return (
@@ -96,7 +115,7 @@ class Header extends PureComponent {
- + this.handleOpenMenu()} className={styles.iconButton} style={{ fontSize: '15px' }} /> {notificationIcon}
diff --git a/src/components/Layout/Header.less b/src/components/Layout/Header.less index a679b4ef..5e5cfd74 100644 --- a/src/components/Layout/Header.less +++ b/src/components/Layout/Header.less @@ -1,5 +1,12 @@ @import '~themes/vars.less'; +.createMenu { + width: 30px; + margin: 0 auto 0 auto; + height: 190px; + + +} .brand { display: flex; vertical-align: middle; @@ -201,4 +208,26 @@ } } } +.createMenuPopover { + :global { + .ant-popover-inner { + background-color: transparent; + box-shadow: unset; + } + + .ant-popover-inner-content { + padding: 0; + } + + .ant-popover-arrow { + display: none; + } + + .ant-list-item-content { + flex: 0; + margin-left: 16px; + } + } +} + diff --git a/src/components/Layout/R_Sider.js b/src/components/Layout/R_Sider.js index e110a3ee..9a5737ae 100644 --- a/src/components/Layout/R_Sider.js +++ b/src/components/Layout/R_Sider.js @@ -18,7 +18,7 @@ class R_Sider extends PureComponent { this.state = { isHover: false }; - this.hover = this.hover.bind(this); + this.hover = this.hover.bind(this); } hover(e) { this.setState({ @@ -124,7 +124,7 @@ class R_Sider extends PureComponent { Admin Area : - null + undefined } diff --git a/src/components/MainSidebar/index.js b/src/components/MainSidebar/index.js index 659c3706..9b08a8d5 100644 --- a/src/components/MainSidebar/index.js +++ b/src/components/MainSidebar/index.js @@ -1,9 +1,9 @@ import React from 'react' import * as ycore from 'ycore' import * as antd from 'antd' +import { CustomIcons } from 'components' import styles from './index.less' -const { SubMenu } = antd.Menu; var userData = ycore.SDCP() class MainSidebar extends React.Component { @@ -21,41 +21,35 @@ class MainSidebar extends React.Component { render(){ return(
- - - - {userData.username} - + Feed + - + News Feed - + Albums - + Saved Posts - + Groups - + Events + Explore - Popular Posts - Discover - Fundings - Common Things - + + Popular Posts + Discover + Fundings + Common Things
) diff --git a/src/components/MainSidebar/index.less b/src/components/MainSidebar/index.less index 5546cc96..57af3ba6 100644 --- a/src/components/MainSidebar/index.less +++ b/src/components/MainSidebar/index.less @@ -1,3 +1,5 @@ +@import '~themes/vars.less'; + .main_menuWrapper{ position: absolute; left: 2%; @@ -5,6 +7,10 @@ top: 70px; width: 20vw; vertical-align: middle; + background-color: #fff; + border: 1px rgba(128, 128, 128, 0.11) solid; + border-radius: 10px; + font-family: "Poppins", sans-serif; :global { .ant-menu{ background-color: transparent; @@ -14,13 +20,14 @@ margin-bottom: 0; } .ant-menu-item{ + margin-left: 15px; height: 28px; line-height: 28px; } .ant-divider-horizontal.ant-divider-with-text-center, .ant-divider-horizontal.ant-divider-with-text-left, .ant-divider-horizontal.ant-divider-with-text-right { display: table; margin: 7px 0; - color: rgba(0, 0, 0, 0.85); + color: rgba(0, 0, 0, 0.712); font-weight: 430; font-size: 13px; white-space: nowrap; @@ -38,9 +45,10 @@ } .profileKey{ :global{ - padding-left: 0; - } - span{ - margin: 0 0 0 5px; + padding-left: -0; + .ant-avatar { + margin: 0 5px 0 -15px; + } } + } diff --git a/src/components/PostCreator/index.js b/src/components/PostCreator/index.js index b57adb5a..351a9861 100644 --- a/src/components/PostCreator/index.js +++ b/src/components/PostCreator/index.js @@ -6,10 +6,6 @@ import {CustomIcons} from 'components' const { Meta } = antd.Card; -// Set default by configuration -const emptyPayload = {user: 'Post Empty', ago: 'This Post is empty', avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png', content: 'Test Test' } -const defaultActions = [,,] - class PostCreator extends React.PureComponent{ constructor(props){ super(props), @@ -75,7 +71,7 @@ class PostCreator extends React.PureComponent{ } PublishPost = (e) => { const { rawtext } = this.state; - const { refreshPull } = this.props + const { refreshPull, toggleShow } = this.props if(!rawtext){ return null @@ -95,10 +91,12 @@ class PostCreator extends React.PureComponent{ const urlObj = `${ycore.endpoints.new_post}${ycore.GetUserToken.decrypted().UserToken}` fetch(urlObj, requestOptions) .then(response => { - console.log(response) + ycore.DevOptions.ShowFunctionsLogs? console.log(response) : null this.setState({ posting_ok: true, posting: false, rawtext: ''}) - refreshPull() setTimeout( () => { this.setState({ posting_ok: false }) }, 1000) + refreshPull() + // console.warn(`[EXCEPTION] refreshPull or/and toogleShow is not set, the controller handlers not working...`) + }) .catch(error => console.log('error', error)); } @@ -139,5 +137,5 @@ class PostCreator extends React.PureComponent{ ) } -} +} export default PostCreator \ No newline at end of file diff --git a/src/components/PostCreator/index.less b/src/components/PostCreator/index.less index ee92ffce..62dec13a 100644 --- a/src/components/PostCreator/index.less +++ b/src/components/PostCreator/index.less @@ -1,9 +1,9 @@ .cardWrapper{ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); border-radius: 7px; - max-width: 70%; - min-width: 312px; - width: 50.6vw; + max-width: 510px; + min-width: 265px; + width: auto; margin: 23px auto 50px auto; :global{ .ant-card-meta-detail > div:not(:last-child){ @@ -16,7 +16,6 @@ } .ant-card-body { padding: 13px 0 5px 0; - transition: height 150ms linear; } .ant-card-actions { border-top: 0; diff --git a/src/layouts/PrimaryLayout.js b/src/layouts/PrimaryLayout.js index 806202ea..d590546e 100644 --- a/src/layouts/PrimaryLayout.js +++ b/src/layouts/PrimaryLayout.js @@ -99,14 +99,13 @@ class PrimaryLayout extends PureComponent { // MenuParentId is equal to -1 is not a available menu. const menus = newRouteList.filter(_ => _.menuParentId !== '-1') - const headerProps = { menus, theme, collapsed, newRouteList, notifications, - onCollapseChange, + onCollapseChange, onThemeChange(theme) { dispatch({ type: 'app/handleThemeChange', @@ -119,14 +118,6 @@ class PrimaryLayout extends PureComponent { }, } - - const LeftSiderProps = { - theme, - menus, - isMobile, - collapsed, - onCollapseChange, - } const RightSiderProps = { theme, collapsed, @@ -138,7 +129,9 @@ class PrimaryLayout extends PureComponent { }) }, } - + const ContainerProps = { + theme, + } const MobileWarning = () =>{ if (resbypass == false) { if (isMobile == true) { @@ -153,7 +146,7 @@ class PrimaryLayout extends PureComponent { return null } - return ( + return (
@@ -161,7 +154,7 @@ class PrimaryLayout extends PureComponent {
- + {children}
@@ -170,8 +163,6 @@ class PrimaryLayout extends PureComponent { ) - - } } diff --git a/src/pages/main/index.js b/src/pages/main/index.js index 4e526ce8..8b573650 100644 --- a/src/pages/main/index.js +++ b/src/pages/main/index.js @@ -12,6 +12,7 @@ class Main extends React.Component { this.state = { feedRaw: '', loading: true, + createPost: true, } } @@ -19,9 +20,9 @@ class Main extends React.Component { ycore.GetFeedPosts((err, result) => this.setState({ feedRaw: result, loading: false })) } handleRefreshList(){ + this.setState({ createPost: !this.state.createPost }) ycore.GetFeedPosts((err, result) => this.setState({ feedRaw: result, loading: false })) } - renderFeedPosts(){ const {feedRaw} = this.state @@ -29,27 +30,26 @@ class Main extends React.Component { const feedParsed = JSON.parse(feedRaw)['data'] return ( feedParsed.map(item=> { - const {postText, post_time, publisher, postFile, postFileName} = 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 + return }) ) } catch (err) { ycore.notifyError(err) - const paylodd = {user: 'Error', ago: '', avatar: '', content: 'Woops an error spawns here :/, maybe reloading?', publisher: '' } + const paylodd = {user: 'Error', ago: '', avatar: '', content: 'Error displaying data :/', publisher: '' } return } } render(){ - const { loading } = this.state; - - + const { loading, createPost } = this.state; + console.log('createPost =>', createPost) return (
- this.handleRefreshList()} /> + {createPost? {this.handleRefreshList()}} /> : null} {loading? :
{this.renderFeedPosts()}
}
) diff --git a/src/ycore_worker.js b/src/ycore_worker.js index 52118d2d..92a24e12 100644 --- a/src/ycore_worker.js +++ b/src/ycore_worker.js @@ -203,6 +203,9 @@ export const asyncSDCP = { } }; export const ControlBar = { + setCreate: (e) =>{ + + }, set: (e) => { SetControls(e) },