import { Calendar, Clock, PawPrint, CreditCard, Star, ChevronRight, AlertTriangle } from "lucide-react"; import { PETS, UPCOMING_APPOINTMENTS, PAST_APPOINTMENTS, INVOICES, LOYALTY, BUSINESS_NAME } from "../mockData.js"; interface Props { onNavigate: (section: "appointments" | "pets" | "billing" | "reports") => void; readOnly: boolean; } function daysUntil(dateStr: string): number { const now = new Date(); now.setHours(0, 0, 0, 0); const target = new Date(dateStr); target.setHours(0, 0, 0, 0); return Math.ceil((target.getTime() - now.getTime()) / (1000 * 60 * 60 * 24)); } function formatDate(dateStr: string): string { return new Date(dateStr).toLocaleDateString("en-US", { weekday: "short", month: "short", day: "numeric" }); } export function Dashboard({ onNavigate, readOnly }: Props) { const nextAppt = UPCOMING_APPOINTMENTS[0]; const outstanding = INVOICES.filter(i => i.status === "outstanding").reduce((sum, i) => sum + i.amount, 0); const recentEvents = [ ...PAST_APPOINTMENTS.slice(0, 3).map(a => ({ id: a.id, date: a.date, text: `${a.petName} — ${a.services.join(", ")}`, type: "appointment" as const, })), ...INVOICES.filter(i => i.status === "paid").slice(0, 2).map(i => ({ id: i.id, date: i.date, text: `Invoice paid — $${i.amount}`, type: "payment" as const, })), ].sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()).slice(0, 5); return (
Here's what's happening at {BUSINESS_NAME}
{nextAppt.petName} with {nextAppt.groomerName}
{nextAppt.services.join(", ")} {nextAppt.addOns.length > 0 && ` + ${nextAppt.addOns.join(", ")}`}
{LOYALTY.points} pts
{LOYALTY.nextRewardAt - LOYALTY.points} pts to {LOYALTY.rewardName}
${outstanding.toFixed(2)}