feat(customers): add initial admin bootstrap and csv import

This commit is contained in:
DS | Schubert 2026-07-03 09:14:56 +02:00
parent c816e9869d
commit ecab0fe6b6
27 changed files with 1197 additions and 34 deletions

View file

@ -1,31 +1,51 @@
"use client";
import { useEffect, useMemo, useState } from "react";
import LogoutButton from "@/components/LogoutButton";
import { api } from "@/lib/api";
import type { CurrentUser } from "@/types/rbac";
export default function Header() {
const [currentUser, setCurrentUser] = useState<CurrentUser | null>(null);
return (
useEffect(() => {
let active = true;
<header className="h-20 bg-white border-b flex items-center justify-between px-8">
api.get<CurrentUser>("/me")
.then((response) => {
if (active) {
setCurrentUser(response.data);
}
})
.catch(() => {
if (active) {
setCurrentUser(null);
}
});
<h1 className="text-3xl font-bold">
return () => {
active = false;
};
}, []);
Dashboard
const displayName = useMemo(() => {
if (!currentUser) {
return "Benutzer";
}
</h1>
const fullName = `${currentUser.first_name} ${currentUser.last_name}`.trim();
return fullName || currentUser.username || "Benutzer";
}, [currentUser]);
<div className="flex items-center gap-4">
<span className="font-semibold">
admin.schubert
</span>
<LogoutButton />
</div>
</header>
);
return (
<header className="flex h-20 items-center justify-between border-b bg-white px-8">
<h1 className="text-3xl font-bold">Dashboard</h1>
<div className="flex items-center gap-4">
<span className="font-semibold">{displayName}</span>
<LogoutButton />
</div>
</header>
);
}