import React from 'react'; import { __ } from '@wordpress/i18n'; import { applyFilters } from '@wordpress/hooks'; import { ArrowRight, Check, FlaskConical, Gauge, HardDrive, Search, ShieldCheck, type LucideIcon } from 'lucide-react'; import type { NavigateFunction } from 'react-router-dom'; import GradeChip from './GradeChip'; import ProPill from './ProPill'; import type { CategoryKey } from '../../api'; import type { DashboardCard, DashboardLine, DashboardModelStats } from './model'; const ICONS: Record< CategoryKey, LucideIcon > = { speed: Gauge, seo: Search, storage: HardDrive, protect: ShieldCheck, }; function EstimateChip() { return ( ); } function LineBody( { line, cardKey }: { line: DashboardLine; cardKey: string } ) { return (
{ line.num ? <>{ line.num }{ ' ' }{ line.label } : { line.label } } { line.tier === 'pro' && } { line.tier === 'ok' && ( ) } { line.tier === 'free' && ( { __( 'Free fix', 'image-sizes' ) } ) }
{ ( line.note || line.estimate ) && (
{ line.note && { line.note } } { line.estimate && }
) }
); } function Line( { line, cardKey }: { line: DashboardLine; cardKey: string } ) { if ( line.to || line.href ) { return ( ); } return ; } /** * One of the four category cards. * * A line that used to be a dashboard card still runs through that card's filter, so a Pro release * that overrides it keeps working; the default it receives is the line itself. */ export default function CategoryCard( { card, stats, navigate, onScan, busy }: { card: DashboardCard; stats: DashboardModelStats; navigate: NavigateFunction; onScan: () => void; busy: boolean; } ) { const Icon = ICONS[ card.key ]; const fixInner = ( <> { card.fix.label }