mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 18:35:07 +03:00
* feat: groundwork for disabling features * update to use profile endpoint & disable features * fix ts error * add useIsFeatureEnabled mock * fix merge conflicts * fix test * upgrade to pro * prettier * add more billing enabled feature checks * disable more stuff * update useIsFeatureEnabled hook * Fix database reports disk size * Fix database reports disk size * disable log sources * disable moar things * Tiny fix --------- Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
|
import { useRouter } from 'next/router'
|
|
import { PropsWithChildren } from 'react'
|
|
|
|
import NoPermission from 'components/ui/NoPermission'
|
|
import ProductMenu from 'components/ui/ProductMenu'
|
|
import { useCheckPermissions, useIsFeatureEnabled, useSelectedProject, withAuth } from 'hooks'
|
|
import ProjectLayout from '../'
|
|
import { generateLogsMenu } from './LogsMenu.utils'
|
|
|
|
interface LogsLayoutProps {
|
|
title?: string
|
|
}
|
|
|
|
const LogsLayout = ({ title, children }: PropsWithChildren<LogsLayoutProps>) => {
|
|
const router = useRouter()
|
|
const pathArr = router.pathname.split('/')
|
|
const page = pathArr[pathArr.length - 1]
|
|
|
|
const { projectAuthAll: authEnabled, projectStorageAll: storageEnabled } = useIsFeatureEnabled([
|
|
'project_storage:all',
|
|
'project_auth:all',
|
|
])
|
|
|
|
const project = useSelectedProject()
|
|
|
|
const canUseLogsExplorer = useCheckPermissions(PermissionAction.ANALYTICS_READ, 'logflare')
|
|
|
|
if (!canUseLogsExplorer) {
|
|
return (
|
|
<ProjectLayout>
|
|
<main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto">
|
|
<NoPermission isFullPage resourceText="access your project's logs explorer" />
|
|
</main>
|
|
</ProjectLayout>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<ProjectLayout
|
|
title={title}
|
|
product="Logs"
|
|
productMenu={
|
|
<ProductMenu
|
|
page={page}
|
|
menu={generateLogsMenu(project, {
|
|
auth: authEnabled,
|
|
storage: storageEnabled,
|
|
})}
|
|
/>
|
|
}
|
|
>
|
|
<main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto">
|
|
{children}
|
|
</main>
|
|
</ProjectLayout>
|
|
)
|
|
}
|
|
|
|
export default withAuth(LogsLayout)
|