feat: band NC folder config, fix watcher event filter, add light/dark theme
- Add PATCH /bands/{id} endpoint for admins to update nc_folder_path
- Add band NC scan folder UI panel with inline edit
- Fix watcher: use activity type field (not human-readable subject) for upload detection
- Reorder watcher filters: audio extension check first, then band path, then type
- Add dark/light theme toggle using GitHub Primer-inspired CSS custom properties
- All inline styles migrated to CSS variables for theme-awareness
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
30
web/src/theme.ts
Normal file
30
web/src/theme.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { createContext, useContext, useState, useEffect, type ReactNode } from "react";
|
||||
import { createElement } from "react";
|
||||
|
||||
type Theme = "dark" | "light";
|
||||
|
||||
interface ThemeCtx {
|
||||
theme: Theme;
|
||||
toggle: () => void;
|
||||
}
|
||||
|
||||
const ThemeContext = createContext<ThemeCtx>({ theme: "dark", toggle: () => {} });
|
||||
|
||||
export function ThemeProvider({ children }: { children: ReactNode }) {
|
||||
const [theme, setTheme] = useState<Theme>(() => {
|
||||
return (localStorage.getItem("rh_theme") as Theme) ?? "dark";
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
document.documentElement.dataset.theme = theme;
|
||||
localStorage.setItem("rh_theme", theme);
|
||||
}, [theme]);
|
||||
|
||||
const toggle = () => setTheme((t) => (t === "dark" ? "light" : "dark"));
|
||||
|
||||
return createElement(ThemeContext.Provider, { value: { theme, toggle } }, children);
|
||||
}
|
||||
|
||||
export function useTheme(): ThemeCtx {
|
||||
return useContext(ThemeContext);
|
||||
}
|
||||
Reference in New Issue
Block a user