diff --git a/web/src/App.css b/web/src/App.css index 71dd4d3..fc0253f 100644 --- a/web/src/App.css +++ b/web/src/App.css @@ -1252,3 +1252,137 @@ .ts-poke-notice button:hover { opacity: 1; } + +/* Mobile layout */ + +@media (max-width: 700px) { + .ts-menubar { + overflow-x: auto; + white-space: nowrap; + } + + .ts-toolbar { + flex-wrap: wrap; + } + + .ts-toolbar-icons { + flex-wrap: wrap; + row-gap: 0.3rem; + } + + .ts-icon-slider input[type="range"] { + width: 60px; + } + + .ts-icon-select select { + max-width: 110px; + } + + .ts-app-logo { + margin-left: 0; + } + + .ts-toolbar-fields { + flex-wrap: wrap; + row-gap: 0.4rem; + } + + .ts-toolbar-fields input:not([type="range"]), + .ts-toolbar-fields select { + max-width: 40vw; + } + + .ts-body { + overflow-y: auto; + } + + .ts-upper { + height: auto !important; + flex-direction: column; + flex-shrink: 1; + } + + .ts-tree-panel { + width: 100% !important; + max-height: 35vh; + border-bottom: 1px solid var(--border-soft); + } + + .ts-resize-handle-vertical, + .ts-resize-handle-horizontal { + display: none; + } + + .ts-side-panel { + max-height: 40vh; + } + + .ts-banner-panel { + max-height: 25vh; + } + + .ts-chat-panel { + min-height: 260px; + } + + .ts-chat-tabs { + overflow-x: auto; + } + + /* Dialogs */ + + .ts-dialog { + max-height: 90vh; + overflow-y: auto; + } + + .ts-connect-dialog, + .ts-favorites-dialog, + .ts-away-dialog, + .ts-options-dialog { + width: 92vw !important; + } + + .ts-dialog-row { + flex-direction: column; + } + + .ts-dialog-grid { + grid-template-columns: 1fr; + } + + .ts-favorites-body, + .ts-options-body { + flex-direction: column; + height: auto; + } + + .ts-favorites-list-col, + .ts-favorites-profile-col { + width: 100%; + border-right: none; + border-left: none; + border-bottom: 1px solid var(--border-soft); + } + + .ts-options-sidebar { + width: 100%; + flex-direction: row; + flex-wrap: wrap; + border-right: none; + border-bottom: 1px solid var(--border-soft); + } + + .ts-options-columns { + flex-direction: column; + } + + .ts-poke-compose { + flex-wrap: wrap; + max-width: 92vw; + } + + .ts-poke-compose input { + min-width: 160px; + } +} diff --git a/web/src/App.tsx b/web/src/App.tsx index afb813e..15b37c1 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -1,5 +1,19 @@ import { useEffect, useRef, useState } from "react"; import "./App.css"; + +/** Only dismiss on a genuine backdrop click, not a text-selection drag that + * starts inside the dialog and releases over the backdrop. */ +function useBackdropDismiss(onDismiss: () => void) { + const mouseDownOnBackdrop = useRef(false); + return { + onMouseDown: (e: React.MouseEvent) => { + mouseDownOnBackdrop.current = e.target === e.currentTarget; + }, + onClick: (e: React.MouseEvent) => { + if (mouseDownOnBackdrop.current && e.target === e.currentTarget) onDismiss(); + }, + }; +} import { AudioPlayer, MicCapture, @@ -430,8 +444,9 @@ function ConnectDialog({ onCancel: () => void; }) { const t = useT(); + const backdrop = useBackdropDismiss(onCancel); return ( -
+
e.stopPropagation()}>
{t("connect.title")} @@ -590,8 +605,9 @@ function FavoritesDialog({ setSelectedId(null); }; + const backdrop = useBackdropDismiss(onClose); return ( -
+
e.stopPropagation()}>
{t("favorites.title")} @@ -763,8 +779,9 @@ function AwayDialog({ onCancel: () => void; }) { const t = useT(); + const backdrop = useBackdropDismiss(onCancel); return ( -
+
e.stopPropagation()}>
{t("away.dialog.title")} @@ -1302,8 +1319,9 @@ function OptionsDialog({ }) { const t = useT(); const active = OPTIONS_SECTIONS.find((s) => s.id === section) ?? OPTIONS_SECTIONS[0]; + const backdrop = useBackdropDismiss(onClose); return ( -
+
e.stopPropagation()}>
{t("options.title")} @@ -1385,6 +1403,7 @@ function AppInner() { const [pokes, setPokes] = useState([]); const [pokeTarget, setPokeTarget] = useState<{ id: number; name: string } | null>(null); const [pokeMessage, setPokeMessage] = useState(""); + const pokeBackdrop = useBackdropDismiss(() => setPokeTarget(null)); const [activeTab, setActiveTab] = useState("channel"); const [theme, setTheme] = useState<"light" | "dark">(() => window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light" @@ -2519,7 +2538,7 @@ function AppInner() { )} {pokeTarget && ( -
setPokeTarget(null)}> +
e.stopPropagation()}> 👉 {t("poke.title")} {pokeTarget.name}