Files
Wen Bo XieandJoshen Lim 2f6977edc3 feat: add Realtime private only feature flag (#37026)
* 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>
2025-07-11 11:47:05 +01:00

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)