sync from mock: motion, privacy-first search stats, auto-update UX

- frontend/src/lib/ui/motion.ts + components/MotionBoot.tsx: page-enter and
  scroll reveal per pathname change (ported from mock motion.js); IntersectionObserver
  plus sweep fallback for jump-scroll/hidden tabs, maps never transformed
- frontend/src/lib/ui/analytics.ts: cookie-less local-first search analytics
  (localStorage at_stats_v1, DNT/GPC + opt-out, term sanitiser, 900ms debounce,
  caps 300 terms / 200 views / 120 days); optional Umami endpoint via AT_ANALYTICS
- /stats page (StatsView + styles/pages/stats.css): KPIs, 14-day chart, top terms,
  top route/stop pages, no-result terms, JSON export, clear, opt-out
- hooks: stops search apply(), stop detail route filter
- remove footer visitor counter (lib/ui/visitors.ts, .mu-visitor/.mu-vreset, i18n keys)
- remove floating install-app button; PwaBoot keeps SW + guarded version toast
  (sessionStorage guard, silent reload when tab hidden)
- i18n th/en: nav.stats, update.applying, stats.* (public + src/data locales)
- version.json + sw VERSION -> 2026.10.24.3; docs/UI-PORT.md section for this round
This commit is contained in:
Bkk1234 committed 2026-11-04 00:53:37 +07:00
1 parent c0b70ff845
commit 4b5a4d33d3
22 files changed
+1473 -453

No files matched your search

