Commit Graph
21 Commits
Author SHA1 Message Date
Bkk1234 7ac7bf5878 Add 3-mode theme system (light / dark / auto by device clock) and tokenize colors
- theme.css: semantic tokens (bg, surface, ink, border, brand, tints, status, glass)
- ThemeSwitch.tsx: radiogroup with light/dark/auto, persisted in localStorage
- auto mode follows device time (06:00-18:00 light), rechecks every minute and on visibilitychange
- inline pre-paint script in layout.tsx prevents flash of wrong theme
- remapped ~250 hardcoded hex declarations across styles to tokens
- fixed --c-ink-2 contrast 4.25 -> 5.36 (WCAG AA) in light mode
- 0 contrast failures below 4.5:1 across 8 pages in both themes
- DESIGN.md: documented theme system
2026-10-23 23:01:06 +07:00
Bkk1234 4c444b3d8d Remove the on-screen numpad from the bus stop code search
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.
2026-10-23 22:49:13 +07:00
Bkk1234 092f551b7d Add service worker and harden the web app manifest for Android 14+ / iOS 17+
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.
2026-10-23 22:40:58 +07:00
Bkk1234 3519f92669 Remove images that no view or data file references
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.
2026-10-23 18:19:07 +07:00
Bkk1234 3b474b1127 Resolve merge conflicts: keep the mock-ported view architecture
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.
2026-10-23 18:10:42 +07:00
Bkk1234 9519fef02d Merge branch 'main' of http://103.107.52.82:3004/at-transit/web-at-transit 2026-10-23 17:52:56 +07:00
Bkk1234 b8ed110459 support English 2026-10-23 17:43:11 +07:00
itmeadmin 138a3d15d8 พอร์ต UI จาก web-at-transit-mock เข้า Next.js + data sync เข้า Postgres/SeaweedFS
- 8 หน้า (home/stops/routes/stop/check/blog/about/credits) แปลง partials → React component ตรง mock
- ตรรกะพอร์ตเป็น src/lib/ui/*.ts (mount()) + runtime/PageRuntime
- CSS: base + pages/*.css import ต่อ route (คงลำดับ cascade ของ mock)
- asset/content: public/{image,resource/data,content,locales,vendor}
- แก้ path รูปไทล์พาร์ทเนอร์ (.image → /image) + fallback absolute
- ลบ UI เดิมที่ไม่ตรง mock (expanded/stops details/old components/globals.css)
- script/sync_data_to_postgres.mjs + sync_images_to_storage.mjs (dry-run/--apply, backup)
- docs/UI-PORT.md + DESIGN.md + README
2026-10-23 15:50:00 +07:00
phattaranun.a 1526c5b6d0 feat(ui): full i18n (th/en) + highway stop search + real km list
i18n:
- LangProvider (client context) + cookie/lang localStorage sync
- locales/th.json + en.json จาก design (269 keys)
- แปล header/nav/footer/home/route/stop/check ผ่าน t()
- server pages อ่าน cookie lang (SSR แปลตรง) + client context

Stop search (หน้า /stops):
- code search 5 หลัก (kilometer '36+020' → pad5 '36020') + numpad
- place search (ชื่อสถานที่) + suggest
- near-me (geolocation → ป้ายทางหลวงใกล้สุด 8 อัน, haversine)
- data: busstop_list.json (154 ป้ายทางหลวง)

Route detail: km list ใช้ระยะจริงจาก stop-km.json (แทน stop_sequence)

Note: 'nearby ใกล้เคียงป้าย' ไม่ทำ — stations.json ไม่มี landmarks data
2026-10-10 23:17:24 +07:00
phattaranun.a 0c3936df69 feat(ui): port route/stop/check pages to match mock + tidy layout
Route detail:
- breadcrumb + route-select dropdown (เปลี่ยนสายในหน้าเดียว)
- vehicle card (รถ + caption + QR + ติดต่อโทร/LINE รวมการ์ดเดียว)
- summary เพิ่ม 'รอบถัดไป' (คำนวณจาก schedules)
- km list (จุดจอดตามเส้นทาง กม.)

Stop detail:
- stop-hero (title/meta pills/metric grid 4 + live clock เที่ยวถัดไป)
- route expander (สายที่ผ่าน + เวลาต่อสาย) + map aside + chips
- breadcrumb

Stop list:
- search form จริง (server-side ?q=) + breadcrumb
- fix TYPE_LABEL/TONE/ICON ให้ตรง station_type จริง (main_terminal/local_stop/market/private_stop)

Check page (ใหม่ /check): เช็กเวลาเดินรถ + selector + 4 สถิติ + ตารางทุกจุดจอด
Header CTA -> /check

Assets: caption<id>.json + qrcode/* จาก mock (lib/captions.ts)
2026-10-10 20:08:42 +07:00
phattaranun.a b022a85178 feat(ui): province→station selector, filter, share, visitor, lang, nav+pages
- HomeClient (client): จังหวัด→สถานี cascade selector (default อ่างทอง),
  กรองเส้นทางตามจังหวัด/สถานี, โชว์โซนว่างเป็น N/A card, ปุ่มแชร์ลิงก์สั้น
- page.tsx: fetch provinces/stops/routeStops + searchParams (p/s) for share link
- Header: nav 6 เมนู + สลับภาษา ไทย/EN (localStorage)
- Footer: ตัวนับผู้เข้าชม (visitsSummary) + เมนู 6 รายการ
- หน้าใหม่ /about /blog /credits (เนื้อหา+รูปจาก mock about-data/blog-data)
- globals.css: selector/share/empty-card/about/blog/credit styles
2026-10-10 19:38:32 +07:00
phattaranun.a 490e6c7d71 feat(ui): sync data from mock + port legend/next-trip/route map
Data:
- sync DB (routes/stations/route_stops/route_provinces/schedules) from
  web-at-transit-mock/resource/data: route 999 -> bangkok group, 1011 name,
  15 stations w/ coordinates, 33 schedules; drop stale stations
- add geojson-web route polylines (frontend/public/data) + lib/geojson.ts;
  route detail now draws the real route path

UI:
- home: legend (คำอธิบายสีการ์ด) + next-trip chip (เที่ยวถัดไป HH:MM /
  ดูตาราง / ยังไม่มีตาราง) computed from schedules
- route detail: drop the debug 'เมตาดาตา' JSON dump + empty ภาพประกอบ
- globals.css: legend styles
2026-10-10 19:00:54 +07:00
phattaranun.a 37711a0a8a fix(backend): cap cargo parallelism to 1 for the VPS build
CARGO_BUILD_JOBS=2 on the 1-vCPU VPS spiked load (~30) and destabilised
the swarm during deploy (health checks timed out, Dokploy restarted and
killed the build). Build with a single job; combined with the 4 GB
swapfile added on the host this keeps the build from starving services.
2026-10-10 17:14:38 +07:00
phattaranun.a 944bb52827 fix(backend): bump builder image rust:1.88 -> 1.90
Deploy failed on the VPS:
  error: rustc 1.88.0 is not supported by the following packages:
    [email protected].0 requires rustc 1.89.0

No Cargo.lock is committed, so cargo resolves the newest crates on every
build; the transitive MSRV has moved past the 1.88 builder. Bump to
rust:1.90-bookworm (>= uuid 1.28's required 1.89).
2026-10-10 16:51:47 +07:00
phattaranun.a 9ba7113017 feat(ui): port design UI + static assets from web-at-transit-mock
- copy .image assets to frontend/public/images (logo, hero map,
  partner logos, route/stop photos, qrcode, landmarks)
- add K2D fonts (offline local woff2) in frontend/public/fonts
- add Lucide icon components (Icons.tsx); replace all emoji icons
- add lib/images.ts static asset resolver (route/stop/partner/logo)
- header/footer/home: minibus logo, hero map bg, partner marquee
- route detail: design car/hero photo; stop detail: design stop photo
- .gitignore: un-ignore frontend/public/images + app icons so the
  frontend Docker build ships the assets
2026-10-10 16:32:03 +07:00
phattaranun.a 24187fc3b7 fix: switch base image to debian:12-slim and install ca-certificates 1.0.0 2026-05-25 02:22:02 +07:00
phattaranun.a ee05890661 feat: implement file retrieval API endpoint 2026-05-25 01:21:11 +07:00
phattaranun.a ae4c665b28 feat: enhance reqwest client configuration with pool idle timeout and TCP keepalive 2026-05-25 01:12:49 +07:00
phattaranun.a 186e56e125 fix: update env_file reference in docker-compose.yml 2026-05-25 01:00:38 +07:00
phattaranun.a 3238747462 refactor: remove unused storage environment variables and update file destination in rewrites 2026-05-25 00:56:05 +07:00
phattaranun.a 2a1854ab08 first commit 2026-05-24 22:55:17 +07:00