mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## What kind of change does this PR introduce? Feature — adds keyboard shortcuts for the Realtime section in Studio. ## What is the current behavior? No keyboard shortcuts exist for Realtime navigation or inspector actions. ## What is the new behavior? ### Navigation chords (layout-scoped, active on any Realtime page) | Shortcut | Action | |---|---| | `R I` | Go to Inspector | | `R P` | Go to Policies | | `R S` | Go to Settings | ### Inspector actions (active on the Inspector page) | Shortcut | Action | Gating | |---|---|---| | `Shift+J` | Join a channel | Only when no channel is joined | | `Shift+L` | Start/Stop listening | Only when a channel is joined | | `Shift+F` | Open filter popover | Only when a channel is joined | | `Shift+B` | Broadcast a message | Only when listening | | `Mod+Shift+C` | Copy selected message | Only when a message is selected | <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Realtime Inspector: new keyboard shortcuts (join channel, toggle listening, toggle filters, broadcast) and a copy-message shortcut with toast feedback. * Channel & Filter popovers support controlled/uncontrolled open state; header now wires popover state through props. * Shortcut tooltips added to copy and broadcast actions; realtime page navigation shortcuts and menu shortcuts added. * **Tests** * Shortcut reference sheet tests updated to include realtime navigation and inspector groups. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46001?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>
44 lines
1.6 KiB
TypeScript
44 lines
1.6 KiB
TypeScript
import { SHORTCUT_REFERENCE_GROUPS } from '../referenceGroups'
|
|
import { RegistryDefinations } from '../types'
|
|
|
|
/**
|
|
* Contextual chords for jumping between Realtime sub-pages — `R + <letter>`.
|
|
*
|
|
* Active only while RealtimeLayout is mounted (i.e. the user is somewhere
|
|
* under `/project/<ref>/realtime/*`). Mirrors the database-nav / auth-nav /
|
|
* functions-nav pattern: the leading `R` is layout-scoped so it doesn't burn a
|
|
* global key.
|
|
*/
|
|
export const REALTIME_NAV_SHORTCUT_IDS = {
|
|
NAV_REALTIME_INSPECTOR: 'nav.realtime-inspector',
|
|
NAV_REALTIME_POLICIES: 'nav.realtime-policies',
|
|
NAV_REALTIME_SETTINGS: 'nav.realtime-settings',
|
|
}
|
|
|
|
export type RealtimeNavShortcutId =
|
|
(typeof REALTIME_NAV_SHORTCUT_IDS)[keyof typeof REALTIME_NAV_SHORTCUT_IDS]
|
|
|
|
export const realtimeNavRegistry: RegistryDefinations<RealtimeNavShortcutId> = {
|
|
[REALTIME_NAV_SHORTCUT_IDS.NAV_REALTIME_INSPECTOR]: {
|
|
id: REALTIME_NAV_SHORTCUT_IDS.NAV_REALTIME_INSPECTOR,
|
|
label: 'Go to Inspector',
|
|
sequence: ['R', 'I'],
|
|
showInSettings: false,
|
|
referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_REALTIME,
|
|
},
|
|
[REALTIME_NAV_SHORTCUT_IDS.NAV_REALTIME_POLICIES]: {
|
|
id: REALTIME_NAV_SHORTCUT_IDS.NAV_REALTIME_POLICIES,
|
|
label: 'Go to Policies',
|
|
sequence: ['R', 'P'],
|
|
showInSettings: false,
|
|
referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_REALTIME,
|
|
},
|
|
[REALTIME_NAV_SHORTCUT_IDS.NAV_REALTIME_SETTINGS]: {
|
|
id: REALTIME_NAV_SHORTCUT_IDS.NAV_REALTIME_SETTINGS,
|
|
label: 'Go to Settings',
|
|
sequence: ['R', 'S'],
|
|
showInSettings: false,
|
|
referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_REALTIME,
|
|
},
|
|
}
|