From ff3695f31d177d4b879f05ff6eb45986511b0c52 Mon Sep 17 00:00:00 2001 From: Alma Date: Sat, 12 Apr 2025 20:10:28 +0200 Subject: [PATCH] working leantime widget 78 --- components/flow.tsx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/components/flow.tsx b/components/flow.tsx index 1a2bdaf5..5a856e3b 100644 --- a/components/flow.tsx +++ b/components/flow.tsx @@ -35,7 +35,6 @@ export function Flow() { const [tasks, setTasks] = useState([]); const [error, setError] = useState(null); const [loading, setLoading] = useState(true); - const [refreshing, setRefreshing] = useState(false); const getStatusLabel = (status: number): string => { switch (status) { @@ -96,9 +95,8 @@ export function Flow() { const dateB = b.dateToFinish ? new Date(b.dateToFinish).getTime() : new Date(b.date).getTime(); return dateA - dateB; }) - .slice(0, 6); // Limit to 6 tasks + .slice(0, 4); // Limit to 4 tasks - console.log('Sorted and filtered tasks:', sortedTasks); setTasks(sortedTasks); } catch (error) { console.error('Error fetching tasks:', error); @@ -125,7 +123,7 @@ export function Flow() { - + {loading ? (
@@ -135,26 +133,26 @@ export function Flow() { ) : tasks.length === 0 ? (
No tasks found
) : ( -
+
{tasks.map((task) => (
-
+
{task.headline} -
- - {task.projectName} +
+ + {task.projectName} {task.dateToFinish && task.dateToFinish !== '0000-00-00 00:00:00' && ( - + Due: {new Date(task.dateToFinish).toLocaleDateString()} )}