From 37070c3cb7da626291dde83b525b9f804e21496e Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Tue, 23 Jun 2026 15:05:13 +0200 Subject: [PATCH] feat(ui): drop Telegram fullscreen; own back chevron everywhere; hidden debug panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Finalises the Telegram Mini App navigation work after on-device testing (Pixel 10 / Android 17 + iOS, fresh beta clients): - Remove requestFullscreen entirely. Immersive fullscreen hid Telegram's native header (and its BackButton) and the Android system swipe-back minimised the app; the owner prefers the windowed full-size (expand) presentation, so the app never requests fullscreen on any platform now. - The app's own back chevron (Header, showBack = !!back) drives back-navigation on every platform; the native Telegram BackButton is dropped — it does not render in the windowed Mini App (backVisible=false on iOS and Android), so relying on it lost back navigation (notably none on iOS). - Replace the temporary always-on diagnostic overlay with a hidden debug panel (components/DebugPanel): ten quick taps on the header title open it; it shows a privacy-safe client diagnostic snapshot (app version, locale, online, userId, Telegram chrome / viewport / SDK state — no secrets, no IP) and shares it via the OS share sheet / clipboard; a tap anywhere except Share dismisses it. - Drop the now-dead telegramRequestFullscreen / telegramBackButton / isTelegramAndroid helpers and the iOS-fullscreen unit test. Telegram has no native non-modal notification API (only modal showPopup / showAlert), so in-app toasts stay ours. Docs: UI_DESIGN.md. --- docs/UI_DESIGN.md | 18 ++++---- ui/src/App.svelte | 10 ++-- ui/src/components/DebugPanel.svelte | 71 +++++++++++++++++++++++++++++ ui/src/components/Header.svelte | 19 +++++++- ui/src/lib/app.svelte.ts | 19 ++++++-- ui/src/lib/telegram.test.ts | 39 ---------------- ui/src/lib/telegram.ts | 58 ++--------------------- 7 files changed, 120 insertions(+), 114 deletions(-) create mode 100644 ui/src/components/DebugPanel.svelte diff --git a/docs/UI_DESIGN.md b/docs/UI_DESIGN.md index 81de97a..3ca2fd6 100644 --- a/docs/UI_DESIGN.md +++ b/docs/UI_DESIGN.md @@ -97,14 +97,16 @@ dismisses as soon as the lobby is ready. The pure layout and timing live in `lib which leaks into the Telegram Desktop webview and otherwise fights it) and the Settings theme switcher is hidden; the nav bar takes Telegram's background and `setHeaderColor` / `setBackgroundColor` / `setBottomBarColor` paint Telegram's own chrome to match; the - native header **BackButton** drives back-navigation (the app's chevron is hidden in - Telegram); **HapticFeedback** fires on tile placement / commit / error; on **iOS** the app - enters **immersive fullscreen** on launch (`requestFullscreen`, Bot API 8.0+) like Telegram's - own Mini Apps, while **Android stays windowed** — there fullscreen hides the native header and - its BackButton, and the Android system swipe-back then minimises the app instead of navigating — - and desktop keeps the bot's full-size window; move drafts auto-save, so there is **no - closing-confirmation guard**; **vertical swipes** (swipe-to-minimise) - are disabled so they don't fight tile drag or the board scroll; **external links** (the word-check + app's **own back chevron** (Header) drives back-navigation on every platform — the native + Telegram BackButton is not used, as it does not render reliably in the windowed Mini App; + **HapticFeedback** fires on tile placement / commit / error; the app calls `expand()` for the + bot's full-size (max-height) window but **never `requestFullscreen`** — immersive fullscreen hid + the native header (and its BackButton) and the Android system swipe-back then minimised the app, + so it stays windowed with Telegram's thin native header (close) above the app's own header; move + drafts auto-save, so there is **no closing-confirmation guard**; a hidden **debug panel** (ten + quick taps on the header title) shows and shares a privacy-safe client diagnostic snapshot for + support; **vertical swipes** (swipe-to-minimise) are disabled so they don't fight tile drag or + the board scroll; **external links** (the word-check dictionary lookup, the rules link, operator-reply links) open through `Telegram.WebApp.openLink` so Telegram shows them in its in-app browser instead of the WebView's "open this link?" confirmation a plain `target=_blank` triggers; and a live stream dropped diff --git a/ui/src/App.svelte b/ui/src/App.svelte index 4533918..bba6053 100644 --- a/ui/src/App.svelte +++ b/ui/src/App.svelte @@ -4,11 +4,11 @@ import { app, bootstrap } from './lib/app.svelte'; import { router, type RouteName } from './lib/router.svelte'; import { t } from './lib/i18n/index.svelte'; - import { insideTelegram, telegramChromeDiag } from './lib/telegram'; import Toast from './components/Toast.svelte'; import Splash from './components/Splash.svelte'; import StaleInviteModal from './components/StaleInviteModal.svelte'; import WelcomeRedeemModal from './components/WelcomeRedeemModal.svelte'; + import DebugPanel from './components/DebugPanel.svelte'; import Login from './screens/Login.svelte'; import Lobby from './screens/Lobby.svelte'; import NewGame from './screens/NewGame.svelte'; @@ -125,12 +125,8 @@ {/if} - -{#if app.ready && insideTelegram()} - {#key router.route.name + (router.route.params.id ?? '')} -
{telegramChromeDiag()}
- {/key} +{#if app.debugOpen} + {/if} diff --git a/ui/src/components/Header.svelte b/ui/src/components/Header.svelte index de1d6f4..6579946 100644 --- a/ui/src/components/Header.svelte +++ b/ui/src/components/Header.svelte @@ -2,7 +2,7 @@ import { navigate } from '../lib/router.svelte'; import { connection } from '../lib/connection.svelte'; import { t } from '../lib/i18n/index.svelte'; - import { app } from '../lib/app.svelte'; + import { app, openDebug } from '../lib/app.svelte'; import Spinner from './Spinner.svelte'; import AdBanner from './AdBanner.svelte'; @@ -12,6 +12,19 @@ // and out of Telegram. The native Telegram BackButton is not used: it does not render reliably in // the windowed Mini App (relying on it would lose back navigation there). const showBack = $derived(!!back); + + // Ten quick taps on the title open the hidden debug panel (components/DebugPanel) — a support aid. + let titleTaps = 0; + let lastTitleTap = 0; + function onTitleTap(): void { + const now = Date.now(); + titleTaps = now - lastTitleTap < 400 ? titleTaps + 1 : 1; + lastTitleTap = now; + if (titleTaps >= 10) { + titleTaps = 0; + openDebug(); + } + }