Searching now has three peer modes on /stops: by stop code, by place name,
and by device location.
- StopsView: third tab (data-mode=near) plus its own panel holding the
location button, hint and result area; the button no longer sits in the
toolbar with Search/Reset/Back
- stops.search.ts: setMode handles the near mode, disables the other panels,
hides the full stop list while the ranked results are shown, and skips
filtering in that mode
- stops.nearme.ts: applies the security gate - the tab is revealed only when
window.isSecureContext && navigator.geolocation exist, otherwise it is
hidden and any active near mode falls back to stop-code search
- i18n: stops.modeNear / nearCta / nearHint (th + en, both copies)
Distance is computed from each stop's own coordinates (busstop_list.json)
against the device position, sorted nearest first.
Verified: secure context shows all three tabs and returns a ranked map;
a forced insecure context hides the tab and refuses the mode.
stops.nearme.ts exported a default mount() but PageRuntime only invokes
the default export of stops.init; this module was imported for its side
effects and never called, so the button did nothing at all.
- self-bind on import with a dataset.nearBound guard against double binding
- retry up to ~2s while ATMap finishes loading
- map.ts: re-enable the button after a successful lookup (it stayed
disabled forever, so a second press was impossible)
Verified with geolocation override at 14.5880,100.4530: first press
renders the map plus 8 nearest stops with distances, button re-enables,
second press works, and no duplicated network requests (2 per press).
Previous order was (menu)(theme)(language). Swapped so the row reads
logo ... (theme)(language)(menu) and the hamburger sits flush against the
right padding edge, which is where the thumb menu is expected.
Measured 360/375/414px: brand starts at 14px, menu ends exactly on the
right padding edge, 8px gaps, no horizontal overflow.
On <640px the topbar used flex-wrap: wrap with no spacer, so the brand,
the hamburger and the theme/language buttons all piled up on the left.
- flex-wrap: nowrap at mobile
- .mu-menu gets margin-inline-start: auto and order 1, .mu-topbar-tools order 2
- .mu-brand flex: 1 1 auto with min-width: 0
Measured 360/375/414px: brand starts at 14px, tools end flush at the right
padding edge, 8px gaps, no horizontal overflow. 768/1280px unchanged.
The topbar carried five small buttons in a row (3 theme + 2 language).
Replaced with two single buttons that open their own popover menu:
- ThemeSwitch: single icon button showing the active mode, menu with
light/dark/auto as menuitemradio
- LangSwitch: new component showing the active code (ไทย / EN), menu
keeps the existing [data-i18n-switch] mechanism from i18n.ts
- .mu-topbar-tools wrapper, 8px gap (WCAG 2.5.8), 40px buttons / 44px on touch
- popovers close on select, outside click and Escape (focus returns to button)
Also fixed two bugs found on /stops:
- .mu-btn.outline had no CSS rule, so the browser painted a light grey
background that ignored the dark theme
- deleted the unused StopSearch component which still carried the old
number pad and its delete key, plus the now-unused stops.padDelete key
Verified at 375px: no horizontal overflow, buttons 40x40 and 59x40,
8px gap; menus open/close correctly in both themes.
Share button was themed only in pages/home.css, so /stops, /routes and
/check rendered an unstyled button. Moved to _shared.css and rebuilt as a
ghost variant of .mu-btn:
- radius 12px -> var(--radius) 8px, min-height 44px (48px on touch)
- focus ring #2b2f42 (near-black) -> var(--c-focus)
- LINE link green -> brand purple (DESIGN.md is single-accent)
- hover/active/transition states added
Global scale cleanup (DESIGN.md allows 4px/8px radii only):
- 16 distinct border-radius values -> var(--radius-sm) / var(--radius) / var(--radius-pill)
- 39 distinct font-sizes -> 13-step scale
- outline-offset 1px/2px/3px -> 2px everywhere
- radius and type scale documented in DESIGN.md as enforced tokens
Verified across 4 pages x 2 themes: identical 44x158 button, radius 8px,
contrast 5.80 light / 7.37 dark, no horizontal overflow.
window.AtShare was assigned the module namespace object from
import('./share'), which is frozen. share.init.ts then threw
'Cannot add property refresh, object is not extensible', aborting the
click handler so the share button did nothing on every page.
- runtime.ts: spread the namespace into a plain object
- share.init.ts: expose the updater as window.AtShareRefresh
- home.init.ts / stop.init.ts: call AtShareRefresh
- remove the temporary probe marker from StopView
Verified: /?s=at_main_terminal, /stops/:code?q=, /routes/:id, /check/:id
all produce short links and restore state on load (TH and EN).
- 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
The five code cells are now the only way to enter a stop code. The numpad
was redundant on touch devices (the cells use inputMode=numeric, so the
system keyboard already switches to digits) and it crowded the 375px
layout.
- StopsView.tsx: drop the .mu-numpad markup.
- stops.search.ts: drop initNumpad(), its call and the pad show/hide toggle.
- stops.css: drop all .mu-numpad rules.
tsc clean, npm run build passes.
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.
Verified each path against every .ts/.tsx/.css under src plus every JSON
under public. Kept all dynamic lookup directories (routes/qrcode/stations/
stops/partners/icons) because the ported modules resolve those per id and
try several extensions at runtime.
Deleted (nothing references them):
- image/extras/boat.jpeg, boat-market2transta.jpg
- image/landmarks/*.{png,jpg} (stations.json has no landmarks[] entries)
- image/icons/minibus-256x256.ico (Next serves app/icon.png instead)
- image/partners/_original/ (local backup of the tcl999 source photo)
public/image: 39.8 MB -> 30.1 MB. npm run build still prerenders all routes.
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.