working leantime widget 63

This commit is contained in:
Alma 2025-04-12 16:07:37 +02:00
parent 8ac9ba4366
commit e7e387dd56

View File

@ -16,7 +16,11 @@ interface Task {
date: string;
editFrom: string;
editTo: string;
editorId: string;
editor: {
id: string;
firstname: string;
lastname: string;
};
authorFirstname?: string;
authorLastname?: string;
tags?: string;
@ -109,6 +113,7 @@ export function Flow() {
const data = await response.json();
if (!data.tasks || !Array.isArray(data.tasks)) {
console.warn('No tasks found in response:', data);
setTasks([]);
return;
}
@ -118,7 +123,7 @@ export function Flow() {
.filter((task: Task) =>
task.headline &&
typeof task.headline === 'string' &&
task.editorId // Only show tasks assigned to the current user
task.editor // Only show tasks with an editor
)
.sort((a: Task, b: Task) => getDateToSort(a) - getDateToSort(b));
@ -176,6 +181,11 @@ export function Flow() {
Due: {formatDate(task.dateToFinish)}
</p>
)}
{task.editor && (
<p className="text-xs text-gray-500 mt-1">
Assigned to: {task.editor.firstname} {task.editor.lastname}
</p>
)}
</div>
))}
</div>