import Link from "next/link"; import type { PlantListItemDto } from "../server/queries"; type Props = { plants: PlantListItemDto[]; }; function daysAgo(isoString: string): string { const diff = Date.now() - new Date(isoString).getTime(); const days = Math.floor(diff / 86_400_000); if (days === 0) return "today"; if (days === 1) return "yesterday"; return `${days}d ago`; } function healthBadgeClass(status: string): string { if (status === "healthy") return "badge-success"; if (status === "sick") return "badge-danger"; return "badge-warning"; } export function PlantList({ plants }: Props) { if (plants.length === 0) { return (
No plants yet.
Add your first plant{plant.name}
Care overdue
)}