import type { PrintJob } from '../types' import { Clock, FileText } from 'lucide-react' interface RecentPrintsProps { jobs: PrintJob[] } export default function RecentPrints({ jobs }: RecentPrintsProps) { if (jobs.length === 0) { return (

No recent print jobs

) } const statusColor = (status: string) => { switch (status.toLowerCase()) { case 'completed': return 'text-emerald-400 bg-emerald-500/10' case 'in_progress': return 'text-sky-400 bg-sky-500/10' case 'failed': return 'text-red-400 bg-red-500/10' default: return 'text-slate-400 bg-slate-500/10' } } return (
{jobs.map((job) => ( ))}
Name Status Duration Filament Cost
{job.name} {job.status}
{formatDuration(job.duration_seconds)}
{job.filament_used_grams?.toFixed(1) ?? '-'} g ${job.cost_usd?.toFixed(2) ?? '-'}
) } function formatDuration(seconds: number): string { if (!seconds) return '-' const hrs = Math.floor(seconds / 3600) const mins = Math.floor((seconds % 3600) / 60) if (hrs > 0) return `${hrs}h ${mins}m` return `${mins}m` }