Finish Docs #38, show publicID on HUB

This commit is contained in:
Nicolas
2025-07-01 11:57:17 +02:00
parent 8493f05ab0
commit f42b60f211
27 changed files with 109 additions and 194 deletions

View File

@@ -1,4 +1,4 @@
import { StatsToggle } from "(app)/_components/StatsToggle";
import { StatsTitle, StatsToggle } from "(app)/_components/StatsToggle";
import { prisma } from "@repo/db";
import { getServerSession } from "api/auth/[...nextauth]/auth";
@@ -282,7 +282,7 @@ export const Stats = async ({ stats }: { stats: "pilot" | "dispo" }) => {
return (
<>
{session.user.permissions.includes("DISPO") && <StatsToggle />}
{session.user.permissions.includes("DISPO") ? <StatsToggle /> : <StatsTitle />}
<div className="card bg-base-200 shadow-xl mb-4 col-span-6 xl:col-span-3">
{stats === "dispo" && <DispoStats />}
{stats === "pilot" && <PilotStats />}

View File

@@ -28,9 +28,12 @@ export const StatsToggle = () => {
}, [checked, router]);
return (
<header className="flex justify-between items-center p-4">
<header className="flex justify-between items-center pb-4">
<h1 className="text-2xl font-bold">
Hallo, {session.status === "authenticated" ? session.data?.user.firstname : "<username>"}
Hallo,{" "}
{session.status === "authenticated"
? session.data?.user.firstname + " <" + session.data?.user.publicId + ">"
: "<username>"}
{"!"}
</h1>
<div>
@@ -49,3 +52,24 @@ export const StatsToggle = () => {
</header>
);
};
export const StatsTitle = () => {
const session = useSession();
return (
<header className="flex justify-left items-center pb-4">
<h1 className="text-2xl font-bold">
Hallo,{" "}
{session.status === "authenticated" ? (
<>
{session.data?.user.firstname}
<span className="text-info text-xl">{" #" + session.data?.user.publicId}</span>
</>
) : (
"<username>"
)}
{"!"}
</h1>
</header>
);
};