diff options
Diffstat (limited to 'packages/cli/src/ui/components/ThemeDialog.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/ThemeDialog.tsx | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/packages/cli/src/ui/components/ThemeDialog.tsx b/packages/cli/src/ui/components/ThemeDialog.tsx index 7c38bb4b..37663447 100644 --- a/packages/cli/src/ui/components/ThemeDialog.tsx +++ b/packages/cli/src/ui/components/ThemeDialog.tsx @@ -12,6 +12,10 @@ import { RadioButtonSelect } from './shared/RadioButtonSelect.js'; import { DiffRenderer } from './messages/DiffRenderer.js'; import { colorizeCode } from '../utils/CodeColorizer.js'; import { LoadedSettings, SettingScope } from '../../config/settings.js'; +import { + getScopeItems, + getScopeMessageForSetting, +} from '../../utils/dialogScopeUtils.js'; interface ThemeDialogProps { /** Callback function when a theme is selected */ @@ -76,11 +80,7 @@ export function ThemeDialog({ // If not found, fall back to the first theme const safeInitialThemeIndex = initialThemeIndex >= 0 ? initialThemeIndex : 0; - const scopeItems = [ - { label: 'User Settings', value: SettingScope.User }, - { label: 'Workspace Settings', value: SettingScope.Workspace }, - { label: 'System Settings', value: SettingScope.System }, - ]; + const scopeItems = getScopeItems(); const handleThemeSelect = useCallback( (themeName: string) => { @@ -120,23 +120,13 @@ export function ThemeDialog({ } }); - const otherScopes = Object.values(SettingScope).filter( - (scope) => scope !== selectedScope, - ); - - const modifiedInOtherScopes = otherScopes.filter( - (scope) => settings.forScope(scope).settings.theme !== undefined, + // Generate scope message for theme setting + const otherScopeModifiedMessage = getScopeMessageForSetting( + 'theme', + selectedScope, + settings, ); - let otherScopeModifiedMessage = ''; - if (modifiedInOtherScopes.length > 0) { - const modifiedScopesStr = modifiedInOtherScopes.join(', '); - otherScopeModifiedMessage = - settings.forScope(selectedScope).settings.theme !== undefined - ? `(Also modified in ${modifiedScopesStr})` - : `(Modified in ${modifiedScopesStr})`; - } - // Constants for calculating preview pane layout. // These values are based on the JSX structure below. const PREVIEW_PANE_WIDTH_PERCENTAGE = 0.55; |