+41 -3
View File
@@ -131,10 +131,10 @@
"stops.noOffset": "No travel time from the first stop yet",
"stops.noBusLine": "No bus line listed",
"stops.modeCode": "Search by stop code",
"stops.modeNear": "Near me",
"stops.modeNear": "Near me",
"stops.nearCta": "Use my location",
"stops.nearHint": "We ask your device for a location, then rank stops by real distance from their coordinates.",
"stops.modePlace": "Search by place name",
"stops.modePlace": "Search by place name",
"stops.codePh": "3+000",
"stops.codeHint": "Type 4 digits and the + sign is added automatically (e.g. 3000 → 3+000)",
"stops.codeHintBox": "Type digits in the boxes — empty boxes are filled with 0 automatically. For 4-digit codes such as 8+591, enter 08+591",
@@ -267,5 +267,43 @@
"check.noMoreToday": "No departures left today",
"check.stopsCount": "stops",
"check.toStopDetail": "View stop detail",
"common.routes": "routes"
"common.routes": "routes",
"nav.stats": "Stats",
"update.applying": "New version — updating…",
"stats.title": "Search statistics on this device",
"stats.lead": "Only counts and search terms are kept — no cookies, no user id, no IP, and nothing leaves this device",
"stats.kpi.views": "Page views",
"stats.kpi.searches": "Searches",
"stats.kpi.terms": "Unique terms",
"stats.kpi.noResult": "No results",
"stats.chart.title": "Last 14 days",
"stats.chart.lead": "Solid bar = page views · light bar = searches",
"stats.terms.title": "Top search terms",
"stats.terms.lead": "Terms are sanitised — emails, phone numbers and long digit runs are stripped before saving",
"stats.terms.empty": "No searches on this device yet — try the stop search page, then come back",
"stats.views.title": "Most opened pages",
"stats.views.lead": "Counts route and stop detail pages only (not tied to any user)",
"stats.views.empty": "No data yet — open a route or stop detail once",
"stats.views.stopPrefix": "Stop {code}",
"stats.views.routePrefix": "Route {n}",
"stats.noresult.title": "Searched, nothing found",
"stats.noresult.lead": "A signal that data is missing — these terms should exist if they are real routes",
"stats.privacy.title": "Privacy",
"stats.privacy.collect": "Stored: page-view counts · sanitised search terms · no-result counts · last-used time",
"stats.privacy.reject": "Not stored: IP · User-Agent · location · cookies · device id · cross-site history",
"stats.privacy.local": "Data lives in this browser's localStorage only — clear it anytime",
"stats.privacy.optoutTitle": "Turn off stats on this device",
"stats.privacy.optoutLead": "Switching this on stops recording immediately (existing numbers stay visible). Do Not Track / GPC are respected anyway.",
"stats.privacy.off": "Stats turned off — nothing new is recorded",
"stats.privacy.on": "Stats turned on",
"stats.btn.export": "Download data (JSON)",
"stats.btn.clear": "Clear data on this device",
"stats.clear.confirm": "Clear all stats on this device? This cannot be undone.",
"stats.clear.done": "Data cleared",
"stats.export.done": "File downloaded",
"stats.since": "Collecting since",
"stats.col.term": "Term",
"stats.col.count": "Hits",
"stats.col.last": "Last",
"stats.col.target": "Page"
}
+41 -3
View File
@@ -131,10 +131,10 @@
"stops.noOffset": "ยังไม่ระบุเวลาเดินทางจากจุดแรก",
"stops.noBusLine": "ยังไม่ระบุสายรถ",
"stops.modeCode": "ค้นหาด้วยรหัสป้าย",
"stops.modeNear": "ป้ายใกล้ฉัน",
"stops.modeNear": "ป้ายใกล้ฉัน",
"stops.nearCta": "ขอพิกัดและหาป้ายใกล้ฉัน",
"stops.nearHint": "ระบบจะขอตำแหน่งจากเครื่อง แล้วคำนวณระยะจากพิกัดป้าย/ศาลารถ เรียงจากใกล้ไปไกล",
"stops.modePlace": "ค้นหาด้วยชื่อสถานที่",
"stops.modePlace": "ค้นหาด้วยชื่อสถานที่",
"stops.codePh": "3+000",
"stops.codeHint": "พิมพ์ตัวเลข 4 หลัก ระบบจะเติมเครื่องหมาย + ให้อัตโนมัติ (เช่น 3000 → 3+000)",
"stops.codeHintBox": "พิมพ์ตัวเลขในช่อง ระบบจะเติม 0 ให้อัตโนมัติเมื่อเว้นว่าง และถ้าเจอรหัส 4 หลัก เช่น 8+591 ให้กรอก 08+591",
@@ -267,5 +267,43 @@
"check.noMoreToday": "ไม่มีรถเหลือในวันนี้แล้ว",
"check.stopsCount": "จุดจอด",
"check.toStopDetail": "ไปหน้ารายละเอียดจุดจอด",
"common.routes": "เส้นทาง"
"common.routes": "เส้นทาง",
"nav.stats": "สถิติ",
"update.applying": "มีเวอร์ชันใหม่ — กำลังอัปเดต…",
"stats.title": "สถิติการค้นหาในเครื่องนี้",
"stats.lead": "เก็บเฉพาะจำนวนครั้งและคำที่ค้น — ไม่มีคุกกี้ ไม่มีรหัสผู้ใช้ ไม่เก็บ IP และไม่ส่งออกนอกเครื่อง",
"stats.kpi.views": "ครั้งที่เปิดหน้า",
"stats.kpi.searches": "ครั้งที่ค้นหา",
"stats.kpi.terms": "คำค้นต่างกัน",
"stats.kpi.noResult": "ค้นแล้วไม่พบ",
"stats.chart.title": "14 วันล่าสุด",
"stats.chart.lead": "แท่งเข้ม = เปิดหน้า · แท่งอ่อน = ค้นหา",
"stats.terms.title": "คำที่ค้นมากที่สุด",
"stats.terms.lead": "คำถูกทำให้ปลอดภัยแล้ว — ตัดอีเมล เบอร์โทร และเลขยาวออกก่อนบันทึก",
"stats.terms.empty": "ยังไม่มีคำค้นในเครื่องนี้ — ลองค้นหาป้ายที่หน้า “ป้ายหยุดรถ” แล้วกลับมาดู",
"stats.views.title": "หน้าที่ถูกเปิดบ่อย",
"stats.views.lead": "นับเฉพาะรายละเอียดสายรถและรายละเอียดป้าย (ไม่ผูกกับผู้ใช้)",
"stats.views.empty": "ยังไม่มีข้อมูล — เปิดรายละเอียดสายหรือป้ายสักครั้ง",
"stats.views.stopPrefix": "ป้าย {code}",
"stats.views.routePrefix": "สาย {n}",
"stats.noresult.title": "ค้นแล้วไม่พบ",
"stats.noresult.lead": "สัญญาณว่าข้อมูลยังขาด — คำเหล่านี้ควรมีในระบบถ้าเป็นเส้นทางจริง",
"stats.privacy.title": "ความเป็นส่วนตัว",
"stats.privacy.collect": "เก็บ: จำนวนเปิดหน้า · คำที่ค้น (ตัดข้อมูลส่วนตัวออก) · จำนวนครั้งที่ค้นไม่พบ · เวลาล่าสุด",
"stats.privacy.reject": "ไม่เก็บ: IP · User-Agent · ตำแหน่ง · คุกกี้ · รหัสเครื่อง · ประวัติข้ามเว็บ",
"stats.privacy.local": "ข้อมูลอยู่ใน localStorage ของเบราว์เซอร์นี้เท่านั้น — ล้างได้ทุกเมื่อ",
"stats.privacy.optoutTitle": "ปิดการเก็บสถิติในเครื่องนี้",
"stats.privacy.optoutLead": "เปิดสวิตช์นี้ = หยุดบันทึกทันที (ยังดูตัวเลขเดิมได้) · ระบบเคารพ Do Not Track / GPC อยู่แล้ว",
"stats.privacy.off": "ปิดการเก็บสถิติแล้ว — ไม่มีการบันทึกใหม่",
"stats.privacy.on": "เปิดการเก็บสถิติแล้ว",
"stats.btn.export": "ดาวน์โหลดข้อมูล (JSON)",
"stats.btn.clear": "ล้างข้อมูลในเครื่อง",
"stats.clear.confirm": "ล้างสถิติทั้งหมดในเครื่องนี้? การลบย้อนกลับไม่ได้",
"stats.clear.done": "ล้างข้อมูลเรียบร้อย",
"stats.export.done": "ดาวน์โหลดไฟล์แล้ว",
"stats.since": "เริ่มเก็บเมื่อ",
"stats.col.term": "คำค้น",
"stats.col.count": "ครั้ง",
"stats.col.last": "ล่าสุด",
"stats.col.target": "หน้า"
}
+1 -1
View File
@@ -15,7 +15,7 @@
- SW ใหม่ → skipWaiting + clients.claim + แจ้งหน้าเว็บ
============================================================ */
const VERSION = "2026.10.24.2"; /* bump เมื่อแก้ UI เพื่อบังคับให้ cache เก่าถูกทิ้ง */
const VERSION = "2026.10.24.3"; /* bump เมื่อแก้ UI เพื่อบังคับให้ cache เก่าถูกทิ้ง */
const CACHE = `atroute-${VERSION}`;
const OFFLINE_URL = "/offline.html";
const VERSION_URL = "/version.json";
+2 -2
View File
@@ -1,6 +1,6 @@
{
"app": "Atroute",
"version": "2026.10.24.2",
"builtAt": "2026-10-24T00:33:20",
"version": "2026.10.24.3",
"builtAt": "2026-11-04T00:51:02",
"pwa": true
}