()
| 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 []; |
no test coverage detected