()
| 80 | }; |
| 81 | |
| 82 | const getUnreadKeys = () => { |
| 83 | if (!announcements.length) return []; |
| 84 | let readKeys = []; |
| 85 | try { |
| 86 | readKeys = JSON.parse(localStorage.getItem('notice_read_keys')) || []; |
| 87 | } catch (_) { |
| 88 | readKeys = []; |
| 89 | } |
| 90 | const readSet = new Set(readKeys); |
| 91 | return announcements.filter((a) => !readSet.has(getAnnouncementKey(a))).map(getAnnouncementKey); |
| 92 | }; |
| 93 | |
| 94 | useEffect(() => { |
| 95 | setUnreadCount(calculateUnreadCount()); |
nothing calls this directly
no test coverage detected