Files
supabase/apps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.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

187 lines
5.4 KiB
TypeScript

import { ArrowUpRight } from 'lucide-react'
import type { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
import type { Project } from 'data/projects/project-detail-query'
import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'
import type { Organization } from 'types'
export const generateSettingsMenu = (
ref?: string,
project?: Project,
organization?: Organization,
features?: {
auth?: boolean
edgeFunctions?: boolean
storage?: boolean
invoices?: boolean
legacyJwtKeys?: boolean
logDrains?: boolean
billing?: boolean
}
): ProductMenuGroup[] => {
const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP
const buildingUrl = `/project/${ref}`
const authEnabled = features?.auth ?? true
const edgeFunctionsEnabled = features?.edgeFunctions ?? true
const storageEnabled = features?.storage ?? true
const legacyJwtKeysEnabled = features?.legacyJwtKeys ?? true
const logDrainsEnabled = features?.logDrains ?? true
const billingEnabled = features?.billing ?? true
return [
{
title: 'Project Settings',
items: [
{
name: 'General',
key: 'general',
url: `/project/${ref}/settings/general`,
items: [],
},
...(IS_PLATFORM
? [
{
name: 'Compute and Disk',
key: 'compute-and-disk',
url: `/project/${ref}/settings/compute-and-disk`,
items: [],
},
]
: []),
{
name: 'Infrastructure',
key: 'infrastructure',
url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/infrastructure`,
items: [],
},
...(IS_PLATFORM
? [
{
name: 'Integrations',
key: 'integrations',
url: `/project/${ref}/settings/integrations`,
items: [],
},
...(logDrainsEnabled
? [
{
name: `Log Drains`,
key: `log-drains`,
url: `/project/${ref}/settings/log-drains`,
items: [],
},
]
: []),
{
name: 'Data API',
key: 'api',
url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/api`,
items: [],
},
{
name: 'API Keys',
key: 'api-keys',
url: `/project/${ref}/settings/api-keys`,
items: [],
label: 'NEW',
},
{
name: 'JWT Keys',
key: 'jwt',
url: legacyJwtKeysEnabled
? `/project/${ref}/settings/jwt`
: `/project/${ref}/settings/jwt/signing-keys`,
items: [],
label: 'NEW',
},
]
: []),
{
name: 'Add Ons',
key: 'addons',
url: `/project/${ref}/settings/addons`,
items: [],
},
{
name: 'Vault',
key: 'vault',
url: isProjectBuilding ? buildingUrl : `/project/${ref}/integrations/vault/overview`,
items: [],
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
label: 'Alpha',
},
],
},
{
title: 'Configuration',
items: [
{
name: 'Database',
key: 'database',
url: isProjectBuilding ? buildingUrl : `/project/${ref}/database/settings`,
items: [],
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
},
...(IS_PLATFORM && authEnabled
? [
{
name: 'Authentication',
key: 'auth',
url: `/project/${ref}/auth/providers`,
items: [],
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
},
]
: []),
...(IS_PLATFORM && storageEnabled
? [
{
name: 'Storage',
key: 'storage',
url: `/project/${ref}/storage/settings`,
items: [],
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
},
]
: []),
...(IS_PLATFORM && edgeFunctionsEnabled
? [
{
name: 'Edge Functions',
key: 'functions',
url: `/project/${ref}/functions/secrets`,
items: [],
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
},
]
: []),
],
},
{
title: 'Billing',
items: [
...(billingEnabled
? [
{
name: 'Subscription',
key: 'subscription',
url: `/org/${organization?.slug}/billing`,
items: [],
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
},
]
: []),
{
name: 'Usage',
key: 'usage',
url: `/org/${organization?.slug}/usage?projectRef=${ref}`,
items: [],
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
},
],
},
]
}