Board: Auto-Update fix, gelber Punkt für Ersteller, Poll 30s

This commit is contained in:
2026-05-28 18:53:12 +02:00
parent b66a373764
commit cc6a1c6dc7
2 changed files with 10 additions and 14 deletions

View File

@@ -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 (
<div style={{ padding: mobile ? '14px 12px 90px' : '36px 44px', maxWidth:1100 }}>
{showBoard && <BoardModal user={user} toast={toast} onClose={()=>setShowBoard(false)} onRead={()=>{ setBoardUnread(0); setPromotedUnread(0); }}/>}
{showBoard && <BoardModal user={user} toast={toast} onClose={()=>setShowBoard(false)} onRead={onBoardRead}/>}
<div style={{ marginBottom:16, display:'flex', alignItems:'flex-start', justifyContent:'space-between' }}>
<div>
<h1 style={{ color:'#fff', fontFamily:"'Space Mono',monospace", fontSize:mobile ? 17 : 22, margin:0 }}>Dashboard</h1>
@@ -1032,15 +1028,15 @@ function Dashboard({ toast, mobile, setActive, unreadMsgs=0, unreadBoard=0, unre
color:'rgba(255,255,255,0.45)', cursor:'pointer',
padding:'4px 10px', fontSize:9, fontFamily:'monospace', letterSpacing:1 }}>
📋 ToDo
{boardUnread > 0 && (
{unreadBoard > 0 && (
<span style={{ position:'absolute', top:-3, right:-3, width:7, height:7,
borderRadius:'50%', background:'#4ecdc4', boxShadow:'0 0 5px #4ecdc4' }}/>
)}
{promotedUnread > 0 && boardUnread === 0 && (
{unreadPromoted > 0 && unreadBoard === 0 && (
<span style={{ position:'absolute', top:-3, right:-3, width:7, height:7,
borderRadius:'50%', background:'#ffe66d', boxShadow:'0 0 5px #ffe66d' }}/>
)}
{promotedUnread > 0 && boardUnread > 0 && (
{unreadPromoted > 0 && unreadBoard > 0 && (
<span style={{ position:'absolute', top:-3, left:-3, width:7, height:7,
borderRadius:'50%', background:'#ffe66d', boxShadow:'0 0 5px #ffe66d' }}/>
)}
@@ -1841,7 +1837,7 @@ export default function App() {
if(!user)return;
const poll=()=>api('/dashboard/board/unread').then(d=>{ setUnreadBoard(d.unread||0); setUnreadPromoted(d.unreadPromoted||0); }).catch(()=>{});
poll();
const t=setInterval(poll,60*1000);
const t=setInterval(poll,30*1000);
return()=>clearInterval(t);
},[user]);
@@ -1892,7 +1888,7 @@ export default function App() {
unreadMsgs={unreadMsgs}/>
)}
<main style={mainStyle}>
{active==='dashboard' && <Dashboard toast={toast} mobile={mobile} setActive={setActive} unreadMsgs={unreadMsgs} unreadBoard={unreadBoard} unreadPromoted={unreadPromoted} user={user}/>}
{active==='dashboard' && <Dashboard toast={toast} mobile={mobile} setActive={setActive} unreadMsgs={unreadMsgs} unreadBoard={unreadBoard} unreadPromoted={unreadPromoted} onBoardRead={()=>{ setUnreadBoard(0); setUnreadPromoted(0); }} user={user}/>}
{active==='admin' && <AdminPanel toast={toast} mobile={mobile} user={user}/>}
{activeTool && <activeTool.component toast={toast} mobile={mobile} setActive={setActive}/>}
</main>