diff --git a/backend/src/routes/dashboard.js b/backend/src/routes/dashboard.js index 37369d0..61d7e10 100644 --- a/backend/src/routes/dashboard.js +++ b/backend/src/routes/dashboard.js @@ -147,8 +147,8 @@ router.get('/board/unread', authenticate, (req, res) => { ? db.prepare("SELECT COUNT(*) c FROM board_items WHERE created_at > ? AND user_id != ?").get(lastRead, u).c : db.prepare('SELECT COUNT(*) c FROM board_items WHERE user_id != ?').get(u).c; const unreadPromoted = lastRead - ? db.prepare("SELECT COUNT(*) c FROM board_items WHERE promoted_at > ? AND user_id != ?").get(lastRead, u).c - : db.prepare("SELECT COUNT(*) c FROM board_items WHERE promoted_at IS NOT NULL AND user_id != ?").get(u).c; + ? db.prepare("SELECT COUNT(*) c FROM board_items WHERE promoted_at > ?").get(lastRead).c + : db.prepare("SELECT COUNT(*) c FROM board_items WHERE promoted_at IS NOT NULL").get().c; res.json({ unread, unreadPromoted }); }); diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index d19442b..78dc7b2 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -990,17 +990,13 @@ function BoardModal({ user, toast, onClose, onRead }) { } -function Dashboard({ toast, mobile, setActive, unreadMsgs=0, unreadBoard=0, unreadPromoted=0, user }) { +function Dashboard({ toast, mobile, setActive, unreadMsgs=0, unreadBoard=0, unreadPromoted=0, onBoardRead, user }) { const [now, setNow] = useState(new Date()); - const [showBoard, setShowBoard] = useState(false); - const [boardUnread, setBoardUnread] = useState(unreadBoard); - const [promotedUnread, setPromotedUnread] = useState(unreadPromoted); - useEffect(()=>{ setBoardUnread(unreadBoard); },[unreadBoard]); - useEffect(()=>{ setPromotedUnread(unreadPromoted); },[unreadPromoted]); + const [showBoard, setShowBoard] = useState(false); useEffect(() => { const t = setInterval(() => setNow(new Date()), 30000); return () => clearInterval(t); }, []); return (