open-notebook/frontend/src/lib/theme-script.ts
Luis Novo b7e656a319
Version 1 (#160)
New front-end
Launch Chat API
Manage Sources
Enable re-embedding of all contents
Sources can be added without a notebook now
Improved settings
Enable model selector on all chats
Background processing for better experience
Dark mode
Improved Notes

Improved Docs: 
- Remove all Streamlit references from documentation
- Update deployment guides with React frontend setup
- Fix Docker environment variables format (SURREAL_URL, SURREAL_PASSWORD)
- Update docker image tag from :latest to :v1-latest
- Change navigation references (Settings → Models to just Models)
- Update development setup to include frontend npm commands
- Add MIGRATION.md guide for users upgrading from Streamlit
- Update quick-start guide with correct environment variables
- Add port 5055 documentation for API access
- Update project structure to reflect frontend/ directory
- Remove outdated source-chat documentation files
2025-10-18 12:46:22 -03:00

18 lines
No EOL
777 B
TypeScript

// This script runs before React hydration to prevent theme flash
export const themeScript = `
(function() {
try {
var theme = JSON.parse(localStorage.getItem('theme-storage') || '{}').state?.theme || 'system';
var systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
var effectiveTheme = theme === 'system' ? (systemPrefersDark ? 'dark' : 'light') : theme;
document.documentElement.classList.remove('light', 'dark');
document.documentElement.classList.add(effectiveTheme);
document.documentElement.setAttribute('data-theme', effectiveTheme);
} catch (e) {
// Fallback to light theme
document.documentElement.classList.add('light');
document.documentElement.setAttribute('data-theme', 'light');
}
})();
`