mirror of
https://github.com/DerTyp7/f1r3wave-website.git
synced 2025-10-29 13:02:09 +01:00
Do not show imprint when disabled in config.json
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
}
|
||||
],
|
||||
"imprint": {
|
||||
"enable": true,
|
||||
"enable": false,
|
||||
"headline": "Imprint / Legal Notice",
|
||||
"name": "[Your Full Name]",
|
||||
"address": "[Your Full Address: Street and House Number, Postcode City]",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useConfig } from '@/contexts/configExports';
|
||||
import styles from '@/styles/Footer.module.scss';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
@@ -12,6 +13,7 @@ interface FooterProps {
|
||||
export default function Footer({ currentYear }: FooterProps) {
|
||||
const [isInLandingPage, setIsInLandingPage] = useState<boolean>(false);
|
||||
const pathname = usePathname();
|
||||
const { config } = useConfig();
|
||||
|
||||
useEffect(() => {
|
||||
setIsInLandingPage(pathname === '/');
|
||||
@@ -20,9 +22,13 @@ export default function Footer({ currentYear }: FooterProps) {
|
||||
return (
|
||||
<footer className={`${styles.footer} ${isInLandingPage ? styles.footerLandingPage : ''}`}>
|
||||
<div className={styles.links}>
|
||||
<Link href="/imprint" className={styles.linksLink}>
|
||||
Imprint
|
||||
</Link>
|
||||
{config?.contact.imprint.enable ? (
|
||||
<Link href="/imprint" className={styles.linksLink}>
|
||||
Imprint
|
||||
</Link>
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
<Link
|
||||
href="https://github.com/DerTyp7/f1r3wave-website"
|
||||
className={styles.linksLink}
|
||||
|
||||
@@ -2,9 +2,15 @@
|
||||
|
||||
import { useConfig } from '@/contexts/configExports';
|
||||
import styles from '@/styles/Imprint.module.scss';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
export default function Imprint() {
|
||||
const { config } = useConfig();
|
||||
const router = useRouter();
|
||||
|
||||
if (!config || !config?.contact.imprint.enable) {
|
||||
router.push('/');
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.imprint}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use client";
|
||||
'use client';
|
||||
|
||||
import { ConfigContextType } from '@/interfaces/config';
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
Reference in New Issue
Block a user