mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-31 03:12:16 +00:00
34 lines
966 B
TypeScript
34 lines
966 B
TypeScript
import { StrictMode } from 'react';
|
|
import { createRoot } from 'react-dom/client';
|
|
import { BrowserRouter } from 'react-router';
|
|
import { ErrorBoundary } from './components/ErrorBoundary';
|
|
import App from './App';
|
|
import './index.css';
|
|
|
|
function applyTheme() {
|
|
try {
|
|
const raw = localStorage.getItem('openjarvis-settings');
|
|
const settings = raw ? JSON.parse(raw) : {};
|
|
const theme = settings.theme || 'system';
|
|
if (theme === 'dark') {
|
|
document.documentElement.classList.add('dark');
|
|
document.documentElement.classList.remove('light');
|
|
} else if (theme === 'light') {
|
|
document.documentElement.classList.add('light');
|
|
document.documentElement.classList.remove('dark');
|
|
}
|
|
} catch { /* use system default */ }
|
|
}
|
|
|
|
applyTheme();
|
|
|
|
createRoot(document.getElementById('root')!).render(
|
|
<StrictMode>
|
|
<ErrorBoundary>
|
|
<BrowserRouter>
|
|
<App />
|
|
</BrowserRouter>
|
|
</ErrorBoundary>
|
|
</StrictMode>,
|
|
);
|