feat: Initialize the Electron frontend with core UI components and integrate Convex backend services.

This commit is contained in:
Bryan1029384756
2026-02-10 18:29:42 -06:00
parent 34e9790db9
commit 17790afa9b
64 changed files with 149216 additions and 628 deletions

View File

@@ -0,0 +1,42 @@
import React, { createContext, useContext, useState, useEffect } from 'react';
const STORAGE_KEY = 'discord-theme';
export const THEMES = {
LIGHT: 'theme-light',
DARK: 'theme-dark',
ASH: 'theme-darker',
ONYX: 'theme-midnight',
};
export const THEME_LABELS = {
[THEMES.LIGHT]: 'Light',
[THEMES.DARK]: 'Dark',
[THEMES.ASH]: 'Ash',
[THEMES.ONYX]: 'Onyx',
};
const ThemeContext = createContext();
export function ThemeProvider({ children }) {
const [theme, setTheme] = useState(() => {
return localStorage.getItem(STORAGE_KEY) || THEMES.DARK;
});
useEffect(() => {
document.documentElement.className = theme;
localStorage.setItem(STORAGE_KEY, theme);
}, [theme]);
return (
<ThemeContext.Provider value={{ theme, setTheme, THEMES, THEME_LABELS }}>
{children}
</ThemeContext.Provider>
);
}
export function useTheme() {
const ctx = useContext(ThemeContext);
if (!ctx) throw new Error('useTheme must be used within ThemeProvider');
return ctx;
}