mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 06:09:08 +03:00
* feat: add Realtime private only feature flag * Chore/patch realtime private only (#37040) * Fix feature preview logic for toggling visibility of private channel toggle in realtime settings * Refactor feature preview to control realtime settings visibility, clean up old feature preview images * Add image for realtime settings feature preview * Fix TS * Check FF as well for showing realtime settings on top of feature preview --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { useRouter } from 'next/router'
|
|
import { PropsWithChildren } from 'react'
|
|
|
|
import { useIsRealtimeSettingsEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
|
|
import { ProductMenu } from 'components/ui/ProductMenu'
|
|
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
|
|
import { withAuth } from 'hooks/misc/withAuth'
|
|
import { useIsRealtimeSettingsFFEnabled } from 'hooks/ui/useFlag'
|
|
import ProjectLayout from '../ProjectLayout/ProjectLayout'
|
|
import { generateRealtimeMenu } from './RealtimeMenu.utils'
|
|
|
|
export interface RealtimeLayoutProps {
|
|
title: string
|
|
}
|
|
|
|
const RealtimeLayout = ({ title, children }: PropsWithChildren<RealtimeLayoutProps>) => {
|
|
const project = useSelectedProject()
|
|
const enableRealtimeSettingsFF = useIsRealtimeSettingsFFEnabled()
|
|
const enableRealtimeSettingsFP = useIsRealtimeSettingsEnabled()
|
|
|
|
const enableRealtimeSettings = enableRealtimeSettingsFF && enableRealtimeSettingsFP
|
|
|
|
const router = useRouter()
|
|
const page = router.pathname.split('/')[4]
|
|
|
|
return (
|
|
<ProjectLayout
|
|
title={title}
|
|
product="Realtime"
|
|
productMenu={
|
|
<ProductMenu
|
|
page={page}
|
|
menu={generateRealtimeMenu(project!, { enableRealtimeSettings })}
|
|
/>
|
|
}
|
|
>
|
|
{children}
|
|
</ProjectLayout>
|
|
)
|
|
}
|
|
|
|
export default withAuth(RealtimeLayout)
|