feat: make Footer copyright and creator texts dynamic via CMS

This commit is contained in:
MichalC
2026-08-31 23:24:02 +02:00
parent 1c3c9ea7b1
commit cccda44fcd
4 changed files with 81 additions and 12 deletions
+27 -2
View File
@@ -245,8 +245,33 @@ async function run() {
association: { association: {
title: 'Działam w ramach b.b.h. Lohnsteuerhilfeverein e.V.', title: 'Działam w ramach b.b.h. Lohnsteuerhilfeverein e.V.',
link: 'https://bbh-lohnsteuerhilfe.de', link: 'https://bbh-lohnsteuerhilfe.de',
} },
} copyright: '© 2024 Finanz- & Lohnbuchhaltung Dipl.-Ing. Janusz Kędzierski. Wszelkie prawa zastrzeżone.',
creator: {
label: 'Realizacja:',
name: 'NetScale',
url: 'https://netscale.pl',
},
},
locale: 'pl'
});
await payload.updateGlobal({
slug: 'footer',
data: {
navigation: footerNavPages,
association: {
title: 'Ich bin im Rahmen des b.b.h. Lohnsteuerhilfevereins e.V. tätig.',
link: 'https://bbh-lohnsteuerhilfe.de',
},
copyright: '© 2024 Finanz- & Lohnbuchhaltung Dipl.-Ing. Janusz Kędzierski. Alle Rechte vorbehalten.',
creator: {
label: 'Erstellt von',
name: 'NetScale',
url: 'https://netscale.pl',
},
},
locale: 'de'
}); });
console.log('Seeding site-settings (homepage)...') console.log('Seeding site-settings (homepage)...')
+1 -1
View File
@@ -56,7 +56,7 @@ export default async function RootLayout({
<LanguageSlugsProvider> <LanguageSlugsProvider>
<Header navItems={headerNavItems} /> <Header navItems={headerNavItems} />
<main className="min-h-screen pt-24">{children}</main> <main className="min-h-screen pt-24">{children}</main>
<Footer navItems={footerNavItems} companyInfo={companyData} association={footerData.association} /> <Footer navItems={footerNavItems} companyInfo={companyData} association={footerData.association} copyright={footerData.copyright} creator={footerData.creator} />
{/* Floating WhatsApp Button */} {/* Floating WhatsApp Button */}
<a <a
+26 -9
View File
@@ -9,11 +9,15 @@ import { MapPin, Phone, Mail, Clock, ExternalLink } from "lucide-react";
export function Footer({ export function Footer({
navItems = [], navItems = [],
companyInfo = {}, companyInfo = {},
association = {} association = {},
copyright,
creator,
}: { }: {
navItems?: any[]; navItems?: any[];
companyInfo?: any; companyInfo?: any;
association?: any; association?: any;
copyright?: any;
creator?: any;
}) { }) {
const pathname = usePathname(); const pathname = usePathname();
@@ -28,9 +32,14 @@ export function Footer({
const email = getLocText(companyInfo.email); const email = getLocText(companyInfo.email);
const hours = getLocText(companyInfo.hours); const hours = getLocText(companyInfo.hours);
const assocTitle = getLocText(association.title); const assocTitle = getLocText(association?.title);
const assocLink = association.link; const assocLink = association?.link;
const assocLogo = association.logo; const assocLogo = association?.logo;
const copyrightText = getLocText(copyright) || `© ${new Date().getFullYear()} Finanz- & Lohnbuchhaltung Dipl.-Ing. Janusz Kędzierski.`;
const creatorLabel = getLocText(creator?.label);
const creatorName = creator?.name;
const creatorUrl = creator?.url;
return ( return (
<footer className="bg-card py-16 md:py-24 mt-auto"> <footer className="bg-card py-16 md:py-24 mt-auto">
@@ -134,11 +143,19 @@ export function Footer({
</div> </div>
<div className="container-premium mt-16 pt-8 border-t border-border flex flex-col md:flex-row justify-between items-center gap-6 text-sm text-foreground/50"> <div className="container-premium mt-16 pt-8 border-t border-border flex flex-col md:flex-row justify-between items-center gap-6 text-sm text-foreground/50">
<p>© {new Date().getFullYear()} Finanz- & Lohnbuchhaltung Dipl.-Ing. Janusz Kędzierski. {currentLocaleCode === 'de' ? 'Alle Rechte vorbehalten.' : 'Wszelkie prawa zastrzeżone.'}</p> <p>{copyrightText}</p>
<p className="flex items-center gap-2 font-medium"> {(creatorName || creatorLabel) && (
{currentLocaleCode === 'de' ? 'Erstellt von' : 'Realizacja:'} <p className="flex items-center gap-2 font-medium">
<a href="#" className="hover:text-accent transition-colors">Intecion</a> {creatorLabel && <span>{creatorLabel}</span>}
</p> {creatorName && creatorUrl ? (
<a href={creatorUrl} target="_blank" rel="noopener noreferrer" className="hover:text-accent transition-colors">
{creatorName}
</a>
) : creatorName ? (
<span>{creatorName}</span>
) : null}
</p>
)}
</div> </div>
</footer> </footer>
); );
+27
View File
@@ -39,6 +39,33 @@ export const Footer: GlobalConfig = {
defaultValue: 'https://bbh-lohnsteuerhilfe.de', defaultValue: 'https://bbh-lohnsteuerhilfe.de',
} }
] ]
},
{
name: 'copyright',
type: 'text',
localized: true,
required: true,
},
{
name: 'creator',
type: 'group',
fields: [
{
name: 'label',
type: 'text',
localized: true,
},
{
name: 'name',
type: 'text',
required: true,
},
{
name: 'url',
type: 'text',
required: true,
}
]
} }
], ],
} }