'use client'; import { useEffect, useState } from 'react'; import Link from 'next/link'; import { MapPin, Phone, Mail, Clock, PawPrint, ChevronRight } from 'lucide-react'; import Header from '@/components/layout/Header'; import Footer from '@/components/layout/Footer'; interface Shelter { id: string; name: string; district: string; address: string; phone: string; email: string; description: string | null; website: string | null; openHours: Record; _count: { animals: number }; } const DAY_LABELS: Record = { mon: 'Seg', tue: 'Ter', wed: 'Qua', thu: 'Qui', fri: 'Sex', sat: 'Sáb', sun: 'Dom', }; export default function SheltersPage() { const [shelters, setShelters] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { fetch('/api/shelters') .then((r) => r.json()) .then((data) => setShelters(Array.isArray(data) ? data : [])) .catch(console.error) .finally(() => setLoading(false)); }, []); return ( <>
{/* Hero */}

Portugal

Canis parceiros.

Organizações verificadas em todo o país que trabalham diariamente para encontrar lares a animais abandonados.

{/* Listagem */}
{loading ? (
{[1,2,3,4].map(i => (
))}
) : shelters.length === 0 ? (

Nenhum canil disponível de momento.

) : (
{shelters.map((shelter) => (
{ const el = e.currentTarget as HTMLElement; el.style.transform = 'translateY(-4px)'; el.style.boxShadow = 'var(--shadow-warm-lg)'; }} onMouseLeave={e => { const el = e.currentTarget as HTMLElement; el.style.transform = 'translateY(0)'; el.style.boxShadow = 'var(--shadow-warm-sm)'; }} > {/* Header colorido */}

{shelter.name}

{shelter.district}

{shelter._count.animals}
disponíveis
{/* Body */}
{shelter.description && (

{shelter.description.length > 120 ? `${shelter.description.slice(0, 120)}…` : shelter.description}

)}
{shelter.address}

Ver animais Doar
))}
)}