functions-detail-nav.ts60 lines · main
| 1 | // @ts-nocheck |
| 2 | import { SHORTCUT_REFERENCE_GROUPS } from '../referenceGroups' |
| 3 | import { RegistryDefinations } from '../types' |
| 4 | |
| 5 | /** |
| 6 | * Digit shortcuts (1-5) for jumping between the tabs on a function detail |
| 7 | * page — Overview, Invocations, Logs, Code, Settings. |
| 8 | * |
| 9 | * Active only while EdgeFunctionDetailsLayout is mounted (i.e. the user is |
| 10 | * on a `/project/<ref>/functions/<slug>/*` route). Digits are scoped to this |
| 11 | * layout so they don't burn global keys. |
| 12 | */ |
| 13 | export const FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS = { |
| 14 | NAV_FUNCTION_DETAIL_OVERVIEW: 'nav.function-detail-overview', |
| 15 | NAV_FUNCTION_DETAIL_INVOCATIONS: 'nav.function-detail-invocations', |
| 16 | NAV_FUNCTION_DETAIL_LOGS: 'nav.function-detail-logs', |
| 17 | NAV_FUNCTION_DETAIL_CODE: 'nav.function-detail-code', |
| 18 | NAV_FUNCTION_DETAIL_SETTINGS: 'nav.function-detail-settings', |
| 19 | } |
| 20 | |
| 21 | export type FunctionsDetailNavShortcutId = |
| 22 | (typeof FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS)[keyof typeof FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS] |
| 23 | |
| 24 | export const functionsDetailNavRegistry: RegistryDefinations<FunctionsDetailNavShortcutId> = { |
| 25 | [FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_OVERVIEW]: { |
| 26 | id: FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_OVERVIEW, |
| 27 | label: 'Go to Overview', |
| 28 | sequence: ['1'], |
| 29 | showInSettings: false, |
| 30 | referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL, |
| 31 | }, |
| 32 | [FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_INVOCATIONS]: { |
| 33 | id: FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_INVOCATIONS, |
| 34 | label: 'Go to Invocations', |
| 35 | sequence: ['2'], |
| 36 | showInSettings: false, |
| 37 | referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL, |
| 38 | }, |
| 39 | [FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_LOGS]: { |
| 40 | id: FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_LOGS, |
| 41 | label: 'Go to Logs', |
| 42 | sequence: ['3'], |
| 43 | showInSettings: false, |
| 44 | referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL, |
| 45 | }, |
| 46 | [FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_CODE]: { |
| 47 | id: FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_CODE, |
| 48 | label: 'Go to Code', |
| 49 | sequence: ['4'], |
| 50 | showInSettings: false, |
| 51 | referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL, |
| 52 | }, |
| 53 | [FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_SETTINGS]: { |
| 54 | id: FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_SETTINGS, |
| 55 | label: 'Go to Settings', |
| 56 | sequence: ['5'], |
| 57 | showInSettings: false, |
| 58 | referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL, |
| 59 | }, |
| 60 | } |