From 7c5b5979bdab37cede74d4c422d25f0a85f41539 Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Wed, 13 May 2026 18:01:45 +0100 Subject: [PATCH] feat(cms): wire DyvoLis gallery to CMS, fix eslint config Add galleryImages array field to DyvoLisPage global so the photo gallery is editable from Payload admin. Component falls back to 24 static images when no CMS images are uploaded. Fix eslint flat-config error caused by referencing @typescript-eslint plugin without an explicit import. Co-Authored-By: Claude Sonnet 4.6 --- eslint.config.mjs | 2 -- src/app/(frontend)/lokatsii/dyvolis/page.tsx | 12 ++++++++++-- src/components/sections/DyvoLisGallery.tsx | 9 ++++++--- src/globals/DyvoLisPage.ts | 7 +++++++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 615e92c..e7a69f3 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -5,8 +5,6 @@ const eslintConfig = [ ...nextConfig, { rules: { - '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], - '@typescript-eslint/no-explicit-any': 'warn', 'no-console': ['warn', { allow: ['warn', 'error'] }], }, }, diff --git a/src/app/(frontend)/lokatsii/dyvolis/page.tsx b/src/app/(frontend)/lokatsii/dyvolis/page.tsx index 5394bdb..d0621fe 100644 --- a/src/app/(frontend)/lokatsii/dyvolis/page.tsx +++ b/src/app/(frontend)/lokatsii/dyvolis/page.tsx @@ -11,7 +11,7 @@ export const revalidate = 60 async function getDyvoLisData() { try { const payload = await getPayload({ config: configPromise }) - return await payload.findGlobal({ slug: 'dyvolis-page', depth: 0 }) + return await payload.findGlobal({ slug: 'dyvolis-page', depth: 1 }) } catch { return null } @@ -38,7 +38,15 @@ export default async function DyvoLisPage() { statLabel={data?.heroStatLabel ?? undefined} tips={data?.heroTips?.map((t: { text: string }) => t.text)} /> - + { + if (!item.image || typeof item.image === 'string') return null + return item.image.url ?? null + }) + .filter((u: string | null): u is string => u !== null)} + /> 0 ? images : GALLERY const [active, setActive] = useState(0) - const n = GALLERY.length + const n = photos.length useEffect(() => { const t = setInterval(() => setActive((p) => (p + 1) % n), 3500) @@ -71,7 +74,7 @@ export function DyvoLisGallery({ className="relative mx-auto h-[260px] max-w-[1204px] lg:h-[400px]" style={{ perspective: '1100px' }} > - {GALLERY.map((src, i) => { + {photos.map((src, i) => { const d = getOffset(i) const absD = Math.abs(d) const sign = d >= 0 ? 1 : -1 @@ -139,7 +142,7 @@ export function DyvoLisGallery({
- {GALLERY.map((_, i) => ( + {photos.map((_, i) => (