AdvisorRulesLayout.tsx42 lines · main
1import { LOCAL_STORAGE_KEYS, useParams } from 'common'
2import { PropsWithChildren } from 'react'
3
4import DefaultLayout from '../DefaultLayout'
5import { PageLayout } from '../PageLayout/PageLayout'
6import AdvisorsLayout from './AdvisorsLayout'
7import { useIsAdvisorRulesEnabled } from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'
8import { FeaturePreviewBadge } from '@/components/ui/FeaturePreviewBadge'
9
10export const AdvisorRulesLayout = ({ children }: PropsWithChildren<{}>) => {
11 const { ref } = useParams()
12 const isAdvisorRulesEnabled = useIsAdvisorRulesEnabled()
13 return (
14 <DefaultLayout>
15 <AdvisorsLayout>
16 <PageLayout
17 title={
18 <span className="flex items-center gap-x-4">
19 Advisor Settings
20 {isAdvisorRulesEnabled && (
21 <FeaturePreviewBadge featureKey={LOCAL_STORAGE_KEYS.UI_PREVIEW_ADVISOR_RULES} />
22 )}
23 </span>
24 }
25 subtitle="Disable specific advisor categories or rules"
26 navigationItems={[
27 {
28 label: 'Security',
29 href: `/project/${ref}/advisors/rules/security`,
30 },
31 {
32 label: 'Performance',
33 href: `/project/${ref}/advisors/rules/performance`,
34 },
35 ]}
36 >
37 {children}
38 </PageLayout>
39 </AdvisorsLayout>
40 </DefaultLayout>
41 )
42}