fix: resolve contact form placeholders, restore process block layout, and fix testimonials carousel scroll logic

This commit is contained in:
MichalC
2026-09-17 22:25:25 +02:00
parent 7cc68b9f36
commit ab4c5c83dd
91 changed files with 4790 additions and 319 deletions
+59
View File
@@ -0,0 +1,59 @@
import { getPayload } from 'payload'
import configPromise from '../src/payload.config'
import fs from 'fs'
import path from 'path'
async function run() {
const payload = await getPayload({ config: configPromise })
const snapshotRaw = fs.readFileSync(path.join(process.cwd(), 'scripts', 'content-snapshot.json'), 'utf8')
const snapshot = JSON.parse(snapshotRaw)
for (const pageSnap of snapshot.pages) {
for (const locale of ['pl', 'de']) {
const pageData = pageSnap[locale]
if (!pageData) continue
// Fetch current page from DB
const pagesInDb = await payload.find({
collection: 'pages',
locale: locale as 'pl' | 'de',
where: { slug: { equals: pageData.slug } }
})
if (pagesInDb.docs.length > 0) {
const dbPage = pagesInDb.docs[0]
let layoutChanged = false
const newLayout = dbPage.layout?.map((dbBlock: any) => {
if (dbBlock.blockType === 'servicesDetailed') {
const snapBlock = pageData.layout.find((b: any) => b.blockType === 'servicesDetailed')
if (snapBlock && snapBlock.services) {
dbBlock.services = snapBlock.services.map((s:any) => {
return {
title: s.title,
description: s.description,
icon: s.icon
}
})
layoutChanged = true
}
}
return dbBlock
})
if (layoutChanged) {
await payload.update({
collection: 'pages',
id: dbPage.id,
locale: locale as 'pl' | 'de',
data: { layout: newLayout }
})
console.log(`Restored servicesDetailed for ${pageData.slug} (${locale})`)
}
}
}
}
process.exit(0)
}
run()