Skip to content
GitLab
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Paulo Avila
petruz-tasks
Commits
a2b64799
Commit
a2b64799
authored
Jun 16, 2026
by
Paulo Avila
Browse files
Nova tab de tarefas vencidas
parent
3910f7de
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/components/tasks/task-table.tsx
View file @
a2b64799
...
@@ -4,7 +4,8 @@ import { Fragment, useState } from "react";
...
@@ -4,7 +4,8 @@ import { Fragment, useState } from "react";
import
{
CheckCircle2
,
ChevronRight
,
Circle
,
Pencil
}
from
"
lucide-react
"
;
import
{
CheckCircle2
,
ChevronRight
,
Circle
,
Pencil
}
from
"
lucide-react
"
;
import
type
{
Subtask
,
Task
,
WorkspaceMember
}
from
"
@/lib/data
"
;
import
type
{
Subtask
,
Task
,
WorkspaceMember
}
from
"
@/lib/data
"
;
import
{
TASK_STATUSES
}
from
"
@/lib/constants
"
;
import
{
TASK_STATUSES
}
from
"
@/lib/constants
"
;
import
{
formatDate
}
from
"
@/lib/dates
"
;
import
{
formatDate
,
getDueInfo
}
from
"
@/lib/dates
"
;
import
{
AlertTriangle
}
from
"
lucide-react
"
;
import
{
canEditTask
}
from
"
@/lib/permissions
"
;
import
{
canEditTask
}
from
"
@/lib/permissions
"
;
import
{
initials
,
toFormValues
}
from
"
./task-utils
"
;
import
{
initials
,
toFormValues
}
from
"
./task-utils
"
;
import
{
Avatar
,
AvatarFallback
}
from
"
@/components/ui/avatar
"
;
import
{
Avatar
,
AvatarFallback
}
from
"
@/components/ui/avatar
"
;
...
@@ -64,10 +65,17 @@ export function TaskTable({
...
@@ -64,10 +65,17 @@ export function TaskTable({
);
);
}
}
const
isOverdue
=
(
t
:
Task
)
=>
getDueInfo
(
t
.
DueDate
,
t
.
Status
)?.
state
===
"
overdue
"
;
const
filteredTasks
=
const
filteredTasks
=
statusFilter
===
"
all
"
statusFilter
===
"
all
"
?
tasks
?
tasks
:
tasks
.
filter
((
t
)
=>
t
.
Status
===
statusFilter
);
:
statusFilter
===
"
overdue
"
?
tasks
.
filter
(
isOverdue
)
:
tasks
.
filter
((
t
)
=>
t
.
Status
===
statusFilter
);
const
overdueCount
=
tasks
.
filter
(
isOverdue
).
length
;
const
filterOptions
=
[
const
filterOptions
=
[
{
value
:
"
all
"
,
label
:
"
Todas
"
,
count
:
tasks
.
length
},
{
value
:
"
all
"
,
label
:
"
Todas
"
,
count
:
tasks
.
length
},
...
@@ -76,36 +84,44 @@ export function TaskTable({
...
@@ -76,36 +84,44 @@ export function TaskTable({
label
:
s
.
label
,
label
:
s
.
label
,
count
:
tasks
.
filter
((
t
)
=>
t
.
Status
===
s
.
value
).
length
,
count
:
tasks
.
filter
((
t
)
=>
t
.
Status
===
s
.
value
).
length
,
})),
})),
{
value
:
"
overdue
"
,
label
:
"
Vencidas
"
,
count
:
overdueCount
},
];
];
return
(
return
(
<
div
className
=
"space-y-3"
>
<
div
className
=
"space-y-3"
>
<
div
className
=
"flex flex-wrap items-center gap-2"
>
<
div
className
=
"flex flex-wrap items-center gap-2"
>
{
filterOptions
.
map
((
option
)
=>
(
{
filterOptions
.
map
((
option
)
=>
{
<
button
const
isActive
=
statusFilter
===
option
.
value
;
key
=
{
option
.
value
}
const
isOverdueFilter
=
option
.
value
===
"
overdue
"
;
type
=
"button"
return
(
onClick
=
{
()
=>
setStatusFilter
(
option
.
value
)
}
<
button
className
=
{
cn
(
key
=
{
option
.
value
}
"
inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors
"
,
type
=
"button"
statusFilter
===
option
.
value
onClick
=
{
()
=>
setStatusFilter
(
option
.
value
)
}
?
"
border-primary bg-primary text-primary-foreground
"
:
"
border-border bg-card text-muted-foreground hover:bg-muted
"
)
}
>
{
option
.
label
}
<
span
className
=
{
cn
(
className
=
{
cn
(
"
rounded-full px-1.5 text-[10px]
"
,
"
inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors
"
,
statusFilter
===
option
.
value
isActive
?
"
bg-primary-foreground/20
"
?
isOverdueFilter
:
"
bg-muted
"
?
"
border-destructive bg-destructive text-destructive-foreground
"
:
"
border-primary bg-primary text-primary-foreground
"
:
isOverdueFilter
&&
option
.
count
>
0
?
"
border-destructive/40 bg-destructive/10 text-destructive hover:bg-destructive/20
"
:
"
border-border bg-card text-muted-foreground hover:bg-muted
"
)
}
)
}
>
>
{
option
.
count
}
{
isOverdueFilter
&&
<
AlertTriangle
className
=
"h-3 w-3"
/>
}
</
span
>
{
option
.
label
}
</
button
>
<
span
))
}
className
=
{
cn
(
"
rounded-full px-1.5 text-[10px]
"
,
isActive
?
"
bg-white/20
"
:
"
bg-black/5 dark:bg-white/10
"
)
}
>
{
option
.
count
}
</
span
>
</
button
>
);
})
}
</
div
>
</
div
>
<
div
>
<
div
>
...
@@ -311,7 +327,9 @@ export function TaskTable({
...
@@ -311,7 +327,9 @@ export function TaskTable({
</
Table
>
</
Table
>
{
filteredTasks
.
length
===
0
&&
(
{
filteredTasks
.
length
===
0
&&
(
<
p
className
=
"p-8 text-center text-sm text-muted-foreground"
>
<
p
className
=
"p-8 text-center text-sm text-muted-foreground"
>
Nenhuma tarefa com este status.
{
statusFilter
===
"
overdue
"
?
"
Nenhuma tarefa vencida. 🎉
"
:
"
Nenhuma tarefa com este status.
"
}
</
p
>
</
p
>
)
}
)
}
</
div
>
</
div
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment