AdvisorRulesLayout.tsx 1.4 KB

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