UI: Version + Nightly-Badge nur im Nightly-Build anzeigen; CI: :latest nur auf main

This commit is contained in:
vibe-bot 2025-08-09 16:14:46 +02:00
parent 55a0c0d65e
commit 138f56d100

View file

@ -30,7 +30,6 @@ export default function App() {
const [chaosMode, setChaosMode] = useState<boolean>(false); const [chaosMode, setChaosMode] = useState<boolean>(false);
const chaosTimeoutRef = useRef<number | null>(null); const chaosTimeoutRef = useRef<number | null>(null);
const chaosModeRef = useRef<boolean>(false); const chaosModeRef = useRef<boolean>(false);
const [buildInfo, setBuildInfo] = useState<{version: string, channel: string}>({version: '1.0.0', channel: 'stable'});
useEffect(() => { chaosModeRef.current = chaosMode; }, [chaosMode]); useEffect(() => { chaosModeRef.current = chaosMode; }, [chaosMode]);
useEffect(() => { useEffect(() => {
@ -47,12 +46,11 @@ export default function App() {
} catch (e: any) { } catch (e: any) {
setError(e?.message || 'Fehler beim Laden der Channels'); setError(e?.message || 'Fehler beim Laden der Channels');
} }
try { setIsAdmin(await adminStatus()); } catch {} try { setIsAdmin(await adminStatus()); } catch {}
try { try {
const h = await fetch('/api/health').then(r => r.json()).catch(() => null); const h = await fetch('/api/health').then(r => r.json()).catch(() => null);
if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays); if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays);
if (h && h.buildInfo) setBuildInfo(h.buildInfo); } catch {}
} catch {}
})(); })();
}, []); }, []);
@ -117,7 +115,6 @@ export default function App() {
try { try {
const h = await fetch('/api/health').then(r => r.json()).catch(() => null); const h = await fetch('/api/health').then(r => r.json()).catch(() => null);
if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays); if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays);
if (h && h.buildInfo) setBuildInfo(h.buildInfo);
} catch {} } catch {}
}; };
@ -255,14 +252,14 @@ export default function App() {
<header className="flex items-center justify-between p-6"> <header className="flex items-center justify-between p-6">
<div className="flex items-center"> <div className="flex items-center">
<div> <div>
<h1 className="text-4xl font-bold"> <h1 className="text-4xl font-bold">
Jukebox 420 Jukebox 420
<div className="text-sm font-normal mt-1 opacity-70"> {import.meta.env.VITE_BUILD_CHANNEL === 'nightly' && (
v{buildInfo.version} <div className="text-sm font-normal mt-1 opacity-70">
{buildInfo.channel === 'nightly' && ( v{import.meta.env.VITE_APP_VERSION || ''}
<span className="ml-2" style={{ color: '#ff4d4f' }}> Nightly</span> <span className="ml-2" style={{ color: '#ff4d4f' }}> Nightly</span>
)} </div>
</div> )}
</h1> </h1>
<p className="text-7xl font-bold mt-2">{clock}</p> <p className="text-7xl font-bold mt-2">{clock}</p>
</div> </div>