diff options
| author | Ali Al Jufairi <[email protected]> | 2025-08-10 09:04:52 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-10 00:04:52 +0000 |
| commit | 8a9a9275440e3681e9be73d741a5aba429ae501f (patch) | |
| tree | cc2c17101c57d0c34049a6ee390d0f1b9bf38018 /packages/cli/src/ui/components/ThemeDialog.tsx | |
| parent | c632ec8b03ac5b459da9ccb041b9fca19252f69b (diff) | |
feat(ui): add /settings command and UI panel (#4738)
Co-authored-by: Jacob Richman <[email protected]>
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; |
