mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-08-09 16:36:40 -07:00
fix(cli): hide read-only settings scopes (#26249)
This commit is contained in:
@@ -73,6 +73,11 @@ export interface BaseSettingsDialogProps {
|
||||
// Scope selector
|
||||
/** Whether to show the scope selector. Default: true */
|
||||
showScopeSelector?: boolean;
|
||||
/** Editable scope items to display. Defaults to all loadable scopes. */
|
||||
scopeItems?: Array<{
|
||||
label: string;
|
||||
value: LoadableSettingScope;
|
||||
}>;
|
||||
/** Currently selected scope */
|
||||
selectedScope: LoadableSettingScope;
|
||||
/** Callback when scope changes */
|
||||
@@ -128,6 +133,7 @@ export function BaseSettingsDialog({
|
||||
searchBuffer,
|
||||
items,
|
||||
showScopeSelector = true,
|
||||
scopeItems: providedScopeItems,
|
||||
selectedScope,
|
||||
onScopeChange,
|
||||
maxItemsToShow,
|
||||
@@ -143,9 +149,19 @@ export function BaseSettingsDialog({
|
||||
}: BaseSettingsDialogProps): React.JSX.Element {
|
||||
const globalKeyMatchers = useKeyMatchers();
|
||||
const keyMatchers = customKeyMatchers ?? globalKeyMatchers;
|
||||
const scopeItems = useMemo(
|
||||
() =>
|
||||
(providedScopeItems ?? getScopeItems()).map((item) => ({
|
||||
...item,
|
||||
key: item.value,
|
||||
})),
|
||||
[providedScopeItems],
|
||||
);
|
||||
const showAvailableScopes = showScopeSelector && scopeItems.length > 1;
|
||||
|
||||
// Calculate effective max items and scope visibility based on terminal height
|
||||
const { effectiveMaxItemsToShow, finalShowScopeSelector } = useMemo(() => {
|
||||
const initialShowScope = showScopeSelector;
|
||||
const initialShowScope = showAvailableScopes;
|
||||
const initialMaxItems = maxItemsToShow;
|
||||
|
||||
if (!availableHeight) {
|
||||
@@ -214,7 +230,7 @@ export function BaseSettingsDialog({
|
||||
maxItemsToShow,
|
||||
items.length,
|
||||
searchEnabled,
|
||||
showScopeSelector,
|
||||
showAvailableScopes,
|
||||
footer,
|
||||
]);
|
||||
|
||||
@@ -248,12 +264,6 @@ export function BaseSettingsDialog({
|
||||
? 'settings'
|
||||
: focusSection;
|
||||
|
||||
// Scope selector items
|
||||
const scopeItems = getScopeItems().map((item) => ({
|
||||
...item,
|
||||
key: item.value,
|
||||
}));
|
||||
|
||||
// Calculate visible items based on scroll offset
|
||||
const visibleItems = items.slice(
|
||||
windowStart,
|
||||
|
||||
Reference in New Issue
Block a user