added footer with legal and contact

This commit is contained in:
z1glr
2025-01-07 20:54:02 +00:00
parent c3bc06fe82
commit f0ad6a3b64
8 changed files with 159 additions and 11 deletions

32
client/src/app/Footer.tsx Normal file
View File

@@ -0,0 +1,32 @@
"use client";
import { Divider } from "@nextui-org/divider";
import { Link } from "@nextui-org/link";
import { usePathname } from "next/navigation";
import React from "react";
export default function Footer({
sites,
}: {
sites: { href: string; text: string }[];
}) {
const pathname = usePathname();
return (
<>
{sites.map((footer, ii, footerSites) => (
<React.Fragment key={ii}>
<Link
href={footer.href}
color={pathname === footer.href ? "danger" : "foreground"}
>
{footer.text}
</Link>
{ii != footerSites.length - 1 ? (
<Divider orientation="vertical" />
) : null}
</React.Fragment>
))}
</>
);
}

View File

@@ -1 +0,0 @@
export default function ManageEvents() {}

View File

@@ -0,0 +1,9 @@
export default function Datenschutz() {
return (
<div>
<h2 className="text-center font-headline text-4xl text-highlight">
Datenschutz
</h2>
</div>
);
}

View File

@@ -0,0 +1,10 @@
export default function Impressum() {
return (
<div>
{" "}
<h2 className="text-center font-headline text-4xl text-highlight">
Impressum
</h2>
</div>
);
}

View File

@@ -1,6 +1,8 @@
import type { Metadata } from "next";
import "./globals.css";
import { NextUIProvider } from "@nextui-org/system";
import React from "react";
import Footer from "./Footer";
export const metadata: Metadata = {
title: "Create Next App",
@@ -12,6 +14,17 @@ export default function RootLayout({
}: Readonly<{
children: React.ReactNode;
}>) {
const footerSites = [
{
text: "Impressum",
href: "/impressum",
},
{
text: "Datenschutz",
href: "/datenschutz",
},
];
return (
<html>
<body className="bg-background text-foreground antialiased">
@@ -23,6 +36,9 @@ export default function RootLayout({
</h1>
</header>
<main className="flex min-h-full flex-1 flex-col">{children}</main>
<footer className="flex h-4 justify-center gap-4">
<Footer sites={footerSites} />
</footer>
</div>
</NextUIProvider>
</body>

View File

@@ -1,29 +1,31 @@
type QueryParams = Record<string, string | { toString(): string }>;
export type APICallResult<T extends object> = Response & { json: () => Promise<T> };
export type APICallResult<T extends object> = Response & {
json: () => Promise<T>;
};
export async function apiCall<K extends object>(
method: "GET",
api: string,
params?: QueryParams
params?: QueryParams,
): Promise<APICallResult<K>>;
export async function apiCall<K extends object>(
method: "POST" | "PATCH",
api: string,
params?: QueryParams,
body?: object
body?: object,
): Promise<APICallResult<K>>;
export async function apiCall<K extends object>(
method: "DELETE",
api: string,
params?: QueryParams,
body?: object
body?: object,
): Promise<APICallResult<K>>;
export async function apiCall<K extends object>(
method: "GET" | "POST" | "PATCH" | "DELETE",
api: string,
params?: QueryParams,
body?: object
body?: object,
): Promise<APICallResult<K>> {
let url = window.origin + "/api/" + api;
@@ -36,8 +38,8 @@ export async function apiCall<K extends object>(
} else {
return [key, value];
}
})
)
}),
),
);
url += "?" + urlsearchparams.toString();
@@ -45,12 +47,22 @@ export async function apiCall<K extends object>(
const response = await fetch(url, {
headers: {
"Content-Type": "application/json; charset=UTF-8"
"Content-Type": "application/json; charset=UTF-8",
},
credentials: "include",
method,
body: body !== undefined ? JSON.stringify(body) : undefined
body: body !== undefined ? JSON.stringify(body) : undefined,
});
return response;
}
}
export function classNames(classNames: Record<string, boolean>): string {
return Object.entries(classNames)
.map(([classString, value]) => {
if (value) {
return classString;
}
})
.join(" ");
}