feat(web): init feature flags + kill switch on startup, fix hardcoded colors

- Providers.tsx now calls initFeatureFlags() and checkKillSwitch()
  on mount (both were wired but never initialized).
- globals.css: replace hardcoded #0b1020 with color-mix() from canvas token.
- layout.tsx: make themeColor responsive (dark/light media queries).
- use-theme.ts: prefix localStorage key with PRODUCT_ID for consistency.
This commit is contained in:
saravanakumardb1 2026-04-13 09:59:54 -07:00
parent 4246d58798
commit 58a778bc1e
4 changed files with 13 additions and 4 deletions

View File

@ -14,7 +14,7 @@ html {
body {
margin: 0;
min-height: 100vh;
background: linear-gradient(180deg, var(--nl-bg-canvas) 0%, #0b1020 100%);
background: linear-gradient(180deg, var(--nl-bg-canvas) 0%, color-mix(in srgb, var(--nl-bg-canvas) 70%, black) 100%);
color: var(--nl-text-primary);
font-family: var(--nl-font-body);
-webkit-font-smoothing: antialiased;

View File

@ -24,7 +24,10 @@ export const metadata: Metadata = {
export const viewport: Viewport = {
width: "device-width",
initialScale: 1,
themeColor: "#06070A",
themeColor: [
{ media: "(prefers-color-scheme: dark)", color: "#06070A" },
{ media: "(prefers-color-scheme: light)", color: "#F8FAFC" },
],
};
export default function RootLayout({

View File

@ -6,12 +6,16 @@ import { Toaster } from "sonner";
import { AuthProvider } from "@/lib/auth";
import { initDiagnostics } from "@/lib/diagnostics";
import { initTelemetry } from "@/lib/telemetry";
import { initFeatureFlags } from "@/lib/feature-flags";
import { checkKillSwitch } from "@/lib/kill-switch";
import { flushOfflineQueue } from "@/lib/offline-queue";
export function Providers({ children }: { children: ReactNode }) {
useEffect(() => {
initTelemetry();
initDiagnostics();
initFeatureFlags().catch(() => {});
checkKillSwitch().catch(() => {});
flushOfflineQueue().catch(() => {});
}, []);

View File

@ -1,14 +1,16 @@
'use client';
import { useState, useEffect, useCallback } from 'react';
import { PRODUCT_ID } from '@/lib/product-config';
type Theme = 'dark' | 'light';
const STORAGE_KEY = `${PRODUCT_ID}_theme`;
export function useTheme() {
const [theme, setThemeState] = useState<Theme>('dark');
useEffect(() => {
const stored = localStorage.getItem('theme') as Theme | null;
const stored = localStorage.getItem(STORAGE_KEY) as Theme | null;
const initial = stored ?? 'dark';
setThemeState(initial);
document.documentElement.setAttribute('data-theme', initial);
@ -16,7 +18,7 @@ export function useTheme() {
const setTheme = useCallback((t: Theme) => {
setThemeState(t);
localStorage.setItem('theme', t);
localStorage.setItem(STORAGE_KEY, t);
document.documentElement.setAttribute('data-theme', t);
}, []);