Files
Gildas Garcia c6fc456910 chore: cleanup duplicate exports studio (#47387)
## Problem

Knip reports many duplicate exports (both named and default). Besides,
we're moving away from default exports and even have an eslint rule to
enforce it on new code.

## Solution

- Cleanup those exports
- Update imports when necessary

No functional changes. If it builds, it's fine
2026-06-29 15:46:16 +02:00

60 lines
1.7 KiB
TypeScript

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<LogsLayoutProps>) => {
const { ref } = useParams()
const logsEnabled = useIsFeatureEnabled('logs:all')
const { isLoading, can: canUseLogsExplorer } = useAsyncCheckPermissions(
PermissionAction.ANALYTICS_READ,
'logflare'
)
if (!logsEnabled) {
return (
<ProjectLayout product="Logs" browserTitle={{ section: title }}>
<UnknownInterface urlBack={`/project/${ref}`} />
</ProjectLayout>
)
}
if (!canUseLogsExplorer) {
if (isLoading) {
return <ProjectLayout isLoading product="Logs" browserTitle={{ section: title }} />
}
if (!isLoading && !canUseLogsExplorer) {
return (
<ProjectLayout product="Logs" browserTitle={{ section: title }}>
<NoPermission isFullPage resourceText="access your project's logs" />
</ProjectLayout>
)
}
}
return (
<ProjectLayout
product="Logs"
browserTitle={{ section: title }}
productMenu={<LogsSidebarMenuV2 />}
>
{children}
</ProjectLayout>
)
}
export default withAuth(LogsLayout)