diff --git a/src/App.tsx b/src/App.tsx index 52b65c8..836ab45 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -17,11 +17,13 @@ import SettingsView from './components/SettingsView'; import { MOCK_MEDIA, DETAIL_MEDIA } from './data'; import { Media, Staff, MediaCategory, UserSettings } from './types'; import { fetchAllMedia, fetchMediaById, fetchCastById, convertApiCastToStaff, fetchSettings, updateSettings } from './api'; +import { ThemeProvider, useTheme } from './contexts/ThemeContext'; function AppContent() { const navigate = useNavigate(); const location = useLocation(); const [searchParams, setSearchParams] = useSearchParams(); + const { setTheme } = useTheme(); const [activeCategory, setActiveCategory] = useState( (searchParams.get('category') as MediaCategory) || 'Anime' ); @@ -43,6 +45,8 @@ function AppContent() { if (loadedSettings) { setSettings(loadedSettings); setEnabledCategories(loadedSettings.enabledCategories); + // Sync theme with theme context + setTheme(loadedSettings.theme); } } catch (error) { console.error('Failed to load settings from API:', error); @@ -50,7 +54,7 @@ function AppContent() { }; loadSettingsFromApi(); - }, []); + }, [setTheme]); const reloadSettings = async () => { try { @@ -58,6 +62,8 @@ function AppContent() { if (loadedSettings) { setSettings(loadedSettings); setEnabledCategories(loadedSettings.enabledCategories); + // Sync theme with theme context + setTheme(loadedSettings.theme); } } catch (error) { console.error('Failed to reload settings from API:', error); @@ -270,7 +276,7 @@ function AppContent() { }; return ( -
+
} /> @@ -329,18 +336,18 @@ function AppContent() { {/* Footer */} -