diff --git a/client/src/pages/DogList.jsx b/client/src/pages/DogList.jsx index 9f0c7bf..d1e6aed 100644 --- a/client/src/pages/DogList.jsx +++ b/client/src/pages/DogList.jsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' import { Link } from 'react-router-dom' -import { Dog, Plus, Search } from 'lucide-react' +import { Dog, Plus, Search, Calendar, Hash, ArrowRight } from 'lucide-react' import axios from 'axios' import DogForm from '../components/DogForm' @@ -52,68 +52,224 @@ function DogList() { fetchDogs() } + 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
+ {filteredDogs.length} {filteredDogs.length === 1 ? 'dog' : 'dogs'} + {search || sexFilter !== 'all' ? ' matching filters' : ' total'} +
+- {dog.breed} • {dog.sex === 'male' ? '♂' : '♀'} -
- {dog.registration_number && ( -{dog.registration_number}
- )} - {dog.birth_date && ( -Born: {new Date(dog.birth_date).toLocaleDateString()}
- )} - - ))} -+ {search || sexFilter !== 'all' + ? 'Try adjusting your search or filters' + : 'Add your first dog to get started'} +
+ {!search && sexFilter === 'all' && ( + + )} +No dogs found matching your search criteria.
+ {/* Info Section */} +