mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
<img width="1305" height="861" alt="file-4841beec98e7fc8c1c9774747afc79a8" src="https://github.com/user-attachments/assets/5455f835-79d7-4e5f-9e12-b0203019084d" /> Replaces the colored severity dots on Issues with three ascending bars, filled up to the severity in its color: - Critical: three red bars - Warning: two yellow bars - Info: one gray bar Empty bars are neutral gray. The new `SeverityIndicator` component is used everywhere the dot was: the Issues sidebar list, the issue detail header, the overview stat cards, and the Issues card on Project Home. ## How to test 1. Open a project with open issues and go to **Issues**. 2. Check the sidebar list: each row shows bars matching its severity, and the second line stays aligned with the title. 3. Check the overview stat cards: Critical, Warning, and Info each show their bars next to the label. 4. Open an issue and check the bars next to the severity in the header. 5. Go to **Project Home** and check the Issues card. 6. Repeat in light and dark themes. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import type { ComponentProps } from 'react'
|
|
import { cn } from 'ui'
|
|
|
|
import { SEVERITY_LABELS } from './Issues.constants'
|
|
import type { IssueSeverity } from '@/data/issues/issue.types'
|
|
|
|
const FILLED_BAR_COUNT: Record<IssueSeverity, number> = {
|
|
info: 1,
|
|
warning: 2,
|
|
critical: 3,
|
|
}
|
|
|
|
const FILLED_BAR_COLORS: Record<IssueSeverity, string> = {
|
|
info: 'text-foreground-lighter',
|
|
warning: 'text-warning',
|
|
critical: 'text-destructive',
|
|
}
|
|
|
|
const BAR_HEIGHTS = [4, 7, 10]
|
|
|
|
type SeverityIndicatorProps = { severity: IssueSeverity } & Omit<ComponentProps<'svg'>, 'children'>
|
|
|
|
/**
|
|
* Three ascending bars, filled up to the issue's severity in its color: one gray bar for info,
|
|
* two yellow for warning, three red for critical. Pass `aria-hidden` when the severity label is
|
|
* already shown next to it.
|
|
*/
|
|
export const SeverityIndicator = ({ severity, className, ...props }: SeverityIndicatorProps) => {
|
|
const filledBarCount = FILLED_BAR_COUNT[severity]
|
|
|
|
return (
|
|
<svg
|
|
viewBox="0 0 12 12"
|
|
role="img"
|
|
aria-label={SEVERITY_LABELS[severity]}
|
|
className={cn('size-3 shrink-0', FILLED_BAR_COLORS[severity], className)}
|
|
{...props}
|
|
>
|
|
{BAR_HEIGHTS.map((height, index) => (
|
|
<rect
|
|
key={height}
|
|
x={1 + index * 4}
|
|
y={11 - height}
|
|
width={2}
|
|
height={height}
|
|
rx={0.5}
|
|
className={index < filledBarCount ? 'fill-current' : 'fill-border-stronger'}
|
|
/>
|
|
))}
|
|
</svg>
|
|
)
|
|
}
|