From 55d25cacacc44fff758384dafe57d951490cdd87 Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Mon, 11 May 2026 14:31:16 +0100 Subject: [PATCH] =?UTF-8?q?fix(locations):=20per-slug=20image=20fallback?= =?UTF-8?q?=20=E2=80=94=20prevents=20all=20cards=20showing=20dinopark=20ph?= =?UTF-8?q?oto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/components/sections/Locations.tsx | 10 +++++++++- src/components/sections/Reviews.tsx | 8 ++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/sections/Locations.tsx b/src/components/sections/Locations.tsx index 8fb51e1..398d2d0 100644 --- a/src/components/sections/Locations.tsx +++ b/src/components/sections/Locations.tsx @@ -8,6 +8,14 @@ function getMediaUrl(img: Media | string | null | undefined): string | null { return img.url ?? null } +const FALLBACK_IMAGES: Record = { + 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 diff --git a/src/components/sections/Reviews.tsx b/src/components/sections/Reviews.tsx index fdf908b..dc3cb12 100644 --- a/src/components/sections/Reviews.tsx +++ b/src/components/sections/Reviews.tsx @@ -133,7 +133,7 @@ export function Reviews({ data, title }: ReviewsProps) {

{title ?? 'Відгуки'} @@ -203,7 +203,11 @@ export function Reviews({ data, title }: ReviewsProps) { > {review.ago} - +