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:
1 parent
c0b70ff845
commit
4b5a4d33d3
22 files changed
+1473
-453
No files matched your search
@@ -720,3 +720,99 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
|
||||
color: var(--c-ink-2);
|
||||
opacity: .85;
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
Motion (ported from web-at-transit-mock/ui/motion.js)
|
||||
---------------------------------------------------------
|
||||
โทเคนเดียวทั้งเว็บ: --mu-ease (deceleration) · 420ms เข้าหน้า
|
||||
520ms reveal · 45ms/ชิ้น · แถบโหลดออกเร็วกว่าเข้า
|
||||
========================================================= */
|
||||
:root { --mu-ease: cubic-bezier(.22, .61, .36, 1); }
|
||||
|
||||
/* ---------- แถบโหลดบาง ๆ บนสุด (ตอนเปลี่ยนหน้า) ---------- */
|
||||
.mu-loadbar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 3px;
|
||||
z-index: 1200;
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
transition: opacity .25s ease;
|
||||
}
|
||||
.mu-loadbar.is-on { opacity: 1; }
|
||||
.mu-loadbar-fill {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
transform: scaleX(0);
|
||||
transform-origin: 0 50%;
|
||||
border-radius: 0 2px 2px 0;
|
||||
background: linear-gradient(90deg, var(--c-brand), #b694f6);
|
||||
box-shadow: 0 0 8px color-mix(in srgb, var(--c-brand) 45%, transparent);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
#view.mu-view-in { animation: muViewIn .42s var(--mu-ease) both; }
|
||||
@keyframes muViewIn {
|
||||
from { opacity: 0; transform: translate3d(0, 10px, 0); }
|
||||
to { opacity: 1; transform: none; }
|
||||
}
|
||||
|
||||
.mu-reveal {
|
||||
opacity: 0;
|
||||
transform: translate3d(0, 18px, 0);
|
||||
transition: opacity .52s var(--mu-ease), transform .52s var(--mu-ease);
|
||||
transition-delay: var(--mu-d, 0ms);
|
||||
}
|
||||
.mu-reveal.is-in { opacity: 1; transform: none; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
#view.mu-view-in { animation: none; }
|
||||
.mu-reveal { opacity: 1; transform: none; transition: none; }
|
||||
.mu-loadbar { display: none; }
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
Toast แจ้งอัปเดตเวอร์ชัน (สร้างจาก PwaBoot)
|
||||
========================================================= */
|
||||
.mu-update-toast {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: calc(20px + env(safe-area-inset-bottom, 0px));
|
||||
z-index: 1300;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
max-width: calc(100vw - 32px);
|
||||
padding: 10px 16px;
|
||||
border-radius: 999px;
|
||||
background: var(--c-ink);
|
||||
color: var(--c-surface);
|
||||
font-size: .82rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.35;
|
||||
box-shadow: 0 10px 24px var(--c-shadow);
|
||||
transform: translate(-50%, 12px);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity .25s ease, transform .25s ease;
|
||||
}
|
||||
.mu-update-toast.is-in { opacity: 1; transform: translate(-50%, 0); }
|
||||
.mu-update-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: #b694f6;
|
||||
flex: none;
|
||||
animation: muUpdatePulse 1.1s ease-in-out infinite;
|
||||
}
|
||||
@keyframes muUpdatePulse {
|
||||
0%, 100% { opacity: .35; transform: scale(.85); }
|
||||
50% { opacity: 1; transform: scale(1); }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.mu-update-toast { transition: none; }
|
||||
.mu-update-dot { animation: none; }
|
||||
}
|
||||
Reference in new issue
Block a user