Files
websitedev/proto/src/lib/partner-references.ts
T
Do SikiandClaude Opus 5.5 5f9a53ed18 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>
2026-09-29 17:17:05 +02:00

72 lines
2.4 KiB
TypeScript

/**
* 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'),
}
}