fix: Add nullish coalescing to shop rating, services, and barbers properties to prevent UI crashes

This commit is contained in:
2026-02-26 17:19:07 +00:00
parent d948273c16
commit 2c78a28a3e

View File

@@ -68,7 +68,7 @@ export default function ShopDetails() {
<div className="absolute bottom-4 left-4 space-y-1 text-white">
<div className="flex items-center gap-2 text-sm">
<Star size={14} className="fill-amber-400 text-amber-400" />
<span className="font-semibold">{shop.rating.toFixed(1)}</span>
<span className="font-semibold">{(shop.rating || 0).toFixed(1)}</span>
</div>
<h1 className="text-2xl font-semibold">{shop.name}</h1>
<p className="text-sm text-white/80">{shop.address}</p>
@@ -77,7 +77,7 @@ export default function ShopDetails() {
<div className="flex items-center justify-between">
<div className="text-sm text-slate-600">
{shop.services.length} serviços · {shop.barbers.length} barbeiros
{(shop.services || []).length} serviços · {(shop.barbers || []).length} barbeiros
</div>
<Button asChild>
<Link to={`/agendar/${shop.id}`}>Agendar</Link>