mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
Don't show more then three announcement popups (because it can be annoying for new users)
This commit is contained in:
parent
2c71530e74
commit
6ca2753536
1 changed files with 18 additions and 11 deletions
|
@ -273,19 +273,26 @@ function checkForSplash() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($i) {
|
if ($i) {
|
||||||
api("announcements", { withUnreads: true })
|
api("announcements", { withUnreads: true, limit: 10 })
|
||||||
.then((announcements) => {
|
.then((announcements) => {
|
||||||
announcements.forEach((announcement) => {
|
const unreadAnnouncements = announcements.filter((item) => {
|
||||||
if (announcement.showPopup && announcement.isRead === false)
|
return !item.isRead;
|
||||||
popup(
|
|
||||||
defineAsyncComponent(
|
|
||||||
() => import("@/components/MkAnnouncement.vue"),
|
|
||||||
),
|
|
||||||
{ announcement: announcement },
|
|
||||||
{},
|
|
||||||
"closed",
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
if (unreadAnnouncements.length > 3) {
|
||||||
|
// TODO: navigate to the announcements page when there are too many unreads
|
||||||
|
} else {
|
||||||
|
unreadAnnouncements.forEach((item) => {
|
||||||
|
if (item.showPopup)
|
||||||
|
popup(
|
||||||
|
defineAsyncComponent(
|
||||||
|
() => import("@/components/MkAnnouncement.vue"),
|
||||||
|
),
|
||||||
|
{ announcement: item },
|
||||||
|
{},
|
||||||
|
"closed",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => console.log(err));
|
.catch((err) => console.log(err));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue