feat(cms): partner categories, publication permission and CMS-managed references copy (MITHOME-131)
Per the managed web operations research (PLATFM-13), a client must not be
shown as a "partner" and names/logos need written permission. Partners
now carry a required relationship category and a publication permission
(default: none) with the permission's location and review date; only
entries with written permission, a category and a logo are public.
The homepage shows clients ("Akik már minket választottak") and other
relationships in separate blocks via ReferencesSection; every partner
shows its relationship type. The section copy moved from a hard-coded
constant into the Home global (localized). The 20260929_partner_references
migration marks Angele Pihenőház as a client reference with written
permission (owner-confirmed), hides any other uncategorised entry, and
seeds the copy in hu + en. The JSON seed uses the same source.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
526f413bfd
commit
5f9a53ed18
@@ -35,6 +35,7 @@ import { fileURLToPath } from 'url'
|
|||||||
import { getPayload, type Payload } from 'payload'
|
import { getPayload, type Payload } from 'payload'
|
||||||
import config from '../src/payload.config'
|
import config from '../src/payload.config'
|
||||||
import { internalPathToPageKey } from '../src/lib/cta-link'
|
import { internalPathToPageKey } from '../src/lib/cta-link'
|
||||||
|
import { CONFIRMED_CLIENT_REFERENCES, REFERENCES_SECTION_COPY } from '../src/migrations/20260929_partner_references'
|
||||||
|
|
||||||
import homeJson from '../src/content/pages/home.json'
|
import homeJson from '../src/content/pages/home.json'
|
||||||
import aboutJson from '../src/content/pages/about.json'
|
import aboutJson from '../src/content/pages/about.json'
|
||||||
@@ -82,9 +83,27 @@ function buildHomeData(json: typeof homeJson) {
|
|||||||
},
|
},
|
||||||
cta,
|
cta,
|
||||||
serviceFeatures,
|
serviceFeatures,
|
||||||
|
// MITHOME-131: seeded in the default locale (hu); en comes from the migration.
|
||||||
|
referencesSection: {
|
||||||
|
clientsTitle: REFERENCES_SECTION_COPY.clientsTitle.hu,
|
||||||
|
clientsSubtitle: REFERENCES_SECTION_COPY.clientsSubtitle.hu,
|
||||||
|
partnersTitle: REFERENCES_SECTION_COPY.partnersTitle.hu,
|
||||||
|
partnersSubtitle: REFERENCES_SECTION_COPY.partnersSubtitle.hu,
|
||||||
|
relationshipLabels: Object.fromEntries(
|
||||||
|
Object.entries(REFERENCES_SECTION_COPY.relationshipLabels).map(([key, copy]) => [key, copy.hu]),
|
||||||
|
) as Record<keyof typeof REFERENCES_SECTION_COPY.relationshipLabels, string>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** MITHOME-131: the JSON partners are confirmed client references with written permission. */
|
||||||
|
function partnerMeta(name: string) {
|
||||||
|
const confirmed = CONFIRMED_CLIENT_REFERENCES.find((c) => c.name === name)
|
||||||
|
return confirmed
|
||||||
|
? { relationship: 'client-reference' as const, publicationPermission: 'granted' as const, permissionReference: confirmed.permissionReference }
|
||||||
|
: { relationship: 'client-reference' as const, publicationPermission: 'none' as const }
|
||||||
|
}
|
||||||
|
|
||||||
function buildAboutData(json: typeof aboutJson) {
|
function buildAboutData(json: typeof aboutJson) {
|
||||||
const { meta, hero, story, mission, team, cta } = json
|
const { meta, hero, story, mission, team, cta } = json
|
||||||
return {
|
return {
|
||||||
@@ -184,12 +203,12 @@ async function upsertPartner(payload: Payload, partner: PartnerJson) {
|
|||||||
await payload.update({
|
await payload.update({
|
||||||
collection: 'partners',
|
collection: 'partners',
|
||||||
id: existingPartner.docs[0].id,
|
id: existingPartner.docs[0].id,
|
||||||
data: { name: partner.name, url: partner.url, logo: mediaId, _status: 'published' },
|
data: { name: partner.name, url: partner.url, logo: mediaId, ...partnerMeta(partner.name), _status: 'published' },
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
await payload.create({
|
await payload.create({
|
||||||
collection: 'partners',
|
collection: 'partners',
|
||||||
data: { name: partner.name, url: partner.url, logo: mediaId, _status: 'published' },
|
data: { name: partner.name, url: partner.url, logo: mediaId, ...partnerMeta(partner.name), _status: 'published' },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import { classifyPartner, seedReferencesSection, up } from '../migrations/20260929_partner_references'
|
||||||
|
import { fakeArgs, fakeCollection } from './helpers/fake-mongo'
|
||||||
|
|
||||||
|
type Doc = Record<string, unknown>
|
||||||
|
|
||||||
|
describe('20260929_partner_references migration (MITHOME-131)', () => {
|
||||||
|
it('should mark the confirmed client as a client reference with written permission', () => {
|
||||||
|
const doc: Doc = { name: 'Angele Pihenőház', url: 'https://angelepihenohaz.hu' }
|
||||||
|
expect(classifyPartner(doc)).toBe(1)
|
||||||
|
expect(doc).toMatchObject({ relationship: 'client-reference', publicationPermission: 'granted' })
|
||||||
|
expect(doc.permissionReference).toMatch(/Írásos engedély/)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should hide any other uncategorised entry until someone classifies it', () => {
|
||||||
|
const doc: Doc = { name: 'Ismeretlen Kft.' }
|
||||||
|
classifyPartner(doc)
|
||||||
|
expect(doc).toEqual({ name: 'Ismeretlen Kft.', publicationPermission: 'none' })
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should not touch an already categorised entry', () => {
|
||||||
|
const doc: Doc = { name: 'Angele Pihenőház', relationship: 'supplier', publicationPermission: 'pending' }
|
||||||
|
expect(classifyPartner(doc)).toBe(0)
|
||||||
|
expect(doc.relationship).toBe('supplier')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should seed the section copy in both languages only when missing', () => {
|
||||||
|
const doc: Doc = {}
|
||||||
|
seedReferencesSection(doc)
|
||||||
|
expect(doc.referencesSection).toMatchObject({
|
||||||
|
clientsTitle: { hu: 'Akik már minket választottak', en: 'Clients who chose us' },
|
||||||
|
relationshipLabels: { infrastructure: { hu: 'Technológiai háttér', en: 'Infrastructure provider' } },
|
||||||
|
})
|
||||||
|
const edited: Doc = { referencesSection: { clientsTitle: { hu: 'Saját cím' } } }
|
||||||
|
expect(seedReferencesSection(edited)).toBe(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should update the partners collection and the home global, idempotently', async () => {
|
||||||
|
const partners = fakeCollection([{ _id: 'p1', name: 'Angele Pihenőház' }])
|
||||||
|
const globals = fakeCollection([{ _id: 'h', globalType: 'home' }])
|
||||||
|
const { args, payload } = fakeArgs({ globals, collections: { partners } })
|
||||||
|
await up(args)
|
||||||
|
expect(payload.logger.info).toHaveBeenLastCalledWith('MITHOME-131 references: 1 partner record(s) classified, 1 home record(s) seeded')
|
||||||
|
await up(args)
|
||||||
|
expect(payload.logger.info).toHaveBeenLastCalledWith('MITHOME-131 references: 0 partner record(s) classified, 0 home record(s) seeded')
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -1,23 +1,64 @@
|
|||||||
import type { CollectionConfig } from 'payload'
|
import type { CollectionConfig } from 'payload'
|
||||||
|
|
||||||
import { collectionVersions } from '../lib/payload-versions'
|
import { collectionVersions } from '../lib/payload-versions'
|
||||||
|
import { PERMISSION_LABELS, PERMISSIONS, RELATIONSHIP_LABELS, RELATIONSHIPS } from '../lib/partner-references'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mirrors home.json `partners.items` (proto/src/content/pages/home.json) —
|
* Mirrors home.json `partners.items` (proto/src/content/pages/home.json) —
|
||||||
* MITHOME-89 (MVP). Korábban a Home Global szándékosan NEM tartalmazta ezt
|
* MITHOME-89 (MVP). Korábban a Home Global szándékosan NEM tartalmazta ezt
|
||||||
* a listát (lásd src/globals/Home.ts megjegyzése) — itt lesz az önálló
|
* a listát (lásd src/globals/Home.ts megjegyzése) — itt lesz az önálló
|
||||||
* collection, logo = Media upload reference.
|
* collection, logo = Media upload reference.
|
||||||
|
*
|
||||||
|
* MITHOME-131: every entry carries its real relationship category (a client
|
||||||
|
* is a reference, not a "partner") and a publication permission; only
|
||||||
|
* entries with a written permission appear publicly (src/lib/partner-references.ts).
|
||||||
*/
|
*/
|
||||||
export const Partners: CollectionConfig = {
|
export const Partners: CollectionConfig = {
|
||||||
slug: 'partners',
|
slug: 'partners',
|
||||||
admin: {
|
admin: {
|
||||||
useAsTitle: 'name',
|
useAsTitle: 'name',
|
||||||
group: 'Oldalak',
|
group: 'Oldalak',
|
||||||
|
defaultColumns: ['name', 'relationship', 'publicationPermission'],
|
||||||
},
|
},
|
||||||
versions: collectionVersions,
|
versions: collectionVersions,
|
||||||
fields: [
|
fields: [
|
||||||
{ name: 'name', type: 'text', required: true },
|
{ name: 'name', type: 'text', required: true },
|
||||||
{ name: 'url', type: 'text', required: true },
|
{ name: 'url', type: 'text', required: true },
|
||||||
|
{
|
||||||
|
name: 'relationship',
|
||||||
|
label: 'Kapcsolat típusa',
|
||||||
|
type: 'select',
|
||||||
|
required: true,
|
||||||
|
options: RELATIONSHIPS.map((value) => ({ label: RELATIONSHIP_LABELS[value], value })),
|
||||||
|
admin: {
|
||||||
|
description:
|
||||||
|
'Ügyfelet ne jelölj partnerként: az ügyfél „Ügyfélreferencia”. Ha csak előfizetőként használunk egy terméket, az „Használt technológia”, nem partnerség.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'publicationPermission',
|
||||||
|
label: 'Közzétételi engedély',
|
||||||
|
type: 'select',
|
||||||
|
required: true,
|
||||||
|
defaultValue: 'none',
|
||||||
|
options: PERMISSIONS.map((value) => ({ label: PERMISSION_LABELS[value], value })),
|
||||||
|
admin: {
|
||||||
|
position: 'sidebar',
|
||||||
|
description: 'A név és a logó csak írásos engedéllyel jelenhet meg a weboldalon.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'permissionReference',
|
||||||
|
label: 'Engedély helye',
|
||||||
|
type: 'text',
|
||||||
|
admin: { position: 'sidebar', description: 'Hol található az írásos engedély (pl. e-mail, szerződés).' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'permissionReviewDate',
|
||||||
|
label: 'Következő felülvizsgálat',
|
||||||
|
type: 'date',
|
||||||
|
admin: { position: 'sidebar' },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'logo',
|
name: 'logo',
|
||||||
type: 'upload',
|
type: 'upload',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Image from 'next/image'
|
|
||||||
import { localePath, type Locale } from '@/lib/i18n'
|
import { localePath, type Locale } from '@/lib/i18n'
|
||||||
import type { getHomeContent, PartnerView } from '@/lib/payload-content'
|
import type { getHomeContent } from '@/lib/payload-content'
|
||||||
|
import { groupReferences, type PartnerView, type Relationship } from '@/lib/partner-references'
|
||||||
|
import ReferencesSection from './ReferencesSection'
|
||||||
import { externalLinkProps } from '@/lib/external-link'
|
import { externalLinkProps } from '@/lib/external-link'
|
||||||
|
|
||||||
type HomeViewProps = {
|
type HomeViewProps = {
|
||||||
@@ -9,18 +10,20 @@ type HomeViewProps = {
|
|||||||
locale: Locale
|
locale: Locale
|
||||||
}
|
}
|
||||||
|
|
||||||
// WHY hardcoded itt: a Partners collection (MITHOME-89) csak name/url/logo-t
|
|
||||||
// tárol, a szekció saját címe/alcíme sosem volt Payload-tartalom (a Home
|
|
||||||
// Globalból is szándékosan kimaradt, lásd src/globals/Home.ts) — ugyanaz a
|
|
||||||
// minta, mint a config/site.ts navigáció-feliratoknál.
|
|
||||||
const PARTNERS_COPY: Record<Locale, { title: string; subtitle: string }> = {
|
|
||||||
hu: { title: 'Partnereink', subtitle: 'Akikkel együtt dolgozunk' },
|
|
||||||
en: { title: 'Our Partners', subtitle: 'Who we work with' },
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function HomeView({ content: pageContent, partners, locale }: HomeViewProps) {
|
export default function HomeView({ content: pageContent, partners, locale }: HomeViewProps) {
|
||||||
const contactHref = localePath(locale, 'contact')
|
const contactHref = localePath(locale, 'contact')
|
||||||
const partnersCopy = PARTNERS_COPY[locale]
|
const references = groupReferences(partners)
|
||||||
|
const refCopy = pageContent.referencesSection
|
||||||
|
const labels = refCopy.relationshipLabels
|
||||||
|
const relationshipLabel = (relationship: Relationship) =>
|
||||||
|
({
|
||||||
|
'client-reference': refCopy.clientsTitle,
|
||||||
|
'technology-partner': labels.technologyPartner,
|
||||||
|
infrastructure: labels.infrastructure,
|
||||||
|
supplier: labels.supplier,
|
||||||
|
'technology-used': labels.technologyUsed,
|
||||||
|
'professional-partner': labels.professionalPartner,
|
||||||
|
})[relationship]
|
||||||
return (
|
return (
|
||||||
<div className="space-y-0">
|
<div className="space-y-0">
|
||||||
{/* Hero Section */}
|
{/* Hero Section */}
|
||||||
@@ -228,49 +231,14 @@ export default function HomeView({ content: pageContent, partners, locale }: Hom
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{/* Partners Section */}
|
{/* References (MITHOME-131): clients and partners are separate blocks. */}
|
||||||
{partners.length > 0 && (
|
<ReferencesSection title={refCopy.clientsTitle} subtitle={refCopy.clientsSubtitle} entries={references.clients} />
|
||||||
<section className="py-16">
|
<ReferencesSection
|
||||||
<div className="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8">
|
title={refCopy.partnersTitle}
|
||||||
<h2 className="text-3xl font-bold text-center mb-3" style={{ color: 'var(--color-foreground)' }}>
|
subtitle={refCopy.partnersSubtitle}
|
||||||
{partnersCopy.title}
|
entries={references.partners}
|
||||||
</h2>
|
relationshipLabel={relationshipLabel}
|
||||||
<p className="text-center mb-10" style={{ color: 'var(--color-foreground-muted)' }}>
|
|
||||||
{partnersCopy.subtitle}
|
|
||||||
</p>
|
|
||||||
{/* WHY grid + w-fit + mx-auto: a felhasználó kérésére valódi
|
|
||||||
mátrix (max 3 oszlop), nem folyó flex-wrap. `w-fit` zsugorítja
|
|
||||||
a rácsot a tényleges (legfeljebb 3 oszlopnyi) tartalom
|
|
||||||
szélességére, a `mx-auto` pedig ettől tudja középre venni —
|
|
||||||
sima `inline-grid`-en az auto margó nem középre igazítana,
|
|
||||||
mert az egy inline-szintű doboz. */}
|
|
||||||
<div className="grid w-fit grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-10 justify-items-center mx-auto">
|
|
||||||
{partners.map((partner) => (
|
|
||||||
<a
|
|
||||||
key={partner.name}
|
|
||||||
href={partner.url}
|
|
||||||
{...externalLinkProps(partner.url)}
|
|
||||||
className="group flex flex-col items-center gap-3 opacity-80 hover:opacity-100 transition-opacity duration-200"
|
|
||||||
title={partner.name}
|
|
||||||
>
|
|
||||||
<span className="relative h-12 w-40">
|
|
||||||
<Image
|
|
||||||
src={partner.logo.url}
|
|
||||||
alt={partner.logo.alt}
|
|
||||||
fill
|
|
||||||
sizes="160px"
|
|
||||||
className="object-contain"
|
|
||||||
/>
|
/>
|
||||||
</span>
|
|
||||||
<span className="text-sm" style={{ color: 'var(--color-foreground-muted)' }}>
|
|
||||||
{partner.name}
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* CTA Section */}
|
{/* CTA Section */}
|
||||||
<section
|
<section
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { render, screen } from '@testing-library/react'
|
||||||
|
import '@testing-library/jest-dom'
|
||||||
|
import ReferencesSection from './ReferencesSection'
|
||||||
|
|
||||||
|
const entry = (name: string, relationship: 'client-reference' | 'infrastructure') => ({
|
||||||
|
name,
|
||||||
|
url: `https://${name.toLowerCase().replace(/\s/g, '')}.example`,
|
||||||
|
relationship,
|
||||||
|
logo: { url: '/media/logo.png', alt: `${name} logo` },
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('ReferencesSection (MITHOME-131)', () => {
|
||||||
|
it('should render nothing without entries', () => {
|
||||||
|
const { container } = render(<ReferencesSection title="T" subtitle="S" entries={[]} />)
|
||||||
|
expect(container).toBeEmptyDOMElement()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should render the CMS title and each entry as an external link in a new tab', () => {
|
||||||
|
render(<ReferencesSection title="Akik már minket választottak" subtitle="Ügyfeleink" entries={[entry('Angele Pihenőház', 'client-reference')]} />)
|
||||||
|
expect(screen.getByRole('heading', { name: 'Akik már minket választottak' })).toBeInTheDocument()
|
||||||
|
const link = screen.getByRole('link', { name: /Angele Pihenőház/ })
|
||||||
|
expect(link).toHaveAttribute('target', '_blank')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should show the relationship type of every partner', () => {
|
||||||
|
render(
|
||||||
|
<ReferencesSection
|
||||||
|
title="Partnereink"
|
||||||
|
subtitle="S"
|
||||||
|
entries={[entry('Adatközpont', 'infrastructure')]}
|
||||||
|
relationshipLabel={(r) => (r === 'infrastructure' ? 'Technológiai háttér' : r)}
|
||||||
|
/>,
|
||||||
|
)
|
||||||
|
expect(screen.getByText('Technológiai háttér')).toBeInTheDocument()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import Image from 'next/image'
|
||||||
|
import { externalLinkProps } from '@/lib/external-link'
|
||||||
|
import type { PartnerView, Relationship } from '@/lib/partner-references'
|
||||||
|
|
||||||
|
type ReferencesSectionProps = {
|
||||||
|
title: string
|
||||||
|
subtitle: string
|
||||||
|
entries: PartnerView[]
|
||||||
|
/** Public relationship label per entry; omitted for the client block. */
|
||||||
|
relationshipLabel?: (relationship: Relationship) => string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MITHOME-131: one references block (clients or partners). All copy comes
|
||||||
|
* from the Home global; entries are pre-filtered to written permission only.
|
||||||
|
*/
|
||||||
|
export default function ReferencesSection({ title, subtitle, entries, relationshipLabel }: ReferencesSectionProps) {
|
||||||
|
if (entries.length === 0) return null
|
||||||
|
return (
|
||||||
|
<section className="py-16">
|
||||||
|
<div className="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||||
|
<h2 className="text-3xl font-bold text-center mb-3" style={{ color: 'var(--color-foreground)' }}>
|
||||||
|
{title}
|
||||||
|
</h2>
|
||||||
|
<p className="text-center mb-10" style={{ color: 'var(--color-foreground-muted)' }}>
|
||||||
|
{subtitle}
|
||||||
|
</p>
|
||||||
|
{/* WHY grid + w-fit + mx-auto: valódi mátrix (max 3 oszlop), a
|
||||||
|
tartalom szélességére zsugorítva és középre véve. */}
|
||||||
|
<div className="grid w-fit grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-10 justify-items-center mx-auto">
|
||||||
|
{entries.map((entry) => (
|
||||||
|
<a
|
||||||
|
key={entry.name}
|
||||||
|
href={entry.url}
|
||||||
|
{...externalLinkProps(entry.url)}
|
||||||
|
className="group flex flex-col items-center gap-2 opacity-80 hover:opacity-100 transition-opacity duration-200"
|
||||||
|
title={entry.name}
|
||||||
|
>
|
||||||
|
<span className="relative h-12 w-40">
|
||||||
|
<Image src={entry.logo.url} alt={entry.logo.alt} fill sizes="160px" className="object-contain" />
|
||||||
|
</span>
|
||||||
|
<span className="text-sm" style={{ color: 'var(--color-foreground-muted)' }}>
|
||||||
|
{entry.name}
|
||||||
|
</span>
|
||||||
|
{relationshipLabel && (
|
||||||
|
<span className="text-xs uppercase tracking-wide" style={{ color: 'var(--color-foreground-muted)' }}>
|
||||||
|
{relationshipLabel(entry.relationship)}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</a>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -194,5 +194,14 @@
|
|||||||
"Hétköznap 8–17 óra között": "Weekdays 8:00–17:00",
|
"Hétköznap 8–17 óra között": "Weekdays 8:00–17:00",
|
||||||
"Munkanapokon 24 órán belül válaszolunk": "We reply within 24 hours on business days",
|
"Munkanapokon 24 órán belül válaszolunk": "We reply within 24 hours on business days",
|
||||||
"Munkanapokon 24 órán belül válaszolunk. Kritikus üzemzavar esetén 0–24 órás riasztási és beavatkozási rend működik.": "We reply within 24 hours on business days. For critical outages, a 24/7 alerting and response process is in place.",
|
"Munkanapokon 24 órán belül válaszolunk. Kritikus üzemzavar esetén 0–24 órás riasztási és beavatkozási rend működik.": "We reply within 24 hours on business days. For critical outages, a 24/7 alerting and response process is in place.",
|
||||||
"Automatikus figyelmeztetés 90%-os postafiók-telítettségnél": "Automatic warning when a mailbox is 90% full"
|
"Automatikus figyelmeztetés 90%-os postafiók-telítettségnél": "Automatic warning when a mailbox is 90% full",
|
||||||
|
"Akik már minket választottak": "Clients who chose us",
|
||||||
|
"Ügyfeleink, akik hozzájárultak a bemutatásukhoz": "Clients who agreed to be featured",
|
||||||
|
"Partnereink és technológiai hátterünk": "Our partners and technology",
|
||||||
|
"Szervezetek, amelyek közreműködnek a szolgáltatásainkban": "Organisations that contribute to our services",
|
||||||
|
"Technológiai partner": "Technology partner",
|
||||||
|
"Technológiai háttér": "Infrastructure provider",
|
||||||
|
"Beszállító": "Supplier",
|
||||||
|
"Általunk használt technológia": "Technology we use",
|
||||||
|
"Szakmai partner": "Professional partner"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { translationStatusField } from './fields/translationStatus'
|
|||||||
/**
|
/**
|
||||||
* Mirrors HomePageContent (proto/src/content/types.ts) — MITHOME-87.
|
* Mirrors HomePageContent (proto/src/content/types.ts) — MITHOME-87.
|
||||||
*
|
*
|
||||||
* WHY nincs `partners` mező: a home.partners.items a JSON-ban ma egy
|
* WHY nincs `partners` lista-mező: a home.partners.items a JSON-ban ma egy
|
||||||
* beágyazott lista, de a Payload oldalon önálló `Partners` collection lesz
|
* beágyazott lista, de a Payload oldalon önálló `Partners` collection lesz
|
||||||
* (logó = Media upload reference) — lásd MITHOME-89. Itt szándékosan
|
* (logó = Media upload reference) — lásd MITHOME-89. Itt szándékosan
|
||||||
* kihagyjuk, nehogy két, egymásnak ellentmondó forrás legyen.
|
* kihagyjuk, nehogy két, egymásnak ellentmondó forrás legyen.
|
||||||
@@ -97,6 +97,32 @@ export const Home: GlobalConfig = {
|
|||||||
type: 'group',
|
type: 'group',
|
||||||
fields: [{ name: 'title', type: 'text', required: true, localized: true }],
|
fields: [{ name: 'title', type: 'text', required: true, localized: true }],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// MITHOME-131: references / partners section copy (was hard-coded in
|
||||||
|
// HomeView). Clients and partners are separate blocks; every partner
|
||||||
|
// shows its relationship type (managed web operations research).
|
||||||
|
name: 'referencesSection',
|
||||||
|
label: 'Referenciák és partnerek',
|
||||||
|
type: 'group',
|
||||||
|
fields: [
|
||||||
|
{ name: 'clientsTitle', type: 'text', required: true, localized: true },
|
||||||
|
{ name: 'clientsSubtitle', type: 'text', required: true, localized: true },
|
||||||
|
{ name: 'partnersTitle', type: 'text', required: true, localized: true },
|
||||||
|
{ name: 'partnersSubtitle', type: 'text', required: true, localized: true },
|
||||||
|
{
|
||||||
|
name: 'relationshipLabels',
|
||||||
|
type: 'group',
|
||||||
|
admin: { description: 'A partnerek alatt megjelenő kapcsolattípus nyilvános felirata.' },
|
||||||
|
fields: [
|
||||||
|
{ name: 'technologyPartner', type: 'text', required: true, localized: true },
|
||||||
|
{ name: 'infrastructure', type: 'text', required: true, localized: true },
|
||||||
|
{ name: 'supplier', type: 'text', required: true, localized: true },
|
||||||
|
{ name: 'technologyUsed', type: 'text', required: true, localized: true },
|
||||||
|
{ name: 'professionalPartner', type: 'text', required: true, localized: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
translationStatusField(),
|
translationStatusField(),
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import { groupReferences, publicPartners } from './partner-references'
|
||||||
|
|
||||||
|
const logo = { url: '/media/logo.png', alt: 'Logo' }
|
||||||
|
|
||||||
|
describe('publicPartners (MITHOME-131)', () => {
|
||||||
|
it('should show only entries with a written permission, a known category and a logo', () => {
|
||||||
|
const docs = [
|
||||||
|
{ name: 'Angele Pihenőház', url: 'https://angelepihenohaz.hu', relationship: 'client-reference', publicationPermission: 'granted', logo },
|
||||||
|
{ name: 'Pending', url: 'https://p.example', relationship: 'client-reference', publicationPermission: 'pending', logo },
|
||||||
|
{ name: 'No permission', url: 'https://n.example', relationship: 'technology-partner', publicationPermission: 'none', logo },
|
||||||
|
{ name: 'Uncategorised', url: 'https://u.example', publicationPermission: 'granted', logo },
|
||||||
|
{ name: 'No logo', url: 'https://l.example', relationship: 'supplier', publicationPermission: 'granted', logo: null },
|
||||||
|
]
|
||||||
|
expect(publicPartners(docs).map((p) => p.name)).toEqual(['Angele Pihenőház'])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should fall back to the name as logo alt text', () => {
|
||||||
|
const [partner] = publicPartners([
|
||||||
|
{ name: 'Acme', url: 'https://acme.example', relationship: 'supplier', publicationPermission: 'granted', logo: { url: '/x.png' } },
|
||||||
|
])
|
||||||
|
expect(partner.logo).toEqual({ url: '/x.png', alt: 'Acme' })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('groupReferences', () => {
|
||||||
|
it('should never present a client as a partner', () => {
|
||||||
|
const view = (name: string, relationship: 'client-reference' | 'infrastructure') => ({ name, url: '', relationship, logo })
|
||||||
|
expect(groupReferences([view('Client', 'client-reference'), view('DC', 'infrastructure')])).toEqual({
|
||||||
|
clients: [view('Client', 'client-reference')],
|
||||||
|
partners: [view('DC', 'infrastructure')],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* MITHOME-131: partner / reference rules (managed web operations research,
|
||||||
|
* PLATFM-13, "Partner- és referenciaprogram").
|
||||||
|
*
|
||||||
|
* - A client must not be presented as a "partner": every entry carries its
|
||||||
|
* real relationship category, and clients are shown separately.
|
||||||
|
* - Only entries with a written publication permission ("granted") and a
|
||||||
|
* usable logo appear publicly.
|
||||||
|
*/
|
||||||
|
export const RELATIONSHIPS = [
|
||||||
|
'client-reference',
|
||||||
|
'technology-partner',
|
||||||
|
'infrastructure',
|
||||||
|
'supplier',
|
||||||
|
'technology-used',
|
||||||
|
'professional-partner',
|
||||||
|
] as const
|
||||||
|
export type Relationship = (typeof RELATIONSHIPS)[number]
|
||||||
|
|
||||||
|
export const RELATIONSHIP_LABELS: Record<Relationship, string> = {
|
||||||
|
'client-reference': 'Ügyfélreferencia',
|
||||||
|
'technology-partner': 'Technológiai partner',
|
||||||
|
infrastructure: 'Infrastruktúra-szolgáltató',
|
||||||
|
supplier: 'Beszállító',
|
||||||
|
'technology-used': 'Használt technológia (nem partnerség)',
|
||||||
|
'professional-partner': 'Szakmai partner',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PERMISSIONS = ['granted', 'pending', 'none'] as const
|
||||||
|
export type Permission = (typeof PERMISSIONS)[number]
|
||||||
|
|
||||||
|
export const PERMISSION_LABELS: Record<Permission, string> = {
|
||||||
|
granted: 'Írásban engedélyezett',
|
||||||
|
pending: 'Egyeztetés alatt',
|
||||||
|
none: 'Nincs engedély',
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PartnerView = {
|
||||||
|
name: string
|
||||||
|
url: string
|
||||||
|
relationship: Relationship
|
||||||
|
logo: { url: string; alt: string }
|
||||||
|
}
|
||||||
|
|
||||||
|
type PartnerDoc = {
|
||||||
|
name: string
|
||||||
|
url: string
|
||||||
|
relationship?: string | null
|
||||||
|
publicationPermission?: string | null
|
||||||
|
logo?: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
const isRelationship = (value: unknown): value is Relationship =>
|
||||||
|
typeof value === 'string' && (RELATIONSHIPS as readonly string[]).includes(value)
|
||||||
|
|
||||||
|
/** Publicly showable entries: written permission, known category, usable logo. */
|
||||||
|
export function publicPartners(docs: readonly PartnerDoc[]): PartnerView[] {
|
||||||
|
return docs.flatMap((doc) => {
|
||||||
|
const logo = doc.logo as { url?: string; alt?: string } | null | undefined
|
||||||
|
if (doc.publicationPermission !== 'granted' || !isRelationship(doc.relationship) || !logo?.url) return []
|
||||||
|
return [{ name: doc.name, url: doc.url, relationship: doc.relationship, logo: { url: logo.url, alt: logo.alt ?? doc.name } }]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Clients and every other relationship are shown in separate blocks. */
|
||||||
|
export function groupReferences(partners: readonly PartnerView[]) {
|
||||||
|
return {
|
||||||
|
clients: partners.filter((p) => p.relationship === 'client-reference'),
|
||||||
|
partners: partners.filter((p) => p.relationship !== 'client-reference'),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ import config from '@payload-config'
|
|||||||
import type { Locale } from './i18n'
|
import type { Locale } from './i18n'
|
||||||
import { resolveCtaHref, type CtaLink } from './cta-link'
|
import { resolveCtaHref, type CtaLink } from './cta-link'
|
||||||
import { readGated } from './translation-gate'
|
import { readGated } from './translation-gate'
|
||||||
|
import { publicPartners, type PartnerView } from './partner-references'
|
||||||
|
|
||||||
let cached: ReturnType<typeof getPayload> | undefined
|
let cached: ReturnType<typeof getPayload> | undefined
|
||||||
|
|
||||||
@@ -105,19 +106,11 @@ export async function getLegalPage(slug: 'adatvedelem' | 'hasznalati-feltetelek'
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PartnerView = { name: string; url: string; logo: { url: string; alt: string } }
|
export type { PartnerView } from './partner-references'
|
||||||
|
|
||||||
|
/** MITHOME-131: only entries with a written permission, a category and a logo. */
|
||||||
export async function getPartners(): Promise<PartnerView[]> {
|
export async function getPartners(): Promise<PartnerView[]> {
|
||||||
const payload = await payloadClient()
|
const payload = await payloadClient()
|
||||||
const result = await payload.find({ collection: 'partners', limit: 100, sort: 'name' })
|
const result = await payload.find({ collection: 'partners', limit: 100, sort: 'name', depth: 1 })
|
||||||
return result.docs
|
return publicPartners(result.docs)
|
||||||
.filter((doc) => typeof doc.logo === 'object' && doc.logo?.url)
|
|
||||||
.map((doc) => ({
|
|
||||||
name: doc.name,
|
|
||||||
url: doc.url,
|
|
||||||
logo: {
|
|
||||||
url: (doc.logo as { url: string }).url,
|
|
||||||
alt: (doc.logo as { alt?: string }).alt ?? doc.name,
|
|
||||||
},
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/**
|
||||||
|
* MITHOME-131: partner- és referenciaszabályok bevezetése a meglévő adaton.
|
||||||
|
*
|
||||||
|
* - A Partners bejegyzések kapcsolati kategóriát és közzétételi engedélyt
|
||||||
|
* kapnak. A tulajdonos 2026-09-29-i megerősítése szerint az Angele
|
||||||
|
* Pihenőház ÜGYFÉL (nem partner), és írásos engedély van a név- és
|
||||||
|
* logóhasználatra. Minden más, kategória nélküli bejegyzés "nincs
|
||||||
|
* engedély" állapotba kerül, tehát rejtve marad, amíg valaki be nem sorolja.
|
||||||
|
* - A Home global megkapja a korábban beégetett szekció-szövegeket
|
||||||
|
* (hu + en), csak ha még üresek.
|
||||||
|
*
|
||||||
|
* Csak a dokumentumot és a legutóbbi verziót írja. Idempotens.
|
||||||
|
*/
|
||||||
|
import type { MigrateDownArgs, MigrateUpArgs } from '@payloadcms/db-mongodb'
|
||||||
|
|
||||||
|
import { rewriteDocs } from '../lib/migrate-global-docs'
|
||||||
|
|
||||||
|
type Data = Record<string, unknown>
|
||||||
|
|
||||||
|
export const CONFIRMED_CLIENT_REFERENCES = [
|
||||||
|
{
|
||||||
|
name: 'Angele Pihenőház',
|
||||||
|
permissionReference: 'Írásos engedély megvan (tulajdonosi megerősítés, 2026-09-29)',
|
||||||
|
},
|
||||||
|
] as const
|
||||||
|
|
||||||
|
type Copy = Record<'hu' | 'en', string>
|
||||||
|
|
||||||
|
export const REFERENCES_SECTION_COPY: {
|
||||||
|
clientsTitle: Copy
|
||||||
|
clientsSubtitle: Copy
|
||||||
|
partnersTitle: Copy
|
||||||
|
partnersSubtitle: Copy
|
||||||
|
relationshipLabels: Record<'technologyPartner' | 'infrastructure' | 'supplier' | 'technologyUsed' | 'professionalPartner', Copy>
|
||||||
|
} = {
|
||||||
|
clientsTitle: { hu: 'Akik már minket választottak', en: 'Clients who chose us' },
|
||||||
|
clientsSubtitle: { hu: 'Ügyfeleink, akik hozzájárultak a bemutatásukhoz', en: 'Clients who agreed to be featured' },
|
||||||
|
partnersTitle: { hu: 'Partnereink és technológiai hátterünk', en: 'Our partners and technology' },
|
||||||
|
partnersSubtitle: { hu: 'Szervezetek, amelyek közreműködnek a szolgáltatásainkban', en: 'Organisations that contribute to our services' },
|
||||||
|
relationshipLabels: {
|
||||||
|
technologyPartner: { hu: 'Technológiai partner', en: 'Technology partner' },
|
||||||
|
infrastructure: { hu: 'Technológiai háttér', en: 'Infrastructure provider' },
|
||||||
|
supplier: { hu: 'Beszállító', en: 'Supplier' },
|
||||||
|
technologyUsed: { hu: 'Általunk használt technológia', en: 'Technology we use' },
|
||||||
|
professionalPartner: { hu: 'Szakmai partner', en: 'Professional partner' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The same copy as stored by Payload for localized fields: { hu, en }. */
|
||||||
|
function localizedCopy(): Data {
|
||||||
|
const { relationshipLabels, ...titles } = REFERENCES_SECTION_COPY
|
||||||
|
return { ...titles, relationshipLabels: { ...relationshipLabels } }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function classifyPartner(doc: Data): number {
|
||||||
|
if (doc.relationship) return 0
|
||||||
|
const confirmed = CONFIRMED_CLIENT_REFERENCES.find((c) => c.name === doc.name)
|
||||||
|
if (confirmed) {
|
||||||
|
doc.relationship = 'client-reference'
|
||||||
|
doc.publicationPermission = 'granted'
|
||||||
|
doc.permissionReference = confirmed.permissionReference
|
||||||
|
} else {
|
||||||
|
doc.publicationPermission = 'none'
|
||||||
|
}
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
export function seedReferencesSection(doc: Data): number {
|
||||||
|
if (doc.referencesSection) return 0
|
||||||
|
doc.referencesSection = localizedCopy()
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function up(args: MigrateUpArgs): Promise<void> {
|
||||||
|
const partners = await rewriteDocs(
|
||||||
|
args,
|
||||||
|
{ kind: 'collection', slug: 'partners' },
|
||||||
|
['relationship', 'publicationPermission', 'permissionReference'],
|
||||||
|
classifyPartner,
|
||||||
|
{ versions: 'latest' },
|
||||||
|
)
|
||||||
|
const home = await rewriteDocs(args, { kind: 'global', slug: 'home' }, ['referencesSection'], seedReferencesSection, {
|
||||||
|
versions: 'latest',
|
||||||
|
})
|
||||||
|
args.payload.logger.info(`MITHOME-131 references: ${partners} partner record(s) classified, ${home} home record(s) seeded`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** DECISION: no automatic down — restore the pre-deploy dump instead. */
|
||||||
|
export async function down(args: MigrateDownArgs): Promise<void> {
|
||||||
|
args.payload.logger.warn('MITHOME-131 references: down is a no-op — restore the pre-deploy dump instead')
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ import * as migration_20260929_cta_page_links from './20260929_cta_page_links'
|
|||||||
import * as migration_20260929_localize_legal_pages from './20260929_localize_legal_pages'
|
import * as migration_20260929_localize_legal_pages from './20260929_localize_legal_pages'
|
||||||
import * as migration_20260929_en_ai_draft from './20260929_en_ai_draft'
|
import * as migration_20260929_en_ai_draft from './20260929_en_ai_draft'
|
||||||
import * as migration_20260929_service_claims from './20260929_service_claims'
|
import * as migration_20260929_service_claims from './20260929_service_claims'
|
||||||
|
import * as migration_20260929_partner_references from './20260929_partner_references'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payload migrations, in order. Passed to `mongooseAdapter({ prodMigrations })`
|
* Payload migrations, in order. Passed to `mongooseAdapter({ prodMigrations })`
|
||||||
@@ -38,4 +39,10 @@ export const migrations = [
|
|||||||
down: migration_20260929_service_claims.down,
|
down: migration_20260929_service_claims.down,
|
||||||
name: '20260929_service_claims',
|
name: '20260929_service_claims',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// MITHOME-131 — partner categories/permissions + references section copy.
|
||||||
|
up: migration_20260929_partner_references.up,
|
||||||
|
down: migration_20260929_partner_references.down,
|
||||||
|
name: '20260929_partner_references',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -67,6 +67,14 @@ describe('Payload collections', () => {
|
|||||||
|
|
||||||
// Regresszió-őr — MITHOME-121: a felhasználó kérésére a logo mező
|
// Regresszió-őr — MITHOME-121: a felhasználó kérésére a logo mező
|
||||||
// opcionálissá vált, hogy egy partner logó nélkül is menthető legyen.
|
// opcionálissá vált, hogy egy partner logó nélkül is menthető legyen.
|
||||||
|
it('should require a relationship category and default to no publication permission (MITHOME-131)', () => {
|
||||||
|
const relationship = findField(Partners.fields, 'relationship') as unknown as { required: boolean; options: { value: string }[] }
|
||||||
|
const permission = findField(Partners.fields, 'publicationPermission') as unknown as { defaultValue: string }
|
||||||
|
expect(relationship.required).toBe(true)
|
||||||
|
expect(relationship.options.map((o) => o.value)).toContain('client-reference')
|
||||||
|
expect(permission.defaultValue).toBe('none')
|
||||||
|
})
|
||||||
|
|
||||||
it('does not require a logo', () => {
|
it('does not require a logo', () => {
|
||||||
const logo = findField(Partners.fields, 'logo')
|
const logo = findField(Partners.fields, 'logo')
|
||||||
expect(logo).toBeDefined()
|
expect(logo).toBeDefined()
|
||||||
|
|||||||
Reference in New Issue
Block a user