- feat(025): favoritos locais com FavoritesContext, HeartButton, PublicFavoritesPage
- feat(026): central de contatos admin (leads/contatos unificados)
- feat(027): configuração da página de contato via admin
- feat(028): trabalhe conosco - candidaturas com upload e admin
- feat(029): UX área do cliente - visitas, comparação, perfil
- feat(030): navbar UX - menu mobile, ThemeToggle, useFavorites
- feat(031): hero light/dark - imagens separadas por tema, upload, preview, seed
- feat(032): performance homepage - Promise.all parallel fetches, sessionStorage cache,
preload hero image, loading=lazy nos cards, useInView hook, will-change carrossel,
keyframes em index.css, AgentsCarousel e HomeScrollScene via props
- fix: light mode HomeScrollScene - gradiente, cores de texto, scroll hint
migrations: g1h2i3j4k5l6 (source em leads), h1i2j3k4l5m6 (contact_config),
i1j2k3l4m5n6 (job_applications), j2k3l4m5n6o7 (hero theme images)
78 lines
3.6 KiB
TypeScript
78 lines
3.6 KiB
TypeScript
import { Link, Navigate } from 'react-router-dom';
|
|
import FavoritesCardsGrid from '../components/FavoritesCardsGrid';
|
|
import Navbar from '../components/Navbar';
|
|
import { useAuth } from '../contexts/AuthContext';
|
|
import { useFavorites } from '../contexts/FavoritesContext';
|
|
|
|
export default function PublicFavoritesPage() {
|
|
const { isAuthenticated, isLoading } = useAuth();
|
|
const { localEntries, favoriteIds } = useFavorites();
|
|
|
|
if (isLoading) {
|
|
return (
|
|
<div className="min-h-screen bg-canvas">
|
|
<Navbar />
|
|
<div className="max-w-4xl mx-auto px-4 pt-20 pb-10">
|
|
<div className="h-7 w-40 animate-pulse rounded-md bg-surface mb-6" />
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
{[...Array(3)].map((_, i) => (
|
|
<div key={i} className="rounded-xl border border-borderSubtle bg-panel h-64 animate-pulse" />
|
|
))}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
// If authenticated, redirect to client area favorites
|
|
if (isAuthenticated) {
|
|
return <Navigate to="/area-do-cliente/favoritos" replace />;
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-screen bg-canvas">
|
|
<Navbar />
|
|
<div className="max-w-4xl mx-auto px-4 pt-20 pb-10">
|
|
<div className="mb-8 flex items-center justify-between gap-4">
|
|
<div>
|
|
<h1 className="text-2xl font-semibold text-textPrimary">Meus Favoritos</h1>
|
|
<p className="text-sm text-textTertiary mt-1">
|
|
{favoriteIds.size} {favoriteIds.size === 1 ? 'imóvel salvo' : 'imóveis salvos'} localmente
|
|
</p>
|
|
</div>
|
|
<Link to="/imoveis" className="text-sm text-accent hover:text-accentHover transition shrink-0">
|
|
← Voltar à listagem
|
|
</Link>
|
|
</div>
|
|
|
|
{/* Banner — incentivo ao cadastro */}
|
|
<div className="mb-6 rounded-xl border border-brand/30 bg-brand/5 px-4 py-4 flex flex-col sm:flex-row sm:items-center gap-3 justify-between">
|
|
<div>
|
|
<p className="text-sm font-medium text-textPrimary">Sincronize seus favoritos</p>
|
|
<p className="text-xs text-textTertiary mt-0.5">
|
|
Crie uma conta gratuita para acessar seus favoritos em qualquer dispositivo.
|
|
</p>
|
|
</div>
|
|
<div className="flex gap-2 shrink-0">
|
|
<Link
|
|
to="/cadastro"
|
|
state={{ from: { pathname: '/area-do-cliente/favoritos' } }}
|
|
className="rounded-lg bg-brand px-4 py-2 text-xs font-semibold text-white hover:bg-accentHover transition"
|
|
>
|
|
Criar conta
|
|
</Link>
|
|
<Link
|
|
to="/login"
|
|
state={{ from: { pathname: '/area-do-cliente/favoritos' } }}
|
|
className="rounded-lg border border-borderSubtle bg-surface px-4 py-2 text-xs font-semibold text-textPrimary hover:bg-panel transition"
|
|
>
|
|
Entrar
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
|
|
<FavoritesCardsGrid entries={localEntries} />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|