- ThemeSwitch: auto now follows the device (prefers-color-scheme) with a live
matchMedia listener instead of a 06:00-18:00 clock rule; labels become
'ตามอุปกรณ์ / Device'; auto icon is a monitor
- layout.tsx pre-paint script resolved with matchMedia (no theme flash)
- i18n: default language is Thai (no navigator guess) in lib/ui/i18n.ts;
new 'i18nready' event so LangSwitch syncs its label after runtime boot
(button previously stuck on ไทย when the page loaded in English)
- VERSION 2026.10.24.5
The service worker version had never moved past 1.0.0 and nothing on the page
said which build was loaded, so an old cached shell looked identical to a
fresh one.
- public/version.json: app, version, builtAt, pwa
- sw.js VERSION -> 2026.10.24.1 (new cache name, old caches dropped on activate)
- next.config: sw.js and version.json are served no-cache, no-store, plus
Service-Worker-Allowed: / ; ui-manifest.json must-revalidate
- layout: <html data-app-version> read from version.json at build time
- PwaBoot: paints the version into the footer badge, polls /version.json
(1.5s then every 5 min) and reloads once when it differs; guards against
reload loops
- footer shows v2026.10.24.1 in mono next to the copyright
Verified: sw.js, /version.json and <html data-app-version> all report
2026.10.24.1, the footer badge shows it, and /stops renders the three search
tabs with the near-me panel in its own tab.
- src/lib/site.ts: single source for site name/url/description (rename via env only)
- src/app/robots.ts: allow all, disallow /api /files, explicit Googlebot/Bingbot/DuckDuckBot/Bravebot/Applebot
- src/app/sitemap.ts: static pages + routes/check/stops from backend, falls back to static when API is down
- src/components/JsonLd.tsx: WebSite + Organization + SearchAction, BreadcrumbList, BusStop, Service
- layout.tsx: metadataBase, canonical, keywords, robots, openGraph, twitter
- generateMetadata for /stops/[code], /routes/[routeId], /check/[routeId]
- canonical + description on /stops /routes /blog /about /credits
- public/og-image.png 1200x630
Android (Samsung S23, One UI 6) refuses 'Install app' / standalone mode
when the origin is not secure or the app has no service worker. The ported
Next.js app shipped neither: only a manifest existed, and no sw.js at all.
- public/sw.js: navigation network-first with an offline fallback,
cache-first for static assets, /api and /files bypassed, versioned
cache with skipWaiting + clients.claim.
- public/offline.html: offline shell.
- src/components/PwaBoot.tsx: registers the worker, wires
beforeinstallprompt into an in-app install button, and shows a
share-sheet hint on iOS/Samsung Internet where the event never fires.
- ui-manifest.json: add id, display_override, prefer_related_applications,
launch_handler, handle_links, a maskable icon for Android 14 and
screenshots for the install preview.
- layout.tsx: viewport-fit=cover, interactive-widget, maximumScale 5
(never user-scalable=no), appleWebApp metadata, format detection off,
and drop manually duplicated meta tags that Next already emits.
Verified: manifest passes 8/8 installability checks, sw.js and offline.html
serve with correct content types, tsc clean, npm run build passes.
The merge of origin/main left 13 conflict markers across 9 files under
frontend/src/app, so 'next build' failed with 21 parse errors and the
Docker frontend image never built.
Resolution:
- Keep the HEAD side (views + PageRuntime shell) for all 8 route pages.
- Rebuild layout.tsx by hand: it mixed both sides outside the conflict
blocks (Viewport/headers/langFromCookie were only imported on the
merged-in side). Kept IconSprite/SiteHeader/SiteFooter/SiteBoot,
the mock CSS order (shared -> map -> shell -> responsive), the
vendored K2D and Leaflet links, and set lang="th" because i18n.ts
sets document.documentElement.lang at runtime.
Verified: tsc --noEmit clean, npm run build compiles and prerenders
all 12 static + 5 dynamic routes.