widget leantime refactor

This commit is contained in:
alma 2026-01-15 23:09:53 +01:00
parent c9cc0b666b
commit b4099d507e
2 changed files with 8 additions and 3 deletions

View File

@ -319,7 +319,7 @@ export async function GET(request: NextRequest) {
headline: task.title,
description: (task as any)._bodyText || null, // Use extracted body text
dateToFinish: task.dueAt || null,
projectName: 'Twenty CRM',
projectName: 'Médiation',
projectId: 0,
status: task.status === 'Done' ? 5 : 1, // 5 = Done, 1 = New (or other status)
editorId: task.assigneeId || null,

View File

@ -154,6 +154,11 @@ export function Duties() {
const todayDay = now.getDate();
const filteredTasks = allTasks.filter((task: Task) => {
// Exclude tasks with status Done (5)
if (task.status === 5) {
return false;
}
const dueDate = getValidDate(task);
if (!dueDate) {
return false; // Exclude tasks without a due date
@ -165,7 +170,7 @@ export function Duties() {
const taskMonth = taskDueDate.getMonth();
const taskDay = taskDueDate.getDate();
// Keep tasks with due date <= today (overdue or due today)
// Keep tasks with due date <= today (overdue or due today, not future)
const isOverdueOrDueToday = taskYear < todayYear ||
(taskYear === todayYear && taskMonth < todayMonth) ||
(taskYear === todayYear && taskMonth === todayMonth && taskDay <= todayDay);
@ -339,7 +344,7 @@ export function Duties() {
<Folder className="h-2.5 w-2.5 mr-1 opacity-70" />
<span className="truncate">{task.projectName}</span>
{(task as any).source === 'twenty-crm' && (
<span className="ml-1 text-[9px] text-purple-600 font-medium">(Twenty CRM)</span>
<span className="ml-1 text-[9px] text-purple-600 font-medium">(Médiation)</span>
)}
</div>
</div>