mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 20:05:06 +03:00
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
|
|
|
import { PropsWithChildren } from 'react'
|
|
|
|
import NoPermission from 'components/ui/NoPermission'
|
|
import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
|
|
import { withAuth } from 'hooks/misc/withAuth'
|
|
import { ProjectLayout } from '../ProjectLayout'
|
|
import { LogsSidebarMenuV2 } from './LogsSidebarMenuV2'
|
|
|
|
interface LogsLayoutProps {
|
|
title?: string
|
|
}
|
|
|
|
const LogsLayout = ({ title, children }: PropsWithChildren<LogsLayoutProps>) => {
|
|
const { isLoading, can: canUseLogsExplorer } = useAsyncCheckPermissions(
|
|
PermissionAction.ANALYTICS_READ,
|
|
'logflare'
|
|
)
|
|
|
|
if (!canUseLogsExplorer) {
|
|
if (isLoading) {
|
|
return <ProjectLayout isLoading></ProjectLayout>
|
|
}
|
|
|
|
if (!isLoading && !canUseLogsExplorer) {
|
|
return (
|
|
<ProjectLayout>
|
|
<NoPermission isFullPage resourceText="access your project's logs" />
|
|
</ProjectLayout>
|
|
)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<ProjectLayout title={title} product="Logs & Analytics" productMenu={<LogsSidebarMenuV2 />}>
|
|
{children}
|
|
</ProjectLayout>
|
|
)
|
|
}
|
|
|
|
export default withAuth(LogsLayout)
|