mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
Part 5 of 6: #52989 → #52990 → #52991 → #52992 → #52993 → #53138 Switches Studio navigation between Advisors and Issues with `issuesInbox`. With the flag off, the existing Advisors sidebar, pages, command menu entries, shortcuts, header panel, and contextual finding links remain available. With it on, these entry points show Issues and legacy Advisor URLs forward to the matching Issues category while preserving finding context. Direct Issues routes remain accessible in either state. The homepage section remains hidden when the flag is off. Telemetry event names are unchanged. ## How to test 1. Turn `issuesInbox` off: desktop and mobile navigation show Advisors, the header opens Advisor Center, and Security, Performance, and enabled Health Advisor pages remain usable. 2. Turn it on: navigation and the header show Issues. Legacy Advisor category URLs forward to matching Issues lists. 3. `G` then `V` opens the active variant. `V` then `S`, `P`, or `H` follows the active category links; shortcut reference labels match. 4. Table Editor finding links open the legacy finding when off and its issue when on. 5. Direct Issues routes remain usable with the flag off; the homepage section stays hidden. ## Validation - Broad navigation/layout/redirect/shortcut regression suite: 456 tests passed, retries disabled. - Focused suite: 181 tests passed with shuffle seed 52993, retries disabled. - Full Studio TypeScript, scoped ESLint, and changed-file Prettier pass. - Behavioral mutation probes detect broken flag guards, finding links, and redirect destinations; source restored afterward. [DEBUG-255](https://linear.app/supabase/issue/DEBUG-255/replace-advisor-terminology-with-issues-throughout-studio) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com>
77 lines
2.4 KiB
TypeScript
77 lines
2.4 KiB
TypeScript
import { useFlag } from 'common'
|
|
import { TextSearchIcon } from 'lucide-react'
|
|
import { Button } from 'ui'
|
|
|
|
import type { AdvisorCategory } from '@/state/advisor-state'
|
|
|
|
const emptyCopyByCategory: Record<AdvisorCategory, { heading: string; message: string }> = {
|
|
security: {
|
|
heading: 'No security issues detected',
|
|
message: 'Congrats! There are no security issues detected for this project',
|
|
},
|
|
performance: {
|
|
heading: 'No performance issues detected',
|
|
message: 'Congrats! There are no performance issues detected for this project',
|
|
},
|
|
health: {
|
|
heading: 'No health issues detected',
|
|
message: 'Your database, instance and services are all responding normally',
|
|
},
|
|
messages: {
|
|
heading: 'No messages',
|
|
message: 'Messages alert you of upcoming changes or potential issues with your project',
|
|
},
|
|
}
|
|
|
|
interface EmptyAdvisorProps {
|
|
categoryFilters: AdvisorCategory[]
|
|
/**
|
|
* Whether severity or status filters are narrowing the list. Unlike the category filter,
|
|
* these can hide items the user would otherwise see, so we can't claim nothing was found.
|
|
*/
|
|
hasFilters: boolean
|
|
onClearFilters: () => void
|
|
}
|
|
|
|
export const EmptyAdvisor = ({
|
|
categoryFilters,
|
|
hasFilters,
|
|
onClearFilters,
|
|
}: EmptyAdvisorProps) => {
|
|
const isIssuesInboxEnabled = useFlag('issuesInbox')
|
|
const singleCategory = categoryFilters.length === 1 ? categoryFilters[0] : undefined
|
|
const canClearFilters = hasFilters || categoryFilters.length > 0
|
|
|
|
const getCopy = () => {
|
|
if (hasFilters) {
|
|
return {
|
|
heading: 'No items found',
|
|
message: isIssuesInboxEnabled
|
|
? 'No issues match your current filters'
|
|
: 'No advisor items match your current filters',
|
|
}
|
|
}
|
|
|
|
if (singleCategory) return emptyCopyByCategory[singleCategory]
|
|
|
|
return { heading: 'No issues detected', message: 'Congrats! There are no issues detected' }
|
|
}
|
|
|
|
const { heading, message } = getCopy()
|
|
|
|
return (
|
|
<div className="h-full px-6 flex flex-col items-center justify-center w-full gap-y-2">
|
|
<TextSearchIcon className="text-foreground-muted" strokeWidth={1} />
|
|
<div className="flex flex-col items-center gap-y-0.5 text-center">
|
|
<h3 className="heading-default">{heading}</h3>
|
|
<p className="text-foreground-light text-sm text-balance">{message}</p>
|
|
</div>
|
|
{canClearFilters && (
|
|
<Button variant="outline" onClick={onClearFilters}>
|
|
Clear filters
|
|
</Button>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|