Database diagrams editor that allows you to visualize and design your DB with a single query.
TypeScript databasedbdb-migrationeditorerdmariadbmssqlmysqlpostgresqlreactreact-flowschema-migrationssqlsqlitetypescriptvisualizationxyflow
some type fixes
Guy Ben-Aharon9cb5f97ae6ac
diff --git a/src/context/theme-context/theme-context.tsx b/src/context/theme-context/theme-context.tsxindex 93f6f81a..df1a62c7 100644--- a/src/context/theme-context/theme-context.tsx+++ b/src/context/theme-context/theme-context.tsx@@ -1,15 +1,17 @@import { createContext } from 'react';+import { emptyFn } from '@/lib/utils';-type ThemeType = 'light' | 'dark' | 'system';+export type ThemeType = 'light' | 'dark' | 'system';+export type EffectiveThemeType = Exclude<ThemeType, 'system'>;export interface ThemeContext {theme: ThemeType;setTheme: (theme: ThemeType) => void;- effectiveTheme: 'light' | 'dark';+ effectiveTheme: EffectiveThemeType;}export const ThemeContext = createContext<ThemeContext>({theme: 'system',- setTheme: () => {},+ setTheme: emptyFn,effectiveTheme: 'light',});diff --git a/src/context/theme-context/theme-provider.tsx b/src/context/theme-context/theme-provider.tsxindex 336aca13..aeffbf63 100644--- a/src/context/theme-context/theme-provider.tsx+++ b/src/context/theme-context/theme-provider.tsx@@ -1,13 +1,8 @@import React, { useEffect, useState } from 'react';-import { ThemeContext } from './theme-context';+import { EffectiveThemeType, ThemeContext, ThemeType } from './theme-context';-type ThemeType = 'light' | 'dark' | 'system';--const getSystemTheme = (): 'light' | 'dark' => {- if (- typeof window !== 'undefined' &&- window.matchMedia('(prefers-color-scheme: dark)').matches- ) {+const getSystemTheme = (): EffectiveThemeType => {+ if (window.matchMedia('(prefers-color-scheme: dark)').matches) {return 'dark';}return 'light';@@ -17,18 +12,12 @@ export const ThemeProvider: React.FC<React.PropsWithChildren> = ({children,}) => {const [theme, setTheme] = useState<ThemeType>(() => {- if (typeof window !== 'undefined') {- const savedTheme = localStorage.getItem(- 'theme'- ) as ThemeType | null;- return savedTheme || 'system';- }- return 'system';+ const savedTheme = localStorage.getItem('theme') as ThemeType | null;+ return savedTheme || 'system';});- const [effectiveTheme, setEffectiveTheme] = useState<'light' | 'dark'>(- getSystemTheme()- );+ const [effectiveTheme, setEffectiveTheme] =+ useState<EffectiveThemeType>(getSystemTheme());useEffect(() => {const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');