import { ClipboardList } from "lucide-react"; import { useEffect, useMemo, useState } from "react"; import { toast } from "sonner"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { HelpLink } from "@/components/HelpLink"; import { TodoPanel } from "@/components/TodoPanel"; import { getTodos } from "../api"; import type { TicketTodo, TodoStatus } from "../types"; type TodosPageProps = { onNavigate: (to: string) => void; }; export function TodosPage({ onNavigate }: TodosPageProps) { const [todos, setTodos] = useState([]); const [status, setStatus] = useState("open"); const [loading, setLoading] = useState(true); async function load() { setLoading(true); try { const result = await getTodos(status); setTodos(result.todos); } catch (error) { toast.error("ToDos konnten nicht geladen werden", { description: error instanceof Error ? error.message : "Unbekannter Fehler" }); } finally { setLoading(false); } } useEffect(() => { void load(); }, [status]); const counts = useMemo( () => ({ open: todos.filter((todo) => todo.status === "open").length, done: todos.filter((todo) => todo.status === "done").length, urgent: todos.filter((todo) => todo.status === "open" && todo.priority === "urgent").length }), [todos] ); return (

ToDos

Offene Aufgaben aus Projekten und normalen Tickets an einem Ort.

Offen {counts.open}
Dringend {counts.urgent}
Erledigt {counts.done}
Aufgabenliste ToDos werden im jeweiligen Ticket angelegt und hier gesammelt angezeigt.
{(["open", "all", "done"] as const).map((value) => ( ))}
{!loading && todos.length === 0 ? null : null}
); }