fix unread notification tab and empty state

This commit is contained in:
isUnknown 2025-01-09 15:44:06 +01:00
parent f0dec81150
commit 0f65b0ea7c

View file

@ -31,7 +31,10 @@
stroke-linejoin="round"
/>
</svg>
<p>Vous navez pas de nouvelles notifications</p>
<p v-if="currentTab === 'all'">
Vous navez pas de nouvelles notifications
</p>
<p v-else>Vous navez pas de notifications non lues</p>
</div>
<section v-else class="notifications | flow">
<template
@ -91,9 +94,16 @@ const notificationComponents = {
};
const sortedNotifications = computed(() => {
return [...notifications.value].sort((a, b) => {
const sortedNotifications = [...notifications.value].sort((a, b) => {
return dayjs(b.date).diff(dayjs(a.date));
});
if (currentTab.value === "unread") {
return sortedNotifications.filter(
(notification) => notification.isread !== "true"
);
}
return sortedNotifications;
});
function changeTab(newValue) {