+ {/* Header */}
-
Dashboard
+
+ Welcome{user?.firstName ? `, ${user.firstName}` : ''}
+
Monitor your loved ones and manage their health sensors
-
-
Dashboard content coming soon...
+ {/* Summary Cards */}
+
+
+
+
+
+
+ {/* Beneficiaries List */}
+
+
+
Your Loved Ones
+
+
+
+ {beneficiaries.length === 0 ? (
+
+
+ 👤
+
+
No beneficiaries yet
+
+ Add your first loved one to start monitoring their health and safety.
+
+
+
+ ) : (
+
+ {beneficiaries.map((beneficiary) => (
+ handleViewBeneficiary(beneficiary.id)}
+ />
+ ))}
+
+ )}
);
}
+
+/**
+ * Summary Card Component
+ */
+interface SummaryCardProps {
+ title: string;
+ value: number;
+ icon: string;
+ color: 'blue' | 'green' | 'purple';
+}
+
+function SummaryCard({ title, value, icon, color }: SummaryCardProps) {
+ const colorClasses = {
+ blue: 'bg-blue-50 text-blue-600',
+ green: 'bg-green-50 text-green-600',
+ purple: 'bg-purple-50 text-purple-600',
+ };
+
+ return (
+
+ );
+}
+
+/**
+ * Beneficiary Card Component
+ */
+interface BeneficiaryCardProps {
+ beneficiary: Beneficiary;
+ onClick: () => void;
+}
+
+function BeneficiaryCard({ beneficiary, onClick }: BeneficiaryCardProps) {
+ const getEquipmentStatusBadge = () => {
+ if (!beneficiary.equipmentStatus) {
+ return { text: 'No Equipment', color: 'bg-slate-100 text-slate-700' };
+ }
+
+ const statusMap: Record
= {
+ none: { text: 'No Equipment', color: 'bg-slate-100 text-slate-700' },
+ ordered: { text: 'Ordered', color: 'bg-blue-100 text-blue-700' },
+ shipped: { text: 'Shipped', color: 'bg-yellow-100 text-yellow-700' },
+ delivered: { text: 'Delivered', color: 'bg-green-100 text-green-700' },
+ active: { text: 'Active', color: 'bg-green-100 text-green-700' },
+ demo: { text: 'Demo', color: 'bg-purple-100 text-purple-700' },
+ };
+
+ return statusMap[beneficiary.equipmentStatus] || statusMap.none;
+ };
+
+ const getSubscriptionBadge = () => {
+ if (!beneficiary.subscription) {
+ return null;
+ }
+
+ const statusMap: Record = {
+ active: { text: 'Active', color: 'bg-green-100 text-green-700' },
+ trial: { text: 'Trial', color: 'bg-blue-100 text-blue-700' },
+ expired: { text: 'Expired', color: 'bg-red-100 text-red-700' },
+ cancelled: { text: 'Cancelled', color: 'bg-slate-100 text-slate-700' },
+ };
+
+ const badge = statusMap[beneficiary.subscription.status];
+ if (!badge) return null;
+
+ return (
+
+ {badge.text}
+
+ );
+ };
+
+ const equipmentBadge = getEquipmentStatusBadge();
+ const subscriptionBadge = getSubscriptionBadge();
+
+ return (
+
+ );
+}
diff --git a/web/tsconfig.json b/web/tsconfig.json
index 1f51897..4c72822 100644
--- a/web/tsconfig.json
+++ b/web/tsconfig.json
@@ -26,7 +26,11 @@
"@/*": [
"./*"
]
- }
+ },
+ "types": [
+ "jest",
+ "@testing-library/jest-dom"
+ ]
},
"include": [
"next-env.d.ts",