From f03fe63bd3b5aa4fac1991ee43850b92f443c082 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 11 Mar 2026 11:45:20 +0100 Subject: [PATCH] Move clock from Soundboard to app header, display next to version Clock now shows globally in the header (left of version badge) instead of being Soundboard-only. Smaller size to fit header layout. Co-Authored-By: Claude Opus 4.6 --- web/src/App.tsx | 18 ++++++++++++ web/src/plugins/soundboard/SoundboardTab.tsx | 22 -------------- web/src/plugins/soundboard/soundboard.css | 30 -------------------- web/src/styles.css | 14 +++++++++ 4 files changed, 32 insertions(+), 52 deletions(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index ca4e00b..a51e0b5 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -76,6 +76,21 @@ export default function App() { localStorage.setItem('hub-theme', t); }; + // ── Clock ── + const [clock, setClock] = useState(''); + useEffect(() => { + const update = () => { + const now = new Date(); + const h = String(now.getHours()).padStart(2, '0'); + const m = String(now.getMinutes()).padStart(2, '0'); + const s = String(now.getSeconds()).padStart(2, '0'); + setClock(`${h}:${m}:${s}`); + }; + update(); + const id = setInterval(update, 1000); + return () => clearInterval(id); + }, []); + // ── Unified Auth State ── const [user, setUser] = useState({ authenticated: false }); const [providers, setProviders] = useState({ discord: false, steam: false, admin: false }); @@ -348,6 +363,9 @@ export default function App() { + + {clock.slice(0, 5)}{clock.slice(5)} + { diff --git a/web/src/plugins/soundboard/SoundboardTab.tsx b/web/src/plugins/soundboard/SoundboardTab.tsx index dc877bb..8c13796 100644 --- a/web/src/plugins/soundboard/SoundboardTab.tsx +++ b/web/src/plugins/soundboard/SoundboardTab.tsx @@ -374,7 +374,6 @@ export default function SoundboardTab({ data, isAdmin: isAdminProp }: Soundboard /* ── UI ── */ const [notification, setNotification] = useState<{ msg: string; type: 'info' | 'error' } | null>(null); - const [clock, setClock] = useState(''); const [ctxMenu, setCtxMenu] = useState<{ x: number; y: number; sound: Sound } | null>(null); const [refreshKey, setRefreshKey] = useState(0); @@ -460,20 +459,6 @@ export default function SoundboardTab({ data, isAdmin: isAdminProp }: Soundboard channels.find(c => `${c.guildId}:${c.channelId}` === selected), [channels, selected]); - /* ── Clock ── */ - useEffect(() => { - const update = () => { - const now = new Date(); - const h = String(now.getHours()).padStart(2, '0'); - const m = String(now.getMinutes()).padStart(2, '0'); - const s = String(now.getSeconds()).padStart(2, '0'); - setClock(`${h}:${m}:${s}`); - }; - update(); - const id = setInterval(update, 1000); - return () => clearInterval(id); - }, []); - /* ── Init ── */ useEffect(() => { (async () => { @@ -814,9 +799,6 @@ export default function SoundboardTab({ data, isAdmin: isAdminProp }: Soundboard const analyticsTop = analytics.mostPlayed.slice(0, 10); const totalSoundsDisplay = analytics.totalSounds || total; - const clockMain = clock.slice(0, 5); - const clockSec = clock.slice(5); - /* ════════════════════════════════════════════ RENDER ════════════════════════════════════════════ */ @@ -870,10 +852,6 @@ export default function SoundboardTab({ data, isAdmin: isAdminProp }: Soundboard -
-
{clockMain}{clockSec}
-
-
{lastPlayed && (
diff --git a/web/src/plugins/soundboard/soundboard.css b/web/src/plugins/soundboard/soundboard.css index c796ce1..60fae3f 100644 --- a/web/src/plugins/soundboard/soundboard.css +++ b/web/src/plugins/soundboard/soundboard.css @@ -80,28 +80,6 @@ letter-spacing: -.02em; } -/* ── Clock ── */ -.clock-wrap { - flex: 1; - display: flex; - justify-content: center; -} - -.clock { - font-size: 22px; - font-weight: 700; - color: var(--text-normal); - letter-spacing: .02em; - font-variant-numeric: tabular-nums; - opacity: .9; -} - -.clock-seconds { - font-size: 14px; - color: var(--text-faint); - font-weight: 500; -} - .topbar-right { display: flex; align-items: center; @@ -1668,14 +1646,6 @@ text-overflow: ellipsis; } - .clock { - font-size: 16px; - } - - .clock-seconds { - font-size: 11px; - } - .tb-btn span:not(.tb-icon) { display: none; } diff --git a/web/src/styles.css b/web/src/styles.css index 3c4676d..9a38deb 100644 --- a/web/src/styles.css +++ b/web/src/styles.css @@ -292,6 +292,20 @@ html, body { line-height: 1; } +/* ── Clock ── */ +.hub-clock { + font-size: 13px; + font-weight: 600; + color: var(--text-muted); + font-variant-numeric: tabular-nums; + letter-spacing: .02em; +} +.hub-clock-sec { + font-size: 10px; + color: var(--text-faint); + font-weight: 400; +} + .hub-version { font-size: 12px; color: var(--text-faint);