Add demo-only mobile view toggle

Simulates a narrow viewport by capping .ts-app's own width and using
a container query (instead of a media query) for the mobile
breakpoint, so the toggle exercises the exact same CSS path real
narrow browsers hit. Only rendered when VITE_DEMO_MODE is set.
This commit is contained in:
Moepchi committed 2026-08-02 13:43:17 +02:00
1 parent 530415b50b
commit 69b256eb42
2 files changed
+38 -2

No files matched your search

+5 -1
View File
@@ -1404,6 +1404,7 @@ function AppInner() {
const [pokeTarget, setPokeTarget] = useState<{ id: number; name: string } | null>(null);
const [pokeMessage, setPokeMessage] = useState("");
const pokeBackdrop = useBackdropDismiss(() => setPokeTarget(null));
const [demoForceMobile, setDemoForceMobile] = useState(false);
const [activeTab, setActiveTab] = useState<ActiveTab>("channel");
const [theme, setTheme] = useState<"light" | "dark">(() =>
window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light"
@@ -2144,13 +2145,16 @@ function AppInner() {
const t = useT();
return (
<div className={`ts-app ts-theme-${theme}`}>
<div className={`ts-app ts-theme-${theme}${demoForceMobile ? " ts-force-mobile" : ""}`}>
{DEMO_MODE && (
<div className="ts-demo-banner">
Demo mode — simulated data only, no real TeamSpeak server involved.{" "}
<a href="https://github.com/Moepchi/webspeak3" target="_blank" rel="noreferrer">
Get WebSpeak3
</a>
<button className="ts-demo-mobile-toggle" onClick={() => setDemoForceMobile((v) => !v)}>
{demoForceMobile ? "🖥 Desktop view" : "📱 Mobile view"}
</button>
</div>
)}
<div className="ts-menubar">