working leantime widget 64
This commit is contained in:
parent
e7e387dd56
commit
fc49d27b93
@ -6,28 +6,22 @@ import { Button } from "@/components/ui/button";
|
||||
import { RefreshCw } from "lucide-react";
|
||||
|
||||
interface Task {
|
||||
id: string;
|
||||
id: number;
|
||||
headline: string;
|
||||
projectName: string;
|
||||
projectId: number;
|
||||
status: number;
|
||||
type: string;
|
||||
dateToFinish: string;
|
||||
description: string;
|
||||
date: string;
|
||||
editFrom: string;
|
||||
editTo: string;
|
||||
editor: {
|
||||
id: string;
|
||||
firstname: string;
|
||||
lastname: string;
|
||||
};
|
||||
authorFirstname?: string;
|
||||
authorLastname?: string;
|
||||
tags?: string;
|
||||
description?: string;
|
||||
milestone?: string;
|
||||
details?: string;
|
||||
milestoneHeadline?: string;
|
||||
dateToFinish: string;
|
||||
projectId: number;
|
||||
projectName: string;
|
||||
type: string;
|
||||
status: number;
|
||||
editorId: string;
|
||||
editorFirstname: string | null;
|
||||
editorLastname: string | null;
|
||||
authorFirstname: string;
|
||||
authorLastname: string;
|
||||
milestoneHeadline: string | null;
|
||||
tags: string;
|
||||
}
|
||||
|
||||
interface ProjectSummary {
|
||||
@ -78,15 +72,11 @@ export function Flow() {
|
||||
};
|
||||
|
||||
const getDateToSort = (task: Task): number => {
|
||||
// Try different date fields in order of preference
|
||||
const dates = [
|
||||
task.dateToFinish,
|
||||
task.date,
|
||||
task.editTo,
|
||||
task.editFrom
|
||||
].filter(date => date && date !== '0000-00-00 00:00:00');
|
||||
|
||||
return dates.length > 0 ? new Date(dates[0]).getTime() : Number.MAX_SAFE_INTEGER;
|
||||
// Try to use dateToFinish first, then fall back to date
|
||||
const dateStr = task.dateToFinish !== '0000-00-00 00:00:00'
|
||||
? task.dateToFinish
|
||||
: task.date;
|
||||
return new Date(dateStr).getTime();
|
||||
};
|
||||
|
||||
const formatDate = (dateStr: string): string => {
|
||||
@ -123,7 +113,7 @@ export function Flow() {
|
||||
.filter((task: Task) =>
|
||||
task.headline &&
|
||||
typeof task.headline === 'string' &&
|
||||
task.editor // Only show tasks with an editor
|
||||
task.status !== 3 // Only show tasks that are not completed (status 3)
|
||||
)
|
||||
.sort((a: Task, b: Task) => getDateToSort(a) - getDateToSort(b));
|
||||
|
||||
@ -181,9 +171,14 @@ export function Flow() {
|
||||
Due: {formatDate(task.dateToFinish)}
|
||||
</p>
|
||||
)}
|
||||
{task.editor && (
|
||||
{task.editorFirstname && task.editorLastname && (
|
||||
<p className="text-xs text-gray-500 mt-1">
|
||||
Assigned to: {task.editor.firstname} {task.editor.lastname}
|
||||
Assigned to: {task.editorFirstname} {task.editorLastname}
|
||||
</p>
|
||||
)}
|
||||
{task.projectName && (
|
||||
<p className="text-xs text-gray-500 mt-1">
|
||||
Project: {task.projectName}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user