From 61ca038d96a06608b6a0fa7ec1f0a9e98f6c960f Mon Sep 17 00:00:00 2001 From: makame Date: Wed, 6 May 2020 15:41:15 +0200 Subject: [PATCH] clean packages --- package-lock.json | 50 +- package.json | 8 +- .../Configuration/ConfigurationAllUsers.tsx | 1 - src/app/Dashboard/DashboardToolbar.tsx | 2 +- src/app/Dashboard/TrackerActivities.tsx | 2 +- src/app/Dashboard/TrackerSelector.tsx | 2 +- src/app/Details/LastMessages.tsx | 1 - src/app/Details/RepositoryUsersDashboard.tsx | 1 - src/app/Log/LogsScreen.tsx | 25 +- src/app/RepositoryUserService.tsx | 12 +- src/app/SearchBar/SearchBar.tsx | 2 +- src/app/SearchService.tsx | 4 +- src/app/Settings/Settings.tsx | 181 +++---- src/components/Layout/LayoutContext.tsx | 2 +- .../UncontrolledModalClose.tsx | 21 +- src/electron/drive.ts | 34 +- src/electron/git-log.hooks.js | 39 ++ src/electron/git/index.ts | 2 +- src/electron/handlers/app-info.handler.ts | 6 - src/electron/handlers/auth.handler.ts | 52 -- src/electron/handlers/chat.handler.ts | 365 -------------- src/electron/handlers/get-data.handler.ts | 3 + src/electron/handlers/get-settings.handler.ts | 12 - .../handlers/get-stats-data.handler.ts | 3 + src/electron/handlers/log.handler.ts | 73 ++- src/electron/preload.js | 8 +- src/electron/users.ts | 135 ------ src/hooks.ts | 44 +- src/layout/DefaultNavbar.tsx | 6 +- src/layout/SidebarMiddleNav.tsx | 9 - src/routing.tsx | 6 - src/shared/Settings.ts | 5 - src/shared/UserConnection.ts | 5 - src/shared/ipc.ts | 21 +- src/styles/plugins/_ag-grid.scss | 2 - src/styles/plugins/_font-awesome.scss | 4 - src/tools.ts | 4 +- src/wip/Apps/BillingEdit/BillingEdit.tsx | 5 +- src/wip/Apps/SessionsEdit/SessionsEdit.tsx | 5 +- src/wip/Interface/Modals/Modals.tsx | 2 +- src/wip/Tables/AgGrid/AgGrid.tsx | 448 ------------------ src/wip/Tables/Tables/Tables.tsx | 424 ----------------- .../Tables/Tables/components/TrBorderless.tsx | 43 -- .../Tables/Tables/components/TrResponsive.tsx | 60 --- .../Tables/components/TrTableBordered.tsx | 41 -- .../Tables/components/TrTableBorderless.tsx | 73 --- .../Tables/components/TrTableContextual.tsx | 72 --- .../Tables/components/TrTableDefault.tsx | 109 ----- .../Tables/Tables/components/TrTableHeads.tsx | 25 - .../Tables/components/TrTableHoverable.tsx | 22 - .../Tables/components/TrTableResponsive.tsx | 67 --- .../Tables/Tables/components/TrTableSmall.tsx | 27 -- .../Tables/components/TrTableStriped.tsx | 32 -- 53 files changed, 248 insertions(+), 2359 deletions(-) create mode 100644 src/electron/git-log.hooks.js delete mode 100644 src/electron/handlers/auth.handler.ts delete mode 100644 src/electron/handlers/chat.handler.ts delete mode 100644 src/electron/users.ts delete mode 100644 src/shared/UserConnection.ts delete mode 100755 src/styles/plugins/_ag-grid.scss delete mode 100755 src/wip/Tables/AgGrid/AgGrid.tsx delete mode 100755 src/wip/Tables/Tables/Tables.tsx delete mode 100755 src/wip/Tables/Tables/components/TrBorderless.tsx delete mode 100755 src/wip/Tables/Tables/components/TrResponsive.tsx delete mode 100755 src/wip/Tables/Tables/components/TrTableBordered.tsx delete mode 100755 src/wip/Tables/Tables/components/TrTableBorderless.tsx delete mode 100755 src/wip/Tables/Tables/components/TrTableContextual.tsx delete mode 100755 src/wip/Tables/Tables/components/TrTableDefault.tsx delete mode 100755 src/wip/Tables/Tables/components/TrTableHeads.tsx delete mode 100755 src/wip/Tables/Tables/components/TrTableHoverable.tsx delete mode 100755 src/wip/Tables/Tables/components/TrTableResponsive.tsx delete mode 100755 src/wip/Tables/Tables/components/TrTableSmall.tsx delete mode 100755 src/wip/Tables/Tables/components/TrTableStriped.tsx diff --git a/package-lock.json b/package-lock.json index d25b873..8df7a95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "git-activity-team-tracker", - "version": "0.2.5", + "version": "0.2.6", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -8057,11 +8057,6 @@ "schema-utils": "^2.5.0" } }, - "file-saver": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.2.tgz", - "integrity": "sha512-Wz3c3XQ5xroCxd1G8b7yL0Ehkf0TC9oYC6buPFkNnU9EnaPlifeAFCyCh+iewXTyFRcg0a6j3J7FmJsIhlhBdw==" - }, "file-selector": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/file-selector/-/file-selector-0.1.12.tgz", @@ -8235,11 +8230,6 @@ } } }, - "font-awesome": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/font-awesome/-/font-awesome-4.7.0.tgz", - "integrity": "sha1-j6jPBBGhoxr9B7BtKQK7n8gVoTM=" - }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -16362,39 +16352,6 @@ "uncontrollable": "^7.0.0" } }, - "react-bootstrap-table-next": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/react-bootstrap-table-next/-/react-bootstrap-table-next-4.0.0.tgz", - "integrity": "sha512-7pDdmMfkQ5G6z21M1adWiontCGpP4N3LGxfzGdPbTuSmqCkX9syP1sglF7GkDvF6bIADbcPT8ttM799x8SSsCA==", - "requires": { - "classnames": "^2.2.5", - "react-transition-group": "^4.2.0", - "underscore": "1.9.1" - } - }, - "react-bootstrap-table2-editor": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/react-bootstrap-table2-editor/-/react-bootstrap-table2-editor-1.4.0.tgz", - "integrity": "sha512-18yDCwsVt3b5Fwy0jidNDAbUA6vC7k9JjQVmykazWSw8G115+mmZnhe9/7RO7jAu8X7lhmobwlNwECzwPu1nDg==" - }, - "react-bootstrap-table2-filter": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/react-bootstrap-table2-filter/-/react-bootstrap-table2-filter-1.3.1.tgz", - "integrity": "sha512-GFj6QTvrdBLCt+7xxsa0t5UQs+DL7L5zhloxHA1z3BbOt5WrWgcpBvN2XIFQ1wiISSmRkzGmkdPsmNfAT1b3FQ==" - }, - "react-bootstrap-table2-paginator": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/react-bootstrap-table2-paginator/-/react-bootstrap-table2-paginator-2.1.2.tgz", - "integrity": "sha512-LC5znEphhgKJvaSY1q8d+Gj0Nc/1X+VS3tKJjkmWmfv9P61YC/BnwJ+aoqEmQzsLiVGowrzss+i/u+Tip5H+Iw==" - }, - "react-bootstrap-table2-toolkit": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/react-bootstrap-table2-toolkit/-/react-bootstrap-table2-toolkit-2.1.2.tgz", - "integrity": "sha512-PKJhh6tBQDh9jpiTKv1RpYCZlsQYbLEQb+GvkePRsUlHjV7anD2OmEviJILKXyUNsumNi0UXgqyMqsZ2HYhD/w==", - "requires": { - "file-saver": "2.0.2" - } - }, "react-bootstrap-typeahead": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/react-bootstrap-typeahead/-/react-bootstrap-typeahead-4.2.2.tgz", @@ -20296,11 +20253,6 @@ } } }, - "underscore": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", - "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" - }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", diff --git a/package.json b/package.json index c03fcb4..7cdf174 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-activity-team-tracker", - "version": "0.2.5", + "version": "0.2.6", "private": false, "description": "The tool visualize git activities, for teams, users, repositories", "author": "Maxim Karpov ", @@ -74,7 +74,6 @@ "electron-settings": "^3.2.0", "electron-updater": "^4.2.5", "faker": "^4.1.0", - "font-awesome": "^4.7.0", "fs-backwards-stream": "^1.0.0", "fs-extra": "^9.0.0", "holderjs": "^2.9.7", @@ -97,11 +96,6 @@ "react": "^16.13.1", "react-beautiful-dnd": "^13.0.0", "react-big-calendar": "^0.24.3", - "react-bootstrap-table-next": "^4.0.0", - "react-bootstrap-table2-editor": "^1.4.0", - "react-bootstrap-table2-filter": "^1.3.1", - "react-bootstrap-table2-paginator": "^2.1.2", - "react-bootstrap-table2-toolkit": "^2.1.2", "react-bootstrap-typeahead": "^4.2.2", "react-content-loader": "^5.0.4", "react-datepicker": "^2.14.1", diff --git a/src/app/Configuration/ConfigurationAllUsers.tsx b/src/app/Configuration/ConfigurationAllUsers.tsx index 3c60003..baaa75a 100755 --- a/src/app/Configuration/ConfigurationAllUsers.tsx +++ b/src/app/Configuration/ConfigurationAllUsers.tsx @@ -248,7 +248,6 @@ export const ConfigurationAllUsers = observer(
{
{
Promise; + clear: () => Promise; } export const LogsScreen = observer(() => { const state = useLocalStore(() => ({ - isDirty: false, search: "", limit: 50, logs: { @@ -95,9 +94,15 @@ export const LogsScreen = observer(() => { load: async () => { state.isLoading = true; state.logs = await ipc.handlers.GET_LOGS(state.search, state.limit); - state.isDirty = false; state.isLoading = false; }, + clear: async () => { + // state.isLoading = true; + throw new Error("sdfsdfsdf"); + // await ipc.handlers.CLEAR_LOGS(); + // state.logs = await ipc.handlers.GET_LOGS(state.search, state.limit); + // state.isLoading = false; + }, })); useOnLoad(state.load); @@ -119,11 +124,11 @@ export const LogsScreen = observer(() => {
- {/*
- - Back Home - -
*/} +
+ +
@@ -151,7 +156,7 @@ export const LogsScreen = observer(() => { {state.isLoading ? ( - ) : ( + ) : state.aggregatedLogs.length > 0 ? ( {state.aggregatedLogs.map((line, index) => { @@ -178,6 +183,8 @@ export const LogsScreen = observer(() => { })}
+ ) : ( +
There are no logs...
)}
diff --git a/src/app/RepositoryUserService.tsx b/src/app/RepositoryUserService.tsx index 74066e4..f8f8bf4 100755 --- a/src/app/RepositoryUserService.tsx +++ b/src/app/RepositoryUserService.tsx @@ -53,11 +53,13 @@ export const RepositoryUserService = createService( .includes(state.usersQueryDelay.toLowerCase()); }) : state.repositoryUsers; - values = values.sort( - (a, b) => - (a[state.sortBy] - b[state.sortBy]) * - (state.sortDirectionDesc ? -1 : 1) - ); + values = values + .slice() + .sort( + (a, b) => + (a[state.sortBy] - b[state.sortBy]) * + (state.sortDirectionDesc ? -1 : 1) + ); return values; }, load: async () => { diff --git a/src/app/SearchBar/SearchBar.tsx b/src/app/SearchBar/SearchBar.tsx index c30f215..6617dc7 100755 --- a/src/app/SearchBar/SearchBar.tsx +++ b/src/app/SearchBar/SearchBar.tsx @@ -7,7 +7,7 @@ import { MenuItem, Highlighter, } from "react-bootstrap-typeahead"; -import { groupBy } from "underscore"; +import { groupBy } from "lodash"; import { searchMap, SearchService } from "../SearchService"; import { useHistory } from "react-router"; import { Nav, NavItem } from "~/components"; diff --git a/src/app/SearchService.tsx b/src/app/SearchService.tsx index 8a78ed0..25e3bde 100755 --- a/src/app/SearchService.tsx +++ b/src/app/SearchService.tsx @@ -4,7 +4,7 @@ import { createService } from "~/components/ServiceProvider/ServiceProvider"; import { useOnLoad } from "~/hooks"; import { Config } from "~/shared/Config"; import { ipc } from "~/shared/ipc"; -import { debounce } from "underscore"; +import { debounce } from "lodash"; export type SearchType = "repository" | "team" | "user"; @@ -64,7 +64,7 @@ export const SearchService = createService( state.config = await ipc.handlers.GET_CONFIG(); state.isLoading = false; }, - reload: debounce(() => state.load(), 1000, false), + reload: debounce(() => state.load(), 1000), })); return state; }, diff --git a/src/app/Settings/Settings.tsx b/src/app/Settings/Settings.tsx index 1876341..68b4191 100755 --- a/src/app/Settings/Settings.tsx +++ b/src/app/Settings/Settings.tsx @@ -12,67 +12,31 @@ import { ButtonGroup, Button, Input, - Form, FormGroup, Label, Accordion, AccordionHeader, AccordionBody, WithLayoutMeta, + UncontrolledModal, + ModalBody, + UncontrolledModalClose, } from "~/components"; import { HeaderMain } from "~/app/HeaderMain"; import { ipc } from "~/shared/ipc"; import { useIsDirty, useOnLoad } from "~/hooks"; import { ApplicationSettings } from "~/shared/Settings"; -import { ConfigurationTable } from "../Configuration/ConfigurationTable"; -import { UserConnection } from "~/shared/UserConnection"; interface SettingsState { isDirty: boolean; config: ApplicationSettings; isLoading: boolean; - users: UserConnection[]; load: () => Promise; save: () => Promise; remount: () => Promise; empty: () => Promise; } -const SettingsUsers = observer(({ state }: { state: SettingsState }) => { - return ( - - - Authorized Users - - - {!state.config || state.isLoading ? ( - - ) : ( - - Email - Name - Public Key - Actions - - } - items={state.users} - render={(item) => ( - <> - {item.email} - {item.name} - {item.publicKey} - Unregister - - )} - /> - )} - - - ); -}); - const SettingsForm = observer(({ state }: { state: SettingsState }) => { return ( @@ -83,7 +47,7 @@ const SettingsForm = observer(({ state }: { state: SettingsState }) => { {!state.config || state.isLoading ? ( ) : ( -
+
@@ -121,101 +85,78 @@ const SettingsForm = observer(({ state }: { state: SettingsState }) => { /> - - - - { - state.config.communicationKey = e.currentTarget.value; - }} - value={state.config.communicationKey} - placeholder="Enter Key..." - /> - - - {!!state.config.communicationKey && ( - <> - - - - { - state.config.email = e.currentTarget.value; - }} - value={state.config.email} - placeholder="Enter your email..." - /> - - - - - - { - state.config.name = e.currentTarget.value; - }} - value={state.config.name} - placeholder="Enter your name..." - /> - - - - - - { - state.config.userPublicKey = e.currentTarget.value; - }} - value={state.config.userPublicKey} - placeholder="Enter your account public key..." - /> - - - - - - { - state.config.userSecretKey = e.currentTarget.value; - }} - value={state.config.userSecretKey} - placeholder="Enter your account secret key..." - /> - - - - )} - + - - + + + +
Remount Drive
+

+ This operation is irreversible, please accept it. +

+ + OK, Process + + + Cancel + +
+
+ + + +
Empty Drive
+

+ This operation is irreversible, please accept it. +

+ + OK, Process + + + Cancel + +
+
- +
)}
@@ -227,11 +168,9 @@ export const Settings = observer(() => { isDirty: false, config: null, isLoading: false, - users: [], load: async () => { state.isLoading = true; state.config = await ipc.handlers.GET_SETTINGS(); - state.users = await ipc.handlers.GET_USERS(); state.isDirty = false; state.isLoading = false; }, @@ -239,20 +178,17 @@ export const Settings = observer(() => { state.isLoading = true; await ipc.handlers.SAVE_SETTINGS(toJS(state.config)); state.config = await ipc.handlers.GET_SETTINGS(); - state.users = await ipc.handlers.GET_USERS(); state.isDirty = false; state.isLoading = false; }, remount: async () => { state.isLoading = true; await ipc.handlers.REMOUNT_DRIVE(); - state.users = await ipc.handlers.GET_USERS(); state.isLoading = false; }, empty: async () => { state.isLoading = true; await ipc.handlers.EMPTY_DRIVE(); - state.users = await ipc.handlers.GET_USERS(); state.isLoading = false; }, })); @@ -302,7 +238,6 @@ export const Settings = observer(() => { - {!!state.config?.communicationKey && } ); }); diff --git a/src/components/Layout/LayoutContext.tsx b/src/components/Layout/LayoutContext.tsx index 85307a4..28d69e4 100755 --- a/src/components/Layout/LayoutContext.tsx +++ b/src/components/Layout/LayoutContext.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { isEqual } from "underscore"; +import { isEqual } from "lodash"; export interface LayoutMeta { sidebarHidden?: boolean; diff --git a/src/components/UncontrolledModal/UncontrolledModalClose.tsx b/src/components/UncontrolledModal/UncontrolledModalClose.tsx index 328ba51..62af691 100755 --- a/src/components/UncontrolledModal/UncontrolledModalClose.tsx +++ b/src/components/UncontrolledModal/UncontrolledModalClose.tsx @@ -3,13 +3,28 @@ import { Button, ButtonProps } from "reactstrap"; import { Consumer } from "./context"; -const UncontrolledModalClose = (props: { tag?: any } & ButtonProps) => { - const { tag, ...otherProps } = props; +const UncontrolledModalClose = ( + props: { + tag?: any; + onClick?: () => Promise | (boolean | void); + } & ButtonProps +) => { + const { tag, onClick, ...otherProps } = props; const Tag = tag; return ( - {(value) => value.toggleModal()} />} + {(value) => ( + { + const res = await onClick(); + if (res !== false) { + value.toggleModal(); + } + }} + /> + )} ); }; diff --git a/src/electron/drive.ts b/src/electron/drive.ts index ec68f43..4086e78 100644 --- a/src/electron/drive.ts +++ b/src/electron/drive.ts @@ -12,7 +12,6 @@ import { SWARM_INIT_TIMEOUT, DRIVE_BASE_FOLDER } from "@env/config"; import { Chat } from "./chat/chat"; import { ipc } from "~/shared/ipc"; import { ApplicationSettings } from "~/shared/Settings"; -import { getUserSettings } from "./handlers/auth.handler"; export const generateDriveKeys = () => { const keyPair = crypto.keyPair(); @@ -191,11 +190,6 @@ export const getSettings = (): ApplicationSettings => { publicKey: settings.get("publicKey"), secretKey: settings.get("secretKey"), useDriveSwarm: settings.get("useDriveSwarm"), - communicationKey: settings.get("communicationKey"), - name: settings.get("name"), - email: settings.get("email"), - userPublicKey: settings.get("userPublicKey"), - userSecretKey: settings.get("userSecretKey"), }; }; @@ -221,13 +215,10 @@ export const loadSettings = (): ApplicationSettings => { } const publicKey = settings.get("publicKey"); const secretKey = settings.get("secretKey"); - const user = getUserSettings(); return { publicKey: publicKey, secretKey: secretKey, useDriveSwarm: settings.get("useDriveSwarm"), - communicationKey: settings.get("communicationKey"), - ...user, }; }; @@ -235,11 +226,6 @@ export const saveSettings = ({ publicKey, secretKey, useDriveSwarm, - communicationKey, - email, - name, - userPublicKey, - userSecretKey, }: ApplicationSettings) => { closeDrive(); if (!publicKey || !secretKey) { @@ -250,27 +236,13 @@ export const saveSettings = ({ settings.set("publicKey", publicKey); settings.set("secretKey", secretKey); settings.set("useDriveSwarm", useDriveSwarm); - settings.set("communicationKey", communicationKey); - settings.set("email", email); - settings.set("name", name); - settings.set("userPublicKey", userPublicKey); - settings.set("userSecretKey", userSecretKey); createDrive(); }; export const createDrive = () => { inited = false; closeDrive(); - const { - publicKey, - secretKey, - useDriveSwarm, - communicationKey, - email, - name, - userPublicKey, - userSecretKey, - } = loadSettings(); + const { publicKey, secretKey, useDriveSwarm } = loadSettings(); drive = hyperdrive(getBaseFolder(), publicKey, { secretKey: parseKey(secretKey), }); @@ -302,9 +274,5 @@ export const createDrive = () => { }); } - if (communicationKey && email && name && userPublicKey && userSecretKey) { - chat = new Chat(communicationKey); - } - ipc.sends.ON_DRIVE_CREATED(); }; diff --git a/src/electron/git-log.hooks.js b/src/electron/git-log.hooks.js new file mode 100644 index 0000000..0fbb049 --- /dev/null +++ b/src/electron/git-log.hooks.js @@ -0,0 +1,39 @@ +const log = require("electron-log"); + +const ignoreLines = [ + "password", + "DeprecationWarning", + "deprecated", + "Electron Security Warning (Insecure Content-Security-Policy)", + "Warning: Using UNSAFE_componentWillMount", + "Warning: validateDOMNesting(...)", + "Warning: A future version of React will block javascript", + "Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended", + "Warning: Legacy context API has been detected within a strict-mode tree", + "Download the React DevTools for a better development experience", + "[HMR] Waiting for update signal from WDS...", + "[MobX] You haven't configured observer batching which might result in unexpected behavior in some cases", + "Warning: Hash history cannot PUSH the same path", +]; + +const hasIgnores = (line) => { + return ( + line && + line.includes && + ignoreLines.toLowerCase && + ignoreLines.toLowerCase().find((s) => line.includes(s)) + ); +}; + +log.hooks.push((message, transport) => { + if ( + message && + message.data && + message.data[0] && + hasIgnores(message.data[0]) + ) { + return false; + } + + return message; +}); diff --git a/src/electron/git/index.ts b/src/electron/git/index.ts index de10dd7..57bfe95 100755 --- a/src/electron/git/index.ts +++ b/src/electron/git/index.ts @@ -4,7 +4,7 @@ import YAML from "yaml"; import path from "path"; import fs from "fs"; import fsExtra from "fs-extra"; -import { pick } from "underscore"; +import { pick } from "lodash"; import { waitForDrive, isExist, readFile, writeFile, readDir } from "../drive"; import { Config } from "~/shared/Config"; import { DEV_CONFIG } from "@env/config"; diff --git a/src/electron/handlers/app-info.handler.ts b/src/electron/handlers/app-info.handler.ts index 99f971a..cfb4a6c 100644 --- a/src/electron/handlers/app-info.handler.ts +++ b/src/electron/handlers/app-info.handler.ts @@ -1,6 +1,5 @@ import { app, ipcMain } from "electron"; import { nameofHandler, IpcHandler } from "~/shared/ipc"; -// import { writeFile, readFile } from "../drive"; ipcMain.handle( nameofHandler("APP_INFO"), @@ -8,11 +7,6 @@ ipcMain.handle( event, ...args: Parameters ): Promise> => { - // await writeFile("/test.txt", "hello"); - // await writeFile("/test.txt", "hello"); - // await writeFile("/test.txt", "hello"); - // console.log(await readFile("/test.txt")); - await new Promise((r) => setTimeout(r, 1000)); return { appName: app.getName(), appVersion: app.getVersion(), diff --git a/src/electron/handlers/auth.handler.ts b/src/electron/handlers/auth.handler.ts deleted file mode 100644 index c78cdce..0000000 --- a/src/electron/handlers/auth.handler.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { ipcMain } from "electron"; -import crypto from "hypercore-crypto"; -import settings from "electron-settings"; -import { IpcHandler, nameofHandler } from "~/shared/ipc"; -import { getUserKey } from "../users"; - -export const getUserKeys = () => { - if (!settings.get("userPublicKey") || !settings.get("userSecretKey")) { - const keyPair = crypto.keyPair(); - settings.set("userPublicKey", keyPair.publicKey.toString("hex")); - settings.set("userSecretKey", keyPair.secretKey.toString("hex")); - } - return { - publicKey: settings.get("userPublicKey"), - secretKey: settings.get("userSecretKey"), - }; -}; - -export const getUserSettings = () => { - const name = settings.get("name"); - const email = settings.get("email"); - const keyPair = getUserKeys(); - const publicKey = keyPair.publicKey; - const secretKey = keyPair.secretKey; - if (!name || !email) { - return null; - } - return { - name, - email, - userPublicKey: publicKey, - userSecretKey: secretKey, - }; -}; - -ipcMain.handle( - nameofHandler("GET_USER"), - async ( - event, - ...args: Parameters - ): Promise> => { - const user = getUserSettings(); - return user - ? { - name: user.name, - email: user.email, - userPublicKey: user.userPublicKey, - userKey: await getUserKey(user.email, user.name), - } - : null; - } -); diff --git a/src/electron/handlers/chat.handler.ts b/src/electron/handlers/chat.handler.ts deleted file mode 100644 index 2647779..0000000 --- a/src/electron/handlers/chat.handler.ts +++ /dev/null @@ -1,365 +0,0 @@ -import { app, ipcMain } from "electron"; -import settings from "electron-settings"; -// import pump from "pump"; -// import IPCStream from 'electron-ipc-stream'; -import { getChat, closeChat } from "../drive"; -import { Channel, Peer } from "../chat/chat"; -import { ipc, IpcHandler, nameofSends, nameofHandler } from "~/shared/ipc"; -import { JsonCompatible } from "~/shared/Json"; -import { - getUserConnection, - registerUserConnection, - generateUserConnection, - generateMessage, - updateUserConnectionData, - getUserKey, -} from "../users"; -import { getUserSettings } from "./auth.handler"; -// import { getWindow } from "../main"; - -const MAIN_CHANNEL_NAME = ""; - -let mainChannel: Channel; -let peerPrivateUsers = new Map>(); -let channels: Channel[] = []; -let peerUsers = new Map(); -let peerMeetMessage = new Map(); - -const destroyChat = () => { - channels = []; - peerPrivateUsers = new Map(); - peerUsers = new Map(); - peerMeetMessage = new Map(); - if (mainChannel) { - if (!mainChannel.isClosed()) { - mainChannel.close(); - } - mainChannel = null; - } - closeChat(); -}; - -const runChannel = (channelName: string) => { - const chat = getChat(); - if (chat) { - const channel = chat.channel(channelName); - channel.on("message", (peer, data) => { - ipc.sends.ON_CHANNEL_MESSAGE(channelName, peer, data); - }); - channel.on("peer", (peer) => { - ipc.sends.ON_CHANNEL_PEER_START(channelName, peer); - }); - channel.on("peer-disconnected", (peer) => { - ipc.sends.ON_CHANNEL_PEER_END(channelName, peer); - }); - return channel; - } - return null; -}; - -const createMainChannel = () => { - channels = []; - peerPrivateUsers = new Map(); - peerUsers = new Map(); - peerMeetMessage = new Map(); - if (mainChannel) { - if (!mainChannel.isClosed()) { - mainChannel.close(); - } - mainChannel = null; - } - mainChannel = runChannel(MAIN_CHANNEL_NAME); -}; - -app.on("ready", () => { - ipcMain.on( - "ON_CHANNEL_PEER_START", - (event, channelName: string, peer: Peer) => { - const channel = findChannel(channelName); - if (!channel && channelName !== MAIN_CHANNEL_NAME) { - return; - } - const message = generateMessage(); - peerMeetMessage.set(peer, message); - peer.send({ - type: "meet", - message, - }); - } - ); - ipcMain.on( - "ON_CHANNEL_PEER_END", - (event, channelName: string, peer: Peer) => { - const email = peerUsers.get(peer); - peerMeetMessage.delete(peer); - peerUsers.delete(peer); - if (email && channelName === MAIN_CHANNEL_NAME) { - if (peerPrivateUsers.has(email)) { - const peers = peerPrivateUsers.get(email); - peers.delete(peer); - } - } - ipc.sends.ON_CHANNEL_UPDATE(channelName); - } - ); - ipcMain.on( - "ON_CHANNEL_MESSAGE", - async (event, channelName: string, peer: Peer, data: JsonCompatible) => { - const channel = findChannel(channelName); - if (!channel && channelName !== MAIN_CHANNEL_NAME) { - return; - } - if (data.type === "auth_fail") { - destroyChat(); - ipc.sends.ON_CHANNEL_AUTH_FAIL( - channelName, - data.from?.email, - data.name?.name - ); - } else if (data.type === "meet") { - const userConnection = generateUserConnection(data.message); - peer.send({ - type: "auth", - ...userConnection, - }); - } else if (data.type === "auth") { - const email = data.email; - const name = data.name; - const publicKey = data.publicKey; - const signature = data.signature; - const message = peerMeetMessage.get(peer); - if (email && name && publicKey && signature && message) { - let user = - (await getUserConnection(email, message, signature)) || - (channelName === MAIN_CHANNEL_NAME && - (await registerUserConnection({ - email, - name, - publicKey, - }))); - if (user) { - peerUsers.set(peer, email); - if (email && channelName === MAIN_CHANNEL_NAME) { - if (!peerPrivateUsers.has(email)) { - peerPrivateUsers.set(email, new Set()); - } - const peers = peerPrivateUsers.get(email); - peers.add(peer); - } - ipc.sends.ON_CHANNEL_UPDATE(channelName); - return; - } - } - const user = getUserSettings(); - peer.send({ - type: "auth_fail", - from: { - email: user.email, - name: user.name, - }, - }); - peer.destroy(); - } else { - const email = peerUsers.get(peer); - if (email) { - if (data.author?.name) { - await updateUserConnectionData(email, data.author.name); - } - const userKey = await getUserKey(email, data.author?.name); - ipc.sends.ON_CHANNEL_VERIFYED_MESSAGE( - channelName, - email, - data.author?.name, - userKey, - data - ); - } - } - } - ); - - ipcMain.on(nameofSends("ON_DRIVE_CREATED"), () => { - createMainChannel(); - }); -}); - -const setChannels = (arr: Channel[]) => { - settings.set( - "channels", - JSON.stringify(arr.map((channel) => channel.getName())) - ); - channels = arr; -}; - -app.on("ready", () => { - ipcMain.on(nameofSends("ON_SETTINGS_UPDATE_FINISH"), () => { - getChannels().forEach((channel) => channel.close()); - setChannels([]); - }); -}); - -const getChannels = (): Channel[] => { - const chat = getChat(); - if (!chat) { - setChannels([]); - } else { - const channelNames: string[] = settings.get("channels") - ? JSON.parse(settings.get("channels")) - : []; - - const notExistedChannels = channelNames.filter( - (channelName) => !channels.find((c) => c.getName() === channelName) - ); - channels = [ - ...channels, - ...notExistedChannels.map((channelName) => runChannel(channelName)), - ]; - } - return channels; -}; - -export const findChannel = (name: string): Channel => { - return getChannels().find((channel) => channel.getName() === name); -}; - -const removeChannel = (name: string) => { - return setChannels( - getChannels().filter((channel) => channel.getName() !== name) - ); -}; - -ipcMain.handle( - nameofHandler("GET_ONLINE_USERS"), - async ( - event, - ...args: Parameters - ): Promise> => { - const result: ReturnType = []; - peerPrivateUsers.forEach((peer, email) => { - result.push(email); - }); - return result; - } -); - -ipcMain.handle( - nameofHandler("GET_CHANNELS"), - async ( - event, - ...args: Parameters - ): Promise> => { - const result: ReturnType = {}; - getChannels().forEach((channel) => { - const arr = []; - peerUsers.forEach((email, peer) => { - if (channel.getPeers().has(peer) && !arr.includes(email)) { - arr.push(email); - } - }); - result[channel.getName()] = arr; - }); - return result; - } -); - -// ipcMain.handle( -// nameofHandler("GET_CONNECTION_STREAMS"), -// async ( -// event, -// ...args: Parameters -// ): Promise> => { -// const [email] = args; -// const chat = getChat(); -// const peers = peerPrivateUsers.get(email); -// const user = await ipc.handlers.GET_USER(); -// const res = []; -// if (chat && peers && user) { -// let index = -1; -// peers.forEach((peer) => { -// if (peer.peer) { -// const addr = email + (++index); -// const stream = new IPCStream(addr, getWindow()); -// pump(peer.getConnection(), stream, peer.getConnection()); -// res.push(addr); -// } -// }); -// } -// return res; -// } -// ); - -ipcMain.handle( - nameofHandler("SEND_USER_MESSAGE"), - async ( - event, - ...args: Parameters - ): Promise> => { - const [email, message] = args; - const chat = getChat(); - const peers = peerPrivateUsers.get(email); - const user = await ipc.handlers.GET_USER(); - if (chat && peers && user) { - peers.forEach((peer) => { - if (!peer.peer) { - peer.send({ ...message, author: user }); - } - }); - } - } -); - -ipcMain.handle( - nameofHandler("SEND_CHANNEL_MESSAGE"), - async ( - event, - ...args: Parameters - ): Promise> => { - const [name, message] = args; - const chat = getChat(); - const channel = findChannel(name); - const user = await ipc.handlers.GET_USER(); - if (chat && channel && user) { - channel.send({ ...message, author: user }); - } - } -); - -ipcMain.handle( - nameofHandler("CREATE_CHANNEL"), - async ( - event, - ...args: Parameters - ): Promise> => { - const [name] = args; - if (!name) { - return; - } - const chat = getChat(); - const user = await ipc.handlers.GET_USER(); - const existChannel = findChannel(name); - if (!existChannel && chat && user) { - const channel = runChannel(name); - const channels = getChannels(); - setChannels([channel, ...channels]); - ipc.sends.ON_CHANNEL_UPDATE(name); - return channel.getKey(); - } - return null; - } -); - -ipcMain.handle( - "CLOSE_CHANNEL", - async (event, ...args: any[]): Promise => { - const [name] = args; - const chat = getChat(); - const channel = findChannel(name); - if (chat && channel) { - channel.close(); - removeChannel(name); - ipc.sends.ON_CHANNEL_UPDATE(name); - return true; - } - return false; - } -); diff --git a/src/electron/handlers/get-data.handler.ts b/src/electron/handlers/get-data.handler.ts index ec8d93d..2217126 100644 --- a/src/electron/handlers/get-data.handler.ts +++ b/src/electron/handlers/get-data.handler.ts @@ -14,6 +14,9 @@ app.on("ready", () => { ipcMain.on(nameofSends("ON_COLLECT_FINISH"), () => { fileMap = null; }); + ipcMain.on(nameofSends("ON_CONFIG_UPDATE_FINISHED"), () => { + fileMap = null; + }); }); ipcMain.handle( diff --git a/src/electron/handlers/get-settings.handler.ts b/src/electron/handlers/get-settings.handler.ts index 878e7bd..6b51d34 100644 --- a/src/electron/handlers/get-settings.handler.ts +++ b/src/electron/handlers/get-settings.handler.ts @@ -3,7 +3,6 @@ import { nameofHandler, IpcHandler, ipc } from "~/shared/ipc"; import { saveSettings, getSettings, emptyDir, remountDrive } from "../drive"; import { getCollectPromise } from "./collect-stats.handler"; -import { getUsers } from "../users"; ipcMain.handle( nameofHandler("GET_SETTINGS"), @@ -15,17 +14,6 @@ ipcMain.handle( } ); -ipcMain.handle( - nameofHandler("GET_USERS"), - async ( - event, - ...args: Parameters - ): Promise> => { - const users = await getUsers(); - return Object.values(users); - } -); - ipcMain.handle( nameofHandler("SAVE_SETTINGS"), async ( diff --git a/src/electron/handlers/get-stats-data.handler.ts b/src/electron/handlers/get-stats-data.handler.ts index fd9c8e9..e1eca33 100644 --- a/src/electron/handlers/get-stats-data.handler.ts +++ b/src/electron/handlers/get-stats-data.handler.ts @@ -32,6 +32,9 @@ app.on("ready", () => { ipcMain.on(nameofSends("ON_COLLECT_FINISH"), () => { cache = {}; }); + ipcMain.on(nameofSends("ON_CONFIG_UPDATE_FINISHED"), () => { + cache = {}; + }); }); ipcMain.handle( diff --git a/src/electron/handlers/log.handler.ts b/src/electron/handlers/log.handler.ts index 889719b..268a741 100644 --- a/src/electron/handlers/log.handler.ts +++ b/src/electron/handlers/log.handler.ts @@ -3,21 +3,11 @@ import { nameofHandler, IpcHandler } from "~/shared/ipc"; import { CATCH_LOGS, FILE_LOG_LEVEL, CONSOLE_LOG_LEVEL } from "@env/config"; import readline from "readline"; import fsReverse from "fs-backwards-stream"; +import fs from "fs"; +import "../git-log.hooks"; import log from "electron-log"; -log.hooks.push((message, transport) => { - if ( - message?.data[0]?.includes && - (message?.data[0]?.includes("DeprecationWarning") || - message?.data[0]?.includes("deprecated")) - ) { - return false; - } - - return message; -}); - log.transports.file.level = FILE_LOG_LEVEL; log.transports.console.level = CONSOLE_LOG_LEVEL; @@ -27,7 +17,8 @@ if (CATCH_LOGS) { const levels = ["info", "warn", "error", "verbose", "debug", "silly"]; -export const getLogPathMain = () => log.transports.file.getFile().path; +export const getLogPathMain = () => + log.transports.file.getFile().path.replace("renderer.log", "main.log"); export const getLogPathRenderer = () => log.transports.file.getFile().path.replace("main.log", "renderer.log"); @@ -46,13 +37,52 @@ ipcMain.handle( } ); +ipcMain.handle( + nameofHandler("CLEAR_LOGS"), + async ( + event, + ...args: Parameters + ): Promise> => { + if (await isFileExist(getLogPathMain())) { + await removeFile(getLogPathMain()); + } + if (await isFileExist(getLogPathRenderer())) { + await removeFile(getLogPathRenderer()); + } + } +); + +const isFileExist = (file) => + new Promise((r) => + fs.exists(file, (exists) => { + r(exists); + }) + ); + +const removeFile = (file) => + new Promise((r, e) => + fs.unlink(file, (err) => { + if (err) { + e(err); + } else { + r(); + } + }) + ); + const searchLinesFile = ( search: string, limit: number, file: string ): Promise => { - return new Promise((r) => { + return new Promise(async (r) => { const main: string[] = []; + + if (!(await isFileExist(file))) { + r(main); + return; + } + const lineReader = readline.createInterface({ input: fsReverse(file), }); @@ -92,8 +122,19 @@ ipcMain.handle( let [search, limit] = args; limit = limit || 100; - const main = await searchLinesFile(search, limit, getLogPathMain()); - const renderer = await searchLinesFile(search, limit, getLogPathRenderer()); + let main: string[] = []; + let renderer: string[] = []; + + try { + main = await searchLinesFile(search, limit, getLogPathMain()); + } catch (error) { + console.log(error); + } + try { + renderer = await searchLinesFile(search, limit, getLogPathRenderer()); + } catch (error) { + console.log(error); + } return { main, diff --git a/src/electron/preload.js b/src/electron/preload.js index 3d47e22..5d9a10a 100644 --- a/src/electron/preload.js +++ b/src/electron/preload.js @@ -1,7 +1,9 @@ const { ipcRenderer, remote } = require("electron"); +require("./git-log.hooks"); + window.ipcRenderer = ipcRenderer; window.remote = remote; -// const log = require("electron-log"); -// window.log = log.functions; -// window.console = log.functions; +const log = require("electron-log"); +window.log = log.functions; +window.console = log.functions; diff --git a/src/electron/users.ts b/src/electron/users.ts deleted file mode 100644 index 01c8b67..0000000 --- a/src/electron/users.ts +++ /dev/null @@ -1,135 +0,0 @@ -import { ipcMain, app } from "electron"; -import crypto from "hypercore-crypto"; -import { crypto_generichash, crypto_generichash_BYTES } from "sodium-universal"; -import { UNREGISTERED_SYMBOL, getAuthor } from "./git"; -import { ipc, nameofSends } from "~/shared/ipc"; -import { isExist, readFile, writeFile, parseKey, waitForDrive } from "./drive"; -import { UserConnection } from "~/shared/UserConnection"; -import { getUserSettings } from "./handlers/auth.handler"; - -const USERS_FILE_PATH = "/users.json"; - -let usersCache: { [email: string]: UserConnection } = null; - -export const getUserKey = async (email: string, name: string) => { - const config = await ipc.handlers.GET_CONFIG(); - const user = getAuthor(config.users, email, name); - return ( - (user && user.name) || - `${email.toLowerCase()} ${name.toLowerCase()} ${UNREGISTERED_SYMBOL}` - ); -}; - -app.on("ready", () => { - ipcMain.on(nameofSends("ON_DRIVE_UPDATE"), () => { - usersCache = null; - }); - ipcMain.on(nameofSends("ON_SETTINGS_UPDATE_FINISH"), () => { - usersCache = null; - }); -}); - -const readUserCacheFile = async () => { - await waitForDrive(); - const isCacheFileExist = await isExist(USERS_FILE_PATH); - if (isCacheFileExist) { - return JSON.parse(await readFile(USERS_FILE_PATH)); - } else { - return {}; - } -}; - -const refillUsersCache = async () => { - if (!usersCache) { - const table = await readUserCacheFile(); - usersCache = table || {}; - } -}; - -const saveUsersCache = async () => { - await writeFile(USERS_FILE_PATH, JSON.stringify(usersCache, null, 2)); -}; - -export const getUsers = async () => { - await refillUsersCache(); - return usersCache; -}; - -export const getUserConnection = async ( - email: string, - message: string, - signature: string -) => { - const users = await getUsers(); - const user = users[email]; - const key = Buffer.alloc(crypto_generichash_BYTES); - crypto_generichash(key, message); - if ( - user && - crypto.verify(key, parseKey(signature), parseKey(user.publicKey)) - ) { - return user; - } - return null; -}; - -export const registerUserConnection = async (user: UserConnection) => { - const users = await getUsers(); - if (!user.email || !user.publicKey) { - return; - } - if (users[user.email]) { - return null; - } else { - users[user.email] = user; - await saveUsersCache(); - return user; - } -}; - -export const updateUserConnectionData = async (email: string, name: string) => { - const users = await getUsers(); - if (users[email] && users[email].name !== name) { - users[email].name = name; - await saveUsersCache(); - } -}; - -export const deleteUserConnection = async (email: string) => { - const users = await getUsers(); - delete users[email]; - await saveUsersCache(); -}; - -export const migrateUserConnection = async ( - email: string, - message: string, - signature: string, - newUser: UserConnection -) => { - const users = await getUsers(); - const user = await getUserConnection(email, message, signature); - if (user) { - delete users[email]; - users[newUser.email] = newUser; - await saveUsersCache(); - } -}; - -export const generateMessage = () => crypto.keyPair().publicKey.toString("hex"); - -export const generateUserConnection = (message: string) => { - const user = getUserSettings(); - const key = Buffer.alloc(crypto_generichash_BYTES); - crypto_generichash(key, message); - const signature = crypto - .sign(key, parseKey(user.userSecretKey)) - .toString("hex"); - return { - email: user.email, - name: user.name, - publicKey: user.userPublicKey, - message, - signature, - }; -}; diff --git a/src/hooks.ts b/src/hooks.ts index ef89801..e4a4be5 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -1,7 +1,7 @@ import React from "react"; import { autorun, reaction, isObservableArray, isObservable, toJS } from "mobx"; import localStorage from "mobx-localstorage"; -import { debounce, isEqual } from "underscore"; +import { debounce, isEqual } from "lodash"; import { deepObserve } from "mobx-utils"; import { useLocation } from "react-router"; @@ -44,14 +44,12 @@ export const useOnChange: ( delay?: number ) => void = (state, name, fn, delay = 100) => { React.useEffect(() => { - (delay - ? debounce((value) => fn(value), delay, false) - : (value) => fn(value))(state[name]); + (delay ? debounce((value) => fn(value), delay) : (value) => fn(value))( + state[name] + ); return reaction( () => [state[name]], - delay - ? debounce(([value]) => fn(value), delay, false) - : ([value]) => fn(value) + delay ? debounce(([value]) => fn(value), delay) : ([value]) => fn(value) ); }, [state, name, fn, delay]); }; @@ -127,16 +125,12 @@ export const useSimpleSyncLocalStorage = ( setObservable(state, name, toJS(localValue)); return reaction( () => [localStorage.getItem(key)], - debounce( - ([localValue]) => { - const value = state[name]; - if (!isObservableEquals(localValue, value)) { - setObservable(state, name, localValue); - } - }, - delay, - false - ) + debounce(([localValue]) => { + const value = state[name]; + if (!isObservableEquals(localValue, value)) { + setObservable(state, name, localValue); + } + }, delay) ); }, [state, name, key, delay]); }; @@ -164,16 +158,12 @@ export const useSyncLocalStorage = ( setObservable(state, name, toJS(localValue)); return reaction( () => [localStorage.getItem(key)], - debounce( - ([localValue]) => { - const value = state[name]; - if (!isObservableEquals(localValue, value)) { - setObservable(state, name, localValue); - } - }, - delay, - false - ) + debounce(([localValue]) => { + const value = state[name]; + if (!isObservableEquals(localValue, value)) { + setObservable(state, name, localValue); + } + }, delay) ); }, [state, name, key, delay]); }; diff --git a/src/layout/DefaultNavbar.tsx b/src/layout/DefaultNavbar.tsx index 86040d7..f7bcc6f 100755 --- a/src/layout/DefaultNavbar.tsx +++ b/src/layout/DefaultNavbar.tsx @@ -41,8 +41,8 @@ export const DefaultNavbar = () => { - {context.breadcrumbs.map((breadcrumb) => ( - <> + {context.breadcrumbs.map((breadcrumb, index) => ( + @@ -53,7 +53,7 @@ export const DefaultNavbar = () => { ) : ( {breadcrumb.name} )} - + ))} diff --git a/src/layout/SidebarMiddleNav.tsx b/src/layout/SidebarMiddleNav.tsx index 62d576c..d2995ea 100755 --- a/src/layout/SidebarMiddleNav.tsx +++ b/src/layout/SidebarMiddleNav.tsx @@ -141,15 +141,6 @@ export const SidebarMiddleNav = observer(() => { - {/* -------- Tables ---------*/} - } - title="Tables" - > - - - {/* -------- Apps ---------*/} { {/* Graphs Routes */} - {/* Tables Routes */} - - - {/* Apps Routes */} diff --git a/src/shared/Settings.ts b/src/shared/Settings.ts index d15a310..e386057 100644 --- a/src/shared/Settings.ts +++ b/src/shared/Settings.ts @@ -2,9 +2,4 @@ export interface ApplicationSettings { publicKey: string; secretKey: string; useDriveSwarm: boolean; - communicationKey: string; - email: string; - name: string; - userPublicKey: string; - userSecretKey: string; } diff --git a/src/shared/UserConnection.ts b/src/shared/UserConnection.ts deleted file mode 100644 index abc8ec6..0000000 --- a/src/shared/UserConnection.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface UserConnection { - publicKey: string; - email: string; - name: string; -} diff --git a/src/shared/ipc.ts b/src/shared/ipc.ts index 9a251be..41d3fa9 100644 --- a/src/shared/ipc.ts +++ b/src/shared/ipc.ts @@ -1,7 +1,6 @@ import { Config } from "./Config"; import { Json, JsonCompatible } from "./Json"; import { ApplicationSettings } from "./Settings"; -import { UserConnection } from "./UserConnection"; export const nameof = (name: keyof T) => name; @@ -106,16 +105,11 @@ export interface IpcHandler { }; GET_CONFIG: (force?: boolean) => Config; SAVE_CONFIG: (config: Config) => void; - GET_USER: () => { - email: string; - name: string; - userKey: string; - userPublicKey: string; - }; LOG: ( log: any, level?: "info" | "warn" | "error" | "verbose" | "debug" | "silly" ) => void; + CLEAR_LOGS: () => void; GET_LOGS: ( search: string, limit?: number @@ -139,7 +133,6 @@ export interface IpcHandler { GET_DATA: () => any; GET_SETTINGS: () => ApplicationSettings; SAVE_SETTINGS: (config: ApplicationSettings) => void; - GET_USERS: () => UserConnection[]; REMOUNT_DRIVE: () => void; EMPTY_DRIVE: () => void; GET_ONLINE_USERS: () => string[]; @@ -209,6 +202,10 @@ export const ipc = { ...args: Parameters ): Promise> => ipcRenderer.invoke(nameofHandler("LOG"), ...args), + CLEAR_LOGS: ( + ...args: Parameters + ): Promise> => + ipcRenderer.invoke(nameofHandler("CLEAR_LOGS"), ...args), GET_LOGS: ( ...args: Parameters ): Promise> => @@ -237,10 +234,6 @@ export const ipc = { ...args: Parameters ): Promise> => ipcRenderer.invoke(nameofHandler("SAVE_SETTINGS"), ...args), - GET_USERS: ( - ...args: Parameters - ): Promise> => - ipcRenderer.invoke(nameofHandler("GET_USERS"), ...args), EMPTY_DRIVE: ( ...args: Parameters ): Promise> => @@ -249,10 +242,6 @@ export const ipc = { ...args: Parameters ): Promise> => ipcRenderer.invoke(nameofHandler("REMOUNT_DRIVE"), ...args), - GET_USER: ( - ...args: Parameters - ): Promise> => - ipcRenderer.invoke(nameofHandler("GET_USER"), ...args), GET_ONLINE_USERS: ( ...args: Parameters ): Promise> => diff --git a/src/styles/plugins/_ag-grid.scss b/src/styles/plugins/_ag-grid.scss deleted file mode 100755 index bbf97d1..0000000 --- a/src/styles/plugins/_ag-grid.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "../framework/plugins/ag-grid/ag-grid"; -@import "../framework/plugins/ag-grid/ag-theme-bootstrap"; diff --git a/src/styles/plugins/_font-awesome.scss b/src/styles/plugins/_font-awesome.scss index 90ceee2..304469e 100755 --- a/src/styles/plugins/_font-awesome.scss +++ b/src/styles/plugins/_font-awesome.scss @@ -1,7 +1,3 @@ -// $fa-font-path: "~font-awesome/fonts/"; - -// @import "~font-awesome/scss/font-awesome"; - @import "~@fortawesome/fontawesome-free/scss/fontawesome.scss"; @import "~@fortawesome/fontawesome-free/scss/solid.scss"; @import "~@fortawesome/fontawesome-free/scss/regular.scss"; diff --git a/src/tools.ts b/src/tools.ts index 2607252..c0fdc26 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -1,3 +1,5 @@ +import numeral from "numeral"; + export const numberWithCommas = (x: number) => { - return (x || 0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); + return numeral(x || 0).format("0,0"); }; diff --git a/src/wip/Apps/BillingEdit/BillingEdit.tsx b/src/wip/Apps/BillingEdit/BillingEdit.tsx index 9f83009..487e933 100755 --- a/src/wip/Apps/BillingEdit/BillingEdit.tsx +++ b/src/wip/Apps/BillingEdit/BillingEdit.tsx @@ -15,7 +15,6 @@ import { import { HeaderMain } from "~/app/HeaderMain"; import { ProfileLeftNav } from "~/wip/Profile/ProfileLeftNav"; import { ProfileHeader } from "~/wip/Profile/ProfileHeader"; -import { TrTableBorderless } from "../../Tables/Tables/components/TrTableBorderless"; export const BillingEdit = () => ( @@ -135,9 +134,7 @@ export const BillingEdit = () => ( Receipt - - - + {/* END Table */} diff --git a/src/wip/Apps/SessionsEdit/SessionsEdit.tsx b/src/wip/Apps/SessionsEdit/SessionsEdit.tsx index 783a736..37b605c 100755 --- a/src/wip/Apps/SessionsEdit/SessionsEdit.tsx +++ b/src/wip/Apps/SessionsEdit/SessionsEdit.tsx @@ -11,7 +11,6 @@ import { import { HeaderMain } from "~/app/HeaderMain"; import { ProfileLeftNav } from "~/wip/Profile/ProfileLeftNav"; import { ProfileHeader } from "~/wip/Profile/ProfileHeader"; -import { TrTableResponsive } from "../../Tables/Tables/components/TrTableResponsive"; export const SessionsEdit = () => ( @@ -44,9 +43,7 @@ export const SessionsEdit = () => ( Action - - - + {/* END Table */} diff --git a/src/wip/Interface/Modals/Modals.tsx b/src/wip/Interface/Modals/Modals.tsx index f3c9104..bb1ef02 100755 --- a/src/wip/Interface/Modals/Modals.tsx +++ b/src/wip/Interface/Modals/Modals.tsx @@ -549,7 +549,7 @@ export const Modals = () => ( > - +
Danger

Change a few things up and try submitting. diff --git a/src/wip/Tables/AgGrid/AgGrid.tsx b/src/wip/Tables/AgGrid/AgGrid.tsx deleted file mode 100755 index 4f38d8b..0000000 --- a/src/wip/Tables/AgGrid/AgGrid.tsx +++ /dev/null @@ -1,448 +0,0 @@ -/* eslint-disable no-script-url */ -import React from "react"; -import { chain, reduce } from "lodash"; -import fetch from "node-fetch"; -import { - Container, - Card, - CardFooter, - CardHeader, - Input, - InputGroup, - AgGridReact, - AgGridColumn, -} from "~/components"; -import { HeaderMain } from "~/app/HeaderMain"; -import colors from "~/colors"; - -/* - CONSTS -*/ -const DATA_URL = "https://api.myjson.com/bins/18oni9"; - -const COUNTRY_CODES = { - Ireland: "ie", - Spain: "es", - "United Kingdom": "gb", - France: "fr", - Germany: "de", - Sweden: "se", - Italy: "it", - Greece: "gr", - Iceland: "is", - Portugal: "pt", - Malta: "mt", - Norway: "no", - Brazil: "br", - Argentina: "ar", - Colombia: "co", - Peru: "pe", - Venezuela: "ve", - Uruguay: "uy", -}; - -const IT_SKILLS = ["android", "css", "html5", "mac", "windows"]; -const IT_SKILLS_NAMES = ["Android", "CSS", "HTML 5", "Mac", "Windows"]; - -const PROFICIENCY_NONE = "none"; -const PROFICIENCY_ABOVE40 = "above40"; -const PROFICIENCY_ABOVE60 = "above60"; -const PROFICIENCY_ABOVE80 = "above80"; - -const PROFICIENCY_NAMES = ["No Filter", "Above 40%", "Above 60%", "Above 80%"]; -const PROFICIENCY_VALUES = [ - PROFICIENCY_NONE, - PROFICIENCY_ABOVE40, - PROFICIENCY_ABOVE60, - PROFICIENCY_ABOVE80, -]; - -/* - Custom Renderers -*/ -const nameRenderer = ({ data }) => ` - - ${data.name} - - `; -const skillsCellRenderer = ({ data }) => - chain(IT_SKILLS) - .map((skill) => - data && data.skills[skill] - ? `` - : "" - ) - .compact() - .join(" ") - .value(); -const countryCellRenderer = ({ value }) => ` - ${value} - `; -const percentCellRenderer = ({ value }) => { - const eDivPercentBar = document.createElement("div"); - eDivPercentBar.className = "div-percent-bar"; - eDivPercentBar.style.width = `${value}%`; - if (value < 20) { - eDivPercentBar.style.backgroundColor = colors["danger"]; - } else if (value < 60) { - eDivPercentBar.style.backgroundColor = colors["warning"]; - } else { - eDivPercentBar.style.backgroundColor = colors["success"]; - } - - const eValue = document.createElement("div"); - eValue.className = "div-percent-value"; - eValue.innerHTML = `${value}%`; - - const eOuterDiv = document.createElement("div"); - eOuterDiv.className = "div-outer-div"; - eOuterDiv.appendChild(eDivPercentBar); - eOuterDiv.appendChild(eValue); - - return eOuterDiv; -}; - -/* - Custom Filters -*/ -class SkillFilter { - filterChangedCallback: any; - model: any; - - init({ filterChangedCallback }) { - this.filterChangedCallback = filterChangedCallback; - - // Initial State - this.model = { - android: false, - css: false, - html5: false, - mac: false, - windows: false, - }; - } - getModel() {} - setModel() {} - getGui() { - const eGui = document.createElement("div"); - - const eInstructions = document.createElement("div"); - eInstructions.className = "h6 dropdown-header"; - eInstructions.innerText = "Custom Skills Filter"; - eGui.appendChild(eInstructions); - - const createCheckMarkElement = () => { - var eCheckMark = document.createElement("i"); - eCheckMark.className = "fa fa-check fa-fw ml-auto text-success"; - - return eCheckMark; - }; - - IT_SKILLS.forEach((skill, index) => { - const skillName = IT_SKILLS_NAMES[index]; - - const eFilter = document.createElement("a"); - eFilter.className = "dropdown-item d-flex align-items-center"; - //eFilter.classList.toggle("active", this.model[skill]); - eFilter.href = "javascript:;"; - - const eImg = document.createElement("img"); - eImg.src = "//www.ag-grid.com/images/skills/" + skill + ".png"; - eImg.height = 20; - eImg.className = "mr-2"; - - const eName = document.createElement("span"); - eName.innerText = skillName; - - eFilter.appendChild(eImg); - eFilter.appendChild(eName); - if (this.model[skill]) { - eFilter.appendChild(createCheckMarkElement()); - } - eGui.appendChild(eFilter); - - eFilter.addEventListener("click", (e) => { - const element = e.currentTarget as HTMLAnchorElement; - this.model[skill] = !this.model[skill]; - this.filterChangedCallback(); - - // Toggle check marks - if (this.model[skill]) { - element.appendChild(createCheckMarkElement()); - } else { - const eCheckMark = element.querySelector("i"); - - if (eCheckMark) { - eCheckMark.remove(); - } - } - - return false; - }); - }); - - return eGui; - } - doesFilterPass({ data }) { - const rowSkills = data.skills; - const { model } = this; - - const passed = reduce( - IT_SKILLS, - (acc, skill) => acc || (rowSkills[skill] && model[skill]), - false - ); - - return passed; - } - isFilterActive() { - return ( - this.model.android || - this.model.css || - this.model.html5 || - this.model.mac || - this.model.windows - ); - } -} - -class ProficiencyFilter { - selected: any; - filterChangedCallback: any; - valueGetter: any; - - init({ filterChangedCallback, valueGetter }) { - this.filterChangedCallback = filterChangedCallback; - this.valueGetter = valueGetter; - - this.selected = PROFICIENCY_NONE; - } - getModel() {} - setModel() {} - getGui() { - const eGui = document.createElement("div"); - - const eInstructions = document.createElement("div"); - eInstructions.className = "h6 dropdown-header"; - eInstructions.innerText = "Custom Proficiency Filter"; - eGui.appendChild(eInstructions); - - PROFICIENCY_NAMES.forEach((name, index) => { - const eFilter = document.createElement("a"); - eFilter.className = "dropdown-item"; - eFilter.classList.toggle( - "active", - PROFICIENCY_VALUES[index] === this.selected - ); - eFilter.href = "javascript:;"; - eFilter.innerText = name; - - eGui.appendChild(eFilter); - - eFilter.addEventListener("click", (e) => { - const element = e.currentTarget as HTMLAnchorElement; - element.parentElement.childNodes.forEach((node: any) => { - node.classList.toggle("active", false); - }); - element.classList.toggle("active"); - - this.selected = PROFICIENCY_VALUES[index]; - this.filterChangedCallback(); - - return false; - }); - }); - - return eGui; - } - doesFilterPass(params) { - const value = this.valueGetter(params); - const valueAsNumber = parseFloat(value); - - switch (this.selected) { - case PROFICIENCY_ABOVE40: - return valueAsNumber >= 40; - case PROFICIENCY_ABOVE60: - return valueAsNumber >= 60; - case PROFICIENCY_ABOVE80: - return valueAsNumber >= 80; - default: - return true; - } - } - isFilterActive() { - return this.selected !== PROFICIENCY_NONE; - } -} - -export class AgGridExample extends React.Component { - state = { - rowData: [], - visibleCount: 0, - quickFilterValue: "", - }; - gridApi: any = null; - - componentDidMount() { - fetch(DATA_URL) - .then((res) => res.json()) - .then((fetchedData) => { - this.setState({ rowData: fetchedData }); - }); - } - - componentDidUpdate(prevProps, prevState) { - if (this.gridApi) { - if (this.state.quickFilterValue !== prevState.quickFilterValue) { - this.gridApi.setQuickFilter(this.state.quickFilterValue); - } - } - } - - onModelUpdated = () => { - if (this.gridApi) { - const model = this.gridApi.getModel(); - const visibleCount = model.getRowCount(); - - this.setState({ visibleCount }); - } - }; - - onGridReady = ({ api }) => { - this.gridApi = api; - }; - - onQuickFilterChange = (e) => { - this.setState({ quickFilterValue: e.target.value }); - }; - - render() { - const { rowData, visibleCount, quickFilterValue } = this.state; - - return ( - - -

- Over 2,500 Companies use ag-Grid. The "ag" - part of ag-Grid stands for "agnostic". The internal ag-Grid - engine is implemented in TypeScript with zero dependencies. ag-Grid - supports Angular through a wrapper component. The wrapper lets you use - ag-Grid in your application like any other Angular component – you - pass configuration through property bindings and handle events through - event bindings. You can even use Angular components to customize the - grid UI and cell contents / behavior. -

- - - - AgGrid Example -
- - {visibleCount} / {rowData.length} - - - - - -
-
-
- - - - - - - - - - - - - - - - - - - -
- - More examples of this table can be found{" "} - - Here - - -
- - ); - } -} diff --git a/src/wip/Tables/Tables/Tables.tsx b/src/wip/Tables/Tables/Tables.tsx deleted file mode 100755 index b60074f..0000000 --- a/src/wip/Tables/Tables/Tables.tsx +++ /dev/null @@ -1,424 +0,0 @@ -import React from "react"; - -import { - Container, - Row, - Col, - Card, - CardTitle, - CardBody, - Table, -} from "~/components"; - -import { HeaderMain } from "~/app/HeaderMain"; - -import { HeaderSection } from "~/app/HeaderSection"; - -import { TrTableDefault } from "./components/TrTableDefault"; -import { TrTableResponsive } from "./components/TrTableResponsive"; -import { TrTableStriped } from "./components/TrTableStriped"; -import { TrTableHoverable } from "./components/TrTableHoverable"; -import { TrTableSmall } from "./components/TrTableSmall"; -import { TrTableBorderless } from "./components/TrTableBorderless"; -import { TrTableBordered } from "./components/TrTableBordered"; -import { TrTableHeads } from "./components/TrTableHeads"; -import { TrTableContextual } from "./components/TrTableContextual"; - -export const Tables = () => ( - - - - {/* START Header 1 */} - - - - All table styles are inherited in Bootstrap 4, meaning any - nested tables will be styled in the same manner as the parent. - - } - /> - - - {/* END Header 1 */} - {/* START Section 1 */} - - - - - - Table Default - #1.01 - -

- Using the most basic table markup, here’s how{" "} - .table-based tables look in Bootstrap. All table - styles are inherited in Bootstrap 4, meaning any nested tables - will be styled in the same manner as the parent. -

-
- {/* START Table */} - - - - - - - - - - - - - - -
ProjectDeadlineLeaderBudgetStatusActions
- {/* END Table */} -
- -
- {/* END Section 1 */} - - {/* START Section 2 */} - - - - - - Table Responsive - #2.01 - -

- Responsive tables allow tables to be scrolled horizontally with - ease. Make any table responsive across all viewports by wrapping - a Table with responsive. -

-
- {/* START Table */} - - - - - - - - - - - - - - -
#Browser & OSIPLocationSigned InAction
- {/* END Table */} -
- -
- {/* END Section 2 */} - - {/* START Section 3 */} - - - - - - Table Striped - #3.01 - -

- Use striped to add zebra-striping to any table row - within the <tbody>. -

-
- {/* START Table */} - - - - - - - - - - - - -
#Product NameLast RefreshLast Month
- {/* END Table */} -
- -
- {/* END Section 3 */} - - {/* START Section 4 */} - - - - - - Table Hoverable - #4.01 - -

- Use hover to add zebra-striping to any table row - within the <tbody>. -

-
- {/* START Table */} - - - - - - - - - - - - - - - -
#NamePriceDate
- {/* END Table */} -
- -
- {/* END Section 4 */} - - {/* START Section 5 */} - - - - - - Table Small - #5.01 - -

- Add size="sm" to make tables more compact by - cutting cell padding in half. -

-
- {/* START Table */} - - - - - - - - - - - - -
IDNameAmountPayment
- {/* END Table */} -
- -
- {/* END Section 5 */} - - {/* START Section 6 */} - - - - - - Table Borderless - #6.01 - -

- Add borderless for a table without borders. -

-
- {/* START Table */} - - - - - - - - - - - - - - - -
#IDDateAmountDescriptionPayment MethodReceipt
- {/* END Table */} -
- -
- {/* END Section 6 */} - - {/* START Section 7 */} - - - - - - Table Bordered - #7.01 - -

- Add bordered for borders on all sides of the table - and cells. -

- {/* START Table */} - - - - - - - - - - - - - -
TicketCompletionCreateDeadlineActions
- {/* END Table */} -
-
- -
- {/* END Section 7 */} - - {/* START Section 8 */} - - - - - - Table Heads - #8.01 - -

- Similar to tables and dark tables, use the modifier classes - .thead-light or .thead-dark to make - <thead>s appear light or dark gray. -

-
- {/* START Table */} - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#First NameLast NameEmailNickRole
#First NameLast NameEmailNickRole
- {/* END Table */} -
- -
- {/* END Section 8 */} - - {/* START Section 9 */} - - - - - - Table Contextual - #9.01 - -

- Use contextual classes to color table rows or individual cells. -

-
- {/* START Table */} - - - - - - - - - - - - - - -
InvoiceNameDatePriceStatusCountry
- {/* END Table */} -
- -
- {/* END Section 9 */} - - {/* START Section 10 */} - - - - - - Table Inverse - #1.10 - -

- You can also invert the colors—with light text on dark - backgrounds—with dark. -

-
- {/* START Table */} - - - - - - - - - - - - - - -
ProjectDeadlineLeaderBudgetStatusActions
- {/* END Table */} -
- -
- {/* END Section 10 */} - -
-); diff --git a/src/wip/Tables/Tables/components/TrBorderless.tsx b/src/wip/Tables/Tables/components/TrBorderless.tsx deleted file mode 100755 index 178233a..0000000 --- a/src/wip/Tables/Tables/components/TrBorderless.tsx +++ /dev/null @@ -1,43 +0,0 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ -import React from "react"; -import faker from "faker/locale/en_US"; -import { UncontrolledTooltip, Badge } from "~/components"; - -const TrBorderless = () => ( - - {/* START TR */} - - - - - - {faker.random.number()} - - - {faker.date.weekday()}, 12 {faker.date.month()}, 2018 - - $ {faker.finance.amount()} - - Premium - - - - {faker.internet.email()} - - - - - - - Download - - - - {/* END TR */} - -); - -export { TrBorderless }; diff --git a/src/wip/Tables/Tables/components/TrResponsive.tsx b/src/wip/Tables/Tables/components/TrResponsive.tsx deleted file mode 100755 index 76d45bc..0000000 --- a/src/wip/Tables/Tables/components/TrResponsive.tsx +++ /dev/null @@ -1,60 +0,0 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ -import React from "react"; -import faker from "faker/locale/en_US"; -import { Media, UncontrolledTooltip } from "~/components"; - -const TrResponsive = () => ( - - {/* START TR */} - - - - - - - - - - -
- Safari / - {faker.system.semver()} -
- macOs {faker.system.semver()} -
-
- - -
- {faker.internet.ip()} -
- - - - -
{faker.address.city()}
- - {faker.address.state()}, {faker.address.country()} - - - - {faker.date.weekday()}, 12 {faker.date.month()}, 2018 -
- 12:34 PM - - - - - - - Revoke - - - - {/* END TR */} -
-); - -export { TrResponsive }; diff --git a/src/wip/Tables/Tables/components/TrTableBordered.tsx b/src/wip/Tables/Tables/components/TrTableBordered.tsx deleted file mode 100755 index 2b621b9..0000000 --- a/src/wip/Tables/Tables/components/TrTableBordered.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import React from "react"; -import faker from "faker/locale/en_US"; -import _ from "lodash"; -import { Progress, ButtonGroup, Button } from "~/components"; - -/*eslint-disable */ -const completion = ["25", "50", "75", "97"]; -/*eslint-enable */ - -const TrTableBordered = () => ( - - {_.times(5, (index) => ( - - - {faker.company.catchPhrase()} - - - - - - {faker.date.weekday()}, 12 {faker.date.month()}, 2018 - - - {faker.date.weekday()}, 12 {faker.date.month()}, 2018 - - - - - - - - - ))} - -); - -export { TrTableBordered }; diff --git a/src/wip/Tables/Tables/components/TrTableBorderless.tsx b/src/wip/Tables/Tables/components/TrTableBorderless.tsx deleted file mode 100755 index a59e116..0000000 --- a/src/wip/Tables/Tables/components/TrTableBorderless.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import React from "react"; -import faker from "faker/locale/en_US"; -import _ from "lodash"; -import { Badge, UncontrolledTooltip } from "~/components"; - -/*eslint-disable */ -const payment = [ - Premium, - Basic, - Pro, - Advanced, - Free, -]; -/*eslint-enable */ -/*eslint-disable */ -const receipt = [ - - - - - - Download - - , - , -]; -/*eslint-enable */ -/*eslint-disable */ -const paymentMethod = [ - - - {faker.internet.email()} - , - - - Visa 4*** **** **** 9221 - , -]; -/*eslint-enable */ -/*eslint-disable */ -const status = [ - - - , - - - , -]; -/*eslint-enable */ - -const TrTableBorderless = () => ( - - {_.times(5, (index) => ( - - {status[index % 2]} - - {faker.random.number()} - - - {faker.date.weekday()}, 12 {faker.date.month()}, 2018 - - - $ {faker.finance.amount()} - - {payment[index % 5]} - {paymentMethod[index % 2]} - {receipt[index % 2]} - - ))} - -); - -export { TrTableBorderless }; diff --git a/src/wip/Tables/Tables/components/TrTableContextual.tsx b/src/wip/Tables/Tables/components/TrTableContextual.tsx deleted file mode 100755 index 0cc1c02..0000000 --- a/src/wip/Tables/Tables/components/TrTableContextual.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import React from "react"; -import faker from "faker/locale/en_US"; -import _ from "lodash"; -import { Badge } from "~/components"; - -/*eslint-disable */ -const trColor = [ - "table-active", - "", - - "table-success", - "", - - "table-info", - "", - - "table-warning", - "", - - "table-danger", - "", - - "table-primary", - "", -]; -/*eslint-enable */ -/*eslint-disable */ -const statusColor = [ - "secondary", - "secondary", - - "success", - "secondary", - - "info", - "secondary", - - "warning", - "secondary", - - "danger", - "secondary", - - "primary", - "secondary", -]; -/*eslint-enable */ - -const TrTableContextual = () => ( - - {_.times(12, (index) => ( - - #{faker.finance.mask()} - - {faker.name.firstName()} {faker.name.lastName()} - - - {faker.date.weekday()}, 12 {faker.date.month()}, 2018 - - $ {faker.finance.amount()} - - - {faker.finance.accountName()} - - - {faker.address.country()} - - ))} - -); - -export { TrTableContextual }; diff --git a/src/wip/Tables/Tables/components/TrTableDefault.tsx b/src/wip/Tables/Tables/components/TrTableDefault.tsx deleted file mode 100755 index 560751a..0000000 --- a/src/wip/Tables/Tables/components/TrTableDefault.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import React from "react"; -import faker from "faker/locale/en_US"; -import _ from "lodash"; -import PropTypes from "prop-types"; -import { - UncontrolledButtonDropdown, - DropdownToggle, - DropdownMenu, - DropdownItem, - Media, - AvatarImage, - AvatarAddonIcon, -} from "~/components"; -import { randomAvatar } from "~/utilities"; - -const colorStatus = ["danger", "success", "warning", "secondary"]; - -const TrTableDefault = (props) => ( - - {_.times(4, (index) => ( - - -
- {faker.name.firstName()} {faker.name.lastName()} -
- {faker.company.companyName()} - - -
Thursday
- Overdue - - - - - , - , - ]} - /> - - -
- {faker.name.firstName()} {faker.name.lastName()} -
- {faker.name.jobTitle()} -
-
- - -
{faker.finance.amount()}
- Paid - - - - {faker.finance.transactionType()} - - - - - - - - - - - Send Email - - - - Call - - - - Profile - - - - - - ))} -
-); - -TrTableDefault.propTypes = { - projectColor: PropTypes.node, - leaderStatus: PropTypes.node, - dropdownColor: PropTypes.node, -}; -TrTableDefault.defaultProps = { - projectColor: "text-inverse", - leaderStatus: "white", - dropdownColor: "", -}; - -export { TrTableDefault }; diff --git a/src/wip/Tables/Tables/components/TrTableHeads.tsx b/src/wip/Tables/Tables/components/TrTableHeads.tsx deleted file mode 100755 index e92a62e..0000000 --- a/src/wip/Tables/Tables/components/TrTableHeads.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from "react"; -import faker from "faker/locale/en_US"; -import _ from "lodash"; -import { Badge } from "~/components"; - -const colorStatus = ["danger", "success", "warning", "secondary"]; - -const TrTableHeads = () => ( - - {_.times(4, (index) => ( - - 1 - {faker.name.firstName()} - {faker.name.lastName()} - {faker.internet.email()} - {faker.internet.userName()} - - {faker.name.jobType()} - - - ))} - -); - -export { TrTableHeads }; diff --git a/src/wip/Tables/Tables/components/TrTableHoverable.tsx b/src/wip/Tables/Tables/components/TrTableHoverable.tsx deleted file mode 100755 index da3d19c..0000000 --- a/src/wip/Tables/Tables/components/TrTableHoverable.tsx +++ /dev/null @@ -1,22 +0,0 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ -import React from "react"; -import faker from "faker/locale/en_US"; - -const TrTableHoverable = () => ( - - - - Invoice #{faker.finance.mask()} - - - {faker.name.firstName()} {faker.name.lastName()} - - $ {faker.finance.amount()} - - {faker.date.weekday()}, 12 {faker.date.month()}, 2018 - - - -); - -export { TrTableHoverable }; diff --git a/src/wip/Tables/Tables/components/TrTableResponsive.tsx b/src/wip/Tables/Tables/components/TrTableResponsive.tsx deleted file mode 100755 index 471572a..0000000 --- a/src/wip/Tables/Tables/components/TrTableResponsive.tsx +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable jsx-a11y/anchor-is-valid */ -import React from "react"; -import faker from "faker/locale/en_US"; -import _ from "lodash"; -import { UncontrolledTooltip, Media } from "~/components"; - -const browserOs = ["Safari", "Firefox", "Opera", "Chrome"]; -const browserIcon = ["desktop", "laptop", "mobile", "tablet"]; -const colorStatus = ["danger", "success", "warning", "secondary"]; - -const TrTableResponsive = () => ( - - {_.times(4, (index) => ( - - - - - - - - - - -
- {browserOs[index % 4]} / - {faker.system.semver()} -
- macOs {faker.system.semver()} -
-
- - -
- {faker.internet.ip()} -
- - - - -
{faker.address.city()}
- - {faker.address.state()}, {faker.address.country()} - - - - {faker.date.weekday()}, 12 {faker.date.month()}, 2018 -
- 12:34 PM - - - - - - - Revoke - - - - ))} -
-); - -export { TrTableResponsive }; diff --git a/src/wip/Tables/Tables/components/TrTableSmall.tsx b/src/wip/Tables/Tables/components/TrTableSmall.tsx deleted file mode 100755 index 2a93e05..0000000 --- a/src/wip/Tables/Tables/components/TrTableSmall.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from "react"; -import faker from "faker/locale/en_US"; -import _ from "lodash"; -import { Badge } from "~/components"; - -const payment = ["success", "danger", "warning", "secondary"]; - -const TrTableSmall = () => ( - - {_.times(4, (index) => ( - - #{faker.finance.mask()} - - {faker.name.firstName()} {faker.name.lastName()} - - $ {faker.finance.amount()} - - - {faker.finance.transactionType()} - - - - ))} - -); - -export { TrTableSmall }; diff --git a/src/wip/Tables/Tables/components/TrTableStriped.tsx b/src/wip/Tables/Tables/components/TrTableStriped.tsx deleted file mode 100755 index 8773779..0000000 --- a/src/wip/Tables/Tables/components/TrTableStriped.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import React from "react"; -import faker from "faker/locale/en_US"; -import _ from "lodash"; - -const lastMonth = [ - - 92.02% - , - - 23.02% - , -]; -const no = ["1", "2", "3", "4"]; - -const TrTableStriped = () => ( - - {_.times(4, (index) => ( - - {no[index % 4]}. - - {faker.commerce.productName()} - - - {faker.date.weekday()}, 12 {faker.date.month()}, 2018 - - {lastMonth[index % 2]} - - ))} - -); - -export { TrTableStriped };