working leantime widget 78
This commit is contained in:
parent
3443805c7b
commit
ff3695f31d
@ -35,7 +35,6 @@ export function Flow() {
|
|||||||
const [tasks, setTasks] = useState<Task[]>([]);
|
const [tasks, setTasks] = useState<Task[]>([]);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
|
||||||
|
|
||||||
const getStatusLabel = (status: number): string => {
|
const getStatusLabel = (status: number): string => {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -96,9 +95,8 @@ export function Flow() {
|
|||||||
const dateB = b.dateToFinish ? new Date(b.dateToFinish).getTime() : new Date(b.date).getTime();
|
const dateB = b.dateToFinish ? new Date(b.dateToFinish).getTime() : new Date(b.date).getTime();
|
||||||
return dateA - dateB;
|
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);
|
setTasks(sortedTasks);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching tasks:', error);
|
console.error('Error fetching tasks:', error);
|
||||||
@ -125,7 +123,7 @@ export function Flow() {
|
|||||||
<RefreshCw className="h-4 w-4" />
|
<RefreshCw className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-4">
|
<CardContent>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="flex items-center justify-center py-4">
|
<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" />
|
<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 ? (
|
) : tasks.length === 0 ? (
|
||||||
<div className="text-sm text-muted-foreground text-center">No tasks found</div>
|
<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) => (
|
{tasks.map((task) => (
|
||||||
<div
|
<div
|
||||||
key={task.id}
|
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
|
<a
|
||||||
href={`https://agilite.slm-lab.net/tickets/showTicket/${task.id}`}
|
href={`https://agilite.slm-lab.net/tickets/showTicket/${task.id}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
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}
|
{task.headline}
|
||||||
</a>
|
</a>
|
||||||
<div className="flex items-center text-gray-500">
|
<div className="flex items-center text-gray-500 text-xs">
|
||||||
<Folder className="h-4 w-4 mr-2 opacity-70" />
|
<Folder className="h-3 w-3 mr-1 opacity-70" />
|
||||||
<span className="text-sm">{task.projectName}</span>
|
<span>{task.projectName}</span>
|
||||||
{task.dateToFinish && task.dateToFinish !== '0000-00-00 00:00:00' && (
|
{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()}
|
Due: {new Date(task.dateToFinish).toLocaleDateString()}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user