MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / calculateUnreadCount

Function calculateUnreadCount

web/src/components/layout/HeaderBar.js:70–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68 const getAnnouncementKey = (a) => `${a?.publishDate || ''}-${(a?.content || '').slice(0, 30)}`;
69
70 const calculateUnreadCount = () => {
71 if (!announcements.length) return 0;
72 let readKeys = [];
73 try {
74 readKeys = JSON.parse(localStorage.getItem('notice_read_keys')) || [];
75 } catch (_) {
76 readKeys = [];
77 }
78 const readSet = new Set(readKeys);
79 return announcements.filter((a) => !readSet.has(getAnnouncementKey(a))).length;
80 };
81
82 const getUnreadKeys = () => {
83 if (!announcements.length) return [];

Callers 1

HeaderBarFunction · 0.85

Calls 1

getAnnouncementKeyFunction · 0.85

Tested by

no test coverage detected