mirror of
https://github.com/supabase/supabase.git
synced 2026-05-22 17:00:43 +08:00
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 -->
43 lines
1.2 KiB
TypeScript
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>
|
|
)
|
|
}
|