refactor & clean icons

This commit is contained in:
srgooglo 2020-11-02 17:22:31 +01:00
parent 8e7012a3f6
commit 087bbc81c4
38 changed files with 186 additions and 131 deletions

View File

@ -6,7 +6,7 @@
"body": [ "body": [
"import verbosity from 'core/libs/verbosity'", "import verbosity from 'core/libs/verbosity'",
"import handle from 'core/libs/errorhandler'", "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 settings from 'core/libs/settings'",
"import endpoints from 'config/endpoints'", "import endpoints from 'config/endpoints'",
"import { v3_model } from 'core/libs'", "import { v3_model } from 'core/libs'",

View File

@ -1,34 +1,34 @@
import { notification, message } from 'antd' import { notification, message } from 'antd'
import * as Icons from 'components/Icons' import { FieldTimeOutlined } from 'components/Icons'
import errStrings from 'config/handlers/errToStrings.js' import errStrings from 'config/handlers/errToStrings.js'
import errNumbers from 'config/handlers/numToError.js' import errNumbers from 'config/handlers/numToError.js'
import errFlags from 'config/handlers/errToFlag.js' import errFlags from 'config/handlers/errToFlag.js'
export default { export default {
SESSION_INVALID: (payload) => { SESSION_INVALID: (payload) => {
notification.error({ notification.error({
message: payload.msg ?? 'Hey', message: payload.msg ?? 'Hey',
icon: <Icons.FieldTimeOutlined />, icon: <FieldTimeOutlined />,
description: errStrings[payload.out] ?? "This session is not valid", description: errStrings[payload.out] ?? "This session is not valid",
placement: 'bottomLeft', placement: 'bottomLeft',
}) })
}, },
OVERLAY_BADPOSITION: () => { OVERLAY_BADPOSITION: () => {
}, },
INTERNAL_PROCESS_FAILED: () =>{ INTERNAL_PROCESS_FAILED: () => {
}, },
INVALID_DATA: () => { INVALID_DATA: () => {
}, },
INVALID_PROPS: () => { INVALID_PROPS: () => {
}, },
MISSING_REQUIRED_PAYLOAD: () => { MISSING_REQUIRED_PAYLOAD: () => {
}, },
INVALID_INDEX: () => { INVALID_INDEX: () => {
} }
} }

View File

@ -1,10 +1,9 @@
import * as Icons from 'components/Icons' import { Command } from 'components/Icons'
export default [ export default [
{ {
key: "inspect_element", key: "inspect_element",
title: "Inspect", title: "Inspect",
icon: <Icons.Command />, icon: <Command />,
require: "embedded", require: "embedded",
params: { params: {
onClick: (e) => { onClick: (e) => {

View File

@ -1,37 +1,37 @@
import * as Icons from 'components/Icons' import { Watch, CornerDownRight, Menu, AlignCenter, Terminal } from 'components/Icons'
export default [ export default [
{ {
id: 'session_noexpire', id: 'session_noexpire',
icon: <Icons.Watch />, icon: <Watch />,
type: 'switch', type: 'switch',
title: 'No expire session', title: 'No expire session',
description: 'Force the app to not expire any session... [Developer]', description: 'Force the app to not expire any session... [Developer]',
}, },
{ {
id: 'search_ontype', id: 'search_ontype',
icon: <Icons.CornerDownRight />, icon: <CornerDownRight />,
type: 'switch', type: 'switch',
title: 'Detect input on search bar', title: 'Detect input on search bar',
description: 'Force the app to automaticly search when a type input is detected... [Developer]', description: 'Force the app to automaticly search when a type input is detected... [Developer]',
}, },
{ {
id: 'post_hidebar', id: 'post_hidebar',
icon: <Icons.Menu />, icon: <Menu />,
type: 'switch', type: 'switch',
title: 'Auto hide postbar', title: 'Auto hide postbar',
description: 'Force the app to hide the post actions (likes, comments ...etc) automaticly... [Developer]', description: 'Force the app to hide the post actions (likes, comments ...etc) automaticly... [Developer]',
}, },
{ {
id: 'post_autoposition', id: 'post_autoposition',
icon: <Icons.AlignCenter />, icon: <AlignCenter />,
type: 'switch', type: 'switch',
title: 'Auto center on click', title: 'Auto center on click',
description: '', description: '',
}, },
{ {
id: 'verbosity', id: 'verbosity',
icon: <Icons.Terminal />, icon: <Terminal />,
type: 'switch', type: 'switch',
title: 'Enable core verbosity', title: 'Enable core verbosity',
description: 'Show all console logs... [Developer]', description: 'Show all console logs... [Developer]',

View File

@ -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 * Sidebar Menu scheme
@ -16,7 +16,7 @@ import * as Icons from 'components/Icons'
export default [ export default [
{ {
id: 'main', id: 'main',
icon: <Icons.Home />, icon: "Home",
title: 'Main', title: 'Main',
attributes: { attributes: {
require: 'login', require: 'login',
@ -26,12 +26,12 @@ export default [
{ {
id: 'explore', id: 'explore',
title: 'Explore', title: 'Explore',
icon: <Icons.Compass />, icon: "Compass",
}, },
{ {
id: 'saves', id: 'saves',
title: 'Saves', title: 'Saves',
icon: <Icons.Bookmark />, icon: "Bookmark",
attributes: { attributes: {
require: 'login', require: 'login',
mobile: false mobile: false
@ -40,7 +40,7 @@ export default [
{ {
id: 'messages', id: 'messages',
title: 'Messages', title: 'Messages',
icon: <Icons.MessageSquare />, icon: "MessageSquare",
attributes: { attributes: {
require: 'login' require: 'login'
} }
@ -48,7 +48,7 @@ export default [
{ {
id: 'rooms', id: 'rooms',
title: 'Rooms', title: 'Rooms',
icon: <Icons.Box />, icon: "Box",
attributes: { attributes: {
require: 'login' require: 'login'
} }
@ -56,7 +56,7 @@ export default [
{ {
id: 'workshop', id: 'workshop',
title: 'Workshop', title: 'Workshop',
icon: <Icons.Package />, icon: "Package",
attributes: { attributes: {
require: 'login' require: 'login'
} }
@ -64,7 +64,7 @@ export default [
{ {
id: 'streams', id: 'streams',
title: 'Streams', title: 'Streams',
icon: <Icons.Tv />, icon: "Tv",
attributes: { attributes: {
require: 'login' require: 'login'
} }
@ -72,7 +72,7 @@ export default [
{ {
id: 'debug', id: 'debug',
title: 'Debug', title: 'Debug',
icon: <Icons.Tool />, icon: "Tool",
attributes: { attributes: {
position: "bottom", position: "bottom",
require: "dev" require: "dev"
@ -81,7 +81,7 @@ export default [
{ {
id: 'settings', id: 'settings',
title: 'Settings', title: 'Settings',
icon: <Icons.Settings />, icon: "Settings",
attributes: { attributes: {
position: "bottom" position: "bottom"
} }
@ -89,7 +89,7 @@ export default [
{ {
id: 'logout', id: 'logout',
title: 'Logout', title: 'Logout',
icon: <Icons.LogOut style={{ color: '#ef233c', marginRight: '10px' }} />, icon: "LogOut",
attributes: { attributes: {
position: "bottom", position: "bottom",
require: 'login' require: 'login'
@ -98,7 +98,7 @@ export default [
{ {
id: 'login', id: 'login',
title: 'Signin', title: 'Signin',
icon: <Icons.LogIn style={{ color: '#3a86ff', marginRight: '10px' }} />, icon: "LogIn",
attributes: { attributes: {
position: "bottom", position: "bottom",
require: "guest" require: "guest"

View File

@ -1,39 +1,39 @@
import * as Icons from 'components/Icons' import { Image, Sidebar, Droplet, FontColorsOutlined, Volume2, Moon } from 'components/Icons'
export default [ export default [
{ {
id: 'backgroundImage', id: 'backgroundImage',
icon: <Icons.Image />, icon: <Image />,
title: 'Background', title: 'Background',
description: 'Change the background of the app', description: 'Change the background of the app',
}, },
{ {
id: 'overlay', id: 'overlay',
icon: <Icons.Sidebar />, icon: <Sidebar />,
title: 'Overlay', title: 'Overlay',
description: 'Description blah blah', description: 'Description blah blah',
}, },
{ {
id: 'color', id: 'color',
icon: <Icons.Droplet />, icon: <Droplet />,
title: 'Colors', title: 'Colors',
description: 'Texts, Buttons, Sliders ...etc', description: 'Texts, Buttons, Sliders ...etc',
}, },
{ {
id: 'text', id: 'text',
icon: <Icons.FontColorsOutlined style={{ marginRight: '10px' }} />, icon: <FontColorsOutlined style={{ marginRight: '10px' }} />,
title: 'Text', title: 'Text',
description: 'Sizes, Fonts', description: 'Sizes, Fonts',
}, },
{ {
id: 'sounds', id: 'sounds',
icon: <Icons.Volume2 />, icon: <Volume2 />,
title: 'Sounds', title: 'Sounds',
description: 'BlipBlopBLup', description: 'BlipBlopBLup',
}, },
{ {
id: 'darkmode', id: 'darkmode',
icon: <Icons.Moon />, icon: <Moon />,
title: 'Dark Mode', title: 'Dark Mode',
description: 'Yeaah, no more daying', description: 'Yeaah, no more daying',
} }

View File

@ -51,7 +51,6 @@
"cryptr": "^6.0.2", "cryptr": "^6.0.2",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"dutier": "^1.1.4", "dutier": "^1.1.4",
"dva-model-enhance": "^1.2.13",
"electron-config": "^2.0.0", "electron-config": "^2.0.0",
"electron-is": "^3.0.0", "electron-is": "^3.0.0",
"electron-log": "^4.2.4", "electron-log": "^4.2.4",
@ -59,7 +58,6 @@
"electron-remote": "^1.3.0", "electron-remote": "^1.3.0",
"electron-updater": "^4.3.4", "electron-updater": "^4.3.4",
"enquire-js": "^0.2.1", "enquire-js": "^0.2.1",
"fast-json-stringify": "^2.2.9",
"feather-reactjs": "^2.0.13", "feather-reactjs": "^2.0.13",
"howler": "^2.2.0", "howler": "^2.2.0",
"html2canvas": "^1.0.0-rc.7", "html2canvas": "^1.0.0-rc.7",
@ -69,7 +67,6 @@
"localforage": "^1.7.4", "localforage": "^1.7.4",
"lodash": "^4.17.19", "lodash": "^4.17.19",
"moment": "^2.28.0", "moment": "^2.28.0",
"npm": "^7.0.2",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"path-to-regexp": "^6.1.0", "path-to-regexp": "^6.1.0",
"platform": "^1.3.6", "platform": "^1.3.6",
@ -94,10 +91,8 @@
"redux-thunk": "^2.3.0", "redux-thunk": "^2.3.0",
"request": "^2.88.2", "request": "^2.88.2",
"socket.io-client": "^2.3.0", "socket.io-client": "^2.3.0",
"socket.io-promise": "^1.1.2",
"stack-trace": "0.0.10", "stack-trace": "0.0.10",
"store": "^2.0.12", "store": "^2.0.12",
"styled-components": "^5.2.0",
"timeago.js": "^4.0.2", "timeago.js": "^4.0.2",
"ts-jest": "^26.4.1", "ts-jest": "^26.4.1",
"wait-on": "^5.2.0" "wait-on": "^5.2.0"
@ -123,9 +118,6 @@
"electron-reloader": "^1.0.1", "electron-reloader": "^1.0.1",
"jest": "^26.5.3", "jest": "^26.5.3",
"jsdoc": "^3.6.5", "jsdoc": "^3.6.5",
"less": "^3.12.2",
"less-loader": "^7.0.1",
"style-loader": "^1.2.1",
"typescript": "^3.9.7", "typescript": "^3.9.7",
"umi": "^3.2.24" "umi": "^3.2.24"
} }

View File

@ -1,7 +1,7 @@
import React from 'react' import React from 'react'
import styles from './index.less' import styles from './index.less'
import { clientInfo, GUID, package_json } from 'core' 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' import * as antd from 'antd'
export default class App_About extends React.Component { export default class App_About extends React.Component {
@ -16,10 +16,10 @@ export default class App_About extends React.Component {
<h1 className={styles.appName}> {clientInfo.siteName} </h1> <h1 className={styles.appName}> {clientInfo.siteName} </h1>
{GUID} {GUID}
<br /> <br />
<antd.Tag color="green"><Icons.Monitor />{clientInfo.os.toString()}</antd.Tag> <antd.Tag color="green"><Monitor />{clientInfo.os.toString()}</antd.Tag>
<antd.Tag color="geekblue"><Icons.Package />v{clientInfo.version}</antd.Tag> <antd.Tag color="geekblue"><Package />v{clientInfo.version}</antd.Tag>
<antd.Tag color="red"><Icons.Radio />{clientInfo.packageStage}</antd.Tag> <antd.Tag color="red"><Radio />{clientInfo.packageStage}</antd.Tag>
<antd.Tag color="magenta"><Icons.Layers />Render with {clientInfo.layout}</antd.Tag> <antd.Tag color="magenta"><Layers />Render with {clientInfo.layout}</antd.Tag>
{this.renderStableTag()} {this.renderStableTag()}
</antd.Card> </antd.Card>

View File

@ -1,5 +1,5 @@
import verbosity from 'core/libs/verbosity' import verbosity from 'core/libs/verbosity'
import * as Icons from 'components/Icons' import { XCircle } from 'components/Icons'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import * as antd from 'antd' import * as antd from 'antd'
import React from 'react' import React from 'react'
@ -31,7 +31,7 @@ class FloatComponent extends React.Component {
> >
<div style={{ top: 0, position: "sticky", borderRadius: "8px 8px 0 0", background: "rgba(0, 0, 0, 0.4)", width: "100%", height: "35px", display: "flex", alignItems: "center", color: "#fff" }}> <div style={{ top: 0, position: "sticky", borderRadius: "8px 8px 0 0", background: "rgba(0, 0, 0, 0.4)", width: "100%", height: "35px", display: "flex", alignItems: "center", color: "#fff" }}>
<div style={{ fontSize: "15px", color: "#fff", display: "flex", height: "100%", padding: "0 10px", alignItems: "center", marginRight: "5px" }}> <div style={{ fontSize: "15px", color: "#fff", display: "flex", height: "100%", padding: "0 10px", alignItems: "center", marginRight: "5px" }}>
<Icons.XCircle onClick={this.handleClose} style={{ cursor: "pointer" }} /> <XCircle onClick={this.handleClose} style={{ cursor: "pointer" }} />
</div> </div>
<div style={{ fontSize: "12px" }}> <div style={{ fontSize: "12px" }}>
{this.props.title ?? null} {this.props.title ?? null}

View File

@ -2,7 +2,7 @@ import React from 'react'
import * as antd from 'antd' import * as antd from 'antd'
import styles from './index.less' import styles from './index.less'
import errNumbers from 'config/handlers/numToError.js' import errNumbers from 'config/handlers/numToError.js'
import { Icons } from 'components' import { Meh } from 'components/Icons'
const InvalidSkeleton = (props) => { const InvalidSkeleton = (props) => {
return( return(
@ -70,7 +70,7 @@ export default class Invalid extends React.Component{
} }
return <Custom return <Custom
icon={<Icons.Meh style={{ fontSize: "100px" }} />} icon={<Meh style={{ fontSize: "100px" }} />}
title="A function called this component due to an error, but apparently it also caused an error when configuring these parameters." 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" message="it seems that someone is not having a good day"
/> />

View File

@ -1,8 +1,6 @@
import verbosity from 'core/libs/verbosity' import verbosity from 'core/libs/verbosity'
import * as Icons from 'components/Icons'
import styles from './index.less' import styles from './index.less'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import * as antd from 'antd'
import React from 'react' import React from 'react'
let onRend = false let onRend = false

View File

@ -1,6 +1,6 @@
import * as React from 'react' import * as React from 'react'
import * as antd from 'antd' import * as antd from 'antd'
import * as Icons from 'components/Icons' import { LoadingOutlined } from 'components/Icons'
import styles from '../index.less' import styles from '../index.less'
export interface Card_Component_props { export interface Card_Component_props {
@ -12,7 +12,7 @@ export interface Card_Component_props {
const Card_Component = (props: Card_Component_props) => { const Card_Component = (props: Card_Component_props) => {
let frag; let frag;
const rd_error = <antd.Result status="error" title="Failed Gathering, reload the page" /> const rd_error = <antd.Result status="error" title="Failed Gathering, reload the page" />
const rd_loading = <Icons.LoadingOutlined spin /> const rd_loading = <LoadingOutlined spin />
if (props.type == "error") frag = (rd_error) if (props.type == "error") frag = (rd_error)
if (props.type == "skeleton") frag = (rd_loading) if (props.type == "skeleton") frag = (rd_loading)

View File

@ -1,6 +1,6 @@
import * as React from 'react' import * as React from 'react'
import * as antd from 'antd' import * as antd from 'antd'
import * as Icons from 'components/Icons' import { LeftOutlined } from 'components/Icons'
import styles from '../../index.less' import styles from '../../index.less'
import classnames from 'classnames' import classnames from 'classnames'
import { Swapper } from '../../index.js' import { Swapper } from '../../index.js'
@ -17,7 +17,7 @@ export interface overlay_primary_props {
const renderExit = ( const renderExit = (
<div className={styles.exit_button}> <div className={styles.exit_button}>
<antd.Button type="ghost" icon={<Icons.LeftOutlined />} onClick={() => Swapper.closeAll()}> Back </antd.Button> <antd.Button type="ghost" icon={<LeftOutlined />} onClick={() => Swapper.closeAll()}> Back </antd.Button>
</div> </div>
) )

View File

@ -1,7 +1,6 @@
import * as React from 'react' import * as React from 'react'
import * as app from 'app'
import * as antd from 'antd' import * as antd from 'antd'
import * as Icons from 'components/Icons' import { LeftOutlined } from 'components/Icons'
import styles from '../../index.less' import styles from '../../index.less'
import classnames from 'classnames' import classnames from 'classnames'
@ -27,7 +26,7 @@ const renderExit = (props: __sec_props) => {
const {functs} = props const {functs} = props
if (isOpen) { if (isOpen) {
return <div className={styles.exit_button}> return <div className={styles.exit_button}>
<antd.Button type="ghost" icon={<Icons.LeftOutlined />} onClick={() => functs.Swapper.close()}> Back </antd.Button> <antd.Button type="ghost" icon={<LeftOutlined />} onClick={() => functs.Swapper.close()}> Back </antd.Button>
</div> </div>
} }
return null return null

View File

@ -30,7 +30,7 @@ export default class Sider_Default extends React.Component {
return componentPosition == position return componentPosition == position
? ( ? (
<antd.Menu.Item icon={e.icon} key={e.id}> <antd.Menu.Item icon={React.createElement(Icons[e.icon])} key={e.id}>
<span>{e.title}</span> <span>{e.title}</span>
</antd.Menu.Item> </antd.Menu.Item>
) )

View File

@ -1,6 +1,6 @@
import React from 'react' import React from 'react'
import styles from './index.less' import styles from './index.less'
import * as Icons from 'components/Icons' import { Minus, X } from 'components/Icons'
import { connect } from 'umi'; import { connect } from 'umi';
@connect(({ app }) => ({ app })) @connect(({ app }) => ({ app }))
@ -26,8 +26,8 @@ export default class WindowNavbar extends React.Component{
return( return(
<div className={styles.navbar} > <div className={styles.navbar} >
<div className={styles.controls}> <div className={styles.controls}>
<div><Icons.Minus onClick={() => this.handleMinimize()} /></div> <div><Minus onClick={() => this.handleMinimize()} /></div>
<div><Icons.X onClick={() => this.handleClose()}/></div> <div><X onClick={() => this.handleClose()}/></div>
</div> </div>
</div> </div>
) )

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import * as antd from 'antd' import * as antd from 'antd'
import * as Icons from 'components/Icons' import { RefreshCw } from 'components/Icons'
import { __legacy__objectToArray, getCircularReplacer, decycle } from 'core' import { __legacy__objectToArray, getCircularReplacer, decycle } from 'core'
const serializeFlags = { const serializeFlags = {
@ -41,7 +41,7 @@ const getDecoratorStr = (e, json) => {
return `Empty (null/undefined)` return `Empty (null/undefined)`
} }
if (isFlagId(e.value, 0)) { if (isFlagId(e.value, 0)) {
return <span><Icons.RefreshCw /> Cylic </span> return <span><RefreshCw /> Cylic </span>
} }
if (typeof (e.value.length) !== "undefined") { if (typeof (e.value.length) !== "undefined") {
return `Lenght (${e.value.length})` return `Lenght (${e.value.length})`
@ -80,7 +80,7 @@ const getContent = (e) => {
} }
if (isFlagId(e.value, 0)) { if (isFlagId(e.value, 0)) {
return <div key={e.key} style={{ display: "flex", alignItems: "center", padding: "12px 16px", height: "47px", backgroundColor: "#d9d9d9" }} > return <div key={e.key} style={{ display: "flex", alignItems: "center", padding: "12px 16px", height: "47px", backgroundColor: "#d9d9d9" }} >
<Icons.RefreshCw /> This cannot be rendered because a cylic has been detected <RefreshCw /> This cannot be rendered because a cylic has been detected
</div> </div>
} }
if (Object.keys(e.value).length > 0) { // trying create nested if (Object.keys(e.value).length > 0) { // trying create nested

View File

@ -2,7 +2,7 @@ import React, { useLayoutEffect } from 'react'
import * as antd from 'antd' import * as antd from 'antd'
import styles from './index.less' import styles from './index.less'
import { MediaPlayer } from 'components' 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 * as core from 'core'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import classnames from 'classnames' import classnames from 'classnames'
@ -12,6 +12,7 @@ import settings from 'core/libs/settings'
import { router } from 'core/libs' import { router } from 'core/libs'
import LikeBtn from './components/like/index.js' import LikeBtn from './components/like/index.js'
import { connect } from 'umi' import { connect } from 'umi'
import { clipboard } from 'core/libs/browser'
const { Meta } = antd.Card const { Meta } = antd.Card
@ -36,17 +37,17 @@ const contextMenuList = [
{ {
key: "inspect_element", key: "inspect_element",
title: "Copy URL", title: "Copy URL",
icon: <Icons.Clipboard />, icon: <Clipboard />,
params: { params: {
onClick: (e) => { onClick: (e) => {
core.writeToClipboard(core.generatePostURI(e.id)) clipboard.copyText(core.generatePostURI(e.id))
} }
} }
}, },
{ {
key: "screenshot", key: "screenshot",
title: "Save screenshot", title: "Save screenshot",
icon: <Icons.Aperture />, icon: <Aperture />,
params: { params: {
itemProps: { itemProps: {
style: { color: "#40a9ff" } style: { color: "#40a9ff" }
@ -92,7 +93,7 @@ export default class PostCard extends React.PureComponent {
if (this.state.ReportIgnore) return null if (this.state.ReportIgnore) return null
return ( return (
<div className={styles.post_card_flaggedWarning}> <div className={styles.post_card_flaggedWarning}>
<Icons.FlagOutlined /> <FlagOutlined />
<h3>It seems that this post has been reported</h3> <h3>It seems that this post has been reported</h3>
<p>The content may be inappropriate or compromising</p> <p>The content may be inappropriate or compromising</p>
<antd.Button <antd.Button
@ -174,7 +175,7 @@ export default class PostCard extends React.PureComponent {
const actions = [ const actions = [
<LikeBtn handleClick={(callback) => { this.handleLikeClick(id, (response) => { callback(response) }) }} count={post_likes} liked={core.booleanFix(is_liked)} />, <LikeBtn handleClick={(callback) => { this.handleLikeClick(id, (response) => { callback(response) }) }} count={post_likes} liked={core.booleanFix(is_liked)} />,
<antd.Badge dot={this.state.payload.post_comments > 0 ? true : false}> <antd.Badge dot={this.state.payload.post_comments > 0 ? true : false}>
<Icons.MessageSquare key="comments" /> <MessageSquare key="comments" />
</antd.Badge>, </antd.Badge>,
] ]
@ -198,16 +199,16 @@ export default class PostCard extends React.PureComponent {
<div className={styles.post_card_title}> <div className={styles.post_card_title}>
<h4 onClick={() => router.goProfile(publisher.username)} className={styles.titleUser}> <h4 onClick={() => router.goProfile(publisher.username)} className={styles.titleUser}>
@{publisher.username} @{publisher.username}
{core.booleanFix(publisher.verified) ? (<Icon style={{ color: 'blue' }} component={Icons.verifiedBadge} />) : null} {core.booleanFix(publisher.verified) ? (<Icon style={{ color: 'blue' }} component={verifiedBadge} />) : null}
{core.booleanFix(publisher.nsfw_flag) ? (<antd.Tag style={{ margin: '0 0 0 13px' }} color="volcano" > NSFW </antd.Tag>) : null} {core.booleanFix(publisher.nsfw_flag) ? (<antd.Tag style={{ margin: '0 0 0 13px' }} color="volcano" > NSFW </antd.Tag>) : null}
</h4> </h4>
<div className={styles.PostTags}> <div className={styles.PostTags}>
<div className={styles.MoreMenu}> <div className={styles.MoreMenu}>
<antd.Dropdown onVisibleChange={this.handleVisibleChange} visible={this.state.visibleMoreMenu} trigger={['click']}> <antd.Dropdown onVisibleChange={this.handleVisibleChange} visible={this.state.visibleMoreMenu} trigger={['click']}>
<Icons.MoreOutlined key="actionMenu" /> <MoreOutlined key="actionMenu" />
</antd.Dropdown> </antd.Dropdown>
</div> </div>
{core.booleanFix(is_post_pinned) ? (<Icons.PushpinFilled />) : null} {core.booleanFix(is_post_pinned) ? (<PushpinFilled />) : null}
</div> </div>
</div> </div>
} }
@ -216,7 +217,7 @@ export default class PostCard extends React.PureComponent {
/> />
{this.renderContent(this.state.payload)} {this.renderContent(this.state.payload)}
<div className={styles.ellipsisIcon}> <div className={styles.ellipsisIcon}>
<Icons.EllipsisOutlined /> <EllipsisOutlined />
</div> </div>
</div> </div>
</antd.Card> </antd.Card>

View File

@ -1,7 +1,6 @@
// @alias from 'components' // @alias from 'components'
// Helpers & Misc // Helpers & Misc
import * as Icons from './Icons'
import Loader from './Loader' import Loader from './Loader'
import About from './About' import About from './About'
import * as Feather from 'feather-reactjs' import * as Feather from 'feather-reactjs'
@ -32,7 +31,6 @@ export {
AppLayout, AppLayout,
PostCard, PostCard,
Invalid, Invalid,
Icons,
Feather, Feather,
About, About,
MediaPlayer, MediaPlayer,

View File

@ -145,7 +145,7 @@ export function generatePostURI(id) {
export function writeToClipboard(text) { export function writeToClipboard(text) {
navigator.clipboard.writeText(text) navigator.clipboard.writeText(text)
.then(() => { .then(() => {
libs.appInterface.notify.info('Copy to clipboard') libs.ui.notify.info('Copy to clipboard')
}, () => { }, () => {
/* failure */ /* failure */
}) })

View File

@ -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
}
}

View File

@ -1,4 +1,4 @@
import { appInterface } from 'core/libs' import { ui } from 'core/libs'
import verbosity from 'core/libs/verbosity' import verbosity from 'core/libs/verbosity'
import errStrings from 'config/handlers/errToStrings.js' import errStrings from 'config/handlers/errToStrings.js'
import errNumbers from 'config/handlers/numToError.js' import errNumbers from 'config/handlers/numToError.js'
@ -15,7 +15,7 @@ export function notifyErrorHandler(params) {
if (!params) { if (!params) {
return false return false
} }
appInterface.notify.open({ ui.notify.open({
message: flagToString[params.flag] ?? "Unexpected Error", message: flagToString[params.flag] ?? "Unexpected Error",
description: description:
<div style={{ display: 'flex', flexDirection: 'column', margin: 'auto', height: "auto" }}> <div style={{ display: 'flex', flexDirection: 'column', margin: 'auto', height: "auto" }}>

View File

@ -1,8 +1,9 @@
import verbosity from './verbosity' import verbosity from './verbosity'
import * as v3_model from './v3_model' import * as v3_model from './v3_model'
import * as appInterface from './appInterface' import * as ui from './ui'
export * from './settings' export * from './settings'
export * from './router' export * from './router'
export * from './dynamicsdcp' export * from './dynamicsdcp'
export * from './browser'
export { v3_model, appInterface, verbosity } export { v3_model, ui, verbosity }

View File

@ -1,7 +1,7 @@
import io from 'socket.io-client' import io from 'socket.io-client'
import verbosity from 'core/libs/verbosity' import verbosity from 'core/libs/verbosity'
import settings from 'core/libs/settings' import settings from 'core/libs/settings'
import { notify } from 'core/libs/appInterface' import { notify } from 'core/libs/ui'
const stateCodes = { const stateCodes = {
0: "closed", 0: "closed",

View File

@ -1,6 +1,6 @@
import * as React from 'react' import * as React from 'react'
import * as antd from 'antd' import * as antd from 'antd'
import * as Icons from 'components/Icons' import { Code, Download, HardDrive } from 'components/Icons'
import { downloadDecodedURI } from 'core' import { downloadDecodedURI } from 'core'
export interface exportData_props { export interface exportData_props {
@ -11,7 +11,7 @@ export interface exportData_props {
const exportCodeRender = (data) => { const exportCodeRender = (data) => {
if(data.length > 500){ if(data.length > 500){
return <div style={{ textAlign: 'center', width: '100%', padding: '30px 0 30px 0' }}> return <div style={{ textAlign: 'center', width: '100%', padding: '30px 0 30px 0' }}>
<Icons.HardDrive style={{ fontSize: '45px', margin: '0' }} /> <HardDrive style={{ fontSize: '45px', margin: '0' }} />
<h4>Hey, this file is too much large!</h4> <h4>Hey, this file is too much large!</h4>
<h3>So it couldn't be displayed.</h3> <h3>So it couldn't be displayed.</h3>
</div> </div>
@ -23,10 +23,10 @@ const exportCodeRender = (data) => {
const exportData_render = (props: exportData_props) => { const exportData_render = (props: exportData_props) => {
antd.Modal.confirm({ antd.Modal.confirm({
title: <div><Icons.Code /> Your export <antd.Tag> {`${props.type.split("/")[1]}`} </antd.Tag></div>, title: <div><Code /> Your export <antd.Tag> {`${props.type.split("/")[1]}`} </antd.Tag></div>,
icon: null, icon: null,
onOk: () => downloadDecodedURI({data: props.data, type: props.type}), onOk: () => downloadDecodedURI({data: props.data, type: props.type}),
okText: <><Icons.Download />Download as File</> , okText: <><Download />Download as File</> ,
cancelText: "Done", cancelText: "Done",
content: exportCodeRender(props.data), content: exportCodeRender(props.data),
}); });

View File

@ -1,11 +1,11 @@
import { notification, message } from 'antd' import { notification, message } from 'antd'
import * as Icons from 'components/Icons' import { Triangle, FieldTimeOutlined, LoadingOutlined } from 'components/Icons'
export const notify = { export const notify = {
fatal: (...res) => { fatal: (...res) => {
notification.error({ notification.error({
message: 'Fatal Error', message: 'Fatal Error',
icon: <Icons.Triangle style={{ color: '#fa8c16' }} />, icon: <Triangle style={{ color: '#fa8c16' }} />,
description: res, description: res,
placement: 'bottomLeft' placement: 'bottomLeft'
}) })
@ -13,7 +13,7 @@ export const notify = {
expire: (...res) => { expire: (...res) => {
notification.error({ notification.error({
message: 'Hey ', message: 'Hey ',
icon: <Icons.FieldTimeOutlined />, icon: <FieldTimeOutlined />,
description: res, description: res,
placement: 'bottomLeft', placement: 'bottomLeft',
}) })
@ -73,7 +73,7 @@ export const notify = {
}, },
proccess: (...res) => { proccess: (...res) => {
notification.open({ notification.open({
icon: <Icons.LoadingOutlined style={{ color: '#108ee9' }} />, icon: <LoadingOutlined style={{ color: '#108ee9' }} />,
message: 'Please wait', message: 'Please wait',
description: <div>{res}</div>, description: <div>{res}</div>,
placement: 'bottomLeft', placement: 'bottomLeft',
@ -83,7 +83,7 @@ export const notify = {
notification.open({ notification.open({
placement: props.placement? props.placement : 'bottomLeft', placement: props.placement? props.placement : 'bottomLeft',
duration: props.duration? props.placement : 15, duration: props.duration? props.placement : 15,
icon: props.icon? props.icon : <Icons.Triangle style={{ color: '#fa8c16' }} />, icon: props.icon? props.icon : <Triangle style={{ color: '#fa8c16' }} />,
message: props.message? props.message : '', message: props.message? props.message : '',
description: props.description? props.description : '' description: props.description? props.description : ''
}) })

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { connect } from 'umi'; import { connect } from 'umi';
import * as antd from 'antd' import * as antd from 'antd'
import * as Icons from 'components/Icons' import { Database, Redux, AlertTriangle } from 'components/Icons'
import { ParamsList } from 'components' import { ParamsList } from 'components'
import { __legacy__objectToArray } from 'core' import { __legacy__objectToArray } from 'core'
import store from 'store' import store from 'store'
@ -82,7 +82,7 @@ class ReduxDebugger extends React.Component {
style={{ wordBreak: 'break-all' }} style={{ wordBreak: 'break-all' }}
header={ header={
<div style={{ display: "flex", alignItems: "center", marginLeft: '10px' }} > <div style={{ display: "flex", alignItems: "center", marginLeft: '10px' }} >
<Icons.Database /> <Database />
<strong>{e.key}</strong> <strong>{e.key}</strong>
</div> </div>
}> }>
@ -94,7 +94,7 @@ class ReduxDebugger extends React.Component {
return ( return (
<div style={{ background: "#fff", borderRadius: "8px", padding: "25px 15px" }}> <div style={{ background: "#fff", borderRadius: "8px", padding: "25px 15px" }}>
<div style={{ marginBottom: "35px" }}> <div style={{ marginBottom: "35px" }}>
<h1 style={{ fontSize: '24px' }}><Icons.Redux /> Redux Store <span style={{ fontSize: '14px', float: "right" }}><Icons.AlertTriangle />Dangerously experimental debugger</span></h1> <h1 style={{ fontSize: '24px' }}><Redux /> Redux Store <span style={{ fontSize: '14px', float: "right" }}><AlertTriangle />Dangerously experimental debugger</span></h1>
<antd.Card>{this.renderCheckboxes()}</antd.Card> <antd.Card>{this.renderCheckboxes()}</antd.Card>
</div> </div>
<hr /> <hr />

View File

@ -2,7 +2,7 @@ import store from 'store'
import { app_config } from 'config' import { app_config } from 'config'
import keys from 'config/app_keys' import keys from 'config/app_keys'
import { user, session } from 'core/models' 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 settings from 'core/libs/settings'
import { queryIndexer } from 'core' import { queryIndexer } from 'core'
import Cryptr from 'cryptr' import Cryptr from 'cryptr'

View File

@ -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 { DynamicSDCP } from 'core/libs/dynamicsdcp'
import settings from 'core/libs/settings' import settings from 'core/libs/settings'
import * as core from 'core' import * as core from 'core'
@ -31,14 +31,14 @@ export default {
usePlugins([payload.array], (err, results) => { usePlugins([payload.array], (err, results) => {
if (err) { if (err) {
verbosity(["Init error!", err]) verbosity(["Init error!", err])
appInterface.notify.error("Plugin initialize error!", err) ui.notify.error("Plugin initialize error!", err)
return false return false
} }
const rootInit = results[0] const rootInit = results[0]
if (!rootInit.uuid) { if (!rootInit.uuid) {
verbosity("Cannot initialize a plugin without UUID.", "Please read SDK documentation for more info.") 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 return false
} }
@ -85,7 +85,7 @@ export default {
window.PluginGlobals[plugin.uuid] = new extendedPlugin({ extended, extendedRequire }) window.PluginGlobals[plugin.uuid] = new extendedPlugin({ extended, extendedRequire })
appInterface.notify.open({ ui.notify.open({
message: `${plugin.title} v${plugin.version}`, message: `${plugin.title} v${plugin.version}`,
description: `New plugin is now installed !` description: `New plugin is now installed !`
}) })

View File

@ -2,7 +2,7 @@ import store from 'store'
import { app_config } from 'config' import { app_config } from 'config'
import keys from 'config/app_keys' import keys from 'config/app_keys'
import { user, session } from 'core/models' 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 settings from 'core/libs/settings'
import { __legacy__objectToArray } from 'core' import { __legacy__objectToArray } from 'core'
import { Howl, Howler } from 'howler' import { Howl, Howler } from 'howler'

View File

@ -3,7 +3,7 @@ import store from 'store'
import { app_config } from 'config' import { app_config } from 'config'
import keys from 'config/app_keys' import keys from 'config/app_keys'
import { user, session } from 'core/models' 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 settings from 'core/libs/settings'
import { DynamicSDCP } from 'core/libs/dynamicsdcp' import { DynamicSDCP } from 'core/libs/dynamicsdcp'
import * as core from 'core' import * as core from 'core'

View File

@ -3,7 +3,7 @@ import ReduxDebugger from 'debuggers/redux'
import * as antd from 'antd' import * as antd from 'antd'
import { FloatComponent } from 'components' import { FloatComponent } from 'components'
import { connect } from 'umi' import { connect } from 'umi'
import * as Icons from 'components/Icons' import { ClusterOutlined } from 'components/Icons'
import { __legacy__objectToArray } from 'core' import { __legacy__objectToArray } from 'core'
@connect((store) => (store)) @connect((store) => (store))
@ -57,7 +57,7 @@ export default class Index extends React.Component {
<ReduxDebugger /> <ReduxDebugger />
<antd.Card> <antd.Card>
<h1><Icons.ClusterOutlined style={{ marginRight: "7px" }} /> Socket </h1> <h1><ClusterOutlined style={{ marginRight: "7px" }} /> Socket </h1>
<antd.Card> <antd.Card>
<h3> Header Node </h3> <h3> Header Node </h3>
<antd.Card> <antd.Card>

View File

@ -1,6 +1,6 @@
import React from 'react' import React from 'react'
import { iatToString } from 'core' import { iatToString } from 'core'
import { router, appInterface } from 'core/libs' import { router, ui } from 'core/libs'
import styles from './index.less' import styles from './index.less'
import classnames from 'classnames' import classnames from 'classnames'
@ -63,7 +63,7 @@ class Login extends React.Component {
componentDidMount() { componentDidMount() {
if (this.props.app.session_valid) { 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')
} }
} }

View File

@ -2,8 +2,7 @@ import React from 'react'
import * as antd from 'antd' import * as antd from 'antd'
import { connect } from 'umi' import { connect } from 'umi'
import { router } from 'core/libs'; import { router } from 'core/libs';
import * as Icons from 'components/Icons' import { Home, Trash } from 'components/Icons'
@connect(({ app }) => ({ app })) @connect(({ app }) => ({ app }))
export default class Logout extends React.Component{ export default class Logout extends React.Component{
@ -23,8 +22,8 @@ export default class Logout extends React.Component{
onCancel() { onCancel() {
dispatchLogout() dispatchLogout()
}, },
okText: <><Icons.Home/>Resume</>, okText: <><Home/>Resume</>,
cancelText: <><Icons.Trash/>Logout</> cancelText: <><Trash/>Logout</>
}); });
} }

View File

@ -1,7 +1,7 @@
import React from 'react' import React from 'react'
import ErrorHandler from 'core/libs/errorhandler' import ErrorHandler from 'core/libs/errorhandler'
import { theme } from 'core/libs/style' 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' import verbosity from 'core/libs/verbosity'
export default class ThemeConfigurator extends React.Component { export default class ThemeConfigurator extends React.Component {