/** * @file app/summary/sections/SummaryPriorityCard.tsx * @description Client component rendering the priority severity analysis breakdown. */ "use client"; import { Flame } from "lucide-react"; import { PRIORITY_CONFIG } from "@/types/task"; /** * Properties for the SummaryPriorityCard component. * * @interface SummaryPriorityCardProps * @property {number} totalTasks - The total number of tasks to calculate percentages against. * @property {Record} priorityCounts - An object containing counts for each priority level. */ interface SummaryPriorityCardProps { totalTasks: number; priorityCounts: Record; } /** * Renders a priority breakdown card featuring progress bars, count badges, * percentage statistics, and severity configuration tags for high, medium, and low tasks. * * @param {SummaryPriorityCardProps} props - The component props. * @returns {JSX.Element} The rendered summary priority card component. */ export default function SummaryPriorityCard({ totalTasks, priorityCounts, }: SummaryPriorityCardProps) { return (

Priority Breakdown

Severity and importance weights assigned to active workloads.

{(["high", "medium", "low"] as const).map((pKey) => { const count = priorityCounts[pKey] || 0; const percentage = totalTasks > 0 ? Math.round((count / totalTasks) * 100) : 0; const config = PRIORITY_CONFIG[pKey]; return (
{config.label}
{percentage}% {count} {count === 1 ? "item" : "items"}
); })}
); }