working leantime widget 78

This commit is contained in:
Alma 2025-04-12 20:10:28 +02:00
parent 3443805c7b
commit ff3695f31d

View File

@ -35,7 +35,6 @@ export function Flow() {
const [tasks, setTasks] = useState<Task[]>([]);
const [error, setError] = useState<string | null>(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() {
<RefreshCw className="h-4 w-4" />
</Button>
</CardHeader>
<CardContent className="space-y-4">
<CardContent>
{loading ? (
<div className="flex items-center justify-center py-4">
<div className="h-4 w-4 animate-spin rounded-full border-2 border-primary border-t-transparent" />
@ -135,26 +133,26 @@ export function Flow() {
) : tasks.length === 0 ? (
<div className="text-sm text-muted-foreground text-center">No tasks found</div>
) : (
<div className="space-y-3">
<div className="space-y-3 max-h-[400px] overflow-y-auto pr-2">
{tasks.map((task) => (
<div
key={task.id}
className="p-4 rounded-2xl bg-white/90 shadow-sm hover:shadow-md transition-all duration-200"
className="p-3 rounded-xl bg-white/90 shadow-sm hover:shadow-md transition-all duration-200"
>
<div className="space-y-2">
<div className="space-y-1">
<a
href={`https://agilite.slm-lab.net/tickets/showTicket/${task.id}`}
target="_blank"
rel="noopener noreferrer"
className="text-blue-500 hover:text-blue-600 font-medium block text-lg"
className="text-blue-500 hover:text-blue-600 font-medium block text-sm"
>
{task.headline}
</a>
<div className="flex items-center text-gray-500">
<Folder className="h-4 w-4 mr-2 opacity-70" />
<span className="text-sm">{task.projectName}</span>
<div className="flex items-center text-gray-500 text-xs">
<Folder className="h-3 w-3 mr-1 opacity-70" />
<span>{task.projectName}</span>
{task.dateToFinish && task.dateToFinish !== '0000-00-00 00:00:00' && (
<span className="ml-4 text-sm">
<span className="ml-2">
Due: {new Date(task.dateToFinish).toLocaleDateString()}
</span>
)}