forked from fahrPool/fahrPool
feat: wire Kanban board into the dashboard page
This commit is contained in:
parent
affa6961ab
commit
a82e31d75e
|
|
@ -1,21 +1,23 @@
|
||||||
import { loadProfile } from "@/lib/auth/profile";
|
import { loadProfile } from "@/lib/auth/profile";
|
||||||
import { Card } from "@/components/ui/Card";
|
import { listAuftraegeFuerKanban, listFahrerNutzer } from "@/lib/dashboard/queries";
|
||||||
|
import { KanbanBoard } from "@/components/dashboard/KanbanBoard";
|
||||||
|
|
||||||
export default async function DashboardPage() {
|
export default async function DashboardPage() {
|
||||||
const result = await loadProfile();
|
const profileResult = await loadProfile();
|
||||||
|
if (profileResult.status !== "ok") {
|
||||||
if (result.status !== "ok") {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const kannZuweisen = profileResult.profile.role === "admin" || profileResult.profile.role === "disponent";
|
||||||
|
const [spalten, fahrerListe] = await Promise.all([
|
||||||
|
listAuftraegeFuerKanban(),
|
||||||
|
kannZuweisen ? listFahrerNutzer() : Promise.resolve([]),
|
||||||
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto max-w-2xl p-4 md:p-8">
|
<div className="mx-auto max-w-6xl p-4 md:p-8">
|
||||||
<Card>
|
<h1 className="mb-6 text-xl font-semibold text-asphalt-grey">Dashboard</h1>
|
||||||
<h1 className="text-xl font-semibold text-asphalt-grey">Dashboard</h1>
|
<KanbanBoard initialSpalten={spalten} fahrerListe={fahrerListe} rolle={profileResult.profile.role} />
|
||||||
<p className="mt-2 text-asphalt-grey">
|
|
||||||
Eingeloggt als {result.profile.name} ({result.profile.role})
|
|
||||||
</p>
|
|
||||||
</Card>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue