From d7299e36439c4b871fa9dea0a95c7945f87698d0 Mon Sep 17 00:00:00 2001 From: Found Pan Tiger Date: Fri, 25 Jun 2021 13:47:13 +0800 Subject: [PATCH] remove some files --- src/layouts/index.tsx | 100 ------------------------------------------ src/utils/deferred.ts | 60 ------------------------- 2 files changed, 160 deletions(-) delete mode 100644 src/layouts/index.tsx delete mode 100644 src/utils/deferred.ts diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx deleted file mode 100644 index 3f293092..00000000 --- a/src/layouts/index.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import { useEffect, useState } from 'react' -import { initializeIcons, loadTheme, ITheme } from '@fluentui/react' -import { Provider } from 'react-redux' -import Editor from '@monaco-editor/react' - -import { DatabaseNav } from '@/components/database-nav' -import { store } from '@/stores/index' -import { TopPivot } from '@/components/pure/top-pivot' -import { useDarkMode } from '@/hooks/use-dark-mode' - -initializeIcons() - -export default (props: { children: React.ReactNode }) => { - const isDarkMode = useDarkMode() - const [theme, setTheme] = useState() - useEffect(() => { - setTheme( - loadTheme({ - palette: isDarkMode - ? { - themePrimary: '#258ede', - themeLighterAlt: '#020609', - themeLighter: '#061723', - themeLight: '#0b2b43', - themeTertiary: '#175585', - themeSecondary: '#217dc3', - themeDarkAlt: '#3998e1', - themeDark: '#55a7e6', - themeDarker: '#7fbdec', - neutralLighterAlt: '#3c3c3c', - neutralLighter: '#444444', - neutralLight: '#515151', - neutralQuaternaryAlt: '#595959', - neutralQuaternary: '#5f5f5f', - neutralTertiaryAlt: '#7a7a7a', - neutralTertiary: '#c8c8c8', - neutralSecondary: '#d0d0d0', - neutralPrimaryAlt: '#dadada', - neutralPrimary: '#ffffff', - neutralDark: '#f4f4f4', - black: '#f8f8f8', - white: '#333333', - } - : { - themePrimary: '#0078d4', - themeLighterAlt: '#eff6fc', - themeLighter: '#deecf9', - themeLight: '#c7e0f4', - themeTertiary: '#71afe5', - themeSecondary: '#2b88d8', - themeDarkAlt: '#106ebe', - themeDark: '#005a9e', - themeDarker: '#004578', - neutralLighterAlt: '#f8f8f8', - neutralLighter: '#f4f4f4', - neutralLight: '#eaeaea', - neutralQuaternaryAlt: '#dadada', - neutralQuaternary: '#d0d0d0', - neutralTertiaryAlt: '#c8c8c8', - neutralTertiary: '#c2c2c2', - neutralSecondary: '#858585', - neutralPrimaryAlt: '#4b4b4b', - neutralPrimary: '#333333', - neutralDark: '#272727', - black: '#1d1d1d', - white: '#ffffff', - }, - }), - ) - }, [isDarkMode]) - - return ( - -
- {/* init colorize */} - -
-
-
- -
- - {props.children} -
-
-
-
- ) -} diff --git a/src/utils/deferred.ts b/src/utils/deferred.ts deleted file mode 100644 index b3cb37e2..00000000 --- a/src/utils/deferred.ts +++ /dev/null @@ -1,60 +0,0 @@ -export class Deferred { - public promise: Promise - - private fate: 'resolved' | 'unresolved' - - private state: 'pending' | 'fulfilled' | 'rejected' - - #resolve: Function | undefined - - #reject: Function | undefined - - constructor() { - this.state = 'pending' - this.fate = 'unresolved' - this.promise = new Promise((resolve, reject) => { - this.#resolve = resolve - this.#reject = reject - }) - this.promise.then( - () => { - this.state = 'fulfilled' - }, - () => { - this.state = 'rejected' - }, - ) - } - - resolve(value?: any) { - if (this.fate === 'resolved') { - throw new Error('Deferred cannot be resolved twice') - } - this.fate = 'resolved' - this.#resolve?.(value) - } - - reject(reason?: any) { - if (this.fate === 'resolved') { - throw new Error('Deferred cannot be resolved twice') - } - this.fate = 'resolved' - this.#reject?.(reason) - } - - isResolved() { - return this.fate === 'resolved' - } - - isPending() { - return this.state === 'pending' - } - - isFulfilled() { - return this.state === 'fulfilled' - } - - isRejected() { - return this.state === 'rejected' - } -}