/* ActiveEngineers — top engineers today by hours logged. * * Compact list: name + ticket count + hours bar. Sorted by hours * desc upstream. Empty when no time has been logged yet today. */ 'use client'; import { Activity } from 'lucide-react'; import { EmptyState } from '@/components/ui/empty-state'; interface Engineer { resourceId: string; name: string; hours: number; ticketsTouched: number; } interface ActiveEngineersProps { data: Engineer[]; } export function ActiveEngineers({ data }: ActiveEngineersProps) { if (data.length === 0) { return ( ); } const max = data.reduce((m, e) => Math.max(m, e.hours), 0) || 1; const totalHours = data.reduce((s, e) => s + e.hours, 0); const totalTickets = data.reduce((s, e) => s + e.ticketsTouched, 0); return (
{data.map((e) => { const pct = (e.hours / max) * 100; return (
{e.name}
{e.hours.toFixed(1)}h
{e.ticketsTouched}{' '} ticket{e.ticketsTouched === 1 ? '' : 's'}
); })}
Total today {totalHours.toFixed(1)}h{' '} across {totalTickets}{' '} ticket{totalTickets === 1 ? '' : 's'}
); }