The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore(studio): add Billing nav command (#42954)
Francesco Sansalvadore834ce5cb9bfd
diff --git a/apps/studio/components/layouts/BillingLayout/Billing.Commands.tsx b/apps/studio/components/layouts/BillingLayout/Billing.Commands.tsxnew file mode 100644index 00000000000..cced180f247--- /dev/null+++ b/apps/studio/components/layouts/BillingLayout/Billing.Commands.tsx@@ -0,0 +1,27 @@+import { IS_PLATFORM } from 'common'+import { COMMAND_MENU_SECTIONS } from 'components/interfaces/App/CommandMenu/CommandMenu.utils'+import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'+import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'+import type { CommandOptions } from 'ui-patterns/CommandMenu'+import { useRegisterCommands } from 'ui-patterns/CommandMenu'++export function useBillingGotoCommands(options?: CommandOptions) {+ const { data: organization } = useSelectedOrganizationQuery()+ const billingEnabled = useIsFeatureEnabled('billing:all')+ const slug = organization?.slug ?? '_'++ useRegisterCommands(+ COMMAND_MENU_SECTIONS.NAVIGATE,+ IS_PLATFORM && billingEnabled+ ? [+ {+ id: 'nav-billing',+ name: 'Billing',+ route: `/org/${slug}/billing`,+ defaultHidden: true,+ },+ ]+ : [],+ { ...options, deps: [slug] }+ )+}diff --git a/apps/studio/components/layouts/useLayoutNavCommands.ts b/apps/studio/components/layouts/useLayoutNavCommands.tsindex 0ce1cf08c0b..8ea4b8ccc07 100644--- a/apps/studio/components/layouts/useLayoutNavCommands.ts+++ b/apps/studio/components/layouts/useLayoutNavCommands.ts@@ -2,6 +2,7 @@ import { useIsLoggedIn } from 'common'import { useApiDocsGotoCommands } from 'components/interfaces/ProjectAPIDocs/ProjectAPIDocs.Commands'import { useAdvisorsGoToCommands } from './AdvisorsLayout/Advisors.Commands'import { useAuthGotoCommands } from './AuthLayout/Auth.Commands'+import { useBillingGotoCommands } from './BillingLayout/Billing.Commands'import { useDatabaseGotoCommands } from './DatabaseLayout/Database.Commands'import { useFunctionsGotoCommands } from './EdgeFunctionsLayout/EdgeFunctions.Commands'import { useIntegrationsGotoCommands } from './IntegrationsLayout/Integrations.Commands'@@ -27,4 +28,5 @@ export function useLayoutNavCommands() {useApiDocsGotoCommands({ enabled: isLoggedIn })useProjectSettingsGotoCommands({ enabled: isLoggedIn })useIntegrationsGotoCommands({ enabled: isLoggedIn })+ useBillingGotoCommands({ enabled: isLoggedIn })}