Files
supabase/apps/studio/components/layouts/IntegrationsLayout/Integrations.Commands.tsx
T
Joshen Lim 7b1ac2a66e Chore/disable more sections 04 (#38064)
* Add flags for policies, third party auth, and manual linking + providers in sign in page

* Add flag for rate limitm page

* Add UnknownInterface components

* Update comment

* Flip flags to true

* Add flags for realtime policies and reports page

* Temp

* Add flag for sign in providers page

* Add flag for stripe wrapper

* Add flag for custom domains

* Add flag for dedicated ipv4 address addon

* Add empty state for realtime policies

* Add empty state for reports page

* Add flag for disable legacy JWT keys section

* Add flag for legacy jwt keys

* nit

* Remove ConnectionStringMoved call out

* Add flag for project settings log drains

* Add flag for subscription link in project settings

* Deprecate settings/auth page and redirect directly to auth page

* Flip back flags

* Add flags for account preferences analytics marketing and account deleetion

* Remove 'table_editor:enable_rls_toggle' flag and revert UI changes

* Remove 'authentication:policies' flag and revert UI changes

* Add flags for cmd K routes

* Add flags for instance size in infra settings

* Small refactor to DisplayApiSettings, decouple ToggleLegacyApiKeysPanel from it

* Have project_connection:javascript_example toggle code example title to TS

* add flag for templates dropdown in logs explorer

* UsesOverview only show link to providers page if providers is enabled

* API Docs UserManagement to only include docs on third party auth if providers is enabled

* Hide instance size on project card if flag is off

* Fix cmd k for roles, update redirect link from settings/auth to auth/providers
2025-08-22 16:17:43 +08:00

73 lines
2.2 KiB
TypeScript

import { useParams } from 'common'
import { COMMAND_MENU_SECTIONS } from 'components/interfaces/App/CommandMenu/CommandMenu.utils'
import { orderCommandSectionsByPriority } from 'components/interfaces/App/CommandMenu/ordering'
import {
IntegrationDefinition,
INTEGRATIONS,
} from 'components/interfaces/Integrations/Landing/Integrations.constants'
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import type { CommandOptions } from 'ui-patterns/CommandMenu'
import { useRegisterCommands } from 'ui-patterns/CommandMenu'
export function useIntegrationsGotoCommands(options?: CommandOptions) {
let { ref } = useParams()
ref ||= '_'
const { integrationsShowStripeWrapper } = useIsFeatureEnabled([
'integrations:show_stripe_wrapper',
])
const allIntegrations = integrationsShowStripeWrapper
? INTEGRATIONS
: INTEGRATIONS.filter((x) => x.id !== 'stripe_wrapper')
const getName = (integration: IntegrationDefinition) => {
switch (integration.id) {
case 'cron':
return 'View and manage your Cron Jobs'
case 'graphiql':
return 'Query database using GraphQL'
case 'vault':
return 'View and manage your keys and secrets via Vault'
default:
return `View and manage your ${integration.name}${integration.type === 'wrapper' ? 's' : ''}`
}
}
useRegisterCommands(
COMMAND_MENU_SECTIONS.NAVIGATE,
allIntegrations.map((x) => {
return {
id: `nav-integrations-${x.id}`,
name: x.name,
value: `Integrations: ${x.name}`,
route: `/project/${ref}/integrations/${x.id}/overview`,
defaultHidden: true,
}
}),
{ ...options, deps: [ref] }
)
useRegisterCommands(
COMMAND_MENU_SECTIONS.INTEGRATIONS,
allIntegrations.map((x) => {
return {
id: `manage-${x.id}`,
name: getName(x),
route: `/project/${ref}/integrations/${x.id}/overview`,
icon: () => (
<div className="w-6 h-6 relative bg-white border rounded-md flex items-center justify-center [&>img]:!p-1 [&>svg]:!p-1">
{x.icon()}
</div>
),
}
}),
{
...options,
deps: [ref],
orderSection: orderCommandSectionsByPriority,
sectionMeta: { priority: 3 },
}
)
}