Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: cmdk sections preview (#34633)

hallidayo23973eb5c334
diff --git a/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.utils.ts b/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.utils.ts
index c80a091d2e6..59ef6d7c1d0 100644
--- a/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.utils.ts
+++ b/apps/studio/components/interfaces/App/CommandMenu/CommandMenu.utils.ts
@@ -1,6 +1,9 @@
export const COMMAND_MENU_SECTIONS = {
ACTIONS: 'Actions',
NAVIGATE: 'Navigate',
- QUERY: 'Query',
+ QUERY: 'Queries',
SUPPORT: 'Support',
+ TABLE: 'Table Editor',
+ SQL: 'SQL Editor',
+ DATABASE: 'Database',
} as const
diff --git a/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx b/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx
index 0601598e5a8..ba42375641b 100644
--- a/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx
+++ b/apps/studio/components/layouts/DatabaseLayout/Database.Commands.tsx
@@ -1,4 +1,4 @@
-import { Code } from 'lucide-react'
+import { Blocks, Code, Database, History, Search } from 'lucide-react'
import { COMMAND_MENU_SECTIONS } from 'components/interfaces/App/CommandMenu/CommandMenu.utils'
import type { CommandOptions } from 'ui-patterns/CommandMenu'
@@ -104,4 +104,70 @@ export function useDatabaseGotoCommands(options?: CommandOptions) {
],
{ ...options, deps: [ref] }
)
+
+ useRegisterCommands(
+ COMMAND_MENU_SECTIONS.DATABASE,
+ [
+ {
+ id: 'run-schema-visualizer',
+ name: 'View your schemas',
+ route: `/project/${ref}/database/schemas`,
+ icon: () => <Search />,
+ },
+ {
+ id: 'run-view-database-functions',
+ name: 'View and create functions',
+ route: `/project/${ref}/database/functions`,
+ icon: () => <Database />,
+ },
+ {
+ id: 'run-view-database-triggers',
+ name: 'View and create triggers',
+ route: `/project/${ref}/database/triggers`,
+ icon: () => <Database />,
+ },
+ {
+ id: 'run-view-database-enumerated-types',
+ name: 'View and create enumerated types',
+ route: `/project/${ref}/database/types`,
+ icon: () => <Database />,
+ },
+ {
+ id: 'run-view-database-extensions',
+ name: 'View your extensions',
+ route: `/project/${ref}/database/extensions`,
+ icon: () => <Blocks />,
+ },
+ {
+ id: 'run-view-database-indexes',
+ name: 'View and create indexes',
+ route: `/project/${ref}/database/indexes`,
+ icon: () => <Database />,
+ },
+ {
+ id: 'run-view-database-roles',
+ name: 'View your roles',
+ route: `/project/${ref}/database/roles`,
+ icon: () => <Database />,
+ },
+ {
+ id: 'run-view-database-backups',
+ name: 'View your backups',
+ route: `/project/${ref}/database/backups/scheduled`,
+ icon: () => <Database />,
+ },
+ {
+ id: 'run-view-database-migrations',
+ name: 'View your migrations',
+ route: `/project/${ref}/database/migrations`,
+ icon: () => <History />,
+ },
+ ],
+ {
+ ...options,
+ deps: [ref],
+ orderSection: orderCommandSectionsByPriority,
+ sectionMeta: { priority: 3 },
+ }
+ )
}
diff --git a/apps/studio/components/layouts/SQLEditorLayout/SqlEditor.Commands.tsx b/apps/studio/components/layouts/SQLEditorLayout/SqlEditor.Commands.tsx
index 6268fb21e55..42c1ad27e8d 100644
--- a/apps/studio/components/layouts/SQLEditorLayout/SqlEditor.Commands.tsx
+++ b/apps/studio/components/layouts/SQLEditorLayout/SqlEditor.Commands.tsx
@@ -72,7 +72,7 @@ export function useSnippetCommands() {
)
useRegisterCommands(
- COMMAND_MENU_SECTIONS.ACTIONS,
+ COMMAND_MENU_SECTIONS.SQL,
[
{
id: 'run-snippet',
@@ -279,7 +279,7 @@ export function useQueryTableCommands(options?: CommandOptions) {
)
useRegisterCommands(
- COMMAND_MENU_SECTIONS.ACTIONS,
+ COMMAND_MENU_SECTIONS.SQL,
[
{
id: 'query-table',
diff --git a/apps/studio/components/layouts/TableEditorLayout/TableEditor.Commands.tsx b/apps/studio/components/layouts/TableEditorLayout/TableEditor.Commands.tsx
index bbfc91c5fe3..7d865165764 100644
--- a/apps/studio/components/layouts/TableEditorLayout/TableEditor.Commands.tsx
+++ b/apps/studio/components/layouts/TableEditorLayout/TableEditor.Commands.tsx
@@ -12,7 +12,7 @@ export function useProjectLevelTableEditorCommands(options?: CommandOptions) {
const ref = project?.ref || '_'
useRegisterCommands(
- COMMAND_MENU_SECTIONS.ACTIONS,
+ COMMAND_MENU_SECTIONS.TABLE,
[
{
id: 'create-table',
@@ -36,7 +36,7 @@ export function useTableEditorGotoCommands(options?: CommandOptions) {
ref ||= '_'
useRegisterCommands(
- COMMAND_MENU_SECTIONS.ACTIONS,
+ COMMAND_MENU_SECTIONS.TABLE,
[
{
id: 'view-tables',