Files
supabase/apps/studio/state/shortcuts/registry/realtime-inspector.ts
Ali WaseemandDanny White 3d9fb2f98d feat(realtime): shortcuts for realtime (#46001)
## 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 -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](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>
2026-05-19 11:12:54 -06:00

58 lines
2.2 KiB
TypeScript

import { RegistryDefinations } from '../types'
/**
* Shortcuts scoped to the Realtime Inspector page.
*
* Active only while the inspector is mounted. All use `Shift+<letter>` to
* avoid conflicting with the global `Mod+` shortcuts and the multi-step nav
* chords.
*/
export const REALTIME_INSPECTOR_SHORTCUT_IDS = {
INSPECTOR_JOIN_CHANNEL: 'realtime-inspector.join-channel',
INSPECTOR_TOGGLE_LISTENING: 'realtime-inspector.toggle-listening',
INSPECTOR_TOGGLE_FILTERS: 'realtime-inspector.toggle-filters',
INSPECTOR_BROADCAST: 'realtime-inspector.broadcast',
INSPECTOR_COPY_MESSAGE: 'realtime-inspector.copy-message',
}
export type RealtimeInspectorShortcutId =
(typeof REALTIME_INSPECTOR_SHORTCUT_IDS)[keyof typeof REALTIME_INSPECTOR_SHORTCUT_IDS]
export const realtimeInspectorRegistry: RegistryDefinations<RealtimeInspectorShortcutId> = {
[REALTIME_INSPECTOR_SHORTCUT_IDS.INSPECTOR_JOIN_CHANNEL]: {
id: REALTIME_INSPECTOR_SHORTCUT_IDS.INSPECTOR_JOIN_CHANNEL,
label: 'Join a channel',
sequence: ['Shift+J'],
showInSettings: false,
options: { ignoreInputs: true, registerInCommandMenu: true },
},
[REALTIME_INSPECTOR_SHORTCUT_IDS.INSPECTOR_TOGGLE_LISTENING]: {
id: REALTIME_INSPECTOR_SHORTCUT_IDS.INSPECTOR_TOGGLE_LISTENING,
label: 'Start/Stop listening',
sequence: ['Shift+L'],
showInSettings: false,
options: { ignoreInputs: true, registerInCommandMenu: true },
},
[REALTIME_INSPECTOR_SHORTCUT_IDS.INSPECTOR_TOGGLE_FILTERS]: {
id: REALTIME_INSPECTOR_SHORTCUT_IDS.INSPECTOR_TOGGLE_FILTERS,
label: 'Toggle filters',
sequence: ['Shift+F'],
showInSettings: false,
options: { ignoreInputs: true, registerInCommandMenu: true },
},
[REALTIME_INSPECTOR_SHORTCUT_IDS.INSPECTOR_BROADCAST]: {
id: REALTIME_INSPECTOR_SHORTCUT_IDS.INSPECTOR_BROADCAST,
label: 'Broadcast a message',
sequence: ['Shift+B'],
showInSettings: false,
options: { ignoreInputs: true, registerInCommandMenu: true },
},
[REALTIME_INSPECTOR_SHORTCUT_IDS.INSPECTOR_COPY_MESSAGE]: {
id: REALTIME_INSPECTOR_SHORTCUT_IDS.INSPECTOR_COPY_MESSAGE,
label: 'Copy selected message',
sequence: ['Mod+Shift+C'],
showInSettings: false,
options: { ignoreInputs: true, registerInCommandMenu: true },
},
}