Files
supabase/apps/studio/components/layouts/AdvisorsLayout/AdvisorsMenu.utils.tsx
Joshen Lim 50eea124e7 Small tweaks to feature preview badge (#45409)
## Context

Small improvements from this PR:
https://github.com/supabase/supabase/pull/45373

- Fix feature preview badge alignment
  - Before:
<img width="341" height="75" alt="image"
src="https://github.com/user-attachments/assets/e6e2f727-fc75-4f70-b9cd-94d67aed8c5d"
/>
  - After:
<img width="365" height="64" alt="image"
src="https://github.com/user-attachments/assets/3d6e5e5d-c285-48f4-8f8f-251c23101e41"
/>
- Shift feature preview badge for policies into tester side panel
<img width="640" height="93" alt="image"
src="https://github.com/user-attachments/assets/3efb73a7-f7f5-4ae0-8560-d1e0ba989626"
/>
- Realised that advisor settings wasn't set up to be behind the feature
preview
  - Fixing that in this PR

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

## Summary by CodeRabbit

* **New Features**
  * Added preview badge indicator to the RLS Tester feature

* **Style**
* Improved spacing and layout alignment across authentication, database
access, webhook, logging, and advisor interface components
  * Enhanced badge component styling for better vertical alignment

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-01 10:18:20 +08:00

54 lines
1.5 KiB
TypeScript

import { useParams } from 'common'
import { ArrowUpRight } from 'lucide-react'
import { useIsAdvisorRulesEnabled } from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'
import type { ProductMenuGroup } from '@/components/ui/ProductMenu/ProductMenu.types'
import { IS_PLATFORM } from '@/lib/constants'
export const useGenerateAdvisorsMenu = (): ProductMenuGroup[] => {
const { ref } = useParams()
const isAdvisorRulesEnabled = useIsAdvisorRulesEnabled()
return [
{
title: 'Advisors',
items: [
{
name: 'Security Advisor',
key: 'security',
url: `/project/${ref}/advisors/security`,
items: [],
},
{
name: 'Performance Advisor',
key: 'performance',
url: `/project/${ref}/advisors/performance`,
items: [],
},
{
name: 'Query Performance',
key: 'query-performance',
url: `/project/${ref}/observability/query-performance`,
items: [],
rightIcon: <ArrowUpRight size={14} strokeWidth={1.5} className="h-4 w-4" />,
},
],
},
...(IS_PLATFORM && isAdvisorRulesEnabled
? [
{
title: 'Configuration',
items: [
{
name: 'Settings',
key: 'rules',
url: `/project/${ref}/advisors/rules/security`,
items: [],
},
],
},
]
: []),
]
}