diff --git a/components/flow.tsx b/components/flow.tsx index a956cb1b..c1c8afd0 100644 --- a/components/flow.tsx +++ b/components/flow.tsx @@ -9,15 +9,13 @@ import { Badge } from "@/components/ui/badge"; interface Task { id: number; headline: string; - description?: string; + userId: number; + status: number; + editorId: string; + assignedTo?: any; + projectName?: string; dateToFinish?: string; date?: string; - projectId?: number; - projectName?: string; - status: number; - editorId?: string; - userId?: number; - assignedTo?: any; } interface ProjectSummary { @@ -85,9 +83,8 @@ export function Flow() { return; } - // Filter tasks with status 3 (In Progress) and sort by date - const filteredAndSortedTasks = data - .filter((task: Task) => task.status === 3) + // Sort tasks by date and limit to 4 + const sortedTasks = data .sort((a: Task, b: Task) => { const dateA = a.dateToFinish ? new Date(a.dateToFinish).getTime() : a.date ? new Date(a.date).getTime() : Date.now(); @@ -97,7 +94,7 @@ export function Flow() { }) .slice(0, 4); // Limit to 4 tasks - setTasks(filteredAndSortedTasks); + setTasks(sortedTasks); } catch (error) { console.error('Error fetching tasks:', error); setError('Failed to fetch tasks'); @@ -148,17 +145,19 @@ export function Flow() { > {task.headline} - {task.projectName && ( -