Do not show imprint when disabled in config.json

This commit is contained in:
2025-10-09 18:09:33 +02:00
parent 3ca3b5fdce
commit c4529ef601
4 changed files with 17 additions and 5 deletions

View File

@@ -25,7 +25,7 @@
} }
], ],
"imprint": { "imprint": {
"enable": true, "enable": false,
"headline": "Imprint / Legal Notice", "headline": "Imprint / Legal Notice",
"name": "[Your Full Name]", "name": "[Your Full Name]",
"address": "[Your Full Address: Street and House Number, Postcode City]", "address": "[Your Full Address: Street and House Number, Postcode City]",

View File

@@ -1,5 +1,6 @@
'use client'; 'use client';
import { useConfig } from '@/contexts/configExports';
import styles from '@/styles/Footer.module.scss'; import styles from '@/styles/Footer.module.scss';
import Link from 'next/link'; import Link from 'next/link';
import { usePathname } from 'next/navigation'; import { usePathname } from 'next/navigation';
@@ -12,6 +13,7 @@ interface FooterProps {
export default function Footer({ currentYear }: FooterProps) { export default function Footer({ currentYear }: FooterProps) {
const [isInLandingPage, setIsInLandingPage] = useState<boolean>(false); const [isInLandingPage, setIsInLandingPage] = useState<boolean>(false);
const pathname = usePathname(); const pathname = usePathname();
const { config } = useConfig();
useEffect(() => { useEffect(() => {
setIsInLandingPage(pathname === '/'); setIsInLandingPage(pathname === '/');
@@ -20,9 +22,13 @@ export default function Footer({ currentYear }: FooterProps) {
return ( return (
<footer className={`${styles.footer} ${isInLandingPage ? styles.footerLandingPage : ''}`}> <footer className={`${styles.footer} ${isInLandingPage ? styles.footerLandingPage : ''}`}>
<div className={styles.links}> <div className={styles.links}>
<Link href="/imprint" className={styles.linksLink}> {config?.contact.imprint.enable ? (
Imprint <Link href="/imprint" className={styles.linksLink}>
</Link> Imprint
</Link>
) : (
''
)}
<Link <Link
href="https://github.com/DerTyp7/f1r3wave-website" href="https://github.com/DerTyp7/f1r3wave-website"
className={styles.linksLink} className={styles.linksLink}

View File

@@ -2,9 +2,15 @@
import { useConfig } from '@/contexts/configExports'; import { useConfig } from '@/contexts/configExports';
import styles from '@/styles/Imprint.module.scss'; import styles from '@/styles/Imprint.module.scss';
import { useRouter } from 'next/navigation';
export default function Imprint() { export default function Imprint() {
const { config } = useConfig(); const { config } = useConfig();
const router = useRouter();
if (!config || !config?.contact.imprint.enable) {
router.push('/');
}
return ( return (
<div className={styles.imprint}> <div className={styles.imprint}>

View File

@@ -1,4 +1,4 @@
"use client"; 'use client';
import { ConfigContextType } from '@/interfaces/config'; import { ConfigContextType } from '@/interfaces/config';
import { createContext, useContext } from 'react'; import { createContext, useContext } from 'react';