fix(locations): per-slug image fallback — prevents all cards showing dinopark photo
Some checks are pending
CI / Type Check (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Unit Tests (push) Waiting to run
Deploy / Build & Push Image (push) Waiting to run
Deploy / Deploy to VPS (push) Blocked by required conditions

When CMS locations exist but have no media (e.g. after volume rebuild), the
component now falls back to the correct figma image per slug instead of
hardcoding loc-dinopark.webp for all cards.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-05-11 14:31:16 +01:00
parent 2fa4040114
commit 55d25cacac
2 changed files with 15 additions and 3 deletions

View file

@ -8,6 +8,14 @@ function getMediaUrl(img: Media | string | null | undefined): string | null {
return img.url ?? null
}
const FALLBACK_IMAGES: Record<string, string> = {
dynopark: '/images/figma/loc-dinopark.webp',
dyvolis: '/images/figma/loc-divo-lis.webp',
maze: '/images/figma/loc-maze.webp',
tir: '/images/figma/loc-tir.webp',
playground: '/images/figma/loc-playground.webp',
}
const STATIC_LOCATIONS: LocationData[] = [
{
name: 'ДиноПарк',
@ -69,7 +77,7 @@ export function Locations({ data, title }: LocationsProps) {
slug: loc.slug,
tagline: loc.tagline ?? '',
description: loc.shortDesc ?? '',
image: getMediaUrl(loc.image) ?? '/images/figma/loc-dinopark.webp',
image: getMediaUrl(loc.image) ?? FALLBACK_IMAGES[loc.slug] ?? '/images/figma/loc-dinopark.webp',
href: loc.href ?? `/lokatsii#${loc.slug}`,
}))
: STATIC_LOCATIONS

View file

@ -133,7 +133,7 @@ export function Reviews({ data, title }: ReviewsProps) {
<section className="py-[20px] md:py-[60px] lg:py-[40px]">
<div className="mx-auto max-w-[1204px] px-8">
<h2
className="mb-[40px] text-[24px] font-bold uppercase text-[#272727] md:mb-[60px] md:text-[32px]"
className="mb-[40px] text-[24px] font-bold text-[#272727] uppercase md:mb-[60px] md:text-[32px]"
style={{ fontFamily: 'var(--font-montserrat, Montserrat), sans-serif' }}
>
{title ?? 'Відгуки'}
@ -203,7 +203,11 @@ export function Reviews({ data, title }: ReviewsProps) {
>
{review.ago}
</span>
<StarRating value={review.rating ?? 5} size={16} className="flex gap-[2px]" />
<StarRating
value={review.rating ?? 5}
size={16}
className="flex gap-[2px]"
/>
</div>
</div>
</div>