From 46e443989dcfbbcc4f07962d9bc19769eb263b6f Mon Sep 17 00:00:00 2001 From: srgooglo <38926803+srgooglo@users.noreply.github.com> Date: Mon, 23 Mar 2020 02:44:07 +0100 Subject: [PATCH] 0.2.23-A1 --- comty_dist.service | 11 ++++ dist-server.sh | 59 +++++++++++++++++++ package.json | 7 ++- src/@ycore/libs.js | 2 +- .../{comty_layout => app_functions}/pre.js | 15 +++++ src/@ycore/libs/ycore_sdcp/pre.js | 2 +- src/@ycore/libs/yulio_id/pre.js | 15 +++-- src/@ycore/ycore_worker.js | 7 +++ src/components/Layout/Secondary/index.js | 9 ++- src/components/Layout/Secondary/index.less | 12 +++- src/components/Layout/Sider.js | 4 +- src/components/Layout/Sider.less | 13 ++-- src/components/Layout/WindowAppBar.js | 38 ++++++++++++ src/components/Layout/WindowAppBar.less | 31 ++++++++++ src/components/Layout/index.js | 3 +- src/components/YulioID/index.js | 3 + src/layouts/BaseLayout.less | 2 +- src/layouts/PrimaryLayout.js | 49 ++++++++------- src/layouts/PrimaryLayout.less | 24 +++----- src/models/app.js | 6 +- src/pages/404.js | 4 +- src/pages/404.less | 1 + src/pages/__m/index.js | 13 ++++ src/pages/index.js | 1 - src/themes/index.less | 2 +- 25 files changed, 265 insertions(+), 68 deletions(-) create mode 100644 comty_dist.service create mode 100644 dist-server.sh rename src/@ycore/libs/{comty_layout => app_functions}/pre.js (66%) mode change 100755 => 100644 create mode 100644 src/components/Layout/WindowAppBar.js create mode 100644 src/components/Layout/WindowAppBar.less diff --git a/comty_dist.service b/comty_dist.service new file mode 100644 index 00000000..09c4cc50 --- /dev/null +++ b/comty_dist.service @@ -0,0 +1,11 @@ +[Unit] +Description=Comty_Development + +[Service] +ExecStart=serve ./dist +Restart=always +User=root +WorkingDirectory=/ycore/development/comty-development + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/dist-server.sh b/dist-server.sh new file mode 100644 index 00000000..d99979fc --- /dev/null +++ b/dist-server.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +pause(){ + read -p "Press [Enter] key to continue..." fackEnterKey +} + +start_cli_dev(){ + sudo serve ./dist +} + +start_dev(){ + sudo systemctl start comty_dist + echo "Starting dev server..." +} + +stop_dev(){ + sudo systemctl stop comty_dist + echo "Stoping dev server..." +} +show_logs(){ + sudo journalctl -u comty_dist + pause +} + + +show_menus() { + clear + echo "~~~~~~~~~~~~~~~~~~~~~" + echo " BuildServe Server " + echo "~~~~~~~~~~~~~~~~~~~~~" + echo "1. Start CLI Server" + echo "2. Start Server" + echo "3. Stop Server" + echo "4. Show DevServer Logs" + echo "" + echo "0. Exit" +} + +read_options(){ + local choice + read -p "Enter choice [ 1 - 4 ] " choice + case $choice in + 0) exit 0;; + 1) start_cli_dev ;; + 2) start_dev ;; + 3) stop_dev ;; + 4) show_logs;; + *) echo -e "${RED}Error...${STD}" && sleep 2 + esac +} + +trap '' SIGINT SIGQUIT SIGTSTP + +while true +do + + show_menus + read_options +done \ No newline at end of file diff --git a/package.json b/package.json index 6bd8060e..aafc5c12 100755 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4", "title": "Comty™", "DevBuild": true, - "version": "0.2.22", + "version": "0.2.23", "description": "", "main": "app/main.js", "author": "RageStudio", @@ -16,6 +16,8 @@ }, "dependencies": { "@ant-design/compatible": "^1.0.1", + "@ant-design/pro-layout": "^5.0.6", + "@lingui/react": "^2.9.1", "@material-ui/core": "^4.9.3", "@material-ui/icons": "^4.9.1", "antd": "^4.0.2", @@ -33,6 +35,7 @@ "md5": "^2.2.1", "moment": "^2.24.0", "node-sass": "^4.13.1", + "nprogress": "^0.2.0", "os-utils": "0.0.14", "path-to-regexp": "^6.1.0", "prop-types": "^15.7.2", @@ -81,7 +84,7 @@ "stylelint": "^13.1.0", "stylelint-config-prettier": "^8.0.1", "stylelint-config-standard": "^20.0.0", - "typescript": "^3.7.5", + "typescript": "^3.8.3", "umi": "^2.13.3", "umi-plugin-react": "^1.15.2", "wait-on": "^4.0.0", diff --git a/src/@ycore/libs.js b/src/@ycore/libs.js index b1dc4934..42047ee9 100755 --- a/src/@ycore/libs.js +++ b/src/@ycore/libs.js @@ -3,4 +3,4 @@ export * from './libs/comty_ng/pre.js'; export * from './libs/yulio_id/pre.js'; export * from './libs/ycore_styles/pre.js'; export * from './libs/ycore_sdcp/pre.js'; -export * from './libs/comty_layout/pre.js' \ No newline at end of file +export * from './libs/app_functions/pre.js' \ No newline at end of file diff --git a/src/@ycore/libs/comty_layout/pre.js b/src/@ycore/libs/app_functions/pre.js old mode 100755 new mode 100644 similarity index 66% rename from src/@ycore/libs/comty_layout/pre.js rename to src/@ycore/libs/app_functions/pre.js index 8b1356f4..46263819 --- a/src/@ycore/libs/comty_layout/pre.js +++ b/src/@ycore/libs/app_functions/pre.js @@ -1,6 +1,21 @@ import {SetControls, CloseControls} from "../../../components/Layout/Control" import {SwapMode} from '../../../components/Layout/Secondary' + +export function QueryRuntime() { + +} +export const CheckThisApp = { + desktop_mode: () => { + const a = localStorage.getItem('desktop_src') + if (a == 'true') { + return true + } + return false + }, + +} + export const SecondarySwap = { ext: ()=> { SwapMode.ext() diff --git a/src/@ycore/libs/ycore_sdcp/pre.js b/src/@ycore/libs/ycore_sdcp/pre.js index bf39b317..2cd0b4eb 100755 --- a/src/@ycore/libs/ycore_sdcp/pre.js +++ b/src/@ycore/libs/ycore_sdcp/pre.js @@ -1,7 +1,6 @@ import * as ycore from 'ycore' import localforage from 'localforage' - export const asyncSDCP = { setSDCP: function (value) { return Promise.resolve().then(function () { @@ -111,6 +110,7 @@ export const CryptSDCP = { export function SetupApp(){ // TODO: Default sets + ycore.notify.success('Authorised, please reload the app for login!') const resourceLoad = localStorage.getItem('resource_bundle') if (!resourceLoad) { localStorage.setItem('resource_bundle', 'light_ng') diff --git a/src/@ycore/libs/yulio_id/pre.js b/src/@ycore/libs/yulio_id/pre.js index 0ff10389..30e8e9b7 100755 --- a/src/@ycore/libs/yulio_id/pre.js +++ b/src/@ycore/libs/yulio_id/pre.js @@ -12,7 +12,7 @@ export function userData(){ return ycore.handlerYIDT.get() } -function __API__User (payload, sdcp){ +function __API__User (payload, sdcp, callback){ const { UserID, UserToken } = payload const a = ycore.CryptSDCP.atob_parse(sdcp) @@ -30,7 +30,7 @@ function __API__User (payload, sdcp){ exp: ycore.AppSettings.SignForNotExpire? 0 : Math.floor(Date.now() / 1000) + (60 * 60), } ycore.handlerYIDT.set(frame, done => { - done? ycore.crouter.native('main') : null + done? callback(false, true) : callback(true, false) }) } @@ -202,8 +202,15 @@ export function __AppSetup__(EncUsername, EncPassword, callback) { ycore.yconsole.log(FramePayload) callback(null, '200') - ycore.GetSDCPfromCloud(FramePayload, (res) => res? __API__User(FramePayload, res) : null ) - ycore.SetupApp() + ycore.GetSDCPfromCloud(FramePayload, (res) => res? __API__User(FramePayload, res, + (err, done) => { + if (err){ + ycore.notify.error('Critical error, token declined!') + return false + } + ycore.SetupApp() + }) : null ) + } if (identState == 400) { callback(null, '400') diff --git a/src/@ycore/ycore_worker.js b/src/@ycore/ycore_worker.js index 1e7c5d4b..6eb94176 100755 --- a/src/@ycore/ycore_worker.js +++ b/src/@ycore/ycore_worker.js @@ -143,6 +143,13 @@ export const crouter = { } export const notify = { + success: (...res) => { + antd.notification.success({ + message: 'Well', + description: (res.toString()), + placement: 'bottomLeft' + }) + }, error: (...res) => { antd.notification.error({ message: 'Wopss', diff --git a/src/components/Layout/Secondary/index.js b/src/components/Layout/Secondary/index.js index d21dbd58..e2d37168 100644 --- a/src/components/Layout/Secondary/index.js +++ b/src/components/Layout/Secondary/index.js @@ -90,9 +90,12 @@ export default class Secondary extends React.PureComponent{ ycore.crouter.native(`@${userData.username}`)} src={userData.avatar} /> -
- {this.state.swap? } onClick={() => this.closeSwap()} > Back : null} - {this.renderMode()} +
+
+ {this.state.swap? } onClick={() => this.closeSwap()} > Back : null} + {this.renderMode()} +
+
diff --git a/src/components/Layout/Secondary/index.less b/src/components/Layout/Secondary/index.less index b820401d..b4af7f25 100644 --- a/src/components/Layout/Secondary/index.less +++ b/src/components/Layout/Secondary/index.less @@ -16,7 +16,11 @@ width: 96vw; position: absolute; right: 0; + >.container{ + border-radius: 12px 12px 12px 12px; + } } + transition: all @SwapAnimDuration ease-in-out; @@ -53,8 +57,9 @@ position: relative; background-color: #201F23; color: @DarkMode-color_container !important; - border-radius: 32px 0 0 32px; - padding: 30px 375px 30px 75px; + &.desktop_mode{ + border-radius: 0 12px 12px 0; + } width: 100%; height: 100vh; :global{ @@ -73,6 +78,9 @@ } } } + .container_body{ + padding: 30px 375px 30px 75px; + } .container_2{ z-index: 201; diff --git a/src/components/Layout/Sider.js b/src/components/Layout/Sider.js index 8d283a65..e42a0981 100755 --- a/src/components/Layout/Sider.js +++ b/src/components/Layout/Sider.js @@ -13,8 +13,6 @@ import * as ycore from 'ycore'; import router from 'umi/router'; import {CustomIcons} from 'components' - - @withI18n() class Sider extends PureComponent { constructor(props) { @@ -68,7 +66,7 @@ class Sider extends PureComponent { theme={this.StrictMode()} width="180" collapsed={collapsed} - className={classnames(styles.sider, {[styles.darkmd]: this.isDarkMode()} )} + className={classnames(styles.sider, {[styles.darkmd]: this.isDarkMode(), [styles.desktop_mode]: this.props.desktop_mode} )} onMouseEnter={() => this.setState({ collapsedWidth: '90' })} onMouseLeave={() => this.setState({ collapsedWidth: '35' })} > diff --git a/src/components/Layout/Sider.less b/src/components/Layout/Sider.less index 046d50fb..c659952d 100755 --- a/src/components/Layout/Sider.less +++ b/src/components/Layout/Sider.less @@ -109,10 +109,10 @@ border-color: transparent; font-size: 13px; font-family: "Poppins", sans-serif; - height: 100%; - width: 100%; - left: 0; - position: absolute; + height: 100vh; + z-index: 100; + float: left; + position: relative; :global { .ant-layout-sider-dark { @@ -154,9 +154,8 @@ .sider { border-right: transparent; - border-radius: 0 10px 10px 0 ; - &.darkmd { - border: none; + &.desktop_mode{ + border-radius: 12px 0 0 12px; } height: 100%; z-index: 50; diff --git a/src/components/Layout/WindowAppBar.js b/src/components/Layout/WindowAppBar.js new file mode 100644 index 00000000..6fd8c1b2 --- /dev/null +++ b/src/components/Layout/WindowAppBar.js @@ -0,0 +1,38 @@ +import React from 'react' +import styles from './WindowAppBar.less' +import * as Icons from '@ant-design/icons' +const remote = { + getCurrentWindow: () =>{ + return + }, + handleFullRescale: () => { + return + }, + app: { + quit: () => { + return + } + } +} +export default class WindowAppBar extends React.PureComponent { + handleFullRescale(){ + return + // const currentWindow = remote.getCurrentWindow() + // if(currentWindow.isMaximized()) { + // currentWindow.unmaximize() + // } else { + // currentWindow.maximize() + // } + } + render(){ + return( +
+
+ remote.getCurrentWindow().minimize() } id="minimize-button" /> + this.handleFullRescale()} /> + remote.app.quit()} id="close-button" /> +
+
+ ) + } +} \ No newline at end of file diff --git a/src/components/Layout/WindowAppBar.less b/src/components/Layout/WindowAppBar.less new file mode 100644 index 00000000..3293acfd --- /dev/null +++ b/src/components/Layout/WindowAppBar.less @@ -0,0 +1,31 @@ +.WindowAppBar { + -webkit-app-region: drag; + position: relative; + vertical-align: top; + width: 100%; + height: 25px; + z-index: 5000; + background-color: #2d2d2d; +} +.WindowControl { + float: right; + height: 100%; + padding: 0 20px 0 0; + transition: all 140ms linear; + :global { + color: #747474; + .anticon { + margin: 0 15px 0 15px; + display: inline-block; + color: inherit; + font-style: normal; + vertical-align: middle; + text-align: center; + } + } +} +.WindowControl:hover{ + :global{ + color: #ffffff; + } +} \ No newline at end of file diff --git a/src/components/Layout/index.js b/src/components/Layout/index.js index bfb103b5..623e1f25 100755 --- a/src/components/Layout/index.js +++ b/src/components/Layout/index.js @@ -1,5 +1,6 @@ import Sider from './Sider' import Control from './Control' import Secondary from './Secondary/index.js' +import WindowAppBar from './WindowAppBar' -export { Sider, Control, Secondary } +export { Sider, Control, Secondary,WindowAppBar } diff --git a/src/components/YulioID/index.js b/src/components/YulioID/index.js index 6eac3b19..832832bc 100755 --- a/src/components/YulioID/index.js +++ b/src/components/YulioID/index.js @@ -6,6 +6,8 @@ import { Button, Input, Drawer } from 'antd'; import * as ycore from 'ycore' import styles from './index.less'; +import { ANT_MARK } from 'antd/lib/locale-provider'; +import { validateLocaleAndSetLanguage } from 'typescript'; const FormItem = Form.Item @@ -101,6 +103,7 @@ class YulioID extends Component {



{StateMessage}
+ {StateException ?
: null}
diff --git a/src/layouts/BaseLayout.less b/src/layouts/BaseLayout.less index 9638f196..eadb36e9 100755 --- a/src/layouts/BaseLayout.less +++ b/src/layouts/BaseLayout.less @@ -9,7 +9,7 @@ pointer-events: none; .bar { - background: @primary-color; + background: transparent; position: fixed; z-index: 2048; top: 0; diff --git a/src/layouts/PrimaryLayout.js b/src/layouts/PrimaryLayout.js index 1fa88833..ff6cf00a 100755 --- a/src/layouts/PrimaryLayout.js +++ b/src/layouts/PrimaryLayout.js @@ -16,7 +16,7 @@ import * as Icons from '@ant-design/icons' import styles from './PrimaryLayout.less' const { Content } = antd.Layout -const { Sider, Control, Secondary } = MyLayout +const { Sider, Control, Secondary, WindowAppBar } = MyLayout @withRouter @connect(({ app, loading }) => ({ app, loading })) @@ -27,12 +27,17 @@ class PrimaryLayout extends React.Component { this.state = { collapsed: (ycore.AppSettings.default_collapse_sider? true : false), isMobile: false, + desktop_mode: false, userData: '' } } componentDidMount() { - this.setState({ userData: ycore.userData() }) + this.setState({ + userData: ycore.userData(), + desktop_mode: ycore.CheckThisApp.desktop_mode() + }) + this.enquireHandler = enquireScreen(mobile => { const { isMobile } = this.state if (isMobile !== mobile) { @@ -64,11 +69,12 @@ class PrimaryLayout extends React.Component { render() { const { app, location, dispatch, children } = this.props - const { userData, collapsed, isMobile } = this.state + const { userData, collapsed, isMobile, desktop_mode } = this.state const { onCollapseChange } = this const { theme } = app - + const SiderProps = { + desktop_mode: desktop_mode, theme, userData, isMobile, @@ -83,30 +89,33 @@ class PrimaryLayout extends React.Component { } const SecondaryProps = { + desktop_mode: desktop_mode, userData, isMobile, theme, } return ( - - {isMobile? : null} -
- - + +
+ {isMobile? : null} +
+ + -
- - - - {children} - - -
+
+ + + + {children} + + +
- - -
+ + + +
) diff --git a/src/layouts/PrimaryLayout.less b/src/layouts/PrimaryLayout.less index 5c28aa6b..63b78ec2 100755 --- a/src/layouts/PrimaryLayout.less +++ b/src/layouts/PrimaryLayout.less @@ -1,21 +1,9 @@ @import '~themes/vars.less'; - -.mobilewarning{ - background-color: rgba(0, 0, 0, 0.975); - color: white; - width: 100%; - position: absolute; - top: 0; - bottom: 0; - z-index: 100000; - display: flex; - justify-content: center; - text-align: center; - :global { - .ant-result-title { - color: white; - } +.AppWrapper{ + &.desktop_mode{ + padding: 0 30px 0 30px; + border-radius: 10px; } } @@ -32,8 +20,12 @@ } .layout{ + background-color: @Theme-Layout-Backgroud; //#E2E6E9; transition: background-color 200ms linear; + &.desktop_mode{ + border-radius: 12px; + } &.md_radius{ width: 95%; margin: auto; diff --git a/src/models/app.js b/src/models/app.js index 7a05d80e..cd8a6253 100755 --- a/src/models/app.js +++ b/src/models/app.js @@ -44,14 +44,14 @@ export default { }, }, effects: { - *query({payload}, { call, put, select }) { + *query({payload}, { call, put, select }) { const validBackup = ycore.ValidBackup(); - if ( ycore.ValidLoginSession() == true) { + if (ycore.ValidLoginSession() == true) { if (pathMatchRegexp(['/', '/login'], window.location.pathname)) { router.push({pathname: '/main',}) } ycore.MakeBackup() - ycore.UpdateSDCP() + ycore.QueryRuntime() return true } else if(!pathMatchRegexp(['','/login'], window.location.pathname)) { diff --git a/src/pages/404.js b/src/pages/404.js index 22a495ad..6de6ad4b 100755 --- a/src/pages/404.js +++ b/src/pages/404.js @@ -4,13 +4,13 @@ import { Page } from 'components' import styles from './404.less' const Error404 = () => ( - +

OBA BLYAT

ERROR 404

-
+ ) export default Error404 diff --git a/src/pages/404.less b/src/pages/404.less index 38c7e9cb..a6c1a253 100755 --- a/src/pages/404.less +++ b/src/pages/404.less @@ -26,6 +26,7 @@ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } .error { + background-color: transparent; color: black; text-align: center; position: absolute; diff --git a/src/pages/__m/index.js b/src/pages/__m/index.js index 594ec8ce..5b151b6f 100755 --- a/src/pages/__m/index.js +++ b/src/pages/__m/index.js @@ -46,6 +46,18 @@ export default class __m extends React.Component { this.setState({s_ses: res}) })} } + handleDesktop(){ + const a = localStorage.getItem('desktop_src') + let to; + if (a == 'false') { + to = true + }else { + to = false + } + ycore.notify.proccess('Switching to ', to? 'Desktop Mode' : 'Normal Mode') + localStorage.setItem('desktop_src', to) + setTimeout(() => ycore.RefreshONCE(), 2000) + } DescompileSDCP(){ let result = {}; for (var i = 0; i < UserData.length; i++) { @@ -107,6 +119,7 @@ export default class __m extends React.Component { ycore.notify.error('Error Mock 1')} > notify.error ycore.notify.proccess('Proccess Mock 1')} > notify.proccess + this.handleDesktop()} > Switch to Desktop_mode
diff --git a/src/pages/index.js b/src/pages/index.js index 21936e89..bb271b88 100755 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -1,7 +1,6 @@ import React, { PureComponent } from 'react' import * as ycore from 'ycore' -@withI18n() class Index extends PureComponent { render() { ycore.crouter.native(`login`) diff --git a/src/themes/index.less b/src/themes/index.less index 8e5ecb3f..ccef96ef 100755 --- a/src/themes/index.less +++ b/src/themes/index.less @@ -3,7 +3,7 @@ body { height: 100%; overflow-y: hidden; - background-color: rgb(249, 249, 249); + background-color: transparent; // rgb(249, 249, 249); } ::-webkit-scrollbar-thumb {