import { PermissionAction } from '@supabase/shared-types/out/constants' import { useParams } from 'common' import { PropsWithChildren } from 'react' import { ProjectLayout } from '../ProjectLayout' import { LogsSidebarMenuV2 } from './LogsSidebarMenuV2' import NoPermission from '@/components/ui/NoPermission' import { UnknownInterface } from '@/components/ui/UnknownInterface' import { useAsyncCheckPermissions } from '@/hooks/misc/useCheckPermissions' import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled' import { withAuth } from '@/hooks/misc/withAuth' interface LogsLayoutProps { title: string } const LogsLayout = ({ title, children }: PropsWithChildren) => { const { ref } = useParams() const logsEnabled = useIsFeatureEnabled('logs:all') const { isLoading, can: canUseLogsExplorer } = useAsyncCheckPermissions( PermissionAction.ANALYTICS_READ, 'logflare' ) if (!logsEnabled) { return ( ) } if (!canUseLogsExplorer) { if (isLoading) { return ( ) } if (!isLoading && !canUseLogsExplorer) { return ( ) } } return ( } > {children} ) } export default withAuth(LogsLayout)