Files
supabase/apps/studio/components/layouts/LogsLayout/LogsLayout.tsx
a10bc9a88a feat(unified-logs): compact toggle banner and ArrowDown selects first log (#46812)
Visual cleanup of the Logs sidebar (unified logs):

- Restyle the "Go back to old logs" and "Try Unified Logs" banners as
full-bleed bordered strips (no card), with an icon-only switch-back
button and a tooltip
- Add a "Beta" badge next to the "Logs" sidebar title
- Rename the product from "Logs & Analytics" to "Logs"

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added Unified Logs banner with “Try Unified Logs” and “More
information” actions, plus a “Go back to old logs” utility layout.
  * Show a **“Beta”** badge for Unified Logs eligibility.

* **UX Updates**
* Updated the Logs experience to consistently display under the
**“Logs”** product layout.

* **Tests / Documentation**
* Updated end-to-end checks and examples to expect the **“Logs”**
heading text exactly.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: kemal <hello@kemal.earth>
2026-06-16 10:50:52 +00: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)