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: {
title: 'Działam w ramach b.b.h. Lohnsteuerhilfeverein e.V.',
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)...')
+1 -1
View File
@@ -56,7 +56,7 @@ export default async function RootLayout({
<LanguageSlugsProvider>
<Header navItems={headerNavItems} />
<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 */}
<a
+26 -9
View File
@@ -9,11 +9,15 @@ import { MapPin, Phone, Mail, Clock, ExternalLink } from "lucide-react";
export function Footer({
navItems = [],
companyInfo = {},
association = {}
association = {},
copyright,
creator,
}: {
navItems?: any[];
companyInfo?: any;
association?: any;
copyright?: any;
creator?: any;
}) {
const pathname = usePathname();
@@ -28,9 +32,14 @@ export function Footer({
const email = getLocText(companyInfo.email);
const hours = getLocText(companyInfo.hours);
const assocTitle = getLocText(association.title);
const assocLink = association.link;
const assocLogo = association.logo;
const assocTitle = getLocText(association?.title);
const assocLink = association?.link;
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 (
<footer className="bg-card py-16 md:py-24 mt-auto">
@@ -134,11 +143,19 @@ export function Footer({
</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">
<p>© {new Date().getFullYear()} Finanz- & Lohnbuchhaltung Dipl.-Ing. Janusz Kędzierski. {currentLocaleCode === 'de' ? 'Alle Rechte vorbehalten.' : 'Wszelkie prawa zastrzeżone.'}</p>
<p className="flex items-center gap-2 font-medium">
{currentLocaleCode === 'de' ? 'Erstellt von' : 'Realizacja:'}
<a href="#" className="hover:text-accent transition-colors">Intecion</a>
</p>
<p>{copyrightText}</p>
{(creatorName || creatorLabel) && (
<p className="flex items-center gap-2 font-medium">
{creatorLabel && <span>{creatorLabel}</span>}
{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>
</footer>
);
+27
View File
@@ -39,6 +39,33 @@ export const Footer: GlobalConfig = {
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,
}
]
}
],
}