From be94aad23ac1e6a6901db2ec6b7bc8fdbf4b1905 Mon Sep 17 00:00:00 2001 From: srgooglo Date: Fri, 28 Aug 2020 03:30:12 +0200 Subject: [PATCH] add: electron support --- .env | 4 +- .umirc.js | 37 ++++++- comty_dev.service | 11 -- comty_dist.service | 11 -- dev-server.sh | 64 ------------ dist-server.sh | 59 ----------- electron-builder.yml | 12 +++ main/configs/config.js | 3 + main/index.js | 83 +++++++++++++++ main/statics/loading.css | 97 ++++++++++++++++++ main/statics/loading.html | 12 +++ main/statics/loading_dev.html | 13 +++ package.json | 69 ++++++++----- public/favicon.png | Bin 0 -> 6664 bytes src/components/About/index.js | 15 ++- src/components/Layout/WindowNavbar/index.js | 12 +++ src/components/Layout/WindowNavbar/index.less | 11 ++ src/components/Layout/index.js | 3 +- src/core/cores/router/index.js | 4 +- src/core/index.js | 3 + src/layouts/BaseLayout.js | 2 + src/layouts/PrimaryLayout.js | 6 +- src/models/app.js | 15 ++- src/pages/index.js | 48 +++++---- src/theme/base/index.less | 13 +-- 25 files changed, 386 insertions(+), 221 deletions(-) delete mode 100755 comty_dev.service delete mode 100755 comty_dist.service delete mode 100755 dev-server.sh delete mode 100755 dist-server.sh create mode 100644 electron-builder.yml create mode 100644 main/configs/config.js create mode 100644 main/index.js create mode 100644 main/statics/loading.css create mode 100644 main/statics/loading.html create mode 100644 main/statics/loading_dev.html create mode 100644 public/favicon.png create mode 100644 src/components/Layout/WindowNavbar/index.js create mode 100644 src/components/Layout/WindowNavbar/index.less diff --git a/.env b/.env index 5ed58914..8637115c 100755 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -UMI_UI=true -NODE_ENV=production \ No newline at end of file +UMI_UI=false +NODE_ENV=development \ No newline at end of file diff --git a/.umirc.js b/.umirc.js index bbb3964c..dee47d86 100644 --- a/.umirc.js +++ b/.umirc.js @@ -1,15 +1,19 @@ import { defineConfig } from 'umi'; +import slash from 'slash'; -const { resolve } = require('path'); +const { resolve, join } = require('path'); export default defineConfig({ hash: false, - ignoreMomentLocale: true, + dynamicImport: { + loading: 'components/Loader/Loader.js', + }, + // dynamicImport: false, + // history: { type: "hash" }, + targets: { ie: 9 }, - dynamicImport: { - loading: 'components/Loader/Loader.js', - }, dva: { immer: true }, + ignoreMomentLocale: true, nodeModulesTransform: { type: 'none', }, @@ -23,6 +27,7 @@ export default defineConfig({ components: resolve(__dirname, './src/components'), models: resolve(__dirname, './src/models'), routes: resolve(__dirname, './src/routes'), + node_modules: resolve(__dirname, './node_modules') }, extraBabelPlugins: [ [ @@ -35,6 +40,28 @@ export default defineConfig({ 'lodash', ], ], + // externals(context, request, callback) { + // const isDev = process.env.NODE_ENV === 'development'; + // let isExternal = false; + // const load = [ + // 'electron', + // 'fs', + // 'path', + // 'os', + // 'child_process' + // ]; + // if (load.includes(request)) { + // isExternal = `require("${request}")`; + // } + // const appDeps = Object.keys(require('./package.json').dependencies); + // if (appDeps.includes(request)) { + // const orininalPath = slash(join(__dirname, 'node_modules', request)); + // const requireAbsolute = `require('${orininalPath}')`; + // console.log(isDev) + // isExternal = isDev ? requireAbsolute : `require('${request}')`; + // } + // callback(null, isExternal); + // }, // plugins: [themePlugin], // chainWebpack: function(config, { webpack }) { // config.module diff --git a/comty_dev.service b/comty_dev.service deleted file mode 100755 index 7ac93caa..00000000 --- a/comty_dev.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Comty_Development - -[Service] -ExecStart=npm start -Restart=always -User=root -WorkingDirectory=/ycore/development/comty-development - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/comty_dist.service b/comty_dist.service deleted file mode 100755 index 09c4cc50..00000000 --- a/comty_dist.service +++ /dev/null @@ -1,11 +0,0 @@ -[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/dev-server.sh b/dev-server.sh deleted file mode 100755 index 1dc991f4..00000000 --- a/dev-server.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh - -pause(){ - read -p "Press [Enter] key to continue..." fackEnterKey -} - -start_cli_dev(){ - sudo npm start -} - -start_dev(){ - sudo systemctl start comty_dev - echo "Starting dev server..." -} - -stop_dev(){ - sudo systemctl stop comty_dev - echo "Stoping dev server..." -} -show_logs(){ - sudo journalctl -u comty_dev -} -update(){ - git reset --merge&&git fetch --all&&git reset --hard origin/master - - -} - -show_menus() { - clear - echo "~~~~~~~~~~~~~~~~~~~~~" - echo " Development Server " - echo "~~~~~~~~~~~~~~~~~~~~~" - echo "1. Start CLI Server" - echo "2. Start Server" - echo "3. Stop Server" - echo "4. Show DevServer Logs" - echo "5. Update from Git" - echo "" - echo "0. Exit" -} - -read_options(){ - local choice - read -p "Enter choice [ 1 - 5 ] " choice - case $choice in - 0) exit 0;; - 1) start_cli_dev ;; - 2) start_dev ;; - 3) stop_dev ;; - 4) show_logs;; - 5) update;; - *) 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/dist-server.sh b/dist-server.sh deleted file mode 100755 index d99979fc..00000000 --- a/dist-server.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/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/electron-builder.yml b/electron-builder.yml new file mode 100644 index 00000000..6cac0d4d --- /dev/null +++ b/electron-builder.yml @@ -0,0 +1,12 @@ +appId: com.example.bruh +productName: Bruh +copyright: Copyright © Bruh +directories: + output: dist + buildResources: resources +files: + - from: . + filter: + - package.json + - app +publish: null diff --git a/main/configs/config.js b/main/configs/config.js new file mode 100644 index 00000000..2dbfdd50 --- /dev/null +++ b/main/configs/config.js @@ -0,0 +1,3 @@ +const Config = require('electron-config') + +module.exports = new Config({ name: 'config' }); \ No newline at end of file diff --git a/main/index.js b/main/index.js new file mode 100644 index 00000000..511e4cae --- /dev/null +++ b/main/index.js @@ -0,0 +1,83 @@ +const { app, BrowserWindow, Menu, Tray, nativeImage } = require('electron') +const { join } = require('path') +const path = require('path') +const packagejson = require('../package.json') +const is = require('electron-is') +const waitOn = require('wait-on'); + +let app_path = `file://${join(__dirname, '..', 'renderer')}/index.html`; + +if (is.dev()) { + require('electron-debug')(); // eslint-disable-line global-require +} + +if (is.dev()) { + app_path = 'http://127.0.0.1:8000/'; +} + +// app.on('window-all-closed', () => { +// if (process.platform !== 'darwin') { +// app.quit(); +// } +// }); + +app.on('activate', () => { + // inits +}); + +app.on('ready', () => { + loadWindow = new BrowserWindow({ + icon: nativeImage.createFromPath(path.join(__dirname, '/public/favicon.png')), + width: 700, + height: 600, + frame: false, + resizable: false, + center: true, + transparent: true, + + }); + + mainWindow = new BrowserWindow({ + icon: nativeImage.createFromPath(path.join(__dirname, '/public/favicon.png')), + show: false, + width: 1280, + height: 720, + frame: false, + webPreferences: { + nodeIntegration: true + } + }); + + tray = new Tray(nativeImage.createFromPath(path.join(__dirname, '/public/favicon.png'))) + + const contextMenu = Menu.buildFromTemplate([ + { label: 'Open', type: 'normal', click: function(){ + mainWindow.show(); + } }, + { label: 'bruh', type: 'radio', checked: true }, + ]) + tray.setToolTip(packagejson.title) + tray.setContextMenu(contextMenu) + + if (is.dev()) { + loadWindow.loadURL(`file://${__dirname}/statics/loading_dev.html`) + }else{ + loadWindow.loadURL(`file://${__dirname}/statics/loading.html`) + } + + waitOn({ resources: [app_path] }, function (err) { + if (err) { + return console.log(err, ' | electron Aborted create window') + } + loadWindow.close() + mainWindow.show() + mainWindow.loadURL(app_path); + }); + +}); + +app.on('close', (event) => { + event.preventDefault(); + mainWindow.hide(); +}); + diff --git a/main/statics/loading.css b/main/statics/loading.css new file mode 100644 index 00000000..649da376 --- /dev/null +++ b/main/statics/loading.css @@ -0,0 +1,97 @@ +body { + background-color: transparent; + border-radius: 12px; + resize: none; + font-family: 'Alata', sans-serif; +} +.wrapper { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + background-color: #222222; + color: #efefef; + border-radius: 12px; + text-align: center; + padding: 20px; +} +.bouncy-logo { + width: 400px; + height: 400px; + margin: 0 auto; + position: relative; + } + .bouncy-logo .ball img { + position: absolute; + height: 200px; + width: 200px; + top: 0; + left: 43%; + transform: translate(-50%, 0); + -webkit-animation-direction: alternate; + -webkit-animation-duration: 1s; + -webkit-animation-name: my-bounce; + -webkit-animation-iteration-count: infinite; + animation-direction: alternate; + animation-duration: 1s; + animation-name: my-bounce; + animation-iteration-count: infinite; + } + .bouncy-logo .ball-shadow { + background: radial-gradient(50% 50%, #ccc 0%, transparent 100%); + height: 50px; + width: 200px; + position: absolute; + top: 230px; + left: 50%; + transform: translate(-50%, 0); + -webkit-animation-direction: alternate; + -webkit-animation-duration: 1s; + -webkit-animation-name: my-grow; + -webkit-animation-iteration-count: infinite; + animation-direction: alternate; + animation-duration: 1s; + animation-name: my-grow; + animation-iteration-count: infinite; + } + + @-webkit-keyframes my-grow { + from { + width: 200px; + height: 50px; + top: 230px; + } + to { + width: 150px; + height: 10px; + top: 240px; + } + } + @keyframes my-grow { + from { + width: 200px; + height: 50px; + top: 230px; + } + to { + width: 150px; + height: 10px; + top: 240px; + } + } + @-webkit-keyframes my-bounce { + from { + top: 0; + } + to { + top: 10%; + } + } + @keyframes my-bounce { + from { + top: 0; + } + to { + top: 10%; + } + } \ No newline at end of file diff --git a/main/statics/loading.html b/main/statics/loading.html new file mode 100644 index 00000000..94fa0747 --- /dev/null +++ b/main/statics/loading.html @@ -0,0 +1,12 @@ + + + + +
+ +
+ + \ No newline at end of file diff --git a/main/statics/loading_dev.html b/main/statics/loading_dev.html new file mode 100644 index 00000000..b8b776cc --- /dev/null +++ b/main/statics/loading_dev.html @@ -0,0 +1,13 @@ + + + + +
+ +

Starting the development server...

+
+ + \ No newline at end of file diff --git a/package.json b/package.json index a35e1e89..8b43a7fe 100755 --- a/package.json +++ b/package.json @@ -3,30 +3,32 @@ "UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4", "title": "Comty™", "DevBuild": true, - "version": "0.8.22", + "version": "0.8.27", "stage": "dev-pre", "description": "", "author": "RageStudio", "license": "ISC", "private": true, + "main": "main/index.js", + "build": { + "files": [ + "./dist/**/*", + "./pages/**/*", + "./node_modules/**/*" + ], + "appId": "com.rstudio.comty", + "asar": false + }, "scripts": { "start": "umi dev", - "build": "umi build", - "postinstall": "umi generate tmp", - "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", - "test": "umi-test", - "test:coverage": "umi-test --coverage" - }, - "gitHooks": { - "pre-commit": "lint-staged" - }, - "lint-staged": { - "*.{js,jsx,less,md,json}": [ - "prettier --write" - ], - "*.ts?(x)": [ - "prettier --parser=typescript --write" - ] + "postinstall": "electron-builder install-app-deps", + "dev": "concurrently \"electron .\" \"umi dev\"", + "build": "npm run build:main && npm run build:renderer", + "build:main": "ESLINT=none roadhog build", + "build:renderer": "ESLINT=none umi build", + "pack": "npm run build && npm run rebuild && build", + "pack:dir": "npm run build && npm run rebuild && build --dir", + "pack:dirOnly": "build --dir" }, "dependencies": { "@icons-pack/react-simple-icons": "^3.8.0", @@ -36,27 +38,26 @@ "@material-ui/core": "^4.9.9", "@material-ui/icons": "^4.9.1", "@ragestudio/ycorejs-lib": "^0.1.22", - "@steveeeie/react-page-transition": "^1.2.0", - "antd": "^4.5.1", + "antd": "^4.6.1", "axios": "^0.19.2", "babel-core": "^6.26.3", "classnames": "^2.2.6", - "dva-model-extend": "^0.1.2", + "electron-config": "^2.0.0", + "electron-is": "^3.0.0", + "electron-log": "^4.2.4", "enquire-js": "^0.2.1", "feather-reactjs": "^2.0.13", "jquery": "^3.5.1", "less-vars-to-js": "^1.3.0", - "lint-staged": "^10.0.7", "localforage": "^1.7.4", "lodash": "^4.17.19", "moment": "^2.27.0", "node-sass": "^4.13.1", "nprogress": "^0.2.0", "path-to-regexp": "^6.1.0", - "prettier": "^1.19.1", - "prop-types": "^15.7.2", + "platform": "^1.3.6", "radium": "^0.26.0", - "react": "^16.12.0", + "react": "^16.13.1", "react-animations": "^1.0.0", "react-color": "^2.18.1", "react-dazzle": "^1.4.0", @@ -66,27 +67,39 @@ "react-helmet": "^5.2.1", "react-linkify": "^1.0.0-alpha", "react-perfect-scrollbar": "^1.5.8", + "react-redux": "^7.2.1", "react-reveal": "^1.2.2", "react-scripts": "^3.4.1", - "react-transition-group": "^4.4.1", "react-virtualized": "^9.21.2", "simple-icons": "^3.3.0", + "slash": "^3.0.0", "stack-trace": "0.0.10", "store": "^2.0.12", "styled-components": "^5.1.1", - "timeago.js": "^4.0.2" + "timeago.js": "^4.0.2", + "wait-on": "^5.2.0" }, "devDependencies": { "@lingui/babel-preset-react": "^2.9.0", "@lingui/cli": "^2.9.0", "@lingui/loader": "^2.9.0", "@umijs/preset-react": "^1.4.0", + "electron": "^10.0.1", + "electron-debug": "^2.0.0", + "electron-rebuild": "^1.7.3", + "electron-builder": "^22.8.0", + "electron-devtools-installer": "^3.1.1", + "concurrently": "^3.5.1", "babel-eslint": "^10.0.1", "babel-plugin-dev-expression": "^0.2.1", "babel-plugin-module-resolver": "^4.0.0", "cross-env": "^6.0.0", - "typescript": "^3.8.3", + "dva-model-extend": "^0.1.2", "jsdoc": "^3.6.5", - "umi": "^3.2.9" + "typescript": "^3.8.3", + "umi": "^3.2.17", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@types/electron-devtools-installer": "^2.2.0", + "@types/node": "^12.12.52" } } diff --git a/public/favicon.png b/public/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..0f5ca3196c3e33e671a8835be59a6f4743ee5672 GIT binary patch literal 6664 zcmZX3c_0+d`~U3Pb**E`nfr>YE4SQd&lVi>;3uj_xopNUNiGNb3D&8^UOTSmKK*7>Ce&w02ob-4XgoxoE9N~mijbv z3VPuQ0Qazofv!z>!Jk4J;>M||!nd=Ih5LjCZxC1Ag!9udre$l+4 zPXI(t(m!fn$#f|#K&MkcY&pb$$Y5Ck^%KNw05~?OaIk2|>i{OA4KILfTY3Xs7c2fUeRno?i8Dvf?&9?tuL<_4Q+e%ZYZ5ksf3X@{t%@? zZ&R8ow7B8(OGmqAmnYSpSeXK|x#+fKP{o@Ng}`^bN{&x)RMmiq)`W2zB+>hYx}Bu-_D*qEm!O8_wAT@n6a`(uT-d~Si_95fjjrFs%5_aZO2;3OY7p4Cq=|O&oV(6& zJ_GtascYm(k7;7L92pj9V)(UtmNy41UQsdH{)7Cdb7nz@L*R+{qKhfm^kCtrnIf8r z82GPti%ek@5Mp4zMgsMzl5YicW%|NrA6OddK(m+;W1osHo40HgNY6Y#O5-&HpRp3l{|wfpnT-wL#TLbNlIo zG-Gh9LQ`M&F?}cy4x4_f)y0aPRLhN+*Hi3~0zHmJ+;lpAhxDZLLT6>@+ujK|GLziK zD;%Mgnp-uuDwix26IVtw07*gUV}}3y??yq`a)v~Kz3=y>19~$ikAtg!M4VAF{p(qB z=A3HsI9-fx^A1lbyUq_H>$F{>Yo$b5ao(YMHn17G0BmWy(AnxU5Y>xs#iFmig}+Ff z2FF}6C3vLP?8B43kqSo?wx5{B?h+qfY;|dFH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yzd)2itQKKt5zm)A9?>VY4871dj5>`5p z+|djl?vyez%?Jo-l>1!+rr+K$5$6yEzvK$%dZptStable } else { @@ -21,9 +22,13 @@ export default class App_About extends React.Component {

{name}

{UUAID}
- v{version} - {stage} - {this.DetectNoNStableBuild()} + {os.toString()} + v{version} + {stage} + Render with {layout} + {this.renderStableTag()} + + ) diff --git a/src/components/Layout/WindowNavbar/index.js b/src/components/Layout/WindowNavbar/index.js new file mode 100644 index 00000000..5ec2417a --- /dev/null +++ b/src/components/Layout/WindowNavbar/index.js @@ -0,0 +1,12 @@ +import React from 'react' +import styles from './index.less' + +export default class WindowNavbar extends React.Component{ + render(){ + return( +
+ +
+ ) + } +} \ No newline at end of file diff --git a/src/components/Layout/WindowNavbar/index.less b/src/components/Layout/WindowNavbar/index.less new file mode 100644 index 00000000..d7f83aa6 --- /dev/null +++ b/src/components/Layout/WindowNavbar/index.less @@ -0,0 +1,11 @@ +.navbar{ + display: block; + -webkit-app-region: drag; + height: 35px; + width: 100%; + position: absolute; + z-index: 5000; + top: 0; + right: 0; + background-color: rgba(45, 45, 45, 0.274); +} \ No newline at end of file diff --git a/src/components/Layout/index.js b/src/components/Layout/index.js index a755a706..4566e41a 100755 --- a/src/components/Layout/index.js +++ b/src/components/Layout/index.js @@ -1,5 +1,6 @@ import Sider from './Sider' import Control from './ControlBar' import Overlay from './Overlay/index.tsx' +import WindowNavbar from './WindowNavbar/index.js' -export { Sider, Control, Overlay } +export { Sider, Control, Overlay, WindowNavbar } diff --git a/src/core/cores/router/index.js b/src/core/cores/router/index.js index 1002cc10..b9f0624d 100644 --- a/src/core/cores/router/index.js +++ b/src/core/cores/router/index.js @@ -18,11 +18,11 @@ export const router = { }, go: e => { router.push(e); - goTo.element('primaryContent'); + // goTo.element('primaryContent'); }, goprofile: () => { router.push(`/@${e}`); - goTo.element('primaryContent'); + // goTo.element('primaryContent'); }, }; diff --git a/src/core/index.js b/src/core/index.js index 22369d69..858b54e8 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -4,6 +4,7 @@ import { cloneDeep } from 'lodash'; import store from 'store'; import { i18n, app_config } from 'config'; import * as errorHandlers from 'core/libs/errorhandler' +import platform from 'platform' const { pathToRegexp } = require('path-to-regexp'); @@ -23,6 +24,8 @@ export const app_info = { version: package_json.version, logo: app_config.FullLogoPath, logo_dark: app_config.DarkFullLogoPath, + os: platform.os, + layout: platform.layout }; export function imageToBase64(img, callback){ diff --git a/src/layouts/BaseLayout.js b/src/layouts/BaseLayout.js index abe1bf21..928f7cc1 100755 --- a/src/layouts/BaseLayout.js +++ b/src/layouts/BaseLayout.js @@ -5,6 +5,7 @@ import { Loader } from 'components' import NProgress from 'nprogress' import { withRouter, connect } from 'umi' import { queryLayout } from 'core' +import WindowNavbar from 'components/Layout/WindowNavbar' import config from 'config' import PrimaryLayout from './PrimaryLayout' @@ -43,6 +44,7 @@ class BaseLayout extends React.Component { {config.app_config.siteName} + {this.props.app.electron? : null} {Loader(this.renderLoading)} {children} diff --git a/src/layouts/PrimaryLayout.js b/src/layouts/PrimaryLayout.js index 3fa23546..fdb0de13 100755 --- a/src/layouts/PrimaryLayout.js +++ b/src/layouts/PrimaryLayout.js @@ -53,7 +53,6 @@ class PrimaryLayout extends React.Component { store.set('collapsed', !fromStore) } - render() { const { location, dispatch, children } = this.props const { collapsed, isMobile } = this.state @@ -85,7 +84,7 @@ class PrimaryLayout extends React.Component { window.DarkMode = isActive(currentTheme["darkmode"])? true : false return ( - + {isActive(currentTheme['backgroundImage'])?
: null} - +
- { + if (!this.props.app) { + return false + } let tmp = [] const keys = Object.keys(this.props.app) const values = Object.values(this.props.app) const lenght = keys.length - for (let i = 0; i < lenght; i++) { - let obj = {} - obj.key = keys[i] - obj.value = values[i] - - tmp[i] = obj - } - - const map = tmp.map(e => { - const v = JSON.stringify(e.value) - return( -
-

{e.key}

- {v.length < 500? {v} : {v}} -
- ) - }) + if(lenght > 0){ + for (let i = 0; i < lenght; i++) { + let obj = {} + obj.key = keys[i] + obj.value = values[i] + + tmp[i] = obj + } + + const map = tmp.map(e => { + try { + const v = JSON.stringify(e.value) + if(!v) return false + return( +
+

{e.key}

+ {v.length < 500? {v} : {v}} +
+ ) + } catch (error) { + return null + } + }) - return map + return map + } + return null } - return (
Redux state}> diff --git a/src/theme/base/index.less b/src/theme/base/index.less index 630d2902..28ad5413 100644 --- a/src/theme/base/index.less +++ b/src/theme/base/index.less @@ -38,7 +38,10 @@ } #app { + -webkit-app-region: no-drag; overflow: hidden; + border-radius: 12px; + color: @AppTheme_global_color!important; background-color: @AppTheme_global_background!important; background-repeat: repeat-x; @@ -48,7 +51,7 @@ overflow: hidden; background-color: transparent; margin: auto; - height: 100vh; + height: 100%; width: 100vw; transition: all @__Global_Components_transitions_dur linear; @@ -79,6 +82,8 @@ } body { + -webkit-app-region: no-drag; + scroll-behavior: smooth; height: 100%; @@ -88,7 +93,7 @@ body { line-height: @base-line-height; font-family: @__Global_texted_font; - + border-radius: 12px; } @media (max-width: @bp-small){ @@ -113,10 +118,6 @@ body { } - - - - .text-overflow { white-space: nowrap; text-overflow: ellipsis;