Spaces:
Sleeping
Sleeping
| import { atom } from 'nanostores'; | |
| import { logStore } from './logs'; | |
| export type Theme = 'dark'; | |
| export const kTheme = 'bolt_theme'; | |
| export function themeIsDark() { | |
| return true; // Always return true since we only support dark mode | |
| } | |
| export const DEFAULT_THEME = 'dark'; | |
| export const themeStore = atom<Theme>(initStore()); | |
| function initStore(): Theme { | |
| if (!import.meta.env.SSR) { | |
| // Always force dark mode - ignore any persisted theme settings | |
| document.querySelector('html')?.setAttribute('data-theme', 'dark'); | |
| // Clean up any old theme settings from localStorage | |
| localStorage.removeItem(kTheme); | |
| // Update user profile to remove theme settings | |
| try { | |
| const userProfile = localStorage.getItem('bolt_user_profile'); | |
| if (userProfile) { | |
| const profile = JSON.parse(userProfile); | |
| delete profile.theme; | |
| localStorage.setItem('bolt_user_profile', JSON.stringify(profile)); | |
| } | |
| } catch (error) { | |
| console.error('Error cleaning up user profile theme:', error); | |
| } | |
| return 'dark' as Theme; | |
| } | |
| return DEFAULT_THEME as Theme; | |
| } | |
| // Removed toggleTheme function since we only support dark mode | |