mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 22:29:11 +03:00
* 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
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { useRouter } from 'next/router'
|
|
import { PropsWithChildren } from 'react'
|
|
|
|
import { ProductMenu } from 'components/ui/ProductMenu'
|
|
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
|
|
import { withAuth } from 'hooks/misc/withAuth'
|
|
import { useFlag } 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 enableRealtimeSettings = useFlag('enableRealtimeSettings')
|
|
|
|
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)
|