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 <noreply@anthropic.com>
This commit is contained in:
parent
cccdf6dd5a
commit
f03fe63bd3
4 changed files with 32 additions and 52 deletions
|
|
@ -76,6 +76,21 @@ export default function App() {
|
||||||
localStorage.setItem('hub-theme', t);
|
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 ──
|
// ── Unified Auth State ──
|
||||||
const [user, setUser] = useState<AuthUser>({ authenticated: false });
|
const [user, setUser] = useState<AuthUser>({ authenticated: false });
|
||||||
const [providers, setProviders] = useState<AuthProviders>({ discord: false, steam: false, admin: false });
|
const [providers, setProviders] = useState<AuthProviders>({ discord: false, steam: false, admin: false });
|
||||||
|
|
@ -348,6 +363,9 @@ export default function App() {
|
||||||
<path d="M21 12a9 9 0 0 1-15 6.7L3 16" />
|
<path d="M21 12a9 9 0 0 1-15 6.7L3 16" />
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
|
<span className="hub-clock">
|
||||||
|
{clock.slice(0, 5)}<span className="hub-clock-sec">{clock.slice(5)}</span>
|
||||||
|
</span>
|
||||||
<span
|
<span
|
||||||
className="hub-version hub-version-clickable"
|
className="hub-version hub-version-clickable"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,6 @@ export default function SoundboardTab({ data, isAdmin: isAdminProp }: Soundboard
|
||||||
|
|
||||||
/* ── UI ── */
|
/* ── UI ── */
|
||||||
const [notification, setNotification] = useState<{ msg: string; type: 'info' | 'error' } | null>(null);
|
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 [ctxMenu, setCtxMenu] = useState<{ x: number; y: number; sound: Sound } | null>(null);
|
||||||
const [refreshKey, setRefreshKey] = useState(0);
|
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.find(c => `${c.guildId}:${c.channelId}` === selected),
|
||||||
[channels, 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 ── */
|
/* ── Init ── */
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
@ -814,9 +799,6 @@ export default function SoundboardTab({ data, isAdmin: isAdminProp }: Soundboard
|
||||||
const analyticsTop = analytics.mostPlayed.slice(0, 10);
|
const analyticsTop = analytics.mostPlayed.slice(0, 10);
|
||||||
const totalSoundsDisplay = analytics.totalSounds || total;
|
const totalSoundsDisplay = analytics.totalSounds || total;
|
||||||
|
|
||||||
const clockMain = clock.slice(0, 5);
|
|
||||||
const clockSec = clock.slice(5);
|
|
||||||
|
|
||||||
/* ════════════════════════════════════════════
|
/* ════════════════════════════════════════════
|
||||||
RENDER
|
RENDER
|
||||||
════════════════════════════════════════════ */
|
════════════════════════════════════════════ */
|
||||||
|
|
@ -870,10 +852,6 @@ export default function SoundboardTab({ data, isAdmin: isAdminProp }: Soundboard
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="clock-wrap">
|
|
||||||
<div className="clock">{clockMain}<span className="clock-seconds">{clockSec}</span></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="topbar-right">
|
<div className="topbar-right">
|
||||||
{lastPlayed && (
|
{lastPlayed && (
|
||||||
<div className="now-playing">
|
<div className="now-playing">
|
||||||
|
|
|
||||||
|
|
@ -80,28 +80,6 @@
|
||||||
letter-spacing: -.02em;
|
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 {
|
.topbar-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -1668,14 +1646,6 @@
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clock {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.clock-seconds {
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tb-btn span:not(.tb-icon) {
|
.tb-btn span:not(.tb-icon) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,20 @@ html, body {
|
||||||
line-height: 1;
|
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 {
|
.hub-version {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: var(--text-faint);
|
color: var(--text-faint);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue