style(hero): reduce gradient overlay intensity to make background image more visible

This commit is contained in:
MichalC
2026-09-17 23:41:11 +02:00
parent 0b35e76cf2
commit 573580d01f
7 changed files with 273 additions and 11 deletions
+62
View File
@@ -0,0 +1,62 @@
import { getPayload } from 'payload'
import configPromise from '../src/payload.config'
async function run() {
const payload = await getPayload({ config: configPromise })
// Get media ids
const media = await payload.find({ collection: 'media', limit: 100 })
const mediaIds = media.docs.map(m => m.id)
if (mediaIds.length === 0) {
console.error("No media ids found! Exiting.")
process.exit(1)
}
// Update all pages
const locales = ['pl', 'de']
let mediaIndex = 0
for (const locale of locales) {
const pages = await payload.find({ collection: 'pages', locale: locale as any, limit: 100 })
for (const page of pages.docs) {
const imgId = mediaIds[mediaIndex % mediaIds.length]
mediaIndex++
let changed = false
const layout = page.layout || []
if (page.slug === 'home') {
// Find hero block
const heroBlock = layout.find((b: any) => b.blockType === 'hero')
if (heroBlock && !heroBlock.image) {
heroBlock.image = imgId
changed = true
console.log(`Updated home page (${locale}) hero image.`)
}
} else {
// Find pageHeader block
const headerBlock = layout.find((b: any) => b.blockType === 'pageHeader')
if (headerBlock && !headerBlock.image) {
headerBlock.image = imgId
changed = true
console.log(`Updated ${page.slug} (${locale}) pageHeader image.`)
}
}
if (changed) {
await payload.update({
collection: 'pages',
id: page.id,
locale: locale as any,
data: { layout }
})
}
}
}
console.log("Done updating pages with FIXED fields.")
process.exit(0)
}
run().catch(console.error)