Files
supabase/apps/studio/components/layouts/RealtimeLayout/RealtimeMenu.utils.ts
T
Joshen Lim 1655a17e70 Add support for configuring realtime settings (#33875)
* Add support for configuring realtime settings

* Refactor

* Fix TS

* Fix TS

* Smol update

* Hide new UI for local selfhosted

* Add feature flag

* Fix reset logic

* Fix

* minor refactor

* Fix package.json

* Simplify
2025-03-03 20:08:15 +08:00

47 lines
1.1 KiB
TypeScript

import type { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
import type { Project } from 'data/projects/project-detail-query'
import { IS_PLATFORM } from 'lib/constants'
export const generateRealtimeMenu = (
project: Project,
flags?: { enableRealtimeSettings: boolean }
): ProductMenuGroup[] => {
const ref = project?.ref ?? 'default'
const { enableRealtimeSettings } = flags || {}
return [
{
title: 'Tools',
items: [
{
name: 'Inspector',
key: 'inspector',
url: `/project/${ref}/realtime/inspector`,
items: [],
},
],
},
{
title: 'Configuration',
items: [
{
name: 'Policies',
key: 'policies',
url: `/project/${ref}/realtime/policies`,
items: [],
},
...(IS_PLATFORM && enableRealtimeSettings
? [
{
name: 'Settings',
key: 'settings',
url: `/project/${ref}/realtime/settings`,
items: [],
},
]
: []),
],
},
]
}