From a56c403af4fc0937b6ff21f8b39217a39e36aae6 Mon Sep 17 00:00:00 2001 From: jason Date: Sun, 8 Mar 2026 23:29:54 -0500 Subject: [PATCH] Redesign: Compact info cards with avatar-style photos --- client/src/pages/Dashboard.jsx | 208 +++++++++++++++++++++++++++------ 1 file changed, 173 insertions(+), 35 deletions(-) diff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsx index b2476fa..6f1da89 100644 --- a/client/src/pages/Dashboard.jsx +++ b/client/src/pages/Dashboard.jsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' import { Link } from 'react-router-dom' -import { Dog, Activity, Heart, AlertCircle } from 'lucide-react' +import { Dog, Activity, Heart, Calendar, Hash, ArrowRight } from 'lucide-react' import axios from 'axios' function Dashboard() { @@ -35,7 +35,7 @@ function Dashboard() { activeHeatCycles: heatCyclesRes.data.length }) - setRecentDogs(dogs.slice(0, 6)) + setRecentDogs(dogs.slice(0, 8)) setLoading(false) } catch (error) { console.error('Error fetching dashboard data:', error) @@ -43,65 +43,203 @@ function Dashboard() { } } + const calculateAge = (birthDate) => { + if (!birthDate) return null + const today = new Date() + const birth = new Date(birthDate) + let years = today.getFullYear() - birth.getFullYear() + let months = today.getMonth() - birth.getMonth() + + if (months < 0) { + years-- + months += 12 + } + + if (years === 0) return `${months}mo` + if (months === 0) return `${years}y` + return `${years}y ${months}mo` + } + if (loading) { return
Loading dashboard...
} return ( -
+

Dashboard

-
-
- -

{stats.totalDogs}

-

Total Dogs

-

- {stats.males} Males • {stats.females} Females -

+ {/* Stats Grid */} +
+
+
+ +
+
{stats.totalDogs}
+
Total Dogs
+
+ {stats.males} ♂ · {stats.females} ♀ +
-
- -

{stats.totalLitters}

-

Total Litters

+
+
+ +
+
{stats.totalLitters}
+
Total Litters
-
- -

{stats.activeHeatCycles}

-

Active Heat Cycles

+
+
+ +
+
{stats.activeHeatCycles}
+
Active Heat Cycles
+ + +
+ +
+
View All Dogs
+
Manage Collection
+
+ {/* Recent Dogs Section */}

Recent Dogs

- View All + + View All + +
{recentDogs.length === 0 ? ( -
- -

No dogs registered yet

-

Start by adding your first dog to the system

- Add Dog +
+ +

No dogs registered yet

+

Start building your kennel management system

+ Add Your First Dog
) : ( -
+
{recentDogs.map(dog => ( - -
+ { + e.currentTarget.style.borderColor = 'var(--primary)' + e.currentTarget.style.transform = 'translateY(-2px)' + }} + onMouseLeave={(e) => { + e.currentTarget.style.borderColor = 'var(--border)' + e.currentTarget.style.transform = 'translateY(0)' + }} + > + {/* Avatar Photo */} +
{dog.photo_urls && dog.photo_urls.length > 0 ? ( - {dog.name} + {dog.name} ) : ( - + )}
-

{dog.name}

-

{dog.breed} • {dog.sex}

- {dog.registration_number && ( -

{dog.registration_number}

- )} + + {/* Info Section */} +
+

+ {dog.name} + + {dog.sex === 'male' ? '♂' : '♀'} + +

+ +
+ {dog.breed} + {dog.birth_date && ( + <> + + + + {calculateAge(dog.birth_date)} + + + )} +
+ + {dog.registration_number && ( +
+ + {dog.registration_number} +
+ )} +
+ + {/* Arrow Indicator */} +
+ +
))}