Board: gelber Punkt bei befördertem Wunsch, promoted_at Tracking

This commit is contained in:
2026-05-28 18:47:42 +02:00
parent 5800b1a624
commit b66a373764
3 changed files with 24 additions and 8 deletions

View File

@@ -990,15 +990,17 @@ function BoardModal({ user, toast, onClose, onRead }) {
}
function Dashboard({ toast, mobile, setActive, unreadMsgs=0, unreadBoard=0, user }) {
function Dashboard({ toast, mobile, setActive, unreadMsgs=0, unreadBoard=0, unreadPromoted=0, user }) {
const [now, setNow] = useState(new Date());
const [showBoard, setShowBoard] = useState(false);
const [boardUnread, setBoardUnread] = useState(unreadBoard);
const [boardUnread, setBoardUnread] = useState(unreadBoard);
const [promotedUnread, setPromotedUnread] = useState(unreadPromoted);
useEffect(()=>{ setBoardUnread(unreadBoard); },[unreadBoard]);
useEffect(()=>{ setPromotedUnread(unreadPromoted); },[unreadPromoted]);
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)}/>}
{showBoard && <BoardModal user={user} toast={toast} onClose={()=>setShowBoard(false)} onRead={()=>{ setBoardUnread(0); setPromotedUnread(0); }}/>}
<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>
@@ -1034,6 +1036,14 @@ function Dashboard({ toast, mobile, setActive, unreadMsgs=0, unreadBoard=0, user
<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 && (
<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 && (
<span style={{ position:'absolute', top:-3, left:-3, width:7, height:7,
borderRadius:'50%', background:'#ffe66d', boxShadow:'0 0 5px #ffe66d' }}/>
)}
</button>
</div>
</div>
@@ -1793,7 +1803,8 @@ export default function App() {
const [updateInfo,setUpdateInfo]=useState(null);
const [showUpd,setShowUpd]=useState(false);
const [unreadMsgs, setUnreadMsgs] = useState(0);
const [unreadBoard, setUnreadBoard] = useState(0);
const [unreadBoard, setUnreadBoard] = useState(0);
const [unreadPromoted, setUnreadPromoted] = useState(0);
const [authChecked, setAuthChecked] = useState(false);
useEffect(()=>{
@@ -1828,7 +1839,7 @@ export default function App() {
useEffect(()=>{
if(!user)return;
const poll=()=>api('/dashboard/board/unread').then(d=>setUnreadBoard(d.unread||0)).catch(()=>{});
const poll=()=>api('/dashboard/board/unread').then(d=>{ setUnreadBoard(d.unread||0); setUnreadPromoted(d.unreadPromoted||0); }).catch(()=>{});
poll();
const t=setInterval(poll,60*1000);
return()=>clearInterval(t);
@@ -1881,7 +1892,7 @@ export default function App() {
unreadMsgs={unreadMsgs}/>
)}
<main style={mainStyle}>
{active==='dashboard' && <Dashboard toast={toast} mobile={mobile} setActive={setActive} unreadMsgs={unreadMsgs} unreadBoard={unreadBoard} user={user}/>}
{active==='dashboard' && <Dashboard toast={toast} mobile={mobile} setActive={setActive} unreadMsgs={unreadMsgs} unreadBoard={unreadBoard} unreadPromoted={unreadPromoted} user={user}/>}
{active==='admin' && <AdminPanel toast={toast} mobile={mobile} user={user}/>}
{activeTool && <activeTool.component toast={toast} mobile={mobile} setActive={setActive}/>}
</main>