fix: resolve contact form placeholders, restore process block layout, and fix testimonials carousel scroll logic
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
import { getPayload } from 'payload'
|
||||
import configPromise from '../src/payload.config'
|
||||
|
||||
async function run() {
|
||||
const payload = await getPayload({ config: configPromise })
|
||||
|
||||
const addressDE = "Vom Kunden zu bestätigen";
|
||||
const hoursDE = "Mo-Fr: 9:00 - 17:00\nNach vorheriger Terminvereinbarung";
|
||||
|
||||
// 1. Kontakt Page (ID: 5, slug: 'kontakt')
|
||||
console.log('Fetching Kontakt DE...');
|
||||
const kontaktDE = await payload.find({ collection: 'pages', locale: 'de', where: { slug: { equals: 'kontakt' } } });
|
||||
if (kontaktDE.docs.length > 0) {
|
||||
const doc = kontaktDE.docs[0];
|
||||
let changed = false;
|
||||
const newLayout = doc.layout?.map((block: any) => {
|
||||
if (block.blockType === 'pageHeader') {
|
||||
if (block.subtitle === 'Masz pytania dotyczące rozliczenia podatkowego w N' || block.subtitle === 'Masz pytania dotyczące rozliczenia podatkowego w Niemczech? Skontaktuj się z nami — chętnie pomożemy.') {
|
||||
block.subtitle = 'Haben Sie Fragen zu Ihrer Steuererklärung in Deutschland? Kontaktieren Sie uns — wir helfen Ihnen gerne.';
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (block.blockType === 'contactSection') {
|
||||
if (block.address === 'DO POTWIERDZENIA PRZEZ KLIENTA') {
|
||||
block.address = addressDE;
|
||||
changed = true;
|
||||
}
|
||||
if (block.hours === 'Pon-Pt: 9:00 - 17:00\nPo wcześniejszym umówieniu') {
|
||||
block.hours = hoursDE;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (changed) delete block.id;
|
||||
return block;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
await payload.update({
|
||||
collection: 'pages',
|
||||
id: doc.id,
|
||||
locale: 'de',
|
||||
data: { layout: newLayout }
|
||||
});
|
||||
console.log('Updated Kontakt DE');
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Jak się umówić Page (slug: 'jak-sie-umowic')
|
||||
console.log('Fetching Jak się umówić DE...');
|
||||
const jsuDE = await payload.find({ collection: 'pages', locale: 'de', where: { slug: { equals: 'terminvereinbarung' } } });
|
||||
if (jsuDE.docs.length === 0) {
|
||||
const jsuDE_plSlug = await payload.find({ collection: 'pages', locale: 'de', where: { slug: { equals: 'jak-sie-umowic' } } });
|
||||
if (jsuDE_plSlug.docs.length > 0) {
|
||||
jsuDE.docs = jsuDE_plSlug.docs;
|
||||
}
|
||||
}
|
||||
|
||||
if (jsuDE.docs.length > 0) {
|
||||
const doc = jsuDE.docs[0];
|
||||
let changed = false;
|
||||
const newLayout = doc.layout?.map((block: any) => {
|
||||
if (block.blockType === 'contactSection') {
|
||||
if (block.address === 'DO POTWIERDZENIA PRZEZ KLIENTA') {
|
||||
block.address = addressDE;
|
||||
changed = true;
|
||||
}
|
||||
if (block.hours === 'Pon-Pt: 9:00 - 17:00\nPo wcześniejszym umówieniu') {
|
||||
block.hours = hoursDE;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (changed) delete block.id;
|
||||
return block;
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
await payload.update({
|
||||
collection: 'pages',
|
||||
id: doc.id,
|
||||
locale: 'de',
|
||||
data: { layout: newLayout }
|
||||
});
|
||||
console.log('Updated Jak się umówić DE');
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Company Global
|
||||
console.log('Fetching Company DE...');
|
||||
const companyDE = await payload.findGlobal({ slug: 'company', locale: 'de' });
|
||||
if (companyDE) {
|
||||
let changed = false;
|
||||
const updateData: any = {};
|
||||
if (companyDE.address === 'DO POTWIERDZENIA PRZEZ KLIENTA') {
|
||||
updateData.address = addressDE;
|
||||
changed = true;
|
||||
}
|
||||
if (companyDE.hours === 'Pon-Pt: 9:00 - 17:00\nPo wcześniejszym umówieniu') {
|
||||
updateData.hours = hoursDE;
|
||||
changed = true;
|
||||
}
|
||||
if (changed) {
|
||||
await payload.updateGlobal({
|
||||
slug: 'company',
|
||||
locale: 'de',
|
||||
data: updateData
|
||||
});
|
||||
console.log('Updated Company DE');
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Migration complete');
|
||||
process.exit(0);
|
||||
}
|
||||
run()
|
||||
Reference in New Issue
Block a user