import { daysAgoFromNow } from '@/lib/format'; import type { Lead } from '@/types/entities'; interface AlertsWidgetProps { leads: Lead[]; } export const AlertsWidget = ({ leads }: AlertsWidgetProps) => { const agingCount = leads.filter( (l) => l.leadStatus === 'NEW' && l.createdAt !== null && daysAgoFromNow(l.createdAt) > 5, ).length; if (agingCount === 0) { return null; } return (

{agingCount} leads aging > 5 days

These leads haven't been contacted and are at risk of going cold.

); };