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
@@ -1,6 +1,7 @@
|
||||
import Image from 'next/image'
|
||||
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'
|
||||
|
||||
type HomeViewProps = {
|
||||
@@ -9,18 +10,20 @@ type HomeViewProps = {
|
||||
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) {
|
||||
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 (
|
||||
<div className="space-y-0">
|
||||
{/* Hero Section */}
|
||||
@@ -228,49 +231,14 @@ export default function HomeView({ content: pageContent, partners, locale }: Hom
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Partners Section */}
|
||||
{partners.length > 0 && (
|
||||
<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)' }}>
|
||||
{partnersCopy.title}
|
||||
</h2>
|
||||
<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>
|
||||
)}
|
||||
{/* References (MITHOME-131): clients and partners are separate blocks. */}
|
||||
<ReferencesSection title={refCopy.clientsTitle} subtitle={refCopy.clientsSubtitle} entries={references.clients} />
|
||||
<ReferencesSection
|
||||
title={refCopy.partnersTitle}
|
||||
subtitle={refCopy.partnersSubtitle}
|
||||
entries={references.partners}
|
||||
relationshipLabel={relationshipLabel}
|
||||
/>
|
||||
|
||||
{/* CTA 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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user