mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
Compare commits
1 Commits
feat/souve
...
feat/LBX-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96b12cb27e |
@@ -130,6 +130,32 @@ export default function Notifications() {
|
||||
return () => unsubscribe();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = window.electron.onSyncNotificationCount(() => {
|
||||
if (userDetails) {
|
||||
fetchApiNotifications(0, false);
|
||||
}
|
||||
fetchLocalNotifications();
|
||||
});
|
||||
|
||||
return () => unsubscribe();
|
||||
}, [userDetails, fetchApiNotifications, fetchLocalNotifications]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleVisibilityChange = () => {
|
||||
if (!document.hidden && userDetails) {
|
||||
fetchApiNotifications(0, false);
|
||||
fetchLocalNotifications();
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener("visibilitychange", handleVisibilityChange);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
||||
};
|
||||
}, [userDetails, fetchApiNotifications, fetchLocalNotifications]);
|
||||
|
||||
const mergedNotifications = useMemo<MergedNotification[]>(() => {
|
||||
const sortByDate = (a: MergedNotification, b: MergedNotification) =>
|
||||
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
||||
|
||||
@@ -116,5 +116,6 @@
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user