Adiciona filtro de notificações lidas

This commit is contained in:
Eduardo Lopes 2026-01-22 17:23:19 -03:00
parent 5b825b6a9a
commit 173d8570c9
3 changed files with 19 additions and 2 deletions

View File

@ -31,6 +31,14 @@
> >
Vencidas Vencidas
</button> </button>
<button
type="button"
class="filter-btn neutral"
[class.active]="filter === 'lidas'"
(click)="setFilter('lidas')"
>
Lidas
</button>
</div> </div>
</div> </div>

View File

@ -72,6 +72,12 @@
background: rgba(239, 68, 68, 0.12); background: rgba(239, 68, 68, 0.12);
color: #b91c1c; color: #b91c1c;
} }
&.neutral.active {
border-color: rgba(15, 23, 42, 0.35);
background: rgba(15, 23, 42, 0.08);
color: #0f172a;
}
} }
.state { .state {

View File

@ -12,7 +12,7 @@ import { NotificationsService, NotificationDto } from '../../services/notificati
}) })
export class Notificacoes implements OnInit { export class Notificacoes implements OnInit {
notifications: NotificationDto[] = []; notifications: NotificationDto[] = [];
filter: 'todas' | 'vencidas' | 'aVencer' = 'todas'; filter: 'todas' | 'vencidas' | 'aVencer' | 'lidas' = 'todas';
loading = false; loading = false;
error = false; error = false;
@ -32,7 +32,7 @@ export class Notificacoes implements OnInit {
}); });
} }
setFilter(value: 'todas' | 'vencidas' | 'aVencer') { setFilter(value: 'todas' | 'vencidas' | 'aVencer' | 'lidas') {
this.filter = value; this.filter = value;
} }
@ -43,6 +43,9 @@ export class Notificacoes implements OnInit {
if (this.filter === 'aVencer') { if (this.filter === 'aVencer') {
return this.notifications.filter(n => n.tipo === 'AVencer'); return this.notifications.filter(n => n.tipo === 'AVencer');
} }
if (this.filter === 'lidas') {
return this.notifications.filter(n => n.lida);
}
return this.notifications; return this.notifications;
} }