feat: Modify the selection order of user Settings and workspace Settings

This commit is contained in:
刘伟光 2026-01-08 11:36:07 +08:00
parent 6319a6ed56
commit 509d304742
5 changed files with 40 additions and 16 deletions

View file

@ -14,7 +14,7 @@ import type { LoadedSettings } from '../../config/settings.js';
import { SettingScope } from '../../config/settings.js';
import { getScopeMessageForSetting } from '../../utils/dialogScopeUtils.js';
import { useKeypress } from '../hooks/useKeypress.js';
import { ScopeSelector } from './shared/ScopeSelector.js';
// import { ScopeSelector } from './shared/ScopeSelector.js';
import { t } from '../../i18n/index.js';
interface ApprovalModeDialogProps {
@ -57,6 +57,23 @@ export function ApprovalModeDialog({
SettingScope.Workspace,
);
const scopeItems = [
{
get label() {
return t('Workspace Settings');
},
value: SettingScope.Workspace,
key: SettingScope.Workspace,
},
{
get label() {
return t('User Settings');
},
value: SettingScope.User,
key: SettingScope.User,
},
];
// Track the currently highlighted approval mode
const [highlightedMode, setHighlightedMode] = useState<ApprovalMode>(
currentMode || ApprovalMode.DEFAULT,
@ -86,13 +103,14 @@ export function ApprovalModeDialog({
setHighlightedMode(mode);
};
const handleScopeHighlight = useCallback((scope: SettingScope) => {
setSelectedScope(scope);
}, []);
// const handleScopeHighlight = useCallback((scope: SettingScope) => {
// setSelectedScope(scope);
// }, []);
const handleScopeSelect = useCallback(
(scope: SettingScope) => {
onSelect(highlightedMode, scope);
setSelectedScope(scope);
},
[onSelect, highlightedMode],
);
@ -155,11 +173,17 @@ export function ApprovalModeDialog({
{/* Scope Selection */}
<Box marginTop={1}>
<ScopeSelector
{/* <ScopeSelector
onSelect={handleScopeSelect}
onHighlight={handleScopeHighlight}
isFocused={focusSection === 'scope'}
initialScope={selectedScope}
/> */}
<RadioButtonSelect
items={scopeItems}
initialIndex={0}
onSelect={handleScopeSelect}
isFocused={focusSection === 'scope'}
/>
</Box>

View file

@ -33,7 +33,7 @@ export function EditorSettingsDialog({
onExit,
}: EditorDialogProps): React.JSX.Element {
const [selectedScope, setSelectedScope] = useState<SettingScope>(
SettingScope.Workspace,
SettingScope.User,
);
const [focusedSection, setFocusedSection] = useState<'editor' | 'scope'>(
'editor',
@ -66,13 +66,6 @@ export function EditorSettingsDialog({
}
const scopeItems = [
{
get label() {
return t('Workspace Settings');
},
value: SettingScope.Workspace,
key: SettingScope.Workspace,
},
{
get label() {
return t('User Settings');
@ -80,6 +73,13 @@ export function EditorSettingsDialog({
value: SettingScope.User,
key: SettingScope.User,
},
{
get label() {
return t('Workspace Settings');
},
value: SettingScope.Workspace,
key: SettingScope.Workspace,
},
];
const handleEditorSelect = (editorType: EditorType | 'not_set') => {

View file

@ -63,7 +63,7 @@ export function SettingsDialog({
);
// Scope selector state (User by default)
const [selectedScope, setSelectedScope] = useState<SettingScope>(
SettingScope.Workspace,
SettingScope.User,
);
// Active indices
const [activeSettingIndex, setActiveSettingIndex] = useState(0);

View file

@ -39,7 +39,7 @@ export function ThemeDialog({
terminalWidth,
}: ThemeDialogProps): React.JSX.Element {
const [selectedScope, setSelectedScope] = useState<SettingScope>(
SettingScope.Workspace,
SettingScope.User,
);
// Track the currently highlighted theme name