feat: Whiteboard Badge - Punkt bei neuen Änderungen/Teilen
This commit is contained in:
@@ -155,7 +155,7 @@ function Login({ onLogin }) {
|
||||
|
||||
// ── Update Modal ──────────────────────────────────────────────────────────────
|
||||
// ── Desktop Sidebar ───────────────────────────────────────────────────────────
|
||||
function Sidebar({ active, setActive, user, onLogout, unreadMsgs=0, hexWarsTurns=0 }) {
|
||||
function Sidebar({ active, setActive, user, onLogout, unreadMsgs=0, hexWarsTurns=0, whiteboardUnread=0 }) {
|
||||
const [appsOpen, setAppsOpen] = useState(true);
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
const [collapsedGroups, setCollapsedGroups] = useState({});
|
||||
@@ -186,6 +186,10 @@ function Sidebar({ active, setActive, user, onLogout, unreadMsgs=0, hexWarsTurns
|
||||
<span style={{ position:'absolute', top:-3, right:-3, width:7, height:7,
|
||||
borderRadius:'50%', background:'#4ecdc4', boxShadow:'0 0 5px #4ecdc4' }}/>
|
||||
)}
|
||||
{collapsed && item.id==='whiteboard' && whiteboardUnread>0 && (
|
||||
<span style={{ position:'absolute', top:-3, right:-3, width:7, height:7,
|
||||
borderRadius:'50%', background:'#4ecdc4', boxShadow:'0 0 5px #4ecdc4' }}/>
|
||||
)}
|
||||
</span>
|
||||
{!collapsed && <span style={{ flex:1, color:ic }}>{item.label}</span>}
|
||||
{!collapsed && item.id==='nachrichten' && unreadMsgs>0 && (
|
||||
@@ -196,6 +200,10 @@ function Sidebar({ active, setActive, user, onLogout, unreadMsgs=0, hexWarsTurns
|
||||
<span style={{ background:'#4ecdc4', color:'#000', borderRadius:10, fontSize:9,
|
||||
fontFamily:'monospace', padding:'1px 6px', fontWeight:700, flexShrink:0 }}>{hexWarsTurns}</span>
|
||||
)}
|
||||
{!collapsed && item.id==='whiteboard' && whiteboardUnread>0 && (
|
||||
<span style={{ background:'#4ecdc4', color:'#000', borderRadius:10, fontSize:9,
|
||||
fontFamily:'monospace', padding:'1px 6px', fontWeight:700, flexShrink:0 }}>{whiteboardUnread}</span>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
@@ -288,7 +296,7 @@ function Sidebar({ active, setActive, user, onLogout, unreadMsgs=0, hexWarsTurns
|
||||
}
|
||||
|
||||
// ── Mobile Bottom Navigation ──────────────────────────────────────────────────
|
||||
function BottomNav({ active, setActive, user, onLogout, unreadMsgs=0, hexWarsTurns=0 }) {
|
||||
function BottomNav({ active, setActive, user, onLogout, unreadMsgs=0, hexWarsTurns=0, whiteboardUnread=0 }) {
|
||||
const [menuOpen, setMenuOpen] = useState(false);
|
||||
const [appsOpen, setAppsOpen] = useState(false);
|
||||
const [mobileCollapsedGroups, setMobileCollapsedGroups] = useState({});
|
||||
@@ -365,7 +373,7 @@ function BottomNav({ active, setActive, user, onLogout, unreadMsgs=0, hexWarsTur
|
||||
</button>
|
||||
{!isGrpCollapsed && tools.map(t => (
|
||||
<MI key={t.id} Icon={t.Icon}
|
||||
label={t.label} dot={t.id==='gebietseroberung' && hexWarsTurns>0}
|
||||
label={t.label} dot={(t.id==='gebietseroberung' && hexWarsTurns>0) || (t.id==='whiteboard' && whiteboardUnread>0)}
|
||||
onClick={() => { setActive(t.id); setAppsOpen(false); }} />
|
||||
))}
|
||||
</div>
|
||||
@@ -399,7 +407,7 @@ function BottomNav({ active, setActive, user, onLogout, unreadMsgs=0, hexWarsTur
|
||||
style={{ flex:1, display:'flex', flexDirection:'column', alignItems:'center',
|
||||
justifyContent:'center', gap:3, background:'transparent', border:'none',
|
||||
cursor:'pointer', position:'relative', minWidth:0, padding:'0 4px' }}>
|
||||
{isApps && (hexWarsTurns>0 || unreadMsgs>0) && (
|
||||
{isApps && (hexWarsTurns>0 || unreadMsgs>0 || whiteboardUnread>0) && (
|
||||
<span style={{ position:'absolute', top:6, right:'calc(50% - 16px)',
|
||||
width:8, height:8, borderRadius:'50%', background:'#4ecdc4',
|
||||
boxShadow:'0 0 6px #4ecdc4', display:'inline-block' }} />
|
||||
@@ -3707,7 +3715,8 @@ export default function App() {
|
||||
};
|
||||
const [toastMsg,setToastMsg]=useState({msg:'',type:'success'});
|
||||
const [unreadMsgs, setUnreadMsgs] = useState(0);
|
||||
const [hexWarsTurns, setHexWarsTurns] = useState(0);
|
||||
const [hexWarsTurns, setHexWarsTurns] = useState(0);
|
||||
const [whiteboardUnread, setWhiteboardUnread] = useState(0);
|
||||
const [unreadBoard, setUnreadBoard] = useState(0);
|
||||
const [unreadPromoted, setUnreadPromoted] = useState(0);
|
||||
const [unreadChangelog,setUnreadChangelog]= useState(0);
|
||||
@@ -3779,6 +3788,14 @@ export default function App() {
|
||||
return()=>clearInterval(t);
|
||||
},[user]);
|
||||
|
||||
useEffect(()=>{
|
||||
if(!user)return;
|
||||
const poll=()=>api('/tools/whiteboard/unread').then(d=>setWhiteboardUnread(d.count||0)).catch(()=>{});
|
||||
poll();
|
||||
const t=setInterval(poll,30*1000);
|
||||
return()=>clearInterval(t);
|
||||
},[user]);
|
||||
|
||||
const toast=useCallback((msg,type='success')=>{
|
||||
setToastMsg({msg,type});
|
||||
setTimeout(()=>setToastMsg({msg:'',type:'success'}),3500);
|
||||
@@ -3816,7 +3833,7 @@ export default function App() {
|
||||
<Sidebar active={active} setActive={setActive} user={user}
|
||||
onLogout={()=>{localStorage.removeItem('sk_token');setUser(null);}}
|
||||
|
||||
unreadMsgs={unreadMsgs} hexWarsTurns={hexWarsTurns}/>
|
||||
unreadMsgs={unreadMsgs} hexWarsTurns={hexWarsTurns} whiteboardUnread={whiteboardUnread}/>
|
||||
)}
|
||||
<main ref={mainRef} style={mainStyle}>
|
||||
{active==='dashboard' && <Dashboard key={dashboardKey} toast={toast} mobile={mobile} setActive={setActive} setDevToolsNav={setDevToolsNav} unreadMsgs={unreadMsgs} unreadBoard={unreadBoard} unreadPromoted={unreadPromoted} onBoardRead={()=>{ setUnreadBoard(0); setUnreadPromoted(0); }} unreadChangelog={unreadChangelog} onChangelogRead={()=>setUnreadChangelog(0)} unackedFavs={unackedFavs} onClearUnackedFavs={()=>setUnackedFavs({count:0,isAdmin:false})} user={user}/>}
|
||||
@@ -3828,7 +3845,7 @@ export default function App() {
|
||||
<BottomNav active={active} setActive={setActive} user={user}
|
||||
onLogout={()=>{localStorage.removeItem('sk_token');setUser(null);}}
|
||||
|
||||
unreadMsgs={unreadMsgs} hexWarsTurns={hexWarsTurns}/>
|
||||
unreadMsgs={unreadMsgs} hexWarsTurns={hexWarsTurns} whiteboardUnread={whiteboardUnread}/>
|
||||
)}
|
||||
<ScrollToTop scrollRef={mainRef}/>
|
||||
<Toast msg={toastMsg.msg} type={toastMsg.type}/>
|
||||
|
||||
Reference in New Issue
Block a user