mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-06 19:35:13 +02:00
added svg for confirmed verdict badge
This commit is contained in:
parent
291fe5d7be
commit
49fa174607
4 changed files with 15 additions and 10 deletions
|
|
@ -49,7 +49,6 @@ export function VerdictBadge({ verdict, compact = false }: VerdictBadgeProps) {
|
|||
const { status } = verdict;
|
||||
const label = STATUS_LABELS[status] ?? status;
|
||||
const tooltip = verdictTooltip(verdict);
|
||||
const flame = status === 'Confirmed' ? '🔥 ' : '';
|
||||
|
||||
return (
|
||||
<span
|
||||
|
|
@ -57,7 +56,6 @@ export function VerdictBadge({ verdict, compact = false }: VerdictBadgeProps) {
|
|||
title={tooltip}
|
||||
data-testid={`verdict-badge-${status.toLowerCase()}`}
|
||||
>
|
||||
{flame}
|
||||
{compact ? status.charAt(0) : label}
|
||||
</span>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -153,6 +153,14 @@ export function CloseIcon({ className, size = 14 }: IconProps) {
|
|||
);
|
||||
}
|
||||
|
||||
export function CheckIcon({ className, size = 14 }: IconProps) {
|
||||
return (
|
||||
<svg {...svgProps({ className, size })} viewBox="0 0 14 14">
|
||||
<path d="M2.5 7.5l3 3 6-7" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export function SunIcon({ className, size = 16 }: IconProps) {
|
||||
return (
|
||||
<svg {...svgProps({ className, size })} viewBox="0 0 16 16">
|
||||
|
|
@ -199,4 +207,5 @@ export const ICONS: Record<string, FC<IconProps>> = {
|
|||
debug: DebugIcon,
|
||||
folder: FolderIcon,
|
||||
tag: TagIcon,
|
||||
check: CheckIcon,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
useState,
|
||||
type ReactNode,
|
||||
} from 'react';
|
||||
import { CheckIcon } from '../icons/Icons';
|
||||
|
||||
interface DropdownProps {
|
||||
trigger: (opts: { open: boolean }) => ReactNode;
|
||||
|
|
@ -94,7 +95,7 @@ export function DropdownItem({
|
|||
onClick={onClick}
|
||||
>
|
||||
<span className="dropdown-item-check" aria-hidden>
|
||||
{checked ? '✓' : ''}
|
||||
{checked && <CheckIcon size={14} />}
|
||||
</span>
|
||||
<span className="dropdown-item-label">{children}</span>
|
||||
{hint && <span className="dropdown-item-hint">{hint}</span>}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ describe('VerdictBadge', () => {
|
|||
expect(screen.getByText('-')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders Confirmed badge with flame and correct class', () => {
|
||||
it('renders Confirmed badge with correct class', () => {
|
||||
render(
|
||||
<VerdictBadge
|
||||
verdict={makeVerdict('Confirmed', {
|
||||
|
|
@ -32,10 +32,10 @@ describe('VerdictBadge', () => {
|
|||
const badge = screen.getByTestId('verdict-badge-confirmed');
|
||||
expect(badge).toBeInTheDocument();
|
||||
expect(badge.className).toContain('badge-dyn-confirmed');
|
||||
expect(badge.textContent).toContain('🔥');
|
||||
expect(badge.textContent).toBe('Confirmed');
|
||||
});
|
||||
|
||||
it('renders PartiallyConfirmed badge with amber class and no flame', () => {
|
||||
it('renders PartiallyConfirmed badge with amber class', () => {
|
||||
render(
|
||||
<VerdictBadge
|
||||
verdict={makeVerdict('PartiallyConfirmed', {
|
||||
|
|
@ -47,7 +47,6 @@ describe('VerdictBadge', () => {
|
|||
const badge = screen.getByTestId('verdict-badge-partiallyconfirmed');
|
||||
expect(badge).toBeInTheDocument();
|
||||
expect(badge.className).toContain('badge-dyn-partiallyconfirmed');
|
||||
expect(badge.textContent).not.toContain('🔥');
|
||||
expect(badge.getAttribute('title')).toContain('sink reached');
|
||||
});
|
||||
|
||||
|
|
@ -56,7 +55,6 @@ describe('VerdictBadge', () => {
|
|||
const badge = screen.getByTestId('verdict-badge-notconfirmed');
|
||||
expect(badge).toBeInTheDocument();
|
||||
expect(badge.className).toContain('badge-dyn-notconfirmed');
|
||||
expect(badge.textContent).not.toContain('🔥');
|
||||
});
|
||||
|
||||
it('renders when attempts are omitted by the API', () => {
|
||||
|
|
@ -119,8 +117,7 @@ describe('VerdictBadge', () => {
|
|||
it('compact mode renders single character', () => {
|
||||
render(<VerdictBadge verdict={makeVerdict('Confirmed')} compact />);
|
||||
const badge = screen.getByTestId('verdict-badge-confirmed');
|
||||
// Compact: first char of status + flame emoji
|
||||
expect(badge.textContent?.replace('🔥 ', '')).toBe('C');
|
||||
expect(badge.textContent).toBe('C');
|
||||
});
|
||||
|
||||
it('renders all five VerifyStatus variants without crashing', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue