mirror of
https://github.com/supabase/supabase.git
synced 2026-09-09 11:30:17 +08:00
## 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
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
|
import { useParams } from 'common'
|
|
import { PropsWithChildren } from 'react'
|
|
|
|
import DatabaseLayout from './DatabaseLayout'
|
|
import { PageLayout } from '@/components/layouts/PageLayout/PageLayout'
|
|
import { NoPermission } from '@/components/ui/NoPermission'
|
|
import { useAsyncCheckPermissions } from '@/hooks/misc/useCheckPermissions'
|
|
|
|
type DatabaseTriggersLayoutProps = PropsWithChildren
|
|
|
|
export const DatabaseTriggersLayout = ({ children }: DatabaseTriggersLayoutProps) => {
|
|
const { ref } = useParams()
|
|
const { can: canReadTriggers, isSuccess: isPermissionsLoaded } = useAsyncCheckPermissions(
|
|
PermissionAction.TENANT_SQL_ADMIN_READ,
|
|
'triggers'
|
|
)
|
|
|
|
const navigationItems = [
|
|
{
|
|
label: 'Data',
|
|
href: `/project/${ref}/database/triggers/data`,
|
|
},
|
|
{
|
|
label: 'Event',
|
|
href: `/project/${ref}/database/triggers/event`,
|
|
},
|
|
]
|
|
|
|
return (
|
|
<DatabaseLayout title="Triggers">
|
|
{isPermissionsLoaded && !canReadTriggers ? (
|
|
<NoPermission isFullPage resourceText="view database triggers" />
|
|
) : (
|
|
<PageLayout
|
|
title="Database Triggers"
|
|
subtitle="Execute actions automatically when database events occur"
|
|
navigationItems={navigationItems}
|
|
size="large"
|
|
>
|
|
{children}
|
|
</PageLayout>
|
|
)}
|
|
</DatabaseLayout>
|
|
)
|
|
}
|