diff --git a/scripts/update_hero_cta.ts b/scripts/update_hero_cta.ts new file mode 100644 index 0000000..4540735 --- /dev/null +++ b/scripts/update_hero_cta.ts @@ -0,0 +1,43 @@ +import { getPayload } from 'payload' +import configPromise from '../src/payload.config' + +async function run() { + console.log('Connecting to Payload Local API...') + const payload = await getPayload({ config: configPromise }) + + for (const locale of ['pl', 'de']) { + const home = await payload.findByID({ collection: 'pages', id: 1, locale: locale as any }) + if (home && home.layout) { + const newLayout = home.layout.map((block: any) => { + if (block.blockType === 'hero' && block.secondaryCta) { + return { + ...block, + secondaryCta: { + ...block.secondaryCta, + url: '#jak-to-dziala' + } + } + } + return block + }) + + await payload.update({ + collection: 'pages', + id: 1, + locale: locale as any, + data: { layout: newLayout }, + }) + console.log(`Updated Hero secondaryCta for locale: ${locale}`) + } + } + + console.log('Done!') + process.exit(0) +} + +try { + await run() +} catch (err) { + console.error('ERROR during setup:', err) + process.exit(1) +} diff --git a/src/blocks/Hero/Component.tsx b/src/blocks/Hero/Component.tsx index b5bab0f..3034115 100644 --- a/src/blocks/Hero/Component.tsx +++ b/src/blocks/Hero/Component.tsx @@ -144,12 +144,21 @@ export const HeroBlock: React.FC = ({ {primaryCta} {secondaryCta?.text && secondaryCta?.url && ( - - {secondaryCta.text} - + secondaryCta.url.startsWith('#') ? ( + + {secondaryCta.text} + + ) : ( + + {secondaryCta.text} + + ) )} diff --git a/src/blocks/Process/Component.tsx b/src/blocks/Process/Component.tsx index 8ad6fed..61ef6a9 100644 --- a/src/blocks/Process/Component.tsx +++ b/src/blocks/Process/Component.tsx @@ -12,7 +12,7 @@ export const ProcessBlock: React.FC = ({ subtitle, title, steps, ctaText, const imageAlt = processMedia?.alt || 'Proces współpracy'; return ( -
+