mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
**Old** <img width="1376" height="1115" alt="image" src="https://github.com/user-attachments/assets/75703b14-f066-491e-8d5a-b68a716fa081" /> **New** <img width="1374" height="678" alt="image" src="https://github.com/user-attachments/assets/538830be-a8bf-40c8-97dc-2c6085d500c7" /> This updates the add-ons design to remove the Compute Size section which has now been moved and simplify the add-on list design.
177 lines
4.8 KiB
TypeScript
177 lines
4.8 KiB
TypeScript
import { useFlag, useParams } from 'common'
|
|
import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'
|
|
import { ArrowUpRight } from 'lucide-react'
|
|
|
|
import { useIsPlatformWebhooksEnabled } from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'
|
|
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
|
|
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
|
|
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
|
|
|
|
export const useGenerateSettingsMenu = () => {
|
|
const { ref } = useParams()
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const { data: organization } = useSelectedOrganizationQuery()
|
|
|
|
const showDashboardPreferences = useFlag('dashboardPreferences')
|
|
const platformWebhooksEnabled = useIsPlatformWebhooksEnabled()
|
|
|
|
const { projectSettingsLegacyJwtKeys: legacyJwtKeysEnabled, billingAll: billingEnabled } =
|
|
useIsFeatureEnabled(['project_settings:legacy_jwt_keys', 'billing:all'])
|
|
|
|
const isProjectActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY
|
|
|
|
if (!IS_PLATFORM) {
|
|
return [
|
|
{
|
|
title: 'Configuration',
|
|
items: [
|
|
{
|
|
name: `Log Drains`,
|
|
key: `log-drains`,
|
|
url: `/project/${ref}/settings/log-drains`,
|
|
items: [],
|
|
},
|
|
],
|
|
},
|
|
]
|
|
}
|
|
|
|
return [
|
|
{
|
|
title: 'Configuration',
|
|
items: [
|
|
{
|
|
name: 'General',
|
|
key: 'general',
|
|
url: `/project/${ref}/settings/general`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Compute and Disk',
|
|
key: 'compute-and-disk',
|
|
url: `/project/${ref}/settings/compute-and-disk`,
|
|
items: [],
|
|
disabled: !isProjectActive,
|
|
},
|
|
{
|
|
name: 'Infrastructure',
|
|
key: 'infrastructure',
|
|
url: `/project/${ref}/settings/infrastructure`,
|
|
items: [],
|
|
disabled: !isProjectActive,
|
|
},
|
|
|
|
{
|
|
name: 'Integrations',
|
|
key: 'integrations',
|
|
url: `/project/${ref}/settings/integrations`,
|
|
items: [],
|
|
disabled: !isProjectActive,
|
|
},
|
|
...(platformWebhooksEnabled
|
|
? [
|
|
{
|
|
name: 'Webhooks',
|
|
key: 'webhooks',
|
|
url: `/project/${ref}/settings/webhooks`,
|
|
items: [],
|
|
disabled: !isProjectActive,
|
|
},
|
|
]
|
|
: []),
|
|
|
|
{
|
|
name: 'API Keys',
|
|
key: 'api-keys',
|
|
url: `/project/${ref}/settings/api-keys/new`,
|
|
items: [],
|
|
disabled: !isProjectActive,
|
|
},
|
|
{
|
|
name: 'JWT Keys',
|
|
key: 'jwt',
|
|
url: legacyJwtKeysEnabled
|
|
? `/project/${ref}/settings/jwt`
|
|
: `/project/${ref}/settings/jwt/signing-keys`,
|
|
items: [],
|
|
disabled: !isProjectActive,
|
|
},
|
|
|
|
{
|
|
name: `Log Drains`,
|
|
key: `log-drains`,
|
|
url: `/project/${ref}/settings/log-drains`,
|
|
items: [],
|
|
disabled: !isProjectActive,
|
|
},
|
|
{
|
|
name: 'Add-ons',
|
|
key: 'addons',
|
|
url: `/project/${ref}/settings/addons`,
|
|
items: [],
|
|
},
|
|
],
|
|
},
|
|
...(IS_PLATFORM && showDashboardPreferences
|
|
? [
|
|
{
|
|
title: 'Preferences',
|
|
items: [
|
|
{
|
|
name: 'Dashboard preferences',
|
|
key: 'preferences',
|
|
url: `/project/${ref}/settings/preferences`,
|
|
items: [],
|
|
},
|
|
],
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
title: 'Integrations',
|
|
items: [
|
|
{
|
|
name: 'Data API',
|
|
key: 'api',
|
|
url: `/project/${ref}/integrations/data_api/overview`,
|
|
items: [],
|
|
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
|
|
disabled: !isProjectActive,
|
|
},
|
|
{
|
|
name: 'Vault',
|
|
key: 'vault',
|
|
url: `/project/${ref}/integrations/vault/overview`,
|
|
items: [],
|
|
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
|
|
label: 'Beta',
|
|
disabled: !isProjectActive,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
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" />,
|
|
},
|
|
],
|
|
},
|
|
]
|
|
}
|