import { Realtime } from 'icons'
import Head from 'next/head'
import { useRouter } from 'next/router'
import type { PropsWithChildren } from 'react'
import { ProjectLayout } from '../ProjectLayout'
import { generateRealtimeMenu } from './RealtimeMenu.utils'
import { HighAvailabilityDisabledEmptyState } from '@/components/ui/HighAvailability/HighAvailabilityDisabledEmptyState'
import { ProductMenu } from '@/components/ui/ProductMenu'
import { ProductMenuShortcuts } from '@/components/ui/ProductMenu/ProductMenuShortcuts'
import { useHighAvailability } from '@/hooks/misc/useHighAvailability'
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
import { withAuth } from '@/hooks/misc/withAuth'
/**
* Menu-only component for the Realtime section. Used by the desktop sidebar and by the
* mobile sheet submenu. Must not wrap ProjectLayout so that opening the realtime submenu
* in the mobile sheet does not overwrite registerOpenMenu and break the menu button.
*/
export const RealtimeProductMenu = () => {
const router = useRouter()
const { data: project } = useSelectedProjectQuery()
const page = router.pathname.split('/')[4]
return
}
export interface RealtimeLayoutProps {
title: string
}
export const RealtimeLayout = ({ title, children }: PropsWithChildren) => {
const { data: project } = useSelectedProjectQuery()
const { isHighAvailability } = useHighAvailability()
const router = useRouter()
const page = router.pathname.split('/')[4]
const menu = generateRealtimeMenu(project)
if (isHighAvailability) {
return (
<>
{title}
}
title="Realtime unavailable on High Availability projects"
description="We're working to bring realtime to High Availability projects. Contact support if this is blocking your work."
/>
>
)
}
return (
}
isBlocking={false}
>
{children}
)
}
export default withAuth(RealtimeLayout)