mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
29 lines
974 B
TypeScript
29 lines
974 B
TypeScript
import { IS_PLATFORM } from 'common'
|
|
import type { CommandOptions } from 'ui-patterns/CommandMenu'
|
|
import { useRegisterCommands } from 'ui-patterns/CommandMenu'
|
|
|
|
import { COMMAND_MENU_SECTIONS } from '@/components/interfaces/App/CommandMenu/CommandMenu.utils'
|
|
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
|
|
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
|
|
|
|
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] }
|
|
)
|
|
}
|