There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
refactor: remove unused code (#2425)
Himself65d6b640726eea
diff --git a/apps/web/src/providers/theme-provider.tsx b/apps/web/src/providers/theme-provider.tsxindex 4182cf4f9b..ec67f3da41 100644--- a/apps/web/src/providers/theme-provider.tsx+++ b/apps/web/src/providers/theme-provider.tsx@@ -1,4 +1,3 @@-import type { ThemeProviderProps } from '@affine/component';import { ThemeProvider as NextThemeProvider, useTheme } from 'next-themes';import type { PropsWithChildren } from 'react';import { memo, useRef } from 'react';@@ -21,12 +20,9 @@ const DesktopThemeSync = memo(function DesktopThemeSync() {return null;});-export const ThemeProvider = ({- children,- ...props-}: PropsWithChildren<ThemeProviderProps>) => {+export const ThemeProvider = ({ children }: PropsWithChildren) => {return (- <NextThemeProvider themes={themes} enableSystem={true} {...props}>+ <NextThemeProvider themes={themes} enableSystem={true}>{children}<DesktopThemeSync /></NextThemeProvider>diff --git a/packages/component/src/styles/index.ts b/packages/component/src/styles/index.tsindex dfeaa6fb37..575d48515d 100644--- a/packages/component/src/styles/index.ts+++ b/packages/component/src/styles/index.ts@@ -1,5 +1,3 @@export * from './helper';export * from './mui-theme';export * from './mui-theme-provider';-export * from './types';-export * from './utils';diff --git a/packages/component/src/styles/mui-theme-provider.tsx b/packages/component/src/styles/mui-theme-provider.tsxindex de5704b9b1..7d1e11ef4e 100644--- a/packages/component/src/styles/mui-theme-provider.tsx+++ b/packages/component/src/styles/mui-theme-provider.tsx@@ -1,29 +1,3 @@-import { CssBaseline } from '@mui/material';-import {- alpha,- createTheme as createMuiTheme,- css,- keyframes,- styled,- type ThemeOptions,- ThemeProvider as MuiThemeProvider,-} from '@mui/material/styles';-import type { PropsWithChildren } from 'react';-import { useMemo } from 'react';+import { alpha, css, keyframes, styled } from '@mui/material/styles';export { alpha, css, keyframes, styled };--export const AffineMuiThemeProvider = ({- theme,- children,-}: PropsWithChildren<{- theme: ThemeOptions;-}>) => {- const muiTheme = useMemo(() => createMuiTheme(theme), [theme]);- return (- <MuiThemeProvider theme={muiTheme}>- <CssBaseline />- {children}- </MuiThemeProvider>- );-};diff --git a/packages/component/src/styles/mui-theme.ts b/packages/component/src/styles/mui-theme.tsindex 7e515740a4..35da7f787c 100644--- a/packages/component/src/styles/mui-theme.ts+++ b/packages/component/src/styles/mui-theme.ts@@ -1,5 +1,3 @@-import '@emotion/react';-import type {Breakpoint,BreakpointsOptions,diff --git a/packages/component/src/styles/types.ts b/packages/component/src/styles/types.tsdeleted file mode 100644index 13f0721fa8..0000000000--- a/packages/component/src/styles/types.ts+++ /dev/null@@ -1,13 +0,0 @@-import type { AffineTheme } from '@toeverything/theme';--export type ThemeProviderProps = {- defaultTheme?: Theme;-};--export type Theme = 'light' | 'dark';-export type ThemeMode = Theme | 'auto';--declare module '@emotion/react' {- // eslint-disable-next-line @typescript-eslint/no-empty-interface- export interface Theme extends AffineTheme {}-}diff --git a/packages/component/src/styles/utils/index.ts b/packages/component/src/styles/utils/index.tsdeleted file mode 100644index 6e5300c818..0000000000--- a/packages/component/src/styles/utils/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './local-storage-theme-helper';-export * from './system-theme-helper';diff --git a/packages/component/src/styles/utils/local-storage-theme-helper.ts b/packages/component/src/styles/utils/local-storage-theme-helper.tsdeleted file mode 100644index be9961e6ab..0000000000--- a/packages/component/src/styles/utils/local-storage-theme-helper.ts+++ /dev/null@@ -1,13 +0,0 @@-import type { ThemeMode } from '../types';--export class LocalStorageThemeHelper {- name = 'Affine-theme-mode';- get = (): ThemeMode | null => {- return localStorage.getItem(this.name) as ThemeMode | null;- };- set = (mode: ThemeMode) => {- localStorage.setItem(this.name, mode);- };-}--export const localStorageThemeHelper = new LocalStorageThemeHelper();diff --git a/packages/component/src/styles/utils/system-theme-helper.ts b/packages/component/src/styles/utils/system-theme-helper.tsdeleted file mode 100644index 9b817c140f..0000000000--- a/packages/component/src/styles/utils/system-theme-helper.ts+++ /dev/null@@ -1,29 +0,0 @@-import type { Theme } from '../types';--export class SystemThemeHelper {- media: MediaQueryList = window.matchMedia('(prefers-color-scheme: light)');- eventList: Array<(e: Event) => void> = [];- eventHandler = (e: Event) => {- this.eventList.forEach(fn => fn(e));- };-- constructor() {- this.media.addEventListener('change', this.eventHandler);- }-- get = (): Theme => {- if (typeof window === 'undefined') {- return 'light';- }- return this.media.matches ? 'light' : 'dark';- };-- onChange = (callback: () => void) => {- this.eventList.push(callback);- };-- dispose = () => {- this.eventList = [];- this.media.removeEventListener('change', this.eventHandler);- };-}