From 632d3824749b2684aa46b49d984f84f00f8dec7a Mon Sep 17 00:00:00 2001 From: Nick Szaunig Date: Fri, 21 Aug 2026 23:52:32 +0200 Subject: [PATCH] feat(frontend): Aufgaben-Modul (Modul 6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aufgabenliste mit Status-/Prioritätsfilter und Erledigen-Aktion sowie Formular zum Anlegen neuer Aufgaben. --- ApiCore-Frontend/src/app/(app)/layout.tsx | 3 + .../src/app/(app)/tasks/new/page.tsx | 119 +++++++++++++ ApiCore-Frontend/src/app/(app)/tasks/page.tsx | 161 ++++++++++++++++++ ApiCore-Frontend/src/lib/tasks/api.ts | 28 +++ ApiCore-Frontend/src/lib/tasks/types.ts | 45 +++++ TASKS.md | 2 +- 6 files changed, 357 insertions(+), 1 deletion(-) create mode 100644 ApiCore-Frontend/src/app/(app)/tasks/new/page.tsx create mode 100644 ApiCore-Frontend/src/app/(app)/tasks/page.tsx create mode 100644 ApiCore-Frontend/src/lib/tasks/api.ts create mode 100644 ApiCore-Frontend/src/lib/tasks/types.ts diff --git a/ApiCore-Frontend/src/app/(app)/layout.tsx b/ApiCore-Frontend/src/app/(app)/layout.tsx index 9fbbdbd..b765a3a 100644 --- a/ApiCore-Frontend/src/app/(app)/layout.tsx +++ b/ApiCore-Frontend/src/app/(app)/layout.tsx @@ -34,6 +34,9 @@ export default function AppLayout({ children }: { children: ReactNode }) { Königinnen + + Aufgaben + {user.role === "ADMIN" ? ( ("NORMAL"); + const [dueDate, setDueDate] = useState(""); + const [error, setError] = useState(null); + + const mutation = useMutation({ + mutationFn: createTask, + onSuccess: () => { + void queryClient.invalidateQueries({ queryKey: ["tasks"] }); + router.push("/tasks"); + }, + onError: () => { + setError("Aufgabe konnte nicht angelegt werden."); + }, + }); + + function handleSubmit(event: FormEvent) { + event.preventDefault(); + setError(null); + mutation.mutate({ + title, + description: description || undefined, + priority, + dueDate: dueDate ? new Date(dueDate).toISOString() : undefined, + }); + } + + return ( +
+ + + Neue Aufgabe + + +
+
+ + setTitle(event.target.value)} + /> +
+
+ + +
+
+ + setDueDate(event.target.value)} + /> +
+
+ +