Files
supabase/apps/studio/components/interfaces/Account/Preferences/HotkeySettings.tsx
Ali Waseem a7341c70ea feat(shortcuts): add showInSettings flag to ShortcutDefinition (#44997)
Closes
[FE-3021](https://linear.app/supabase/issue/FE-3021/hide-shortcut-in-settings-option-for-new-api).

## Summary
- Adds an optional `showInSettings` field to `ShortcutDefinition`
(defaults to `true`).
- `HotkeySettings` filters out entries where `showInSettings === false`
before rendering the Account → Preferences → Keyboard shortcuts list.
- No registry entries are flipped in this PR — opt-in per shortcut as
needed.

## Test plan
- [x] Confirm all existing shortcuts still appear under Account →
Preferences → Keyboard shortcuts.
- [x] Temporarily set `showInSettings: false` on one entry and verify it
disappears from the list.
- [x] `pnpm --filter studio exec tsc --noEmit` passes.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Keyboard shortcuts can now be selectively hidden from the Account
preferences settings based on configuration.

* **Refactor**
* Updated keyboard shortcut filtering logic to respect visibility
settings.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-17 10:31:39 -06:00

43 lines
1.2 KiB
TypeScript

import { Card } from 'ui'
import {
PageSection,
PageSectionContent,
PageSectionDescription,
PageSectionMeta,
PageSectionSummary,
PageSectionTitle,
} from 'ui-patterns/PageSection'
import { HotkeyToggle } from './HotkeyToggle'
import { SHORTCUT_DEFINITIONS } from '@/state/shortcuts/registry'
const SHORTCUT_ORDER = Object.values(SHORTCUT_DEFINITIONS).filter(
(definition) => definition.showInSettings !== false
)
export const HotkeySettings = () => {
return (
<PageSection>
<PageSectionMeta>
<PageSectionSummary>
<PageSectionTitle id="keyboard-shortcuts">Keyboard shortcuts</PageSectionTitle>
<PageSectionDescription>
Choose which shortcuts stay active while working in the dashboard.
</PageSectionDescription>
</PageSectionSummary>
</PageSectionMeta>
<PageSectionContent>
<Card>
{SHORTCUT_ORDER.map((definition, index) => (
<HotkeyToggle
key={definition.id}
definition={definition}
isLast={index === SHORTCUT_ORDER.length - 1}
/>
))}
</Card>
</PageSectionContent>
</PageSection>
)
}