CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
- Products collection (interim mirror of the PLATFM-14 catalogue contract): lifecycle status, product type, required whole-forint net price, yearly billing, service definition, per-product English gate - HostingPlans global: page copy, comparison labels, VAT rate (27%) - Gate: production shows only active plans, staging all but retired; with no showable plan the page is 404 and left out of the menu and the sitemap - /hu/tarhely-csomagok <-> /en/hosting-plans via PAGE_SLUGS (hreflang, language switcher, CTA page picker) - Seed migration 20260929_hosting_plans: mIT Start (14 900 Ft/yr, 5 mailboxes) and mIT Mid (23 900 Ft/yr) as drafts, English AI draft; idempotent - Production SEO suite expects at least 12 sitemap URLs; new SMOKE-10 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
2.3 KiB
TypeScript
67 lines
2.3 KiB
TypeScript
import type { GroupField } from 'payload'
|
|
|
|
import { CTA_PAGES, type CtaPage } from '../../lib/cta-link'
|
|
|
|
const PAGE_LABELS: Record<CtaPage, string> = {
|
|
home: 'Főoldal',
|
|
about: 'Rólunk',
|
|
services: 'Szolgáltatások',
|
|
// MITHOME-130: 404 while no plan is showable — link to it only once a plan is active.
|
|
hostingPlans: 'Tárhelycsomagok (csak aktív csomaggal)',
|
|
contact: 'Kapcsolat',
|
|
privacy: 'Adatvédelem',
|
|
terms: 'Felhasználási feltételek',
|
|
}
|
|
|
|
type Sibling = { linkType?: string } | undefined
|
|
|
|
const isPageLink = (sibling: Sibling) => (sibling?.linkType ?? 'page') === 'page'
|
|
|
|
/**
|
|
* MITHOME-123: CTA button = localized text + either an internal page
|
|
* (resolved per locale by src/lib/cta-link.ts) or an external URL.
|
|
*
|
|
* WHY custom `validate` instead of `required`: `page` and `href` are only
|
|
* required for their own link type; the other one is hidden and empty.
|
|
* WHY no "open in new tab" switch: external links always open in a new
|
|
* tab, decided from the URL (MITHOME-124, src/lib/external-link.ts).
|
|
* DECISION: `href` stays localized (MITHOME-111) — an external target may
|
|
* differ per language; `linkType`/`page` are shared across locales.
|
|
*/
|
|
export function ctaLinkGroup(name: string): GroupField {
|
|
return {
|
|
name,
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'text', type: 'text', required: true, localized: true },
|
|
{
|
|
name: 'linkType',
|
|
type: 'radio',
|
|
required: true,
|
|
defaultValue: 'page',
|
|
options: [
|
|
{ label: 'Belső oldal', value: 'page' },
|
|
{ label: 'Külső URL', value: 'url' },
|
|
],
|
|
admin: { layout: 'horizontal' },
|
|
},
|
|
{
|
|
name: 'page',
|
|
type: 'select',
|
|
options: CTA_PAGES.map((value) => ({ label: PAGE_LABELS[value], value })),
|
|
admin: { condition: (_data, sibling) => isPageLink(sibling) },
|
|
validate: (value: unknown, { siblingData }: { siblingData: Sibling }) =>
|
|
!isPageLink(siblingData) || Boolean(value) || 'Válassz oldalt.',
|
|
},
|
|
{
|
|
name: 'href',
|
|
type: 'text',
|
|
localized: true,
|
|
admin: { condition: (_data, sibling) => !isPageLink(sibling) },
|
|
validate: (value: unknown, { siblingData }: { siblingData: Sibling }) =>
|
|
isPageLink(siblingData) || Boolean(value) || 'Add meg az URL-t.',
|
|
},
|
|
],
|
|
}
|
|
}
|