Skip to content

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

2.5 KB
Raw Blame
import { IS_PLATFORM } from 'common'
import {
  CommandHeader,
  CommandMenu,
  CommandMenuInput,
  CommandMenuList,
} from 'ui-patterns/CommandMenu'
import { useChangelogCommand } from 'ui-patterns/CommandMenu/prepackaged/Changelog'
import { useDocsAiCommands } from 'ui-patterns/CommandMenu/prepackaged/DocsAi'
import { useDocsSearchCommands } from 'ui-patterns/CommandMenu/prepackaged/DocsSearch'
import { useThemeSwitcherCommands } from 'ui-patterns/CommandMenu/prepackaged/ThemeSwitcher'

import { useApiKeysCommands } from './ApiKeys'
import { useApiUrlCommand } from './ApiUrl'
import { useContextSearchCommands } from './ContextSearchCommands'
import { useCreateCommands } from './CreateCommands'
import { useDatabaseEntitySearchCommands } from './DatabaseEntitySearchCommands'
import { useFeaturePreviewCommands } from './FeaturePreviews'
import { orderCommandSectionsByPriority } from './ordering'
import { useConfigureOrganizationCommand, useProjectSwitchCommand } from './OrgProjectSwitcher'
import { useSupportCommands } from './Support'
import { useBranchCommands } from '@/components/interfaces/BranchManagement/Branch.Commands'
import { useConnectCommands } from '@/components/interfaces/ConnectButton/Connect.Commands'
import {
  useQueryTableCommands,
  useSnippetCommands,
} from '@/components/layouts/SQLEditorLayout/SqlEditor.Commands'
import { useProjectLevelTableEditorCommands } from '@/components/layouts/TableEditorLayout/TableEditor.Commands'
import { useLayoutNavCommands } from '@/components/layouts/useLayoutNavCommands'

export function CommandMenuInnerContent() {
  return (
    <>
      <CommandHeader>
        <CommandMenuInput />
      </CommandHeader>
      <CommandMenuList />
    </>
  )
}

export function StudioCommandMenu() {
  useCreateCommands()
  useApiKeysCommands()
  useApiUrlCommand()
  useConnectCommands()
  useProjectLevelTableEditorCommands()
  useProjectSwitchCommand()
  useConfigureOrganizationCommand()
  useQueryTableCommands()
  useBranchCommands()
  useSnippetCommands()
  useLayoutNavCommands()
  useDocsSearchCommands({
    options: { orderSection: orderCommandSectionsByPriority, sectionMeta: { priority: 3 } },
  })
  useDocsAiCommands({
    options: { orderSection: orderCommandSectionsByPriority, sectionMeta: { priority: 3 } },
  })
  useSupportCommands()
  useChangelogCommand({ enabled: IS_PLATFORM })
  useThemeSwitcherCommands()
  useContextSearchCommands()
  useDatabaseEntitySearchCommands()
  useFeaturePreviewCommands()

  return (
    <CommandMenu>
      <CommandMenuInnerContent />
    </CommandMenu>
  )
}