From 9ce55217a11af573767e3b275be6c7225814b67c Mon Sep 17 00:00:00 2001 From: syntaxbullet Date: Mon, 22 Jun 2026 12:23:06 +0200 Subject: [PATCH] feat: manage testimonial labels via payload --- src/collections/Pages/aboutFields.ts | 5 ++ src/collections/Pages/homeFields.ts | 5 ++ src/payload-types.ts | 20 ++++++++ src/spa/aboutContent.ts | 49 ++---------------- src/spa/components/TestimonialsSection.tsx | 58 +++++++++++++--------- src/spa/homeContent.ts | 49 +----------------- src/spa/testimonialsContent.ts | 53 ++++++++++++++++++++ 7 files changed, 123 insertions(+), 116 deletions(-) create mode 100644 src/spa/testimonialsContent.ts diff --git a/src/collections/Pages/aboutFields.ts b/src/collections/Pages/aboutFields.ts index 7b23463..d5284f0 100644 --- a/src/collections/Pages/aboutFields.ts +++ b/src/collections/Pages/aboutFields.ts @@ -160,6 +160,11 @@ export const aboutFields: Field[] = [ fields: [ text('eyebrow', 'Eyebrow', aboutContent.testimonials.eyebrow), textarea('heading', 'Heading', aboutContent.testimonials.heading), + textarea('desktopHeading', 'Desktop heading', aboutContent.testimonials.desktopHeading), + text('yearPrefix', 'Award year prefix', aboutContent.testimonials.yearPrefix), + text('previousLabel', 'Previous button label', aboutContent.testimonials.previousLabel), + text('nextLabel', 'Next button label', aboutContent.testimonials.nextLabel), + text('slideLabelPrefix', 'Slide dot label prefix', aboutContent.testimonials.slideLabelPrefix), { name: 'items', label: 'Testimonials', diff --git a/src/collections/Pages/homeFields.ts b/src/collections/Pages/homeFields.ts index b5cc1aa..5e1a905 100644 --- a/src/collections/Pages/homeFields.ts +++ b/src/collections/Pages/homeFields.ts @@ -219,6 +219,11 @@ export const homeFields: Field[] = [ fields: [ text('eyebrow', 'Eyebrow', homeContent.testimonials.eyebrow), textarea('heading', 'Heading', homeContent.testimonials.heading), + textarea('desktopHeading', 'Desktop heading', homeContent.testimonials.desktopHeading), + text('yearPrefix', 'Award year prefix', homeContent.testimonials.yearPrefix), + text('previousLabel', 'Previous button label', homeContent.testimonials.previousLabel), + text('nextLabel', 'Next button label', homeContent.testimonials.nextLabel), + text('slideLabelPrefix', 'Slide dot label prefix', homeContent.testimonials.slideLabelPrefix), { name: 'items', label: 'Testimonials', diff --git a/src/payload-types.ts b/src/payload-types.ts index ddf602c..3925a97 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -354,6 +354,11 @@ export interface Page { testimonials?: { eyebrow?: string | null; heading?: string | null; + desktopHeading?: string | null; + yearPrefix?: string | null; + previousLabel?: string | null; + nextLabel?: string | null; + slideLabelPrefix?: string | null; items?: | { image?: (number | null) | Media; @@ -1228,6 +1233,11 @@ export interface Page { testimonials?: { eyebrow?: string | null; heading?: string | null; + desktopHeading?: string | null; + yearPrefix?: string | null; + previousLabel?: string | null; + nextLabel?: string | null; + slideLabelPrefix?: string | null; items?: | { image?: (number | null) | Media; @@ -3339,6 +3349,11 @@ export interface PagesSelect { | { eyebrow?: T; heading?: T; + desktopHeading?: T; + yearPrefix?: T; + previousLabel?: T; + nextLabel?: T; + slideLabelPrefix?: T; items?: | T | { @@ -4069,6 +4084,11 @@ export interface PagesSelect { | { eyebrow?: T; heading?: T; + desktopHeading?: T; + yearPrefix?: T; + previousLabel?: T; + nextLabel?: T; + slideLabelPrefix?: T; items?: | T | { diff --git a/src/spa/aboutContent.ts b/src/spa/aboutContent.ts index 2cec1d4..a95be47 100644 --- a/src/spa/aboutContent.ts +++ b/src/spa/aboutContent.ts @@ -1,3 +1,5 @@ +import { testimonialsContent } from '@/spa/testimonialsContent' + export const aboutContent = { hero: { backgroundImageFilename: 'saal-leer-atmosphaere.jpg', @@ -49,52 +51,7 @@ export const aboutContent = { year: 2025, selectedWinners: [], }, - testimonials: { - eyebrow: 'Stimmen der Preisträger', - heading: 'DAS SAGEN UNSERE\nPREISTRÄGER.', - items: [ - { - imageUrl: 'https://images.unsplash.com/photo-1573496359142-b8d87734a5a2?auto=format&fit=crop&q=80&w=600', - name: 'Dr. Maria Huber', - role: 'Geschäftsführerin', - company: 'TechVision GmbH', - year: '2025', - quote: 'Der BMP hat uns neue Türen geöffnet. Die Auszeichnung ist ein wichtiges Qualitätssiegel für unser gesamtes Team.', - }, - { - imageUrl: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?auto=format&fit=crop&q=80&w=600', - name: 'Hannes Weber', - role: 'Inhaber & CEO', - company: 'Weber Präzision GmbH', - year: '2023', - quote: 'Der Gewinn war ein Moment des Stolzes für die gesamte Belegschaft. Die höchste Anerkennung für unsere tägliche Arbeit.', - }, - { - imageUrl: 'https://images.unsplash.com/photo-1580489944761-15a19d654956?auto=format&fit=crop&q=80&w=600', - name: 'Lisa Berger', - role: 'Gründerin & CEO', - company: 'EcoTech Bavaria', - year: '2024', - quote: 'Das Netzwerk, das wir durch den BMP gewonnen haben, ist unbezahlbar. Wir fanden Partner, die unsere Werte teilen.', - }, - { - imageUrl: 'https://images.unsplash.com/photo-1560250097-0b93528c311a?auto=format&fit=crop&q=80&w=600', - name: 'Dr. Michael Schuh', - role: 'Vorstand', - company: 'Bayerischer Maschinenbau', - year: '2024', - quote: 'Der Preis hat unsere Sichtbarkeit weit über die bayerischen Grenzen hinaus gestärkt. Ein echtes Premium-Siegel.', - }, - { - imageUrl: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?auto=format&fit=crop&q=80&w=600', - name: 'Anna Kellner', - role: 'Mitgründerin', - company: 'AlpinTech Solutions', - year: '2024', - quote: 'Der BMP hat unsere Employer Brand transformiert. Wir gewinnen heute die besten Talente, weil wir Preisträger sind.', - }, - ], - }, + testimonials: testimonialsContent, history: { eyebrow: 'Geschichte & Meilensteine', heading: '20 JAHRE\nMITTELSTANDSEXZELLENZ', diff --git a/src/spa/components/TestimonialsSection.tsx b/src/spa/components/TestimonialsSection.tsx index e870c43..ce73dff 100644 --- a/src/spa/components/TestimonialsSection.tsx +++ b/src/spa/components/TestimonialsSection.tsx @@ -4,17 +4,10 @@ import MunichSkylineBg from '@/spa/components/ui/munich-skyline-bg'; import { useIsMobile } from '@/spa/hooks/useIsMobile'; import Image from '@/spa/components/ui/UnoptimizedImage' import { mediaUrl } from '@/spa/cmsMediaField' +import { testimonialsContent } from '@/spa/testimonialsContent' const FF = '"IBM Plex Sans", sans-serif'; -export const TESTIMONIALS = [ - { img: "https://images.unsplash.com/photo-1573496359142-b8d87734a5a2?auto=format&fit=crop&q=80&w=600", name: "Dr. Maria Huber", role: "Geschäftsführerin", company: "TechVision GmbH", year: "2025", quote: "Der BMP hat uns neue Türen geöffnet. Die Auszeichnung ist ein wichtiges Qualitätssiegel für unser gesamtes Team." }, - { img: "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?auto=format&fit=crop&q=80&w=600", name: "Hannes Weber", role: "Inhaber & CEO", company: "Weber Präzision GmbH", year: "2023", quote: "Der Gewinn war ein Moment des Stolzes für die gesamte Belegschaft. Die höchste Anerkennung für unsere tägliche Arbeit." }, - { img: "https://images.unsplash.com/photo-1580489944761-15a19d654956?auto=format&fit=crop&q=80&w=600", name: "Lisa Berger", role: "Gründerin & CEO", company: "EcoTech Bavaria", year: "2024", quote: "Das Netzwerk, das wir durch den BMP gewonnen haben, ist unbezahlbar. Wir fanden Partner, die unsere Werte teilen." }, - { img: "https://images.unsplash.com/photo-1560250097-0b93528c311a?auto=format&fit=crop&q=80&w=600", name: "Dr. Michael Schuh", role: "Vorstand", company: "Bayerischer Maschinenbau", year: "2024", quote: "Der Preis hat unsere Sichtbarkeit weit über die bayerischen Grenzen hinaus gestärkt. Ein echtes Premium-Siegel." }, - { img: "https://images.unsplash.com/photo-1438761681033-6461ffad8d80?auto=format&fit=crop&q=80&w=600", name: "Anna Kellner", role: "Mitgründerin", company: "AlpinTech Solutions", year: "2024", quote: "Der BMP hat unsere Employer Brand transformiert. Wir gewinnen heute die besten Talente, weil wir Preisträger sind." }, -]; - type TestimonialItem = { img: string name: string @@ -27,7 +20,12 @@ type TestimonialItem = { type TestimonialsCms = { eyebrow?: string | null heading?: string | null - items?: Array> | null + desktopHeading?: string | null + yearPrefix?: string | null + previousLabel?: string | null + nextLabel?: string | null + slideLabelPrefix?: string | null + items?: Array> | null } const fallbackText = (value: unknown, fallback: string) => @@ -40,15 +38,29 @@ function Lines({ text }: { text: string }) { export default function TestimonialsSection({ data }: { data?: TestimonialsCms }) { const [active, setActive] = useState(0); const testimonials: TestimonialItem[] = data?.items?.length ? data.items.map((item) => ({ - img: mediaUrl(item.image, item.imageUrl || item.img || ''), + img: mediaUrl(item.image, fallbackText(item.imageUrl, fallbackText(item.img, ''))), name: fallbackText(item.name, ''), role: fallbackText(item.role, ''), company: fallbackText(item.company, ''), year: fallbackText(item.year, ''), quote: fallbackText(item.quote, ''), - })) : TESTIMONIALS; + })) : testimonialsContent.items.map((item) => ({ + img: item.imageUrl, + name: item.name, + role: item.role, + company: item.company, + year: item.year, + quote: item.quote, + })); const t = testimonials[active] || testimonials[0]; const isMobile = useIsMobile(); + const eyebrow = fallbackText(data?.eyebrow, testimonialsContent.eyebrow); + const heading = fallbackText(data?.heading, testimonialsContent.heading); + const desktopHeading = fallbackText(data?.desktopHeading, testimonialsContent.desktopHeading); + const yearPrefix = fallbackText(data?.yearPrefix, testimonialsContent.yearPrefix); + const previousLabel = fallbackText(data?.previousLabel, testimonialsContent.previousLabel); + const nextLabel = fallbackText(data?.nextLabel, testimonialsContent.nextLabel); + const slideLabelPrefix = fallbackText(data?.slideLabelPrefix, testimonialsContent.slideLabelPrefix); const prev = () => setActive(i => (i - 1 + testimonials.length) % testimonials.length); const next = () => setActive(i => (i + 1) % testimonials.length); @@ -60,9 +72,9 @@ export default function TestimonialsSection({ data }: { data?: TestimonialsCms } {isMobile && (
{/* Section header */} - {fallbackText(data?.eyebrow, 'Stimmen der Preisträger')} + {eyebrow}

- +

@@ -72,7 +84,7 @@ export default function TestimonialsSection({ data }: { data?: TestimonialsCms }
{t.name}
- Preisträger {t.year} + {yearPrefix} {t.year}
{/* Body */}
@@ -86,15 +98,15 @@ export default function TestimonialsSection({ data }: { data?: TestimonialsCms } {/* Controls */}
- -
{testimonials.map((_, i) => ( -
@@ -117,10 +129,10 @@ export default function TestimonialsSection({ data }: { data?: TestimonialsCms } {/* Right – quote */}
- {fallbackText(data?.eyebrow, 'Stimmen der Preisträger')} + {eyebrow}

- +

@@ -131,17 +143,17 @@ export default function TestimonialsSection({ data }: { data?: TestimonialsCms }

{t.name}
{t.role} · {t.company}
-
Preisträger {t.year}
+
{yearPrefix} {t.year}
- -
{testimonials.map((_, i) => ( -
diff --git a/src/spa/homeContent.ts b/src/spa/homeContent.ts index ffc37cf..82300cd 100644 --- a/src/spa/homeContent.ts +++ b/src/spa/homeContent.ts @@ -1,4 +1,5 @@ import { participationContent } from '@/spa/participationContent' +import { testimonialsContent } from '@/spa/testimonialsContent' export const homeContent = { hero: { @@ -122,53 +123,7 @@ export const homeContent = { cardFallbackTitle: 'Preisträger', hoverLabel: 'Detail →', }, - testimonials: { - eyebrow: 'Stimmen der Preisträger', - heading: 'DAS SAGEN UNSERE\nPREISTRÄGER.', - items: [ - { - imageUrl: 'https://images.unsplash.com/photo-1573496359142-b8d87734a5a2?auto=format&fit=crop&q=80&w=600', - name: 'Dr. Maria Huber', - role: 'Geschäftsführerin', - company: 'TechVision GmbH', - year: '2025', - quote: 'Der BMP hat uns neue Türen geöffnet. Die Auszeichnung ist ein wichtiges Qualitätssiegel für unser gesamtes Team.', - }, - { - imageUrl: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?auto=format&fit=crop&q=80&w=600', - name: 'Hannes Weber', - role: 'Inhaber & CEO', - company: 'Weber Präzision GmbH', - year: '2023', - quote: 'Der Gewinn war ein Moment des Stolzes für die gesamte Belegschaft. Die höchste Anerkennung für unsere tägliche Arbeit.', - }, - { - imageUrl: 'https://images.unsplash.com/photo-1580489944761-15a19d654956?auto=format&fit=crop&q=80&w=600', - name: 'Lisa Berger', - role: 'Gründerin & CEO', - company: 'EcoTech Bavaria', - year: '2024', - quote: 'Das Netzwerk, das wir durch den BMP gewonnen haben, ist unbezahlbar. Wir fanden Partner, die unsere Werte teilen.', - }, - { - imageUrl: 'https://images.unsplash.com/photo-1560250097-0b93528c311a?auto=format&fit=crop&q=80&w=600', - name: 'Dr. Michael Schuh', - role: 'Vorstand', - company: 'Bayerischer Maschinenbau', - year: '2024', - quote: 'Der Preis hat unsere Sichtbarkeit weit über die bayerischen Grenzen hinaus gestärkt. Ein echtes Premium-Siegel.', - }, - { - imageUrl: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?auto=format&fit=crop&q=80&w=600', - name: 'Anna Kellner', - role: 'Mitgründerin', - company: 'AlpinTech Solutions', - year: '2024', - quote: - 'Der BMP hat unsere Employer Brand transformiert. Wir gewinnen heute die besten Talente, weil wir Preisträger sind.', - }, - ], - }, + testimonials: testimonialsContent, benefits: { eyebrow: 'Mehr als nur ein Preis', heading: 'WARUM SICH DIE\nTEILNAHME LOHNT.', diff --git a/src/spa/testimonialsContent.ts b/src/spa/testimonialsContent.ts new file mode 100644 index 0000000..c1c9704 --- /dev/null +++ b/src/spa/testimonialsContent.ts @@ -0,0 +1,53 @@ +export const testimonialsContent = { + eyebrow: 'Stimmen der Preisträger', + heading: 'DAS SAGEN UNSERE\nPREISTRÄGER.', + desktopHeading: 'DAS SAGEN UNSERE PREISTRÄGER.', + yearPrefix: 'Preisträger', + previousLabel: 'Vorheriges', + nextLabel: 'Nächstes', + slideLabelPrefix: 'Stimme', + items: [ + { + imageUrl: 'https://images.unsplash.com/photo-1573496359142-b8d87734a5a2?auto=format&fit=crop&q=80&w=600', + name: 'Dr. Maria Huber', + role: 'Geschäftsführerin', + company: 'TechVision GmbH', + year: '2025', + quote: 'Der BMP hat uns neue Türen geöffnet. Die Auszeichnung ist ein wichtiges Qualitätssiegel für unser gesamtes Team.', + }, + { + imageUrl: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?auto=format&fit=crop&q=80&w=600', + name: 'Hannes Weber', + role: 'Inhaber & CEO', + company: 'Weber Präzision GmbH', + year: '2023', + quote: 'Der Gewinn war ein Moment des Stolzes für die gesamte Belegschaft. Die höchste Anerkennung für unsere tägliche Arbeit.', + }, + { + imageUrl: 'https://images.unsplash.com/photo-1580489944761-15a19d654956?auto=format&fit=crop&q=80&w=600', + name: 'Lisa Berger', + role: 'Gründerin & CEO', + company: 'EcoTech Bavaria', + year: '2024', + quote: 'Das Netzwerk, das wir durch den BMP gewonnen haben, ist unbezahlbar. Wir fanden Partner, die unsere Werte teilen.', + }, + { + imageUrl: 'https://images.unsplash.com/photo-1560250097-0b93528c311a?auto=format&fit=crop&q=80&w=600', + name: 'Dr. Michael Schuh', + role: 'Vorstand', + company: 'Bayerischer Maschinenbau', + year: '2024', + quote: 'Der Preis hat unsere Sichtbarkeit weit über die bayerischen Grenzen hinaus gestärkt. Ein echtes Premium-Siegel.', + }, + { + imageUrl: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?auto=format&fit=crop&q=80&w=600', + name: 'Anna Kellner', + role: 'Mitgründerin', + company: 'AlpinTech Solutions', + year: '2024', + quote: + 'Der BMP hat unsere Employer Brand transformiert. Wir gewinnen heute die besten Talente, weil wir Preisträger sind.', + }, + ], +} +