The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(studio): add keyboard shortcuts for Advisors (#46238)
Ali Waseem6f88585a7e3c
diff --git a/apps/studio/components/interfaces/Linter/LintPageTabs.tsx b/apps/studio/components/interfaces/Linter/LintPageTabs.tsxindex 25645f8e2b8..a8615c71fc7 100644--- a/apps/studio/components/interfaces/Linter/LintPageTabs.tsx+++ b/apps/studio/components/interfaces/Linter/LintPageTabs.tsx@@ -13,6 +13,7 @@ import {import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'import { LINT_TABS, LINTER_LEVELS } from '@/components/interfaces/Linter/Linter.constants'+import { ShortcutTooltip } from '@/components/ui/ShortcutTooltip'import { Lint } from '@/data/lint/lint-query'interface LintPageTabsProps {@@ -61,7 +62,7 @@ const LintPageTabs = ({ currentTab, setCurrentTab, isLoading, activeLints }: Linreturn (<Tabs_Shadcn_- defaultValue={currentTab}+ value={currentTab}onValueChange={(value) => {setCurrentTab(value as LINTER_LEVELS)const { sort, search, ...rest } = router.query@@ -70,46 +71,53 @@ const LintPageTabs = ({ currentTab, setCurrentTab, isLoading, activeLints }: Lin><TabsList_Shadcn_ className={cn('flex gap-0 border-0 items-end z-10 relative')}>{LINT_TABS.map((tab) => (- <TabsTrigger_Shadcn_+ <ShortcutTooltipkey={tab.id}- value={tab.id}- className={cn(- 'group relative',- 'px-6 py-3 border-b-0 flex flex-col items-start shadow-none! border-default border-t',- 'even:border-x last:border-r even:border-x-strong! last:border-r-strong!',- tab.id === currentTab ? 'bg-surface-200!' : 'bg-surface-200/33!',- 'hover:bg-surface-100!',- 'data-[state=active]:bg-surface-200!',- 'hover:text-foreground-light',- 'transition'- )}+ shortcutId={tab.shortcutId}+ label={`Switch to ${tab.label}`}+ side="top"+ align="start">- {tab.id === currentTab && (- <div className="absolute top-0 left-0 w-full h-px bg-foreground" />- )}- <div className="flex items-center gap-x-2">- <span- className={- tab.id === LINTER_LEVELS.ERROR- ? 'text-destructive-600'- : tab.id === LINTER_LEVELS.WARN- ? 'text-warning'- : 'text-brand-500'- }- >- <MessageSquareMore size={14} fill="currentColor" strokeWidth={0} />- </span>+ <TabsTrigger_Shadcn_+ value={tab.id}+ className={cn(+ 'group relative',+ 'px-6 py-3 border-b-0 flex flex-col items-start shadow-none! border-default border-t',+ 'even:border-x last:border-r even:border-x-strong! last:border-r-strong!',+ tab.id === currentTab ? 'bg-surface-200!' : 'bg-surface-200/33!',+ 'hover:bg-surface-100!',+ 'data-[state=active]:bg-surface-200!',+ 'hover:text-foreground-light',+ 'transition'+ )}+ >+ {tab.id === currentTab && (+ <div className="absolute top-0 left-0 w-full h-px bg-foreground" />+ )}+ <div className="flex items-center gap-x-2">+ <span+ className={+ tab.id === LINTER_LEVELS.ERROR+ ? 'text-destructive-600'+ : tab.id === LINTER_LEVELS.WARN+ ? 'text-warning'+ : 'text-brand-500'+ }+ >+ <MessageSquareMore size={14} fill="currentColor" strokeWidth={0} />+ </span>- <span className="">{tab.label}</span>- <Tooltip>- <TooltipTrigger asChild>- <InformationCircleIcon className="transition text-foreground-muted w-3 h-3 data-[state=delayed-open]:text-foreground-light" />- </TooltipTrigger>- <TooltipContent side="top">{tab.description}</TooltipContent>- </Tooltip>- </div>- <LintCountLabel tab={tab} />- </TabsTrigger_Shadcn_>+ <span className="">{tab.label}</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <InformationCircleIcon className="transition text-foreground-muted w-3 h-3 data-[state=delayed-open]:text-foreground-light" />+ </TooltipTrigger>+ <TooltipContent side="top">{tab.description}</TooltipContent>+ </Tooltip>+ </div>+ <LintCountLabel tab={tab} />+ </TabsTrigger_Shadcn_>+ </ShortcutTooltip>))}</TabsList_Shadcn_></Tabs_Shadcn_>diff --git a/apps/studio/components/interfaces/Linter/Linter.constants.ts b/apps/studio/components/interfaces/Linter/Linter.constants.tsindex e9c740c507e..a251a0465aa 100644--- a/apps/studio/components/interfaces/Linter/Linter.constants.ts+++ b/apps/studio/components/interfaces/Linter/Linter.constants.ts@@ -1,6 +1,7 @@import { ReactNode } from 'react'import { Lint } from '@/data/lint/lint-query'+import { SHORTCUT_IDS, type ShortcutId } from '@/state/shortcuts/registry'export enum LINTER_LEVELS {ERROR = 'ERROR',@@ -18,23 +19,32 @@ export type LintInfo = {category: 'security' | 'performance'}-export const LINT_TABS = [+export const LINT_TABS: ReadonlyArray<{+ id: LINTER_LEVELS+ label: string+ description: string+ descriptionShort: string+ shortcutId: ShortcutId+}> = [{id: LINTER_LEVELS.ERROR,label: 'Errors',description: 'You should consider these issues urgent and fix them as soon as you can.',descriptionShort: 'Require immediate attention',+ shortcutId: SHORTCUT_IDS.ADVISORS_TAB_ERRORS,},{id: LINTER_LEVELS.WARN,label: 'Warnings',description: 'You should try and read through these issues and fix them if necessary.',descriptionShort: 'To resolve only if necessary',+ shortcutId: SHORTCUT_IDS.ADVISORS_TAB_WARNINGS,},{id: LINTER_LEVELS.INFO,label: 'Info',description: 'You should read through these suggestions and consider implementing them.',descriptionShort: 'For consideration to implement',+ shortcutId: SHORTCUT_IDS.ADVISORS_TAB_INFO,},]diff --git a/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx b/apps/studio/components/interfaces/Linter/LinterDataGrid.tsxindex 93b66bcfd48..53d36a44a0b 100644--- a/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx+++ b/apps/studio/components/interfaces/Linter/LinterDataGrid.tsx@@ -16,8 +16,10 @@ import {lintInfoMap,NoIssuesFound,} from '@/components/interfaces/Linter/Linter.utils'+import { ShortcutTooltip } from '@/components/ui/ShortcutTooltip'import { Lint } from '@/data/lint/lint-query'import { useTrack } from '@/lib/telemetry/track'+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'interface LinterDataGridProps {isLoading: boolean@@ -193,7 +195,9 @@ export const LinterDataGrid = ({</h3><LintCategoryBadge category={selectedLint.categories[0]} /></div>- <Button type="text" icon={<X />} onClick={handleSidepanelClose} />+ <ShortcutTooltip shortcutId={SHORTCUT_IDS.ADVISORS_CLOSE_DETAIL} side="left">+ <Button type="text" icon={<X />} onClick={handleSidepanelClose} />+ </ShortcutTooltip></div><div className="p-6 flex-grow min-h-0 overflow-y-auto"><LintDetaildiff --git a/apps/studio/components/interfaces/Linter/LinterFilters.tsx b/apps/studio/components/interfaces/Linter/LinterFilters.tsxindex 3e9d39306fd..59b2fd47ef8 100644--- a/apps/studio/components/interfaces/Linter/LinterFilters.tsx+++ b/apps/studio/components/interfaces/Linter/LinterFilters.tsx@@ -5,7 +5,9 @@ import { Button } from 'ui'import { LINT_TABS, LINTER_LEVELS } from '@/components/interfaces/Linter/Linter.constants'import { DownloadResultsButton } from '@/components/ui/DownloadResultsButton'import { FilterPopover } from '@/components/ui/FilterPopover'+import { ShortcutTooltip } from '@/components/ui/ShortcutTooltip'import { Lint } from '@/data/lint/lint-query'+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'interface LinterFiltersProps {filterOptions: {@@ -60,17 +62,19 @@ const LinterFilters = ({</div>))}<div className="flex items-center gap-x-2">- <Button- size="tiny"- type="default"- disabled={isLoading}- onClick={onClickRefresh}- icon={- <RefreshCw className={`text-foreground-light ${isLoading ? 'animate-spin' : ''}`} />- }- >- Refresh- </Button>+ <ShortcutTooltip shortcutId={SHORTCUT_IDS.ADVISORS_REFRESH} side="bottom">+ <Button+ size="tiny"+ type="default"+ disabled={isLoading}+ onClick={onClickRefresh}+ icon={+ <RefreshCw className={`text-foreground-light ${isLoading ? 'animate-spin' : ''}`} />+ }+ >+ Refresh+ </Button>+ </ShortcutTooltip><DownloadResultsButtonalign="end"results={filteredLints}diff --git a/apps/studio/components/interfaces/Linter/LinterPageFooter.tsx b/apps/studio/components/interfaces/Linter/LinterPageFooter.tsxindex 0423d8c5f85..99b6ac3eb53 100644--- a/apps/studio/components/interfaces/Linter/LinterPageFooter.tsx+++ b/apps/studio/components/interfaces/Linter/LinterPageFooter.tsx@@ -3,8 +3,10 @@ import { X } from 'lucide-react'import { Button, cn } from 'ui'import { Markdown } from '../Markdown'+import { ShortcutTooltip } from '@/components/ui/ShortcutTooltip'import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'import { DOCS_URL } from '@/lib/constants'+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'interface LinterPageFooterProps {isLoading: boolean@@ -46,15 +48,22 @@ export const LinterPageFooter = ({Consider resetting the analysis after making any changes</p>- <Button- type="default"- className="mt-3! w-min"- disabled={isLoading || isRefetching}- loading={isLoading || isRefetching}- onClick={() => refetch()}+ <ShortcutTooltip+ shortcutId={SHORTCUT_IDS.ADVISORS_REFRESH}+ label="Rerun linter"+ side="bottom"+ align="start">- Rerun linter- </Button>+ <Button+ type="default"+ className="mt-3! w-min"+ disabled={isLoading || isRefetching}+ loading={isLoading || isRefetching}+ onClick={() => refetch()}+ >+ Rerun linter+ </Button>+ </ShortcutTooltip></div><divdiff --git a/apps/studio/components/interfaces/Linter/useAdvisorPageShortcuts.ts b/apps/studio/components/interfaces/Linter/useAdvisorPageShortcuts.tsnew file mode 100644index 00000000000..e821f25e069--- /dev/null+++ b/apps/studio/components/interfaces/Linter/useAdvisorPageShortcuts.ts@@ -0,0 +1,52 @@+import { useRouter } from 'next/router'++import { LINTER_LEVELS } from './Linter.constants'+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'+import { useShortcut } from '@/state/shortcuts/useShortcut'++interface UseAdvisorPageShortcutsParams {+ setCurrentTab: (level: LINTER_LEVELS) => void+ refetch: () => void+ hasSelectedLint: boolean+ isRefreshDisabled: boolean+}++/**+ * Registers shortcuts that apply across the Security and Performance Advisor+ * pages:+ * - 1 / 2 / 3: switch to Errors / Warnings / Info tab+ * - Shift+R: rerun the linter+ * - Escape: close the lint detail panel (only when a lint is selected)+ *+ * The tab handlers mirror the URL update that `LintPageTabs` performs on click,+ * so the `preset` query stays in sync and the side panel closes.+ */+export function useAdvisorPageShortcuts({+ setCurrentTab,+ refetch,+ hasSelectedLint,+ isRefreshDisabled,+}: UseAdvisorPageShortcutsParams) {+ const router = useRouter()++ const switchTab = (level: LINTER_LEVELS) => {+ setCurrentTab(level)+ const { sort, search, id, ...rest } = router.query+ router.push({ ...router, query: { ...rest, preset: level } })+ }++ useShortcut(SHORTCUT_IDS.ADVISORS_TAB_ERRORS, () => switchTab(LINTER_LEVELS.ERROR))+ useShortcut(SHORTCUT_IDS.ADVISORS_TAB_WARNINGS, () => switchTab(LINTER_LEVELS.WARN))+ useShortcut(SHORTCUT_IDS.ADVISORS_TAB_INFO, () => switchTab(LINTER_LEVELS.INFO))++ useShortcut(SHORTCUT_IDS.ADVISORS_REFRESH, refetch, { enabled: !isRefreshDisabled })++ useShortcut(+ SHORTCUT_IDS.ADVISORS_CLOSE_DETAIL,+ () => {+ const { id, ...rest } = router.query+ router.push({ query: rest })+ },+ { enabled: hasSelectedLint }+ )+}diff --git a/apps/studio/components/layouts/AdvisorsLayout/AdvisorsLayout.tsx b/apps/studio/components/layouts/AdvisorsLayout/AdvisorsLayout.tsxindex 1bd0776d633..0e9398a4636 100644--- a/apps/studio/components/layouts/AdvisorsLayout/AdvisorsLayout.tsx+++ b/apps/studio/components/layouts/AdvisorsLayout/AdvisorsLayout.tsx@@ -2,7 +2,9 @@ import { useRouter } from 'next/router'import { PropsWithChildren } from 'react'import { ProjectLayout } from '../ProjectLayout'+import { useGenerateAdvisorsMenu } from './AdvisorsMenu.utils'import { AdvisorsSidebarMenu } from './AdvisorsSidebarMenu'+import { ProductMenuShortcuts } from '@/components/ui/ProductMenu/ProductMenuShortcuts'import { withAuth } from '@/hooks/misc/withAuth'export interface AdvisorsLayoutProps {@@ -12,6 +14,7 @@ export interface AdvisorsLayoutProps {const AdvisorsLayout = ({ children }: PropsWithChildren<AdvisorsLayoutProps>) => {const router = useRouter()const page = router.pathname.split('/')[4]+ const menu = useGenerateAdvisorsMenu()return (<ProjectLayout@@ -19,6 +22,7 @@ const AdvisorsLayout = ({ children }: PropsWithChildren<AdvisorsLayoutProps>) =>product="Advisors"productMenu={<AdvisorsSidebarMenu page={page} />}>+ <ProductMenuShortcuts menu={menu} />{children}</ProjectLayout>)diff --git a/apps/studio/components/layouts/AdvisorsLayout/AdvisorsMenu.utils.tsx b/apps/studio/components/layouts/AdvisorsLayout/AdvisorsMenu.utils.tsxindex d99e24ff76b..602873ec919 100644--- a/apps/studio/components/layouts/AdvisorsLayout/AdvisorsMenu.utils.tsx+++ b/apps/studio/components/layouts/AdvisorsLayout/AdvisorsMenu.utils.tsx@@ -4,6 +4,7 @@ import { ArrowUpRight } from 'lucide-react'import { useIsAdvisorRulesEnabled } from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'import type { ProductMenuGroup } from '@/components/ui/ProductMenu/ProductMenu.types'import { IS_PLATFORM } from '@/lib/constants'+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'export const useGenerateAdvisorsMenu = (): ProductMenuGroup[] => {const { ref } = useParams()@@ -18,12 +19,14 @@ export const useGenerateAdvisorsMenu = (): ProductMenuGroup[] => {key: 'security',url: `/project/${ref}/advisors/security`,items: [],+ shortcutId: SHORTCUT_IDS.NAV_ADVISORS_SECURITY,},{name: 'Performance Advisor',key: 'performance',url: `/project/${ref}/advisors/performance`,items: [],+ shortcutId: SHORTCUT_IDS.NAV_ADVISORS_PERFORMANCE,},{name: 'Query Performance',@@ -44,6 +47,7 @@ export const useGenerateAdvisorsMenu = (): ProductMenuGroup[] => {key: 'rules',url: `/project/${ref}/advisors/rules/security`,items: [],+ shortcutId: SHORTCUT_IDS.NAV_ADVISORS_RULES,},],},diff --git a/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsx b/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsxindex 78ed2d924a5..76acfd88534 100644--- a/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsx+++ b/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsx@@ -42,6 +42,7 @@ interface ShortcutGroup {const GROUP_LABELS: Record<string, string> = {...SHORTCUT_REFERENCE_GROUP_LABELS,'action-bar': 'Actions',+ 'advisors-page': 'Advisors','ai-assistant': 'AI Assistant','auth-users': 'Auth Users','command-menu': 'Command Menu',diff --git a/apps/studio/pages/project/[ref]/advisors/performance.tsx b/apps/studio/pages/project/[ref]/advisors/performance.tsxindex 13758a69ee7..27b3d915448 100644--- a/apps/studio/pages/project/[ref]/advisors/performance.tsx+++ b/apps/studio/pages/project/[ref]/advisors/performance.tsx@@ -8,6 +8,7 @@ import { LinterDataGrid } from '@/components/interfaces/Linter/LinterDataGrid'import LinterFilters from '@/components/interfaces/Linter/LinterFilters'import { LinterPageFooter } from '@/components/interfaces/Linter/LinterPageFooter'import LintPageTabs from '@/components/interfaces/Linter/LintPageTabs'+import { useAdvisorPageShortcuts } from '@/components/interfaces/Linter/useAdvisorPageShortcuts'import AdvisorsLayout from '@/components/layouts/AdvisorsLayout/AdvisorsLayout'import { DefaultLayout } from '@/components/layouts/DefaultLayout'import { FormHeader } from '@/components/ui/Forms/FormHeader'@@ -60,6 +61,13 @@ const ProjectLints: NextPageWithLayout = () => {return activeLints.find((lint) => lint.cache_key === id) ?? null}, [id, activeLints])+ useAdvisorPageShortcuts({+ setCurrentTab,+ refetch,+ hasSelectedLint: selectedLint !== null,+ isRefreshDisabled: isLoading || isRefetching,+ })+return (<div className="h-full flex flex-col"><FormHeaderdiff --git a/apps/studio/pages/project/[ref]/advisors/security.tsx b/apps/studio/pages/project/[ref]/advisors/security.tsxindex 993a607227d..1e29f31cc27 100644--- a/apps/studio/pages/project/[ref]/advisors/security.tsx+++ b/apps/studio/pages/project/[ref]/advisors/security.tsx@@ -8,6 +8,7 @@ import { LinterDataGrid } from '@/components/interfaces/Linter/LinterDataGrid'import LinterFilters from '@/components/interfaces/Linter/LinterFilters'import { LinterPageFooter } from '@/components/interfaces/Linter/LinterPageFooter'import LintPageTabs from '@/components/interfaces/Linter/LintPageTabs'+import { useAdvisorPageShortcuts } from '@/components/interfaces/Linter/useAdvisorPageShortcuts'import AdvisorsLayout from '@/components/layouts/AdvisorsLayout/AdvisorsLayout'import { DefaultLayout } from '@/components/layouts/DefaultLayout'import { FormHeader } from '@/components/ui/Forms/FormHeader'@@ -63,6 +64,13 @@ const ProjectLints: NextPageWithLayout = () => {return activeLints.find((lint) => lint.cache_key === id) ?? null}, [id, activeLints])+ useAdvisorPageShortcuts({+ setCurrentTab,+ refetch,+ hasSelectedLint: selectedLint !== null,+ isRefreshDisabled: isLoading || isRefetching,+ })+return (<div className="h-full flex flex-col"><FormHeaderdiff --git a/apps/studio/state/shortcuts/referenceGroups.ts b/apps/studio/state/shortcuts/referenceGroups.tsindex bac2d7ec9ad..7a5b32e3291 100644--- a/apps/studio/state/shortcuts/referenceGroups.ts+++ b/apps/studio/state/shortcuts/referenceGroups.ts@@ -7,6 +7,7 @@ export const SHORTCUT_REFERENCE_GROUPS = {NAVIGATION_FUNCTIONS: 'navigation.functions',NAVIGATION_FUNCTION_DETAIL: 'navigation.function-detail',NAVIGATION_REALTIME: 'navigation.realtime',+ NAVIGATION_ADVISORS: 'navigation.advisors',} as constexport const SHORTCUT_REFERENCE_GROUP_LABELS: Record<string, string> = {@@ -18,6 +19,7 @@ export const SHORTCUT_REFERENCE_GROUP_LABELS: Record<string, string> = {[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTIONS]: 'Edge Functions Navigation',[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL]: 'Edge Function Tabs',[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_REALTIME]: 'Realtime Navigation',+ [SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS]: 'Advisors Navigation',}export const SHORTCUT_REFERENCE_GROUP_ORDER = [@@ -38,6 +40,8 @@ export const SHORTCUT_REFERENCE_GROUP_ORDER = ['functions-overview',SHORTCUT_REFERENCE_GROUPS.NAVIGATION_REALTIME,'realtime-inspector',+ SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS,+ 'advisors-page','logs-preview','nav','ai-assistant',diff --git a/apps/studio/state/shortcuts/registry.ts b/apps/studio/state/shortcuts/registry.tsindex 2e7b911c8ab..fd649ba2890 100644--- a/apps/studio/state/shortcuts/registry.ts+++ b/apps/studio/state/shortcuts/registry.ts@@ -1,4 +1,6 @@import { SHORTCUT_REFERENCE_GROUPS } from './referenceGroups'+import { ADVISORS_NAV_SHORTCUT_IDS, advisorsNavRegistry } from './registry/advisors-nav'+import { ADVISORS_PAGE_SHORTCUT_IDS, advisorsPageRegistry } from './registry/advisors-page'import { AUTH_NAV_SHORTCUT_IDS, authNavRegistry } from './registry/auth-nav'import { AUTH_USERS_SHORTCUT_IDS, authUsersRegistry } from './registry/auth-users'import { DATABASE_NAV_SHORTCUT_IDS, databaseNavRegistry } from './registry/database-nav'@@ -125,6 +127,11 @@ export const SHORTCUT_IDS = {// Realtime Inspector page shortcuts...REALTIME_INSPECTOR_SHORTCUT_IDS,+ // Advisors sub-page navigation chords+ ...ADVISORS_NAV_SHORTCUT_IDS,+ // Advisors lint page shortcuts (tabs, refresh, close detail)+ ...ADVISORS_PAGE_SHORTCUT_IDS,+// LogsPreviewer shortcuts (Function Logs, Function Invocations, Logs Explorer)...LOGS_PREVIEW_SHORTCUT_IDS,@@ -448,6 +455,11 @@ export const SHORTCUT_DEFINITIONS: Record<ShortcutId, ShortcutDefinition> = {// Realtime Inspector page shortcut registration...realtimeInspectorRegistry,+ // Advisors sub-page navigation chord registration+ ...advisorsNavRegistry,+ // Advisors lint page shortcut registration+ ...advisorsPageRegistry,+// LogsPreviewer shortcut registration...logsPreviewRegistry,diff --git a/apps/studio/state/shortcuts/registry/advisors-nav.ts b/apps/studio/state/shortcuts/registry/advisors-nav.tsnew file mode 100644index 00000000000..eb129776b0f--- /dev/null+++ b/apps/studio/state/shortcuts/registry/advisors-nav.ts@@ -0,0 +1,43 @@+import { SHORTCUT_REFERENCE_GROUPS } from '../referenceGroups'+import { RegistryDefinations } from '../types'++/**+ * Contextual chords for jumping between Advisors sub-pages — `V + <letter>`.+ *+ * Active only while AdvisorsLayout is mounted (i.e. the user is somewhere+ * under `/project/<ref>/advisors/*`). Mirrors the database-nav / auth-nav+ * pattern: the leading `V` (adVisor) is layout-scoped so it doesn't burn a+ * global key. `A` is already in use by Auth.+ */+export const ADVISORS_NAV_SHORTCUT_IDS = {+ NAV_ADVISORS_SECURITY: 'nav.advisors-security',+ NAV_ADVISORS_PERFORMANCE: 'nav.advisors-performance',+ NAV_ADVISORS_RULES: 'nav.advisors-rules',+}++export type AdvisorsNavShortcutId =+ (typeof ADVISORS_NAV_SHORTCUT_IDS)[keyof typeof ADVISORS_NAV_SHORTCUT_IDS]++export const advisorsNavRegistry: RegistryDefinations<AdvisorsNavShortcutId> = {+ [ADVISORS_NAV_SHORTCUT_IDS.NAV_ADVISORS_SECURITY]: {+ id: ADVISORS_NAV_SHORTCUT_IDS.NAV_ADVISORS_SECURITY,+ label: 'Go to Security Advisor',+ sequence: ['V', 'S'],+ showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS,+ },+ [ADVISORS_NAV_SHORTCUT_IDS.NAV_ADVISORS_PERFORMANCE]: {+ id: ADVISORS_NAV_SHORTCUT_IDS.NAV_ADVISORS_PERFORMANCE,+ label: 'Go to Performance Advisor',+ sequence: ['V', 'P'],+ showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS,+ },+ [ADVISORS_NAV_SHORTCUT_IDS.NAV_ADVISORS_RULES]: {+ id: ADVISORS_NAV_SHORTCUT_IDS.NAV_ADVISORS_RULES,+ label: 'Go to Advisor Settings',+ sequence: ['V', 'R'],+ showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS,+ },+}diff --git a/apps/studio/state/shortcuts/registry/advisors-page.ts b/apps/studio/state/shortcuts/registry/advisors-page.tsnew file mode 100644index 00000000000..02b84b5c707--- /dev/null+++ b/apps/studio/state/shortcuts/registry/advisors-page.ts@@ -0,0 +1,61 @@+import { SHORTCUT_REFERENCE_GROUPS } from '../referenceGroups'+import { RegistryDefinations } from '../types'++/**+ * Shortcuts scoped to the Security and Performance Advisor pages — tab digit+ * shortcuts, refresh, and detail panel close. The tab digits mirror the+ * functions-detail-nav pattern (`ignoreInputs: true` so they don't fire from+ * inputs), and `Escape` follows the auth-users close-panel pattern with+ * `conflictBehavior: 'allow'` since other surfaces also use Escape.+ */+export const ADVISORS_PAGE_SHORTCUT_IDS = {+ ADVISORS_TAB_ERRORS: 'advisors-page.tab-errors',+ ADVISORS_TAB_WARNINGS: 'advisors-page.tab-warnings',+ ADVISORS_TAB_INFO: 'advisors-page.tab-info',+ ADVISORS_REFRESH: 'advisors-page.refresh',+ ADVISORS_CLOSE_DETAIL: 'advisors-page.close-detail',+}++export type AdvisorsPageShortcutId =+ (typeof ADVISORS_PAGE_SHORTCUT_IDS)[keyof typeof ADVISORS_PAGE_SHORTCUT_IDS]++export const advisorsPageRegistry: RegistryDefinations<AdvisorsPageShortcutId> = {+ [ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_ERRORS]: {+ id: ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_ERRORS,+ label: 'Switch to Errors',+ sequence: ['1'],+ showInSettings: false,+ options: { ignoreInputs: true, registerInCommandMenu: true },+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS,+ },+ [ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_WARNINGS]: {+ id: ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_WARNINGS,+ label: 'Switch to Warnings',+ sequence: ['2'],+ showInSettings: false,+ options: { ignoreInputs: true, registerInCommandMenu: true },+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS,+ },+ [ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_INFO]: {+ id: ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_INFO,+ label: 'Switch to Info',+ sequence: ['3'],+ showInSettings: false,+ options: { ignoreInputs: true, registerInCommandMenu: true },+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS,+ },+ [ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_REFRESH]: {+ id: ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_REFRESH,+ label: 'Refresh advisor',+ sequence: ['Shift+R'],+ showInSettings: false,+ options: { ignoreInputs: true, registerInCommandMenu: true },+ },+ [ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_CLOSE_DETAIL]: {+ id: ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_CLOSE_DETAIL,+ label: 'Close lint details panel',+ sequence: ['Escape'],+ showInSettings: false,+ options: { ignoreInputs: true, conflictBehavior: 'allow' },+ },+}