From 087bbc81c46b8a4f7207884838a531beb8100a60 Mon Sep 17 00:00:00 2001 From: srgooglo Date: Mon, 2 Nov 2020 17:22:31 +0100 Subject: [PATCH] refactor & clean icons --- .vscode/functions_schemas.code-snippets | 2 +- config/handlers/flagToBehavior.js | 46 ++++++------- globals/contextMenu.js | 5 +- globals/settings.js | 12 ++-- globals/sidebar_menu.js | 24 +++---- globals/theme_settings.js | 14 ++-- package.json | 8 --- src/components/About/index.js | 10 +-- src/components/FloatComponent/index.tsx | 4 +- src/components/Invalid/index.js | 4 +- src/components/Layout/ContextMenu/index.tsx | 2 - .../Overlay/components/Card_Component.tsx | 4 +- .../Overlay/components/layout/Primary.tsx | 4 +- .../Overlay/components/layout/Secondary.tsx | 5 +- src/components/Layout/Sider/default/index.js | 2 +- src/components/Layout/WindowNavbar/index.js | 6 +- src/components/ParamsList/index.js | 6 +- src/components/PostCard/index.js | 21 +++--- src/components/index.js | 2 - src/core/index.js | 2 +- src/core/libs/browser/index.ts | 68 +++++++++++++++++++ src/core/libs/errorhandler/index.js | 4 +- src/core/libs/index.js | 5 +- src/core/libs/socket/index.ts | 2 +- .../export_data/index.tsx | 8 +-- src/core/libs/{appInterface => ui}/index.js | 0 .../{appInterface => ui}/modals/modals.js | 0 .../{appInterface => ui}/modals/modals.less | 0 .../libs/{appInterface => ui}/notify/index.js | 10 +-- src/debuggers/redux.js | 6 +- src/models/app.js | 2 +- src/models/extended.js | 8 +-- src/models/socket.ts | 2 +- src/models/user.ts | 2 +- src/pages/index.js | 4 +- src/pages/login/index.js | 4 +- src/pages/logout.js | 7 +- .../settings/components/theme/configurator.js | 2 +- 38 files changed, 186 insertions(+), 131 deletions(-) create mode 100644 src/core/libs/browser/index.ts rename src/core/libs/{appInterface => ui}/export_data/index.tsx (75%) rename src/core/libs/{appInterface => ui}/index.js (100%) rename src/core/libs/{appInterface => ui}/modals/modals.js (100%) rename src/core/libs/{appInterface => ui}/modals/modals.less (100%) rename src/core/libs/{appInterface => ui}/notify/index.js (87%) diff --git a/.vscode/functions_schemas.code-snippets b/.vscode/functions_schemas.code-snippets index 3b956c1e..f4da0d43 100644 --- a/.vscode/functions_schemas.code-snippets +++ b/.vscode/functions_schemas.code-snippets @@ -6,7 +6,7 @@ "body": [ "import verbosity from 'core/libs/verbosity'", "import handle from 'core/libs/errorhandler'", - "import { notify } from 'core/libs/appInterface'", + "import { notify } from 'core/libs/ui'", "import settings from 'core/libs/settings'", "import endpoints from 'config/endpoints'", "import { v3_model } from 'core/libs'", diff --git a/config/handlers/flagToBehavior.js b/config/handlers/flagToBehavior.js index 68cab590..f73321b8 100644 --- a/config/handlers/flagToBehavior.js +++ b/config/handlers/flagToBehavior.js @@ -1,34 +1,34 @@ import { notification, message } from 'antd' -import * as Icons from 'components/Icons' +import { FieldTimeOutlined } from 'components/Icons' import errStrings from 'config/handlers/errToStrings.js' import errNumbers from 'config/handlers/numToError.js' -import errFlags from 'config/handlers/errToFlag.js' +import errFlags from 'config/handlers/errToFlag.js' export default { - SESSION_INVALID: (payload) => { - notification.error({ - message: payload.msg ?? 'Hey', - icon: , - description: errStrings[payload.out] ?? "This session is not valid", - placement: 'bottomLeft', - }) - }, - OVERLAY_BADPOSITION: () => { - - }, - INTERNAL_PROCESS_FAILED: () =>{ + SESSION_INVALID: (payload) => { + notification.error({ + message: payload.msg ?? 'Hey', + icon: , + description: errStrings[payload.out] ?? "This session is not valid", + placement: 'bottomLeft', + }) + }, + OVERLAY_BADPOSITION: () => { - }, - INVALID_DATA: () => { + }, + INTERNAL_PROCESS_FAILED: () => { - }, - INVALID_PROPS: () => { + }, + INVALID_DATA: () => { - }, - MISSING_REQUIRED_PAYLOAD: () => { + }, + INVALID_PROPS: () => { - }, - INVALID_INDEX: () => { + }, + MISSING_REQUIRED_PAYLOAD: () => { - } + }, + INVALID_INDEX: () => { + + } } \ No newline at end of file diff --git a/globals/contextMenu.js b/globals/contextMenu.js index 79077144..73ed04d7 100644 --- a/globals/contextMenu.js +++ b/globals/contextMenu.js @@ -1,10 +1,9 @@ -import * as Icons from 'components/Icons' - +import { Command } from 'components/Icons' export default [ { key: "inspect_element", title: "Inspect", - icon: , + icon: , require: "embedded", params: { onClick: (e) => { diff --git a/globals/settings.js b/globals/settings.js index d8009b0f..447891b5 100755 --- a/globals/settings.js +++ b/globals/settings.js @@ -1,37 +1,37 @@ -import * as Icons from 'components/Icons' +import { Watch, CornerDownRight, Menu, AlignCenter, Terminal } from 'components/Icons' export default [ { id: 'session_noexpire', - icon: , + icon: , type: 'switch', title: 'No expire session', description: 'Force the app to not expire any session... [Developer]', }, { id: 'search_ontype', - icon: , + icon: , type: 'switch', title: 'Detect input on search bar', description: 'Force the app to automaticly search when a type input is detected... [Developer]', }, { id: 'post_hidebar', - icon: , + icon: , type: 'switch', title: 'Auto hide postbar', description: 'Force the app to hide the post actions (likes, comments ...etc) automaticly... [Developer]', }, { id: 'post_autoposition', - icon: , + icon: , type: 'switch', title: 'Auto center on click', description: '', }, { id: 'verbosity', - icon: , + icon: , type: 'switch', title: 'Enable core verbosity', description: 'Show all console logs... [Developer]', diff --git a/globals/sidebar_menu.js b/globals/sidebar_menu.js index 4e54281f..db6d54b0 100644 --- a/globals/sidebar_menu.js +++ b/globals/sidebar_menu.js @@ -1,4 +1,4 @@ -import * as Icons from 'components/Icons' +import { Home, Compass, Bookmark, MessageSquare, Box, Package, Tv, Tool, Settings, LogIn, LogOut } from 'components/Icons' /** * Sidebar Menu scheme @@ -16,7 +16,7 @@ import * as Icons from 'components/Icons' export default [ { id: 'main', - icon: , + icon: "Home", title: 'Main', attributes: { require: 'login', @@ -26,12 +26,12 @@ export default [ { id: 'explore', title: 'Explore', - icon: , + icon: "Compass", }, { id: 'saves', title: 'Saves', - icon: , + icon: "Bookmark", attributes: { require: 'login', mobile: false @@ -40,7 +40,7 @@ export default [ { id: 'messages', title: 'Messages', - icon: , + icon: "MessageSquare", attributes: { require: 'login' } @@ -48,7 +48,7 @@ export default [ { id: 'rooms', title: 'Rooms', - icon: , + icon: "Box", attributes: { require: 'login' } @@ -56,7 +56,7 @@ export default [ { id: 'workshop', title: 'Workshop', - icon: , + icon: "Package", attributes: { require: 'login' } @@ -64,7 +64,7 @@ export default [ { id: 'streams', title: 'Streams', - icon: , + icon: "Tv", attributes: { require: 'login' } @@ -72,7 +72,7 @@ export default [ { id: 'debug', title: 'Debug', - icon: , + icon: "Tool", attributes: { position: "bottom", require: "dev" @@ -81,7 +81,7 @@ export default [ { id: 'settings', title: 'Settings', - icon: , + icon: "Settings", attributes: { position: "bottom" } @@ -89,7 +89,7 @@ export default [ { id: 'logout', title: 'Logout', - icon: , + icon: "LogOut", attributes: { position: "bottom", require: 'login' @@ -98,7 +98,7 @@ export default [ { id: 'login', title: 'Signin', - icon: , + icon: "LogIn", attributes: { position: "bottom", require: "guest" diff --git a/globals/theme_settings.js b/globals/theme_settings.js index 15cec16e..a1af89f4 100644 --- a/globals/theme_settings.js +++ b/globals/theme_settings.js @@ -1,39 +1,39 @@ -import * as Icons from 'components/Icons' +import { Image, Sidebar, Droplet, FontColorsOutlined, Volume2, Moon } from 'components/Icons' export default [ { id: 'backgroundImage', - icon: , + icon: , title: 'Background', description: 'Change the background of the app', }, { id: 'overlay', - icon: , + icon: , title: 'Overlay', description: 'Description blah blah', }, { id: 'color', - icon: , + icon: , title: 'Colors', description: 'Texts, Buttons, Sliders ...etc', }, { id: 'text', - icon: , + icon: , title: 'Text', description: 'Sizes, Fonts', }, { id: 'sounds', - icon: , + icon: , title: 'Sounds', description: 'BlipBlopBLup', }, { id: 'darkmode', - icon: , + icon: , title: 'Dark Mode', description: 'Yeaah, no more daying', } diff --git a/package.json b/package.json index 4674dcd9..aa526586 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "cryptr": "^6.0.2", "dotenv": "^8.2.0", "dutier": "^1.1.4", - "dva-model-enhance": "^1.2.13", "electron-config": "^2.0.0", "electron-is": "^3.0.0", "electron-log": "^4.2.4", @@ -59,7 +58,6 @@ "electron-remote": "^1.3.0", "electron-updater": "^4.3.4", "enquire-js": "^0.2.1", - "fast-json-stringify": "^2.2.9", "feather-reactjs": "^2.0.13", "howler": "^2.2.0", "html2canvas": "^1.0.0-rc.7", @@ -69,7 +67,6 @@ "localforage": "^1.7.4", "lodash": "^4.17.19", "moment": "^2.28.0", - "npm": "^7.0.2", "nprogress": "^0.2.0", "path-to-regexp": "^6.1.0", "platform": "^1.3.6", @@ -94,10 +91,8 @@ "redux-thunk": "^2.3.0", "request": "^2.88.2", "socket.io-client": "^2.3.0", - "socket.io-promise": "^1.1.2", "stack-trace": "0.0.10", "store": "^2.0.12", - "styled-components": "^5.2.0", "timeago.js": "^4.0.2", "ts-jest": "^26.4.1", "wait-on": "^5.2.0" @@ -123,9 +118,6 @@ "electron-reloader": "^1.0.1", "jest": "^26.5.3", "jsdoc": "^3.6.5", - "less": "^3.12.2", - "less-loader": "^7.0.1", - "style-loader": "^1.2.1", "typescript": "^3.9.7", "umi": "^3.2.24" } diff --git a/src/components/About/index.js b/src/components/About/index.js index 3636b290..927de12f 100644 --- a/src/components/About/index.js +++ b/src/components/About/index.js @@ -1,7 +1,7 @@ import React from 'react' import styles from './index.less' import { clientInfo, GUID, package_json } from 'core' -import * as Icons from 'components/Icons' +import { Monitor, Package, Radio, Layers } from 'components/Icons' import * as antd from 'antd' export default class App_About extends React.Component { @@ -16,10 +16,10 @@ export default class App_About extends React.Component {

{clientInfo.siteName}

{GUID}
- {clientInfo.os.toString()} - v{clientInfo.version} - {clientInfo.packageStage} - Render with {clientInfo.layout} + {clientInfo.os.toString()} + v{clientInfo.version} + {clientInfo.packageStage} + Render with {clientInfo.layout} {this.renderStableTag()} diff --git a/src/components/FloatComponent/index.tsx b/src/components/FloatComponent/index.tsx index b8463d28..2788fdc5 100644 --- a/src/components/FloatComponent/index.tsx +++ b/src/components/FloatComponent/index.tsx @@ -1,5 +1,5 @@ import verbosity from 'core/libs/verbosity' -import * as Icons from 'components/Icons' +import { XCircle } from 'components/Icons' import ReactDOM from 'react-dom' import * as antd from 'antd' import React from 'react' @@ -31,7 +31,7 @@ class FloatComponent extends React.Component { >
- +
{this.props.title ?? null} diff --git a/src/components/Invalid/index.js b/src/components/Invalid/index.js index aafb1c62..6537e0c6 100644 --- a/src/components/Invalid/index.js +++ b/src/components/Invalid/index.js @@ -2,7 +2,7 @@ import React from 'react' import * as antd from 'antd' import styles from './index.less' import errNumbers from 'config/handlers/numToError.js' -import { Icons } from 'components' +import { Meh } from 'components/Icons' const InvalidSkeleton = (props) => { return( @@ -70,7 +70,7 @@ export default class Invalid extends React.Component{ } return } + icon={} title="A function called this component due to an error, but apparently it also caused an error when configuring these parameters." message="it seems that someone is not having a good day" /> diff --git a/src/components/Layout/ContextMenu/index.tsx b/src/components/Layout/ContextMenu/index.tsx index f0861f94..05cbe649 100644 --- a/src/components/Layout/ContextMenu/index.tsx +++ b/src/components/Layout/ContextMenu/index.tsx @@ -1,8 +1,6 @@ import verbosity from 'core/libs/verbosity' -import * as Icons from 'components/Icons' import styles from './index.less' import ReactDOM from 'react-dom' -import * as antd from 'antd' import React from 'react' let onRend = false diff --git a/src/components/Layout/Overlay/components/Card_Component.tsx b/src/components/Layout/Overlay/components/Card_Component.tsx index 2d0eb8dc..934e42fd 100644 --- a/src/components/Layout/Overlay/components/Card_Component.tsx +++ b/src/components/Layout/Overlay/components/Card_Component.tsx @@ -1,6 +1,6 @@ import * as React from 'react' import * as antd from 'antd' -import * as Icons from 'components/Icons' +import { LoadingOutlined } from 'components/Icons' import styles from '../index.less' export interface Card_Component_props { @@ -12,7 +12,7 @@ export interface Card_Component_props { const Card_Component = (props: Card_Component_props) => { let frag; const rd_error = - const rd_loading = + const rd_loading = if (props.type == "error") frag = (rd_error) if (props.type == "skeleton") frag = (rd_loading) diff --git a/src/components/Layout/Overlay/components/layout/Primary.tsx b/src/components/Layout/Overlay/components/layout/Primary.tsx index bcadc080..2ad96c01 100644 --- a/src/components/Layout/Overlay/components/layout/Primary.tsx +++ b/src/components/Layout/Overlay/components/layout/Primary.tsx @@ -1,6 +1,6 @@ import * as React from 'react' import * as antd from 'antd' -import * as Icons from 'components/Icons' +import { LeftOutlined } from 'components/Icons' import styles from '../../index.less' import classnames from 'classnames' import { Swapper } from '../../index.js' @@ -17,7 +17,7 @@ export interface overlay_primary_props { const renderExit = (
- } onClick={() => Swapper.closeAll()}> Back + } onClick={() => Swapper.closeAll()}> Back
) diff --git a/src/components/Layout/Overlay/components/layout/Secondary.tsx b/src/components/Layout/Overlay/components/layout/Secondary.tsx index 0b4c6335..55592593 100644 --- a/src/components/Layout/Overlay/components/layout/Secondary.tsx +++ b/src/components/Layout/Overlay/components/layout/Secondary.tsx @@ -1,7 +1,6 @@ import * as React from 'react' -import * as app from 'app' import * as antd from 'antd' -import * as Icons from 'components/Icons' +import { LeftOutlined } from 'components/Icons' import styles from '../../index.less' import classnames from 'classnames' @@ -27,7 +26,7 @@ const renderExit = (props: __sec_props) => { const {functs} = props if (isOpen) { return
- } onClick={() => functs.Swapper.close()}> Back + } onClick={() => functs.Swapper.close()}> Back
} return null diff --git a/src/components/Layout/Sider/default/index.js b/src/components/Layout/Sider/default/index.js index fb6ee985..8ede81cc 100644 --- a/src/components/Layout/Sider/default/index.js +++ b/src/components/Layout/Sider/default/index.js @@ -30,7 +30,7 @@ export default class Sider_Default extends React.Component { return componentPosition == position ? ( - + {e.title} ) diff --git a/src/components/Layout/WindowNavbar/index.js b/src/components/Layout/WindowNavbar/index.js index db36c6c0..c40fa160 100644 --- a/src/components/Layout/WindowNavbar/index.js +++ b/src/components/Layout/WindowNavbar/index.js @@ -1,6 +1,6 @@ import React from 'react' import styles from './index.less' -import * as Icons from 'components/Icons' +import { Minus, X } from 'components/Icons' import { connect } from 'umi'; @connect(({ app }) => ({ app })) @@ -26,8 +26,8 @@ export default class WindowNavbar extends React.Component{ return(
-
this.handleMinimize()} />
-
this.handleClose()}/>
+
this.handleMinimize()} />
+
this.handleClose()}/>
) diff --git a/src/components/ParamsList/index.js b/src/components/ParamsList/index.js index dd33489a..135a9edb 100644 --- a/src/components/ParamsList/index.js +++ b/src/components/ParamsList/index.js @@ -1,6 +1,6 @@ import React from 'react'; import * as antd from 'antd' -import * as Icons from 'components/Icons' +import { RefreshCw } from 'components/Icons' import { __legacy__objectToArray, getCircularReplacer, decycle } from 'core' const serializeFlags = { @@ -41,7 +41,7 @@ const getDecoratorStr = (e, json) => { return `Empty (null/undefined)` } if (isFlagId(e.value, 0)) { - return Cylic + return Cylic } if (typeof (e.value.length) !== "undefined") { return `Lenght (${e.value.length})` @@ -80,7 +80,7 @@ const getContent = (e) => { } if (isFlagId(e.value, 0)) { return
- This cannot be rendered because a cylic has been detected + This cannot be rendered because a cylic has been detected
} if (Object.keys(e.value).length > 0) { // trying create nested diff --git a/src/components/PostCard/index.js b/src/components/PostCard/index.js index cbdef67d..415cacf7 100644 --- a/src/components/PostCard/index.js +++ b/src/components/PostCard/index.js @@ -2,7 +2,7 @@ import React, { useLayoutEffect } from 'react' import * as antd from 'antd' import styles from './index.less' import { MediaPlayer } from 'components' -import * as Icons from 'components/Icons' +import { Clipboard, Aperture, FlagOutlined, MessageSquare, MoreOutlined, PushpinFilled, EllipsisOutlined, verifiedBadge } from 'components/Icons' import * as core from 'core' import Icon from '@ant-design/icons' import classnames from 'classnames' @@ -12,6 +12,7 @@ import settings from 'core/libs/settings' import { router } from 'core/libs' import LikeBtn from './components/like/index.js' import { connect } from 'umi' +import { clipboard } from 'core/libs/browser' const { Meta } = antd.Card @@ -36,17 +37,17 @@ const contextMenuList = [ { key: "inspect_element", title: "Copy URL", - icon: , + icon: , params: { onClick: (e) => { - core.writeToClipboard(core.generatePostURI(e.id)) + clipboard.copyText(core.generatePostURI(e.id)) } } }, { key: "screenshot", title: "Save screenshot", - icon: , + icon: , params: { itemProps: { style: { color: "#40a9ff" } @@ -92,7 +93,7 @@ export default class PostCard extends React.PureComponent { if (this.state.ReportIgnore) return null return (
- +

It seems that this post has been reported

The content may be inappropriate or compromising

{ this.handleLikeClick(id, (response) => { callback(response) }) }} count={post_likes} liked={core.booleanFix(is_liked)} />, 0 ? true : false}> - + , ] @@ -198,16 +199,16 @@ export default class PostCard extends React.PureComponent {

router.goProfile(publisher.username)} className={styles.titleUser}> @{publisher.username} - {core.booleanFix(publisher.verified) ? () : null} + {core.booleanFix(publisher.verified) ? () : null} {core.booleanFix(publisher.nsfw_flag) ? ( NSFW ) : null}

- +
- {core.booleanFix(is_post_pinned) ? () : null} + {core.booleanFix(is_post_pinned) ? () : null}
} @@ -216,7 +217,7 @@ export default class PostCard extends React.PureComponent { /> {this.renderContent(this.state.payload)}
- +
diff --git a/src/components/index.js b/src/components/index.js index d8c0e633..e9d33b9a 100755 --- a/src/components/index.js +++ b/src/components/index.js @@ -1,7 +1,6 @@ // @alias from 'components' // Helpers & Misc -import * as Icons from './Icons' import Loader from './Loader' import About from './About' import * as Feather from 'feather-reactjs' @@ -32,7 +31,6 @@ export { AppLayout, PostCard, Invalid, - Icons, Feather, About, MediaPlayer, diff --git a/src/core/index.js b/src/core/index.js index 9b6c3fe2..b536d858 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -145,7 +145,7 @@ export function generatePostURI(id) { export function writeToClipboard(text) { navigator.clipboard.writeText(text) .then(() => { - libs.appInterface.notify.info('Copy to clipboard') + libs.ui.notify.info('Copy to clipboard') }, () => { /* failure */ }) diff --git a/src/core/libs/browser/index.ts b/src/core/libs/browser/index.ts new file mode 100644 index 00000000..a729841a --- /dev/null +++ b/src/core/libs/browser/index.ts @@ -0,0 +1,68 @@ +const zeroStyles = (element: HTMLElement, ...properties: string[]): void => { + for (const property of properties) { + element.style.setProperty(property, '0') + } +} + +const removeElement = (element: HTMLElement): void => { + element.parentNode!.removeChild(element) +} + +const createTextArea = (): HTMLTextAreaElement => { + const textArea: HTMLTextAreaElement = document.createElement('textarea') + textArea.setAttribute('cols', '0') + textArea.setAttribute('rows', '0') + zeroStyles(textArea, + 'border-width', + 'bottom', + 'margin-left', 'margin-top', + 'outline-width', + 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', + 'right', + ) + textArea.style.setProperty('box-sizing', 'border-box') + textArea.style.setProperty('height', '1px') + textArea.style.setProperty('margin-bottom', '-1px') + textArea.style.setProperty('margin-right', '-1px') + textArea.style.setProperty('max-height', '1px') + textArea.style.setProperty('max-width', '1px') + textArea.style.setProperty('min-height', '1px') + textArea.style.setProperty('min-width', '1px') + textArea.style.setProperty('outline-color', 'transparent') + textArea.style.setProperty('position', 'absolute') + textArea.style.setProperty('width', '1px') + document.body.appendChild(textArea) + return textArea; +} + +export const clipboard = { + copyText: (data:String) => { + if (typeof (data) !== "string") { + return false + } + const textArea: HTMLTextAreaElement = createTextArea() + textArea.value = data + textArea.select() + const success: boolean = document.execCommand('copy') + removeElement(textArea) + if (!success) { + return false + } + }, + readText: (data:String) => { + if (typeof (data) !== "string") { + return false + } + const textArea: HTMLTextAreaElement = createTextArea() + textArea.focus() + const success: boolean = document.execCommand('paste') + + if (!success) { + removeElement(textArea) + return false + } + const value: string = textArea.value + removeElement(textArea) + return value + } +} \ No newline at end of file diff --git a/src/core/libs/errorhandler/index.js b/src/core/libs/errorhandler/index.js index 67d06317..cdc45f77 100644 --- a/src/core/libs/errorhandler/index.js +++ b/src/core/libs/errorhandler/index.js @@ -1,4 +1,4 @@ -import { appInterface } from 'core/libs' +import { ui } from 'core/libs' import verbosity from 'core/libs/verbosity' import errStrings from 'config/handlers/errToStrings.js' import errNumbers from 'config/handlers/numToError.js' @@ -15,7 +15,7 @@ export function notifyErrorHandler(params) { if (!params) { return false } - appInterface.notify.open({ + ui.notify.open({ message: flagToString[params.flag] ?? "Unexpected Error", description:
diff --git a/src/core/libs/index.js b/src/core/libs/index.js index 576bf1b8..c59e7dd0 100644 --- a/src/core/libs/index.js +++ b/src/core/libs/index.js @@ -1,8 +1,9 @@ import verbosity from './verbosity' import * as v3_model from './v3_model' -import * as appInterface from './appInterface' +import * as ui from './ui' export * from './settings' export * from './router' export * from './dynamicsdcp' +export * from './browser' -export { v3_model, appInterface, verbosity } +export { v3_model, ui, verbosity } diff --git a/src/core/libs/socket/index.ts b/src/core/libs/socket/index.ts index 2599b810..85015039 100644 --- a/src/core/libs/socket/index.ts +++ b/src/core/libs/socket/index.ts @@ -1,7 +1,7 @@ import io from 'socket.io-client' import verbosity from 'core/libs/verbosity' import settings from 'core/libs/settings' -import { notify } from 'core/libs/appInterface' +import { notify } from 'core/libs/ui' const stateCodes = { 0: "closed", diff --git a/src/core/libs/appInterface/export_data/index.tsx b/src/core/libs/ui/export_data/index.tsx similarity index 75% rename from src/core/libs/appInterface/export_data/index.tsx rename to src/core/libs/ui/export_data/index.tsx index 0839b56d..72374ed8 100644 --- a/src/core/libs/appInterface/export_data/index.tsx +++ b/src/core/libs/ui/export_data/index.tsx @@ -1,6 +1,6 @@ import * as React from 'react' import * as antd from 'antd' -import * as Icons from 'components/Icons' +import { Code, Download, HardDrive } from 'components/Icons' import { downloadDecodedURI } from 'core' export interface exportData_props { @@ -11,7 +11,7 @@ export interface exportData_props { const exportCodeRender = (data) => { if(data.length > 500){ return
- +

Hey, this file is too much large!

So it couldn't be displayed.

@@ -23,10 +23,10 @@ const exportCodeRender = (data) => { const exportData_render = (props: exportData_props) => { antd.Modal.confirm({ - title:
Your export {`${props.type.split("/")[1]}`}
, + title:
Your export {`${props.type.split("/")[1]}`}
, icon: null, onOk: () => downloadDecodedURI({data: props.data, type: props.type}), - okText: <>Download as File , + okText: <>Download as File , cancelText: "Done", content: exportCodeRender(props.data), }); diff --git a/src/core/libs/appInterface/index.js b/src/core/libs/ui/index.js similarity index 100% rename from src/core/libs/appInterface/index.js rename to src/core/libs/ui/index.js diff --git a/src/core/libs/appInterface/modals/modals.js b/src/core/libs/ui/modals/modals.js similarity index 100% rename from src/core/libs/appInterface/modals/modals.js rename to src/core/libs/ui/modals/modals.js diff --git a/src/core/libs/appInterface/modals/modals.less b/src/core/libs/ui/modals/modals.less similarity index 100% rename from src/core/libs/appInterface/modals/modals.less rename to src/core/libs/ui/modals/modals.less diff --git a/src/core/libs/appInterface/notify/index.js b/src/core/libs/ui/notify/index.js similarity index 87% rename from src/core/libs/appInterface/notify/index.js rename to src/core/libs/ui/notify/index.js index ac690b41..de6dab3e 100644 --- a/src/core/libs/appInterface/notify/index.js +++ b/src/core/libs/ui/notify/index.js @@ -1,11 +1,11 @@ import { notification, message } from 'antd' -import * as Icons from 'components/Icons' +import { Triangle, FieldTimeOutlined, LoadingOutlined } from 'components/Icons' export const notify = { fatal: (...res) => { notification.error({ message: 'Fatal Error', - icon: , + icon: , description: res, placement: 'bottomLeft' }) @@ -13,7 +13,7 @@ export const notify = { expire: (...res) => { notification.error({ message: 'Hey ', - icon: , + icon: , description: res, placement: 'bottomLeft', }) @@ -73,7 +73,7 @@ export const notify = { }, proccess: (...res) => { notification.open({ - icon: , + icon: , message: 'Please wait', description:
{res}
, placement: 'bottomLeft', @@ -83,7 +83,7 @@ export const notify = { notification.open({ placement: props.placement? props.placement : 'bottomLeft', duration: props.duration? props.placement : 15, - icon: props.icon? props.icon : , + icon: props.icon? props.icon : , message: props.message? props.message : '', description: props.description? props.description : '' }) diff --git a/src/debuggers/redux.js b/src/debuggers/redux.js index d37706ca..7882f9c7 100644 --- a/src/debuggers/redux.js +++ b/src/debuggers/redux.js @@ -1,7 +1,7 @@ import React from 'react'; import { connect } from 'umi'; import * as antd from 'antd' -import * as Icons from 'components/Icons' +import { Database, Redux, AlertTriangle } from 'components/Icons' import { ParamsList } from 'components' import { __legacy__objectToArray } from 'core' import store from 'store' @@ -82,7 +82,7 @@ class ReduxDebugger extends React.Component { style={{ wordBreak: 'break-all' }} header={
- + {e.key}
}> @@ -94,7 +94,7 @@ class ReduxDebugger extends React.Component { return (
-

Redux Store Dangerously experimental debugger

+

Redux Store Dangerously experimental debugger

{this.renderCheckboxes()}

diff --git a/src/models/app.js b/src/models/app.js index d2e26313..41fe060d 100755 --- a/src/models/app.js +++ b/src/models/app.js @@ -2,7 +2,7 @@ import store from 'store' import { app_config } from 'config' import keys from 'config/app_keys' import { user, session } from 'core/models' -import { router, verbosity, appInterface } from 'core/libs' +import { router, verbosity, ui } from 'core/libs' import settings from 'core/libs/settings' import { queryIndexer } from 'core' import Cryptr from 'cryptr' diff --git a/src/models/extended.js b/src/models/extended.js index 88642806..11625695 100644 --- a/src/models/extended.js +++ b/src/models/extended.js @@ -1,4 +1,4 @@ -import { router, verbosity, appInterface } from 'core/libs' +import { router, verbosity, ui } from 'core/libs' import { DynamicSDCP } from 'core/libs/dynamicsdcp' import settings from 'core/libs/settings' import * as core from 'core' @@ -31,14 +31,14 @@ export default { usePlugins([payload.array], (err, results) => { if (err) { verbosity(["Init error!", err]) - appInterface.notify.error("Plugin initialize error!", err) + ui.notify.error("Plugin initialize error!", err) return false } const rootInit = results[0] if (!rootInit.uuid) { verbosity("Cannot initialize a plugin without UUID.", "Please read SDK documentation for more info.") - appInterface.notify.error("Cannot initialize a plugin without UUID.") + ui.notify.error("Cannot initialize a plugin without UUID.") return false } @@ -85,7 +85,7 @@ export default { window.PluginGlobals[plugin.uuid] = new extendedPlugin({ extended, extendedRequire }) - appInterface.notify.open({ + ui.notify.open({ message: `${plugin.title} v${plugin.version}`, description: `New plugin is now installed !` }) diff --git a/src/models/socket.ts b/src/models/socket.ts index cde62520..cb3600d2 100644 --- a/src/models/socket.ts +++ b/src/models/socket.ts @@ -2,7 +2,7 @@ import store from 'store' import { app_config } from 'config' import keys from 'config/app_keys' import { user, session } from 'core/models' -import { router, verbosity, appInterface } from 'core/libs' +import { router, verbosity, ui } from 'core/libs' import settings from 'core/libs/settings' import { __legacy__objectToArray } from 'core' import { Howl, Howler } from 'howler' diff --git a/src/models/user.ts b/src/models/user.ts index 06c21808..5ff3709d 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -3,7 +3,7 @@ import store from 'store' import { app_config } from 'config' import keys from 'config/app_keys' import { user, session } from 'core/models' -import { router, verbosity, appInterface } from 'core/libs' +import { router, verbosity, ui } from 'core/libs' import settings from 'core/libs/settings' import { DynamicSDCP } from 'core/libs/dynamicsdcp' import * as core from 'core' diff --git a/src/pages/index.js b/src/pages/index.js index dff12680..e99c961c 100755 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -3,7 +3,7 @@ import ReduxDebugger from 'debuggers/redux' import * as antd from 'antd' import { FloatComponent } from 'components' import { connect } from 'umi' -import * as Icons from 'components/Icons' +import { ClusterOutlined } from 'components/Icons' import { __legacy__objectToArray } from 'core' @connect((store) => (store)) @@ -57,7 +57,7 @@ export default class Index extends React.Component { -

Socket

+

Socket

Header Node

diff --git a/src/pages/login/index.js b/src/pages/login/index.js index aafeb075..bf4057a6 100755 --- a/src/pages/login/index.js +++ b/src/pages/login/index.js @@ -1,6 +1,6 @@ import React from 'react' import { iatToString } from 'core' -import { router, appInterface } from 'core/libs' +import { router, ui } from 'core/libs' import styles from './index.less' import classnames from 'classnames' @@ -63,7 +63,7 @@ class Login extends React.Component { componentDidMount() { if (this.props.app.session_valid) { - appInterface.notify.info('You have already logged into an account, you can change your account by logging in again') + ui.notify.info('You have already logged into an account, you can change your account by logging in again') } } diff --git a/src/pages/logout.js b/src/pages/logout.js index fe47a3e8..8e29686f 100644 --- a/src/pages/logout.js +++ b/src/pages/logout.js @@ -2,8 +2,7 @@ import React from 'react' import * as antd from 'antd' import { connect } from 'umi' import { router } from 'core/libs'; -import * as Icons from 'components/Icons' - +import { Home, Trash } from 'components/Icons' @connect(({ app }) => ({ app })) export default class Logout extends React.Component{ @@ -23,8 +22,8 @@ export default class Logout extends React.Component{ onCancel() { dispatchLogout() }, - okText: <>Resume, - cancelText: <>Logout + okText: <>Resume, + cancelText: <>Logout }); } diff --git a/src/pages/settings/components/theme/configurator.js b/src/pages/settings/components/theme/configurator.js index d26102aa..dae2533d 100644 --- a/src/pages/settings/components/theme/configurator.js +++ b/src/pages/settings/components/theme/configurator.js @@ -1,7 +1,7 @@ import React from 'react' import ErrorHandler from 'core/libs/errorhandler' import { theme } from 'core/libs/style' -import exportDataAsFile from 'core/libs/appInterface/export_data' +import exportDataAsFile from 'core/libs/ui/export_data' import verbosity from 'core/libs/verbosity' export default class ThemeConfigurator extends React.Component {