mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 13:55:50 +00:00
Root causes: 1. ThemeProvider was imported but never used in App.tsx and showSetupDialog 2. setThemeConfigCallbacks was never called to inject persistence callbacks 3. Preview/save/cancel theme lifecycle had no provider to coordinate Changes: - Export setThemeConfigCallbacks from @anthropic/ink - Wrap App.tsx children with ThemeProvider (initialState from config, onThemeSave persists) - Wrap showSetupDialog with ThemeProvider for onboarding/trust dialogs - Call setThemeConfigCallbacks in init.ts to register load/save callbacks - Update SnapshotUpdateDialog test to account for new ThemeProvider wrapper Fixes #theme-switching
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import { FpsMetricsProvider } from '../context/fpsMetrics.js';
|
|
import { StatsProvider, type StatsStore } from '../context/stats.js';
|
|
import { type AppState, AppStateProvider } from '../state/AppState.js';
|
|
import { onChangeAppState } from '../state/onChangeAppState.js';
|
|
import type { FpsMetrics } from '../utils/fpsTracker.js';
|
|
import { ThemeProvider } from '@anthropic/ink';
|
|
import { getGlobalConfig, saveGlobalConfig } from '../utils/config.js';
|
|
|
|
type Props = {
|
|
getFpsMetrics: () => FpsMetrics | undefined;
|
|
stats?: StatsStore;
|
|
initialState: AppState;
|
|
children: React.ReactNode;
|
|
};
|
|
|
|
/**
|
|
* Top-level wrapper for interactive sessions.
|
|
* Provides FPS metrics, stats context, and app state to the component tree.
|
|
*/
|
|
export function App({ getFpsMetrics, stats, initialState, children }: Props): React.ReactNode {
|
|
return (
|
|
<FpsMetricsProvider getFpsMetrics={getFpsMetrics}>
|
|
<StatsProvider store={stats}>
|
|
<AppStateProvider initialState={initialState} onChangeAppState={onChangeAppState}>
|
|
<ThemeProvider
|
|
initialState={getGlobalConfig().theme}
|
|
onThemeSave={setting => saveGlobalConfig(current => ({ ...current, theme: setting }))}
|
|
>
|
|
{children}
|
|
</ThemeProvider>
|
|
</AppStateProvider>
|
|
</StatsProvider>
|
|
</FpsMetricsProvider>
|
|
);
|
|
}
|