fix: Hiding the alert bell if not active alerts

This commit is contained in:
2026-07-07 22:43:02 +02:00
parent 86cbe94cae
commit e656c79589
+4 -1
View File
@@ -806,6 +806,8 @@ export default function App() {
}, 20000); }, 20000);
return () => window.clearInterval(id); return () => window.clearInterval(id);
}, []); }, []);
// Close the (now-hidden) dropdown when the last alert clears/expires.
useEffect(() => { if (recentAlerts.length === 0) setAlertsPanelOpen(false); }, [recentAlerts.length]);
// NET Control tab — enabled from Tools (persisted; once on it's a tab like Cluster). // NET Control tab — enabled from Tools (persisted; once on it's a tab like Cluster).
const [netEnabled, setNetEnabled] = useState(() => localStorage.getItem('opslog.netEnabled') === '1'); const [netEnabled, setNetEnabled] = useState(() => localStorage.getItem('opslog.netEnabled') === '1');
@@ -2727,7 +2729,8 @@ export default function App() {
// row instead of the intrusive floating cards. It lights + shows a count when // row instead of the intrusive floating cards. It lights + shows a count when
// alerts are pending; click it to see the last 3 (each clickable to tune). // alerts are pending; click it to see the last 3 (each clickable to tune).
const hasAlerts = recentAlerts.length > 0; const hasAlerts = recentAlerts.length > 0;
const alertLedBlock = ( // Only show the bell when there are pending alerts — hidden otherwise.
const alertLedBlock = !hasAlerts ? null : (
<div className="relative self-end mb-0.5 shrink-0"> <div className="relative self-end mb-0.5 shrink-0">
<button type="button" onClick={() => setAlertsPanelOpen((o) => !o)} <button type="button" onClick={() => setAlertsPanelOpen((o) => !o)}
title={hasAlerts ? t('alert.pending', { n: recentAlerts.length }) : t('alert.noneShort')} title={hasAlerts ? t('alert.pending', { n: recentAlerts.length }) : t('alert.noneShort')}