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