From 4de4482c88c978611164549de81ae0371e6d86e8 Mon Sep 17 00:00:00 2001 From: Jonny Date: Mon, 6 Jul 2026 12:20:50 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20add=20StatusBadge=20and=20restyle=20Auf?= =?UTF-8?q?tr=C3=A4ge=20list=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5 --- web/app/auftraege/page.tsx | 20 +++++++++++--- web/components/AuftragListe.tsx | 46 +++++++++++++++++-------------- web/components/ui/StatusBadge.tsx | 25 +++++++++++++++++ 3 files changed, 66 insertions(+), 25 deletions(-) create mode 100644 web/components/ui/StatusBadge.tsx diff --git a/web/app/auftraege/page.tsx b/web/app/auftraege/page.tsx index cc7e573..394ad6e 100644 --- a/web/app/auftraege/page.tsx +++ b/web/app/auftraege/page.tsx @@ -2,6 +2,8 @@ import Link from "next/link"; import { loadProfile } from "@/lib/auth/profile"; import { listAuftraegeFuerListe } from "@/lib/auftraege/queries"; import { AuftragListe } from "@/components/AuftragListe"; +import { Alert } from "@/components/ui/Alert"; +import { buttonClasses } from "@/components/ui/Button"; export default async function AuftraegePage({ searchParams, @@ -19,10 +21,20 @@ export default async function AuftraegePage({ const kannAnlegen = profileResult.profile.role === "admin" || profileResult.profile.role === "disponent"; return ( -
-

Aufträge

- {error &&

{error}

} - {kannAnlegen && Neuen Auftrag anlegen} +
+
+

Aufträge

+ {kannAnlegen && ( + + Neuen Auftrag anlegen + + )} +
+ {error && ( +
+ {error} +
+ )} {istFahrer ? ( <> diff --git a/web/components/AuftragListe.tsx b/web/components/AuftragListe.tsx index a40af1a..130c24f 100644 --- a/web/components/AuftragListe.tsx +++ b/web/components/AuftragListe.tsx @@ -1,29 +1,33 @@ import Link from "next/link"; import type { Auftrag } from "@/lib/auftraege/queries"; +import { Card } from "@/components/ui/Card"; +import { StatusBadge } from "@/components/ui/StatusBadge"; export function AuftragListe({ titel, auftraege }: { titel: string; auftraege: Auftrag[] }) { - if (auftraege.length === 0) { - return ( -
-

{titel}

-

Keine Aufträge.

-
- ); - } - return ( -
-

{titel}

-
    - {auftraege.map((auftrag) => ( -
  • - - {auftrag.abholort.adresse} → {auftrag.zielort.adresse} ({auftrag.fahrzeug.kennzeichen}) —{" "} - {auftrag.status} - -
  • - ))} -
+
+

{titel}

+ {auftraege.length === 0 ? ( +

Keine Aufträge.

+ ) : ( +
    + {auftraege.map((auftrag) => ( +
  • + + +
    + +
    +

    + {auftrag.abholort.adresse} → {auftrag.zielort.adresse} +

    +

    {auftrag.fahrzeug.kennzeichen}

    +
    + +
  • + ))} +
+ )}
); } diff --git a/web/components/ui/StatusBadge.tsx b/web/components/ui/StatusBadge.tsx new file mode 100644 index 0000000..99b44d3 --- /dev/null +++ b/web/components/ui/StatusBadge.tsx @@ -0,0 +1,25 @@ +import type { AuftragStatus } from "@/lib/auftraege/queries"; + +const STATUS_LABELS: Record = { + offen: "Offen", + zugewiesen: "Zugewiesen", + unterwegs: "Unterwegs", + abgeschlossen: "Abgeschlossen", + storniert: "Storniert", +}; + +const STATUS_CLASSES: Record = { + offen: "bg-gray-100 text-status-neutral", + zugewiesen: "bg-blue-50 text-performance-blue", + unterwegs: "bg-amber-50 text-status-warning", + abgeschlossen: "bg-green-50 text-status-success", + storniert: "bg-red-50 text-status-danger", +}; + +export function StatusBadge({ status }: { status: AuftragStatus }) { + return ( + + {STATUS_LABELS[status]} + + ); +}