Compare commits

..
32 Commits
Author SHA1 Message Date
Bkk1234 327f63e63a chore: untrack frontend/tsconfig.tsbuildinfo (Next build cache) 2026-11-20 08:47:13 +07:00
Bkk1234 abc8721f4b footer: contact email [email protected]
Replaces [email protected] in SiteFooter (mailto + label) · VERSION
2026.10.24.9
2026-11-04 22:00:49 +07:00
Bkk1234 757920585e affiliates: add thpostmart + pantip mall tile images
Copied from web-at-transit-mock/.image/partners (identical md5). *.png is
git-ignored globally, so they are added with -f like the other partner tiles
already tracked here.
2026-11-04 21:36:34 +07:00
Bkk1234 c879cb1010 affiliates: sync with mock (thpostmart + pantip mall)
The served copy (frontend/public/resource/data/affiliates.json) was missing the
last two partners, so the footer marquee had 8 tiles instead of 10. Copied the
mock file byte-for-byte; served JSON now diffs clean against
web-at-transit-mock/resource/data/affiliates.json.

Tile images live under the git-ignored public/image tree and were copied to the
server separately · marquee 10 tiles, 0 broken images · VERSION 2026.10.24.8
2026-11-04 21:35:29 +07:00
Bkk1234 0aea027fe2 dark: make dropdowns readable (select options + pop menus)
- theme.css: colour-scheme per theme for select/input/textarea and explicit
  option/optgroup colours (native popup was rendering light text on white in
  dark mode); :checked uses the purple tint
- _shared.css: token fallbacks on .mu-pop-* so the theme/language menus stay
  readable if tokens fail to load
- VERSION 2026.10.24.7
2026-11-04 02:24:36 +07:00
Bkk1234 347ab56546 release: bump to 2026.10.24.6 (check-page share gutter fix) 2026-11-04 02:08:17 +07:00
Bkk1234 187da921f1 check page: align share button with the page gutter
The share row sat outside .mu-container, so its right edge was 15px from the
viewport while routes/stops pages sit at 43px. Wrapped it in .mu-container —
measured rightGap 43 on /check, same as /routes/:id and /stops/:code.
2026-11-04 02:05:50 +07:00
Bkk1234 29b126b188 theme & language: device-following auto theme, Thai default, dropdown sync
- 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
2026-11-04 01:17:39 +07:00
Bkk1234 4b5a4d33d3 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
2026-11-04 00:53:37 +07:00
Bkk1234 c0b70ff845 migrate revised about/blog content from the mock
Copied the five edited content files from
web-at-transit-mock/ui/partials/{about-data,blog-data} into
public/content/{about-data,blog-data}; byte-identical (sha256 verified).

Files: about-data text2/text3/text4, blog-data text5/text7.
The Next port reads /content/about-data/ and /content/blog-data/ at runtime,
so no code change was needed.

Verified in the browser at /about and /blog/5 in Thai and English - the new
copy renders and matches the mock's body text exactly.
2026-10-24 13:51:11 +07:00
Bkk1234 50a7647f89 add themes 2026-10-24 01:00:37 +07:00
Bkk1234 c1cb69b35a sync with web-at-transit-mock: import the 85 locale keys it already had
The mock carried aria.* and other keys the Next port never received, so
Thai/English coverage was 269 keys here against 354 there. Imported all
missing keys from the mock; both locales now match key for key.

Placeholder numbering and aria labels now come from the same source as the
mock.
2026-10-24 00:53:13 +07:00
Bkk1234 55fbd397fc stops: white search panel, drop the search button, purple reset
- .mu-toolbar background: purple gradient -> var(--c-surface) white
- removed #stops-search-btn (filtering already runs live while typing; the
  existing JS guarded on the element existing, so nothing else changes)
- #stops-reset-btn ghost -> primary so it renders in brand purple

Verified on both ports at 1280px light theme: toolbar rgb(255,255,255),
no search button, reset button has the purple gradient, back stays ghost.
2026-10-24 00:46:31 +07:00
Bkk1234 a9847b478c stops: white hero panel with a dark border
.mu-hero-panel used a purple gradient with a light border. Now a plain white
surface with a 1px --c-ink border (which resolves to #1f2a44 in light mode and
to the light ink in dark mode so the outline stays visible).

Matches the mock, which uses #ffffff / #1f2a44.

Measured: light rgb(255,255,255) bg + rgb(31,42,68) border on both ports;
dark keeps a readable outline.
2026-10-24 00:43:48 +07:00
Bkk1234 1b67be36ee stops: fix broken [hidden] rule - each tab shows only its own panel
Root cause of 'the version is new but the old bug is back'. When the on-screen
numpad CSS was removed earlier, a regex dropped the rule body of
'.mu-search-mode[hidden] { display: none; }' but left the selector. CSS then
parsed the following declarations as belonging to that selector:

  .mu-search-mode[hidden],
  .mu-search-field { display: flex; ... }

so every mode panel rendered as flex and none of them could be hidden. The
toolbar measured 341px against the mock's 245px on /stops.

Restored the rule body and added '.mu-stop-grid[hidden] { display:none }'
(grid was overriding hidden too, in both repos).

Measured side by side with :8090/ui/#/stops - code/place/near each show only
their own panel, the stop list hides on the near tab, toolbar height matches
within 2px across all four states.
2026-10-24 00:42:02 +07:00
Bkk1234 18f7a6e34b Serve HTML with no-store so a plain reload picks up a new deploy
Root cause of 'the change never appears': pages are statically prerendered,
so Next replied with Cache-Control: s-maxage=31536000. The browser kept the
old HTML for up to a year, which is why editing sw.js and the footer version
changed nothing for an existing visitor.

next.config now adds, for any request whose Accept includes text/html:
  Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate
Static assets are untouched (hashed files under _next/static keep their
immutable caching).

Bumped version.json and the SW VERSION to 2026.10.24.2.

Verified with curl (Accept: text/html) that /, /stops, /routes, /about and
/credits all return no-store, while images still return public, max-age=0;
and in the browser an ordinary reload returns the three-tab /stops page with
the v2026.10.24.2 footer badge.
2026-10-24 00:34:51 +07:00
Bkk1234 0cf391afba PWA: publish an app version so stale shells are detectable
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.
2026-10-24 00:27:23 +07:00
Bkk1234 7652ddaae5 stops: move the near-me result panel inside its own tab panel
The result container had been left outside #stops-near-wrap and an earlier
selout removed the wrong copy, so on /stops the map and ranked stops were
rendered at the bottom of the page instead of inside the third tab, unlike
the mock at :8090/ui/#/stops.

Now the DOM matches the mock exactly: three tabs, three panels, the location
button and its result inside the near panel, and only Search/Clear/Back in
the toolbar.

Compared side by side against :8090/ui/#/stops - tab order, panel visibility,
active state, list visibility on the near tab, geolocation result (map plus
8 ranked stops), button re-enable and repeat press all identical.
2026-10-24 00:20:12 +07:00
Bkk1234 f754cffe58 stops: fit three search tabs on narrow screens, bump SW cache version
The third tab made the Thai labels wrap on 375px. The tab bar now stretches
its children so all three share the same height, uses centred two-line labels
with a 56px minimum, and keeps zero horizontal overflow at 360/375/414px.

sw.js VERSION 1.0.0 -> 1.0.1 so browsers drop the cached shell and pick up
the three-tab markup without a manual cache clear.
2026-10-24 00:14:32 +07:00
Bkk1234 8eb101c5f1 Promote 'near me' to the third search tab, gated on secure context
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.
2026-10-24 00:09:04 +07:00
Bkk1234 e6cef15dc8 Fix 'stops near me' button: it was dead code
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).
2026-10-24 00:03:05 +07:00
Bkk1234 70cc81b923 Put the hamburger at the far right of the mobile topbar
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.
2026-10-23 23:49:51 +07:00
Bkk1234 937336f4cc Fix mobile topbar alignment: logo left, menu and tools right
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.
2026-10-23 23:43:01 +07:00
Bkk1234 cb4905a12d Declutter navbar: one button per tool (theme, language)
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.
2026-10-23 23:37:44 +07:00
Bkk1234 bf42076b52 Align share button and all component scales with DESIGN.md
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.
2026-10-23 23:32:37 +07:00
Bkk1234 66d7e235c3 Fix share button: ES module namespace was not extensible
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).
2026-10-23 23:26:18 +07:00
Bkk1234 2fa73f43d9 Add SEO foundation: robots, sitemap, JSON-LD, OG/Twitter cards, per-page metadata
- 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
2026-10-23 23:15:06 +07:00
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
85 changed files with 4421 additions and 2272 deletions

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
.env
1.env
.github/
node_modules/
dist/
+93
View File
@@ -115,6 +115,54 @@
- **ชื่อเฉพาะไม่แปล** — ชื่อสถานี จังหวัด สายรถ (ภาษาไทยเสมอ)
- **ตรวจก่อน commit:** `python resource/tools/check-i18n.py`
## 3.2 ธีม (Theme) — สว่าง / มืด / ตามเวลาเครื่อง
**ไฟล์:** `frontend/src/styles/theme.css` (โทเคน) · `frontend/src/components/ThemeSwitch.tsx` (ตัวสลับ)
### โหมดที่รองรับ
| โหมด | ค่า `data-theme` | กติกา |
|---|---|---|
| สว่าง | `light` | ผู้ใช้เลือกเอง |
| มืด | `dark` | ผู้ใช้เลือกเอง |
| ตามเวลา | `auto` | 06:00–17:59 = สว่าง · 18:00–05:59 = มืด (เวลาจากเครื่องผู้ใช้) |
- ค่าเริ่มต้น = `auto` · เก็บที่ `localStorage['at_theme']`
- สคริปต์ inline ใน `src/app/layout.tsx` ตั้ง `data-theme` **ก่อน paint** → ไม่มีจอขาววูบ
- โหมด `auto` ตรวจซ้ำทุก 60 วินาที + ทุกครั้งที่กลับเข้าแท็บ (`visibilitychange`)
- `color-scheme` ถูกตั้งตามธีม → สกรอลบาร์/คอนโทรลเบราว์เซอร์กลมกลืน
### กฎการใช้สี (สำคัญ)
**ห้ามใส่ hex ตรง ๆ ในไฟล์ CSS อีก** — ใช้โทเคนใน `theme.css` เท่านั้น
| โทเคน | สว่าง | มืด | ใช้กับ |
|---|---|---|---|
| `--c-bg` | `#f7f9fd` | `#120e1e` | พื้นหลังหน้า |
| `--c-surface` | `#ffffff` | `#171225` | การ์ด/แถบนำทาง |
| `--c-surface-2` | `#faf7ff` | `#1f1833` | พื้นรอง |
| `--c-surface-3` | `#f4f2fa` | `#251d3d` | พื้นตติยภูมิ |
| `--c-ink` | `#1f2a44` | `#ece9f7` | ข้อความหลัก |
| `--c-ink-2` | `#5f6b83` | `#a9a2c4` | ข้อความรอง |
| `--c-border` | `#e7e2f6` | `#352b52` | เส้นขอบ |
| `--c-brand` | `#7a4cc0` | `#7a4cc0` | พื้นม่วง (คงที่) |
| `--c-brand-ink` | `#7a4cc0` | `#b892f5` | ตัวอักษรม่วง |
| `--c-tint-purple/pink/green/amber/cyan` | อ่อน | เข้มจัด | พื้นตามหมวด |
| `--c-ok/warn/danger/info` | เข้ม | สว่าง | ข้อความสถานะ |
| `--c-glass / -70 / -24` | ขาวโปร่ง | ดำโปร่ง | พื้นผิวโปร่งแสง |
### ตรวจแล้ว (WCAG AA)
- ข้อความบนพื้น: **0 จุดต่ำกว่า 4.5:1** ทั้งโหมดสว่างและมืด (สแกน 8 หน้า)
- ปุ่มธีม 34×34px · **40×40px บนจอสัมผัส** (`@media (pointer: coarse)`)
- `aria-checked` + `role="radiogroup"` + `:focus-visible` 2px
- ไม่มี horizontal overflow ที่ 375px
### ข้อควรระวัง
- แผนที่ (Leaflet) ยังใช้ไทล์สว่าง — ตั้งใจให้เป็นเช่นนั้น (อ่านถนนง่ายกว่า)
- `--c-brand` คงที่ทั้ง 2 ธีม เพื่อรักษาเอกลักษณ์ม่วง; ที่เปลี่ยนคือ `--c-brand-ink` (ตัวอักษร)
## 4. ตัวพิมพ์ (Typography)
```css
@@ -151,6 +199,31 @@ subset thai/latin/latin-ext · ~218 KB) + ไฟล์ `.woff2` 18 ไฟล์
- ข้อมูลรอง: muted 0.85rem
- hover: ขอบเปลี่ยนเป็น `--purple-300` + `translateY(-1px)` — **ห้ามใส่ shadow**
### ปุ่มแชร์หน้านี้ (`.mu-share-row` / `.mu-share-btn`)
ใช้ร่วมทุกหน้า — `/` · `/stops/:code` · `/routes/:id` · `/check/:id`
(ประกาศใน `styles/_shared.css` **ไม่ใช่** CSS ของหน้าใดหน้าหนึ่ง — เคยหลุดไปอยู่ใน `pages/home.css` ทำให้หน้าอื่นไม่มีสไตล์)
- **variant = ปุ่มรอง (ghost)** เพราะไม่ใช่ CTA หลักของหน้า — CTA หลักคือ topbar `.mu-action-btn`
- พื้น `--c-surface` · ขอบ `1px solid --c-border` · ตัวอักษร `--c-brand-ink` · weight 700
- `min-height: 44px` (48px เมื่อ `@media (pointer: coarse)`) · `padding: 10px 18px` · `gap: 6px`
- ไอคอน `.ic` 16px · `font-size: .85rem` · `line-height: 1`
- hover = ขอบ `#d8c9f2` + พื้น `--c-surface-2` (ไม่มี shadow) · active = `translateY(1px)`
- โฟกัส = `outline: 2px solid var(--c-focus)` + `offset: 2px` — **ห้ามใช้สีดำ/เทา**
- ข้อความสถานะ `.mu-share-status` ใช้ `--c-ink-2` · ลิงก์ที่คัดลอก `.mu-share-url` ใช้ mono + `tabular-nums` + `word-break: break-all`
- ปุ่มแชร์ LINE ใช้ `--c-brand-ink` (ม่วง) — **ไม่ใช้เขียว** เพราะ DESIGN ใช้แอคเซนต์เดียว
- มือถือ (<560px) = ปุ่มเต็มความกว้าง ข้อความชิดซ้าย
### สเกลที่บังคับใช้ (radius / type)
| หมวด | ค่าที่อนุญาต | โทเคน |
|---|---|---|
| มุมโค้ง | **4px · 8px · pill** เท่านั้น | `--radius-sm` · `--radius` · `--radius-pill` |
| ขนาดตัวอักษร | 0.72 · 0.78 · 0.85 · 0.95 · 1 · 1.1 · 1.2 · 1.35 · 1.5 · 1.6 · 1.8 · 2 · 2.2 rem | — |
| ปุ่ม | `min-height 44px` (48px จอสัมผัส) · `radius 8px` · `font-size .85rem` · weight 700 | — |
| โฟกัส | `outline 2px solid var(--c-focus)` · `offset 2px` | — |
> ค่า 12/14/16/18/20/22px และ 0.68/0.7/0.74/0.8/0.82/0.9/1.05 ฯลฯ ถูกยุบในรอบปรับปรุงนี้ — **ห้ามเพิ่มค่าใหม่นอกตาราง** ถ้าจำเป็นให้เพิ่มในไฟล์นี้ก่อน
### ชิปรหัส / เวลา (code chip / departure chip)
- รหัสป้าย/เลขสาย: พื้น `--grad-brand` ตัวอักษรขาว mono 700
- กลุ่มเวลาวางเป็น grid เรียงจากน้อยไปมาก
@@ -194,6 +267,26 @@ subset thai/latin/latin-ext · ~218 KB) + ไฟล์ `.woff2` 18 ไฟล์
- active menu = เส้นใต้ `--purple`
- CTA "เช็กเวลาเดินรถ" = พื้น `--grad-brand` ตัวอักษรขาวหนา
#### เครื่องมือในแถบนำทาง — "ปุ่มละเรื่อง" (`.mu-topbar-tools`)
**ห้ามวางกลุ่มปุ่มเรียงเป็นแถว** (เช่น ปุ่มธีม 3 ปุ่ม + ปุ่มภาษา 2 ปุ่ม = 5 ปุ่ม) เพราะทำให้แถบนำทางแน่นและล้นบนจอเล็ก
| ปุ่ม | แสดง | กดแล้ว |
|---|---|---|
| ธีม (`.mu-pop-btn`) | ไอคอนของโหมดที่ใช้อยู่ (สว่าง/มืด/ตามเวลา) | เปิดเมนู 3 ตัวเลือก `role="menuitemradio"` |
| ภาษา (`.mu-pop-btn-lang`) | รหัสภาษาที่ใช้อยู่ (`ไทย` / `EN`) + chevron | เปิดเมนู 2 ภาษา |
- **มือถือ (<640px)** — โลโก้ชิดซ้าย · `(ธีม)(ภาษา)(3 ขีด)` ชิดขวา โดย **3 ขีดอยู่ขวาสุด**: `flex-wrap: nowrap` · `margin-inline-start: auto` ที่ `.mu-topbar-tools` · `order: 2` (tools) / `3` (menu)
- **≥640px** — เมนู 3 ขีดซ่อน แสดง `.mu-nav` แทน · `≥1024px` เพิ่มปุ่ม CTA
- ปุ่มกลมเหลี่ยม `height 40px` · `radius 8px` · ขอบ `--c-border` · ตัวอักษร `--c-brand-ink`
- จอสัมผัส → `44px`
- ระยะห่างระหว่างปุ่ม **≥ 8px** (WCAG 2.5.8)
- เมนู `.mu-pop-panel` ชิดขวา `z-index: 1200` (เหนือ topbar 1100 · ใต้ visitor dialog 3000)
- ปิดเมนูด้วย: เลือกแล้ว · คลิกนอก · `Esc` (คืนโฟกัสที่ปุ่ม)
- ข้อความในเมนูมีทั้งไทยและอังกฤษกำกับ (`.mu-pop-item-th` / `.mu-pop-item-en`)
#### ปุ่มขอบ (`.mu-btn.outline`)
พื้นโปร่งใส + ขอบและตัวอักษร `--c-brand-ink` — **ต้องมีกฎนี้เสมอ** ถ้าไม่มี เบราว์เซอร์จะใส่พื้นเทาอ่อนเองและหลุดธีมในโหมดมืด
### ฟอร์มค้นหา
- พื้น `--paper` ขอบ `--line`, โฟกัส = ขอบ `--purple-300` — ไม่มี glow
- ช่องกรอกแบบแบ่งกล่อง (รหัสป้าย) ใช้ mono + กล่องละ 1 หลัก
+15 -1
View File
@@ -84,7 +84,21 @@ npm run dev # http://localhost:3000
```
- เปิดทุก route: `/`, `/stops`, `/stops/:code`, `/routes`, `/routes/:id`, `/check`,
`/check/:id`, `/blog`, `/blog/:id`, `/about`, `/credits`
`/check/:id`, `/blog`, `/blog/:id`, `/about`, `/credits`, `/stats`
- เทียบภาพกับ mock ที่ viewport เดียวกัน (1280×900) — diff ที่วัดได้ 0.7–2.3%
(ที่เหลือมาจาก marquee animation / ตัวเลขผู้เข้าชม)
- ตรวจว่าไม่มี horizontal scroll และปุ่ม/ลิงก์กดได้จริง
## รอบล่าสุด — motion, สถิติ, auto-update (พอร์ตจาก mock)
| ของใน mock | ใน repo นี้ | หมายเหตุ |
|---|---|---|
| `ui/motion.js` (enter · reveal · loading bar) | `src/lib/ui/motion.ts` + `components/MotionBoot.tsx` + CSS ใน `src/styles/_shared.css` | MotionBoot เรียก `Motion.enter(#view)` ทุกครั้งที่ pathname เปลี่ยน (แทน router เดิม) · reveal ใช้ `IntersectionObserver` + sweep (กันค้างตอนกระโดดข้ามหน้า/แท็บถูกซ่อน) |
| `ui/analytics.js` + `#/stats` | `src/lib/ui/analytics.ts` + `app/stats/page.tsx` + `components/views/StatsView.tsx` + `styles/pages/stats.css` | เก็บใน localStorage `at_stats_v1` · ไม่มีคุกกี้/IP/UA · `cleanTerm()` ตัดอีเมล/เบอร์/เลขยาว · debounce 900ms · opt-out + DNT/GPC · ค่าเริ่มต้นไม่ส่งออกเน็ต (จะส่งก็ต่อเมื่อตั้ง `window.AT_ANALYTICS = {endpoint, siteId}`) |
| ปุ่มติดตั้งแอปลอยมุมขวาล่าง | **เอาออก** — `PwaBoot` เหลือ SW + version check | Chrome/Edge ยังมีไอคอนติดตั้งของเบราว์เซอร์เอง |
| ตัวเลขผู้เข้าชม 12,834 ใน footer | **เอาออก** — ลบ `lib/ui/visitors.ts` + CSS `.mu-visitor/.mu-vreset` + คีย์ `visitors.*` | backend มี `/api/visits` (record_visit/visits_summary) แต่ frontend ยังไม่เรียก — ถ้าจะทำสถิติรวมศูนย์ ให้ต่อที่ `lib/api.ts` |
| bump + `version.json` + toast อัปเดต | `PwaBoot` เทียบ `/version.json` กับ `<html data-app-version>` (อ่านตอน build) → toast + reload ครั้งเดียว/เวอร์ชัน | ต้อง bump `public/version.json` + `public/sw.js` VERSION แล้ว rebuild |
**ยังไม่พอร์ต (ตั้งใจ):** หน้ารวมศูนย์สถิติจาก backend — backend มีตาราง `visit_daily_stats`
และ API `/visits/summary` แล้ว แต่ยังไม่มี UI/การเรียก; ถ้าจะทำต้องตัดสินใจเรื่อง visitor id
เชิงความเป็นส่วนตัวก่อน (mock ใช้ local-only เพื่อไม่ต้องมี id ถาวร)
+1 -1
View File
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
import "./.next/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
+30
View File
@@ -8,6 +8,36 @@ const nextConfig = {
images: {
remotePatterns: [{ protocol: "http", hostname: "**" }, { protocol: "https", hostname: "**" }]
},
async headers() {
return [
{
/* sw.js และ version.json ต้องไม่ถูก HTTP cache — ไม่งั้นผู้ใช้ค้างรุ่นเก่า */
source: "/sw.js",
headers: [
{ key: "Cache-Control", value: "no-cache, no-store, must-revalidate" },
{ key: "Service-Worker-Allowed", value: "/" },
],
},
{
source: "/version.json",
headers: [{ key: "Cache-Control", value: "no-cache, no-store, must-revalidate" }],
},
{
source: "/ui-manifest.json",
headers: [{ key: "Cache-Control", value: "public, max-age=0, must-revalidate" }],
},
{
/* หน้าเว็บ (HTML) เป็น static prerender → Next แปะ s-maxage=31536000 (1 ปี)
ทำให้เบราว์เซอร์ค้างหน้าเก่าหลัง deploy ใหม่ จึงบังคับ no-store เฉพาะ text/html
(ไม่กระทบ _next/static ที่มี hash อยู่แล้ว) */
source: "/:path*",
has: [{ type: "header", key: "accept", value: "(.*text/html.*)" }],
headers: [
{ key: "Cache-Control", value: "private, no-cache, no-store, max-age=0, must-revalidate" },
],
},
];
},
async rewrites() {
return [
{
@@ -2,7 +2,7 @@
"th": {
"title": "ไม่มีจิตรกรคนไหนนั่งวาดภาพจากอากาศ",
"body": [
"บางคนอาจจะสงสัยว่าวลีนี้เกี่ยวกับเว็ปเราอย่างไร อย่างที่สำนวนบอกไม่มีจิตรกรวาดรูปจากอากาศ เว็ปเราก็ไม่ได้มโนจากอากาศเหมือนกันจะสร้างอะไรได้มันต้องมีต้นแบบให้ดู ขอให้เครดิตและขอบคุณต้นแบบของเราทุกๆคน",
"อย่หน้านี้เขียนเพื่อขอบคุณต้นแบบของเรา บางคนอาจจะสงสัยว่าวลีนี้เกี่ยวกับเว็ปเราอย่างไร อย่างที่สำนวนบอกไม่มีจิตรกรวาดรูปจากอากาศ เว็ปเราก็ไม่ได้มโนจากอากาศเหมือนกันจะสร้างอะไรได้มันต้องมีต้นแบบให้ดู เช่น",
"- Mayday กลุ่มคนรณรงค์เรื่องรถเมล์ในกรุงเทพ ปริมณฑล",
"- AyuthayaBusMap เป็นธุรกิจในอยุธยาทำแผนที่รถประจำทางบริการนักท่องเที่ยว",
"- กลุ่มไลน์รถตู้ กรุงเทพ-อ่างทอง (สายใน) เป็นต้นแบบว่าถึงเราไม่ใช่ผู้ประกอบการเราก็ลุกขึ้นมาทำอะไรซักอย่างได้"
@@ -2,11 +2,8 @@
"th": {
"title": "ความตั้งใจในปัจจุบัน",
"body": [
"ความตั้งใจของเราคือ พยายามรวบรวมช่องทางการติดต่อถามเวลาเดินรถหรือติดตามข่าวสาร เช่น เบอร์โทร เพจFB กลุ่มFBหรือline หรือwww ที่รถประจำทางแต่ละสายประกาศไว้",
"ส่วนเรื่อตารางเวลาเดินรถที่เวปเราบอกตรงๆว่า เราอยากทำเป็นไอเดีย ว่าถ้าอ่างทองมีตารางเดินรถออนไลน์คงจะดีแต่ไม่ต้องไปเชื่อมาก เราคาดสีสถานะใว้",
"สีแดง คือตารางเวลาที่ไม่ได้อัปเดพเกิน 1 อาทิตย์น่าจะเป็นสีที่เห็นได้บ่อยที่สุด",
"สีเขียว คือตารางเวลาที่ได้อัพเดตไม่เกิน 1 วัน",
"สีส้ม คือตารางเวลาที่ไม่ได้อัพเดตเกิน 1 วันแต่น้อยกว่า 1 อาทิตย์"
"ความตั้งใจของเราคือ พยายามรวบรวมช่องทางการติดต่อถามเวลาเดินรถ หรือติดตามข่าวสารช่องทางต่างๆ เช่น เบอร์โทรศัพท์ เพจและกลุ่ม FaceBook หรือ lineOA หรือ www ที่นายท่าของรถประจำทางแต่ละสายประกาศไว้",
"ส่วนเรื่อตารางเวลาเดินรถที่เห็นในเว็ปเราบอกตรงๆว่าอย่าไปเชื่อมากเพราะเราไม่มีเวลาแก้เวลาทุกวันของทุกสาย เราอยากทำเป็นแนวคิดเป็นตัวอย่างถ้าอ่างทองมีตารางเดินรถออนไลน์คงจะดีเราระบุไว้ว่าตารางเวลาสร้างผ่านไปแล้วกี่วัน"
]
},
"en": {
@@ -2,7 +2,9 @@
"th": {
"title": "แผนพัฒนาในอนาคต",
"body": [
"ถ้ามีคนถามถึงแผนพัฒนาในอนาคตมั้ยก็ต้องบอกตรงๆว่าไม่มีการที่ใครเข้าเวปมาแล้วได้โทรถามเวลาเดินรถ หรือเข้ากลุ่มไลน์รถสองแถว รถมินิบัสถือว่าเว็ปนี้ทำหน้าที่ครบแล้ว จริงๆเว็ปนี้ตอนแรกตั้งใจเป็นเว็บชั่วคราวเราอยากให้หน่วยงานราชการและเอกชนใช้กฎหมาย PPP ร่วมทุนระหว่างราชการและเอกขนเพื่อสร้างระบบขนส่งมวลชนของอ่างทอง มีเว็ปแบบเรา มีสถานีขนส่งผดสประจำอำเภอ มีรถประจำทางเส้นเลือดฝอยที่ให้บริการได้ทั้งวัน มีเรือโดยสารแม่น้ำน้อย มีเรือข้ามฟากไชโย หรือใครมีไอเดียก็เมลล์มาบอกได้เผื่อจะนำไปปรับปรุงอนาคต"
"ถ้ามีคนถามถึงแผนพัฒนาในอนาคตมั้ยก็ต้องบอกว่า ไม่มี ใครเข้าเว็ปมาแล้วได้โทรถามเวลาเดินรถ หรือเข้ากลุ่มไลน์รถสองแถว รถมินิบัสถือว่าเว็ปเราทำหน้าที่เรียบร้อยแล้ว",
"เว็ปนี้ตอนแรกตั้งใจเป็นเว็บชั่วคราว เป็นแค่ตัวอย่างเฉยๆอยากให้หน่วยงานราชการและเอกชนใช้กฎหมายร่วมทุนระหว่างหน่วยงานราชการและเอกขน เพื่อสร้างระบบขนส่งมวลชนจังหวัดอ่างทองมีสถานีขนส่งอำเภอพร้อมอาคารจอดรถ(ไม่รู้เป็นอะไรสถานีขนส่งต้องไม่มีอาคาจอดรถรถมินบัสหมวด 1/4 ก็ไม่มีจะให้ญาติมาส่งทกครั้งหรือเดินมาขึ้นรถหรือไง)",
"สถานีขนส่งรถทัวร์สายเหนือ มีรถประจำทางเส้นเลือดฝอยที่ให้บริการได้ทั้งวัน มีเรือโดยสารแม่น้ำน้อย มีเรือข้ามฟากไชโย มีเว็ปดูเวลาเดินรถและตำแหน่งรถปัจจุบันได้ทัน เราตั้งใจทำยังไงก็เรียกว่าทางการไม่ได้"
]
},
"en": {
+2 -2
View File
@@ -77,8 +77,8 @@
"tag": "ความฝัน",
"body": [
"เราเกิดและเติบโตมาที่อ่างทอง ก็เห็นความเปลี่ยนแปลงแม้ว่าจะไม่ทันช่วงที่การขนส่งสาธารณะรุ่งเรือง ลุงๆป้าๆบอกว่าคนที่บขส คึกคักมากรถออกทุก 10 นาที มีรถอ่างทองไปพระพุทธบาท โผงเผง วัดสระแก้ว วัดเอกราช วัดมหานาม วัดพิกุลทอง และอื่นๆอีก แต่เท่าที่เราจำได้มีเมล์แดง เมล์ฟ้า เมล์เนื้อ แล้วมีรถตู้ผี 555 ไปถึงอนุเสาวรีย์ แล้วก็มาจัดระเบียบ และก็เริ่มทรุดลงมาเพราะคนมีรถมอไซ รถยนต์ จนมาช่วงโควิค ที่บางคนกลัวติดโรค ถึงขั้นซื้อรถใหม่",
"เราพอเข้าใจสถานการณ์ปัจจุบันถ้าจะให้กลับมาทั้งหมดไม่มีวันเป้นไปได้แล้ว เวลาฟังนักวิชาการ นักข่าว นักเคลื่อนไหวบอกว่า ภาครัฐต้องมาดูแล มันก็ขำนะพอรถประจำทางวิ่งกันได้เอกชนก็ทำกันเอง แต่พอวิ่งมีแต่เจ๊งกลับโยนใหห้ภาครัฐทำ",
"แต่ก็นั่นแหละมันอยู่ในกฎหมาย ว่าองค์กรปกครองส่วนท้องถิ่นมีหน้าที่จัดหาบริการขนส่งสาธารณะ เราก็ไม่แม่นกฎหมายแต่มันก็จะมีแนวคิดประมาณว่า ถ้าโครงการขาดทุนสะสมทุกวันต้องเอาหลวงถมทุกวันหนวยงานตรวจสอบอาจไม่ชอบ และฟ้องเรียกเงินคืนก็ได้ บางครั้งรัฐไม่เสียประโยชน์อาจไม่เท่ากับประชาชนเสียประโยชน์",
"เราพอเข้าใจสถานการณ์ปัจจุบันถ้าจะให้กลับมาทั้งหมดไม่มีวันเป้นไปได้แล้ว เวลาฟังนักวิชาการ นักข่าว นักเคลื่อนไหวบอกว่า ภาครัฐต้องมาดูแล บางทีก็ขำนะพอรถประจำทางวิ่งมีกำไรกันเอกชนก็ทำกันเอง แต่พอปัจจุบันวิ่งรถไปมีแต่เจ๊งกลับโยนให้ภาครัฐทำ",
"แต่ก็นั่นแหละมันอยู่ในกฎหมาย ว่าองค์กรปกครองส่วนท้องถิ่นมีหน้าที่จัดหาบริการขนส่งสาธารณะ เราก็ไม่แม่นกฎหมายแต่มันก็จะมีแนวคิดประมาณว่า ถ้าโครงการขาดทุนสะสมทุกวันต้องเอางบประมาณราชการถมทุกวันหน่วยงานตรวจสอบอาจไม่ชอบ และฟ้องเรียกเงินคืนก็ได้ เหมือนอย่างกรณีหลายปีก่อนที่องค์กรปกครองส่วนท้องถิ่นจัดการฉีดวัคซีนป้องกันพิษสุนัขบ้าแต่หน่วยงานตรวจสอบฟ้องศาลปกครองว่าอปทไม่สามารถทำได้เป็นหน้าที่ของปศุสัตว์จังหวัด/อำเภอสุดท้ายถึงจะแพ้ในชั้นศาลแต่บั่นทอนกำลังใจข้าราชการที่ทำงานกรณีรถประจำทางก็เหมือนกันต่อให้มีเขียนว่าเป็นหน้าที่อปทแต่ถ้ามีข้อความในกฎหมาย ระเบียบให้สามารถตีความได้ข้าราชการจะสบายใจในการทำงานได้อย่างไรการขึ้นศาลมันเสียพลังชีวิต บางครั้งคำว่ารัฐไม่เสียประโยชน์อาจไม่เท่ากับประชาชนเสียประโยชน์ก็ได้",
"มาถึงข้อเสนอเรา เราว่าขั้นต่ำที่สุดอยากให้กู้รถประจำทางเชื่อมต่อำเภอเข้าสู่ตัวเมือง ได้แก่",
"1. สามโก้-วิเศษ-อ่างทอง",
"2. แสวงหา-โพธิ์ทอง-อ่างทอง",
+2 -1
View File
@@ -6,7 +6,8 @@
"body": [
"ตามกฎหมายควบคุมการขนส่งทางบกแบ่งรถประจำทางออกเป็น 4 หมวด ได้แก่ 1.รถประจำทางในเขตเทศบาล 2.รถจากต่างจังหวัดเข้ากรุงเทพ 3.รถจากจังหวัดหนึ่งถึงอีกจังหวัดหนึ่ง 4.รถภายในจังหวัด",
"กรมการขนส่งใช้ระบบให้นิติบุคคล พวก บริษัท ห้างหุ้นส่วน หรือสหกรณ์ใครสนใจก็เข้าไปของใบอนุญาต ซึ่งหลักการนี้ก็ใช้มาตั้งแต่ ปี 2520 กว่าๆ ถึงจะออกกฎระเบียบรองๆตามสภาพบ้านเมืองแต่ปัจจุบันเราก็เห็นสภาพกันอยู่ว่ามันแย่แค่ไหน",
"อยากเสนอให้ องค์กรปกครองส่วนท้องถิ่นเข้ามาเดินรถ หมวด1 และหมวด4 ไม่ว่าจะดำเนินการเอง จ้างเหมาเอกชนหรือทำข้อตกลงสำรองจ่ายเฉพาะส่วนต่างที่เอกชน เราก็อาจจะเห็นบางจังหวัดเริ่มทำบ้างแล้ว แต่สำหรับอ่างทองจะเอาเงินจากไหนมาจัดบริการแบบนี้ ส่วนรถหมวด 2 และ 3 ถึงเราจะอยากให้อุดหนุนแต่มันก็เลยคำว่า บริการพื้นฐานไปแล้วก็คงได้แต่ส่งกำลังใจให้มีกำไรและจัดบริการดีๆ"
"อยากเสนอให้ องค์กรปกครองส่วนท้องถิ่นเข้ามาเดินรถ หมวด 1 และหมวด 4 ไม่ว่าจะดำเนินการเอง จ้างเหมาเอกชนหรือทำข้อตกลงสำรองจ่ายเฉพาะส่วนต่างที่เอกชน เราก็อาจจะเห็นบางจังหวัดเริ่มทำบ้างแล้ว แต่สำหรับอ่างทองจะเอาเงินจากไหนมาจัดบริการแบบนี้",
" ส่วนรถประจำทางหมวด 2 และ 3 เราก็อยากให้อุดหนุนแต่มันเลยคำว่า บริการพื้นฐานไปแล้วก็คงได้แต่ส่งกำลังใจให้มีกำไรและมีคนใช้บริการเยอะๆ"
]
},
"en": {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

+43 -3
View File
@@ -89,7 +89,7 @@
"home.lead": "Browse routes, find stops, and preview a route right from this page",
"home.chooseProvince": "Select Province",
"home.chooseStation": "Select Terminal",
"share.label": "Share short link",
"share.label": "Share this page",
"share.copied": "Link copied",
"share.short": "Short link",
"share.line": "Share on LINE",
@@ -131,6 +131,9 @@
"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.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.codePh": "3+000",
"stops.codeHint": "Type 4 digits and the + sign is added automatically (e.g. 3000 → 3+000)",
@@ -138,7 +141,6 @@
"stops.codeFull": "Stop code:",
"stops.placePh": "Ang Thong Hospital",
"stops.placeHint": "Type a place name such as a hospital or land office, then pick a match",
"stops.padDelete": "Del",
"stops.reset": "Clear",
"stops.section": "Section",
"stops.showing": "Showing {a} of {b} stops",
@@ -265,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"
}
+43 -3
View File
@@ -89,7 +89,7 @@
"home.lead": "ดูสายรถ, ค้นหาป้าย และเปิดตัวอย่างเส้นทางได้ทันทีจากหน้าแรก",
"home.chooseProvince": "เลือกจังหวัด",
"home.chooseStation": "เลือกสถานีขนส่งผู้โดยสาร",
"share.label": "แชร์ลิงก์สั้น",
"share.label": "แชร์หน้านี้",
"share.copied": "คัดลอกลิงก์แล้ว",
"share.short": "ลิงก์สั้น",
"share.line": "แชร์ผ่าน LINE",
@@ -131,6 +131,9 @@
"stops.noOffset": "ยังไม่ระบุเวลาเดินทางจากจุดแรก",
"stops.noBusLine": "ยังไม่ระบุสายรถ",
"stops.modeCode": "ค้นหาด้วยรหัสป้าย",
"stops.modeNear": "ป้ายใกล้ฉัน",
"stops.nearCta": "ขอพิกัดและหาป้ายใกล้ฉัน",
"stops.nearHint": "ระบบจะขอตำแหน่งจากเครื่อง แล้วคำนวณระยะจากพิกัดป้าย/ศาลารถ เรียงจากใกล้ไปไกล",
"stops.modePlace": "ค้นหาด้วยชื่อสถานที่",
"stops.codePh": "3+000",
"stops.codeHint": "พิมพ์ตัวเลข 4 หลัก ระบบจะเติมเครื่องหมาย + ให้อัตโนมัติ (เช่น 3000 → 3+000)",
@@ -138,7 +141,6 @@
"stops.codeFull": "รหัสป้าย:",
"stops.placePh": "โรงพยาบาลอ่างทอง",
"stops.placeHint": "พิมพ์ชื่อสถานที่สำคัญ เช่น โรงพยาบาล สำนักงานที่ดิน แล้วเลือกรายการที่ตรงกัน",
"stops.padDelete": "ลบ",
"stops.reset": "ล้างค่า",
"stops.section": "ตอน",
"stops.showing": "แสดง {a} จาก {b} ป้าย",
@@ -265,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": "หน้า"
}
+47
View File
@@ -0,0 +1,47 @@
<!doctype html>
<html lang="th">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<title>ออฟไลน์ | Atroute</title>
<link rel="stylesheet" href="/vendor/fonts/k2d.css" />
<style>
:root { color-scheme: light; }
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100dvh;
display: grid;
place-items: center;
padding: 24px;
background: #fcfbff;
color: #2c2340;
font-family: "K2D", "Noto Sans Thai", system-ui, sans-serif;
text-align: center;
}
.box { max-width: 360px; }
img { width: 72px; height: 72px; object-fit: contain; margin-bottom: 18px; }
h1 { font-size: 1.25rem; margin: 0 0 8px; }
p { margin: 0 0 20px; color: #6f6a80; line-height: 1.6; font-size: 0.95rem; }
button {
min-height: 44px;
padding: 10px 22px;
border: 0;
border-radius: 999px;
background: #7a4cc0;
color: #fff;
font: inherit;
font-weight: 600;
cursor: pointer;
}
</style>
</head>
<body>
<div class="box">
<img src="/image/icons/minibus-512x512.png" alt="" />
<h1>ไม่มีการเชื่อมต่อ</h1>
<p>หน้านี้ต้องใช้อินเทอร์เน็ต — หน้ำที่เคยเปิดไว้จะยังใช้งานได้ตอนออฟไลน์</p>
<button type="button" onclick="location.reload()">ลองอีกครั้ง</button>
</div>
</body>
</html>
@@ -111,6 +111,30 @@
"affiliate_link": "",
"status": "registered",
"note": "มีบัญชีแล้ว — ยังไม่ใช้ใน footer"
},
{
"id": "THpostmart",
"brand": "THpostmart",
"brand_th": "ไทยโพสต์มาร์ท",
"tile_image": ".image/partners/thpostmart.png",
"in_footer_marquee": true,
"affiliate_program": "",
"program_url": "",
"affiliate_link": "https://www.thailandpostmart.com/",
"status": "no registered",
"note": "ไม่มีบัญชี"
},
{
"id": "pantip mall",
"brand": "pantip mall",
"brand_th": "พันทิป มอลล์",
"tile_image": ".image/partners/pantip mall.png",
"in_footer_marquee": true,
"affiliate_program": "",
"program_url": "",
"affiliate_link": "https://www.pantipmall.com/",
"status": "no registered",
"note": "ไม่มีบัญชี"
}
]
}
+124
View File
@@ -0,0 +1,124 @@
/* ============================================================
Atroute — Service Worker (Next.js)
ทำไมต้องมี:
Chrome/Edge/Samsung Internet จะ "ติดตั้งเป็นแอป" ได้ก็ต่อเมื่อ
1) เสิร์ฟผ่าน HTTPS (หรือ localhost)
2) มี manifest ที่ถูกต้อง (192 + 512 icon, start_url, display)
3) ★ มี service worker ที่มี fetch handler ควบคุมหน้าเว็บ
ข้อ 3 คือสิ่งที่ Next.js ไม่มีให้เอง — ไฟล์นี้คือคำตอบ
กลยุทธ์
- นำทาง (HTML) → network-first (ออนไลน์ได้ของใหม่, ออฟไลน์ใช้ cache)
- /_next/static, /image, /vendor, ฟอนต์ → cache-first (เร็ว + ออฟไลน์ได้)
- /api → ไม่แตะ (ให้ network จัดการ)
- SW ใหม่ → skipWaiting + clients.claim + แจ้งหน้าเว็บ
============================================================ */
const VERSION = "2026.10.24.9"; /* bump เมื่อแก้ UI เพื่อบังคับให้ cache เก่าถูกทิ้ง */
const CACHE = `atroute-${VERSION}`;
const OFFLINE_URL = "/offline.html";
const VERSION_URL = "/version.json";
/* ไฟล์ที่ precache ไว้ใช้ตอนออฟไลน์ (เฉพาะที่ path คงที่) */
const PRECACHE = [
"/",
OFFLINE_URL,
"/ui-manifest.json",
"/image/icons/minibus-192x192.png",
"/image/icons/minibus-512x512.png",
"/image/icons/minibus-maskable-512x512.png",
"/logo.svg",
"/vendor/fonts/k2d.css",
"/vendor/leaflet/leaflet.css",
];
self.addEventListener("install", (event) => {
event.waitUntil(
caches
.open(CACHE)
.then((cache) => cache.addAll(PRECACHE).catch(() => undefined))
.then(() => self.skipWaiting()),
);
});
self.addEventListener("activate", (event) => {
event.waitUntil(
caches
.keys()
.then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k))))
.then(() => self.clients.claim())
.then(() => {
self.clients.matchAll({ type: "window" }).then((cs) => {
cs.forEach((c) => c.postMessage({ type: "SW_ACTIVATED", version: VERSION }));
});
}),
);
});
self.addEventListener("message", (event) => {
if (event.data === "SKIP_WAITING") self.skipWaiting();
});
/** ไฟล์ static ที่ cache-first ได้ (path มี hash หรือไม่เปลี่ยนบ่อย) */
function isStaticAsset(url) {
return (
url.pathname.startsWith("/_next/static/") ||
url.pathname.startsWith("/image/") ||
url.pathname.startsWith("/vendor/") ||
url.pathname.startsWith("/content/") ||
/\.(?:png|jpe?g|webp|avif|svg|ico|woff2?|ttf|css|js)$/i.test(url.pathname)
);
}
self.addEventListener("fetch", (event) => {
const req = event.request;
if (req.method !== "GET") return;
const url = new URL(req.url);
/* ไม่ยุ่งกับ API และ cross-origin */
if (url.origin !== self.location.origin) return;
if (url.pathname.startsWith("/api/") || url.pathname.startsWith("/files/")) return;
/* ---- นำทาง: network-first + offline fallback ---- */
if (req.mode === "navigate") {
event.respondWith(
fetch(req)
.then((res) => {
const copy = res.clone();
caches.open(CACHE).then((c) => c.put(req, copy)).catch(() => undefined);
return res;
})
.catch(async () => {
const cached = await caches.match(req);
return cached || (await caches.match(OFFLINE_URL)) || Response.error();
}),
);
return;
}
/* ---- static: cache-first แล้วค่อยเติม cache ---- */
if (isStaticAsset(url)) {
event.respondWith(
caches.match(req).then((cached) => {
if (cached) return cached;
return fetch(req).then((res) => {
if (res.ok && res.type === "basic") {
const copy = res.clone();
caches.open(CACHE).then((c) => c.put(req, copy)).catch(() => undefined);
}
return res;
});
}),
);
return;
}
/* ---- อื่น ๆ: network-first ---- */
event.respondWith(
fetch(req)
.then((res) => res)
.catch(() => caches.match(req).then((r) => r || Response.error())),
);
});
+54 -4
View File
@@ -10,28 +10,50 @@
"orientation": "any",
"background_color": "#fcfbff",
"theme_color": "#7a4cc0",
"categories": ["travel", "navigation", "transportation"],
"categories": [
"travel",
"navigation",
"transportation"
],
"shortcuts": [
{
"name": "เช็กเวลาเดินรถ",
"short_name": "เช็กเวลา",
"description": "ดูตารางเวลาเดินรถทุกจุดจอด",
"url": "/check",
"icons": [{ "src": "/image/icons/minibus-192x192.png", "sizes": "192x192", "type": "image/png" }]
"icons": [
{
"src": "/image/icons/minibus-192x192.png",
"sizes": "192x192",
"type": "image/png"
}
]
},
{
"name": "ป้ายหยุดรถ",
"short_name": "ป้ายหยุดรถ",
"description": "ค้นหาป้ายหยุดรถทั้งหมด",
"url": "/stops",
"icons": [{ "src": "/image/icons/minibus-192x192.png", "sizes": "192x192", "type": "image/png" }]
"icons": [
{
"src": "/image/icons/minibus-192x192.png",
"sizes": "192x192",
"type": "image/png"
}
]
},
{
"name": "รายละเอียดสายรถ",
"short_name": "สายรถ",
"description": "ดูรายละเอียดเส้นทางเดินรถ",
"url": "/routes",
"icons": [{ "src": "/image/icons/minibus-192x192.png", "sizes": "192x192", "type": "image/png" }]
"icons": [
{
"src": "/image/icons/minibus-192x192.png",
"sizes": "192x192",
"type": "image/png"
}
]
}
],
"icons": [
@@ -52,6 +74,34 @@
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/image/icons/minibus-maskable-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
}
],
"id": "/",
"display_override": [
"standalone",
"minimal-ui",
"browser"
],
"prefer_related_applications": false,
"launch_handler": {
"client_mode": "navigate-existing"
},
"handle_links": "preferred",
"scope_extensions": [],
"edge_side_panel": {},
"screenshots": [
{
"src": "/image/network/overview-map.png",
"sizes": "1440x1080",
"type": "image/png",
"form_factor": "wide",
"label": "แผนที่เครือข่ายป้าย Atroute"
}
]
}
+6
View File
@@ -0,0 +1,6 @@
{
"app": "Atroute",
"version": "2026.10.24.9",
"builtAt": "2026-11-04T21:59:58",
"pwa": true
}
+6 -85
View File
@@ -1,95 +1,16 @@
<<<<<<< HEAD
import AboutView from "@/components/views/AboutView";
import PageRuntime from "@/components/PageRuntime";
export const metadata = { title: "เกี่ยวกับเรา" };
export const metadata = {
title: "เกี่ยวกับเรา",
description: "Atroute — แหล่งรวมข้อมูลรถโดยสารจังหวัดอ่างทอง",
alternates: { canonical: "/about" },
};
export default function Page() {
return (
<>
<AboutView />
<PageRuntime page="about" />
=======
import { HERO_MAP } from "@/lib/images";
const BLOCKS = [
{
title: "เราคือใคร? คิดอย่างไรถึงเริ่มทำเว็บนี้",
pic: "/images/about/pic1.jpg",
body: [
"สวัสดีผู้อ่านทุกคน ขอบคุณที่เข้ามาดูเว็ปตั้งแต่แรกเริ่ม เปลี่ยนชื่อหลายรอบ สำหรับข้อมูลส่วนตัวว่าเราคือใครเราไม่อยากเปิดเผยตัวตน เก็บความเป็นส่วนตัว",
"ส่วนที่ว่าคิดยังไงถึงเริ่มทำเว็บนี้ เรามีประสบการณ์รอ รถมินิบัส อ่างทอง-กรุงเทพ(สายใน) หน้าสำนักงานที่ดินจังหวัดอ่างทอง ตอน 4โมงเช้า-5โมงเช้า ถ้าคนทั่วไปอาจจะไม่รู้ แต่ถ้าคนที่ขึ้นสายนี้ประจำจะรู้ แต่เราไม่รู้ไง! และตอนนั้นเป็นวันเสาร์ก็ไม่มีสองแถวด้วย รู้สึกว่าอยากขึ้นทำอะไรซักอย่าง",
],
},
{
title: "ไม่มีจิตรกรคนไหนนั่งวาดภาพจากอากาศ",
pic: "/images/about/pic2.jpg",
body: [
"บางคนอาจจะสงสัยว่าวลีนี้เกี่ยวกับเว็ปเราอย่างไร อย่างที่สำนวนบอกไม่มีจิตรกรวาดรูปจากอากาศ เว็ปเราก็ไม่ได้มโนจากอากาศเหมือนกันจะสร้างอะไรได้มันต้องมีต้นแบบให้ดู ขอให้เครดิตและขอบคุณต้นแบบของเราทุกๆคน",
"- Mayday กลุ่มคนรณรงค์เรื่องรถเมล์ในกรุงเทพ ปริมณฑล",
"- AyuthayaBusMap เป็นธุรกิจในอยุธยาทำแผนที่รถประจำทางบริการนักท่องเที่ยว",
"- กลุ่มไลน์รถตู้ กรุงเทพ-อ่างทอง (สายใน) เป็นต้นแบบว่าถึงเราไม่ใช่ผู้ประกอบการเราก็ลุกขึ้นมาทำอะไรซักอย่างได้",
],
},
{
title: "ความตั้งใจในปัจจุบัน",
pic: "/images/about/pic3.jpg",
body: [
"ความตั้งใจของเราคือ พยายามรวบรวมช่องทางการติดต่อถามเวลาเดินรถหรือติดตามข่าวสาร เช่น เบอร์โทร เพจFB กลุ่มFBหรือline หรือwww ที่รถประจำทางแต่ละสายประกาศไว้",
"ส่วนเรื่องตารางเวลาเดินรถที่เวปเราบอกตรงๆว่า เราอยากทำเป็นไอเดีย ว่าถ้าอ่างทองมีตารางเดินรถออนไลน์คงจะดีแต่ไม่ต้องไปเชื่อมาก เราคาดสีสถานะใว้",
"สีแดง คือตารางเวลาที่ไม่ได้อัปเดตเกิน 1 อาทิตย์ น่าจะเป็นสีที่เห็นได้บ่อยที่สุด",
"สีเขียว คือตารางเวลาที่ได้อัปเดตไม่เกิน 1 วัน",
"สีส้ม คือตารางเวลาที่ไม่ได้อัปเดตเกิน 1 วันแต่น้อยกว่า 1 อาทิตย์",
],
},
{
title: "แผนพัฒนาในอนาคต",
pic: "/images/about/pic4.jpg",
body: [
"ถ้ามีคนถามถึงแผนพัฒนาในอนาคตมั้ยก็ต้องบอกตรงๆว่าไม่มีการที่ใครเข้าเวปมาแล้วได้โทรถามเวลาเดินรถ หรือเข้ากลุ่มไลน์รถสองแถว รถมินิบัส ถือว่าเว็ปนี้ทำหน้าที่ครบแล้ว จริงๆเว็ปนี้ตอนแรกตั้งใจเป็นเว็บชั่วคราว เราอยากให้หน่วยงานราชการและเอกชนใช้กฎหมาย PPP ร่วมทุนระหว่างราชการและเอกชนเพื่อสร้างระบบขนส่งมวลชนของอ่างทอง มีเว็ปแบบเรา มีสถานีขนส่งผู้โดยสารประจำอำเภอ มีรถประจำทางเส้นเลือดฝอยที่ให้บริการได้ทั้งวัน มีเรือโดยสารแม่น้ำน้อย มีเรือข้ามฟากไชโย หรือใครมีไอเดียก็เมลล์มาบอกได้เผื่อจะนำไปปรับปรุงอนาคต",
],
},
];
export default function AboutPage() {
return (
<>
<section className="hero hero--short">
<img className="hero__map" src={HERO_MAP} alt="" aria-hidden="true" />
<div className="hero__blob one" aria-hidden />
<div className="hero__blob two" aria-hidden />
<div className="hero__blob three" aria-hidden />
<div className="container hero__inner">
<span className="hero__badge">เกี่ยวกับเรา</span>
<h1>
เกี่ยวกับเรา
<br />
<span className="hero__grad">เมื่อไหร่รถจะมา</span>
</h1>
<p className="hero__lead">เรื่องราวและที่มาของเว็บนี้ — อ่านเรียงตามบล็อกด้านล่างได้เลย</p>
</div>
</section>
<main className="main">
<div className="container">
<div className="about-wrap">
{BLOCKS.map((b) => (
<article className="about-block" key={b.title}>
<div className="about-block__text">
<h2>{b.title}</h2>
{b.body.map((p, i) => (
<p key={i}>{p}</p>
))}
</div>
<div className="about-media">
<img src={b.pic} alt={b.title} loading="lazy" decoding="async" />
</div>
</article>
))}
</div>
</div>
</main>
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
</>
<PageRuntime page="about" /> </>
);
}
+6 -74
View File
@@ -1,84 +1,16 @@
<<<<<<< HEAD
import BlogView from "@/components/views/BlogView";
import PageRuntime from "@/components/PageRuntime";
export const metadata = { title: "บ่นไปเรื่อย" };
export const metadata = {
title: "บ่นไปเรื่อย",
description: "บทความและเรื่องเล่าเกี่ยวกับการเดินทางด้วยรถโดยสารในจังหวัดอ่างทอง",
alternates: { canonical: "/blog" },
};
export default function Page() {
return (
<>
<BlogView />
<PageRuntime page="blog" />
=======
import { HERO_MAP } from "@/lib/images";
import t1 from "@/data/blog/text1.json";
import t2 from "@/data/blog/text2.json";
import t3 from "@/data/blog/text3.json";
import t4 from "@/data/blog/text4.json";
import t5 from "@/data/blog/text5.json";
import t6 from "@/data/blog/text6.json";
import t7 from "@/data/blog/text7.json";
type Post = { date: string; th: { title: string; tag?: string; body: string[] } };
const POSTS: (Post & { pic: string })[] = [
{ ...(t1 as Post), pic: "/images/blog/pic1.jpg" },
{ ...(t2 as Post), pic: "/images/blog/pic2.jpg" },
{ ...(t3 as Post), pic: "/images/blog/pic3.jpg" },
{ ...(t4 as Post), pic: "/images/blog/pic4.jpg" },
{ ...(t5 as Post), pic: "/images/blog/pic5.jpg" },
{ ...(t6 as Post), pic: "/images/blog/pic6.jpg" },
{ ...(t7 as Post), pic: "/images/blog/pic7.jpg" },
].sort((a, b) => (a.date < b.date ? 1 : -1));
function fmtDate(d: string) {
const [y, m, dd] = d.split("-");
const months = ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."];
return `${Number(dd)} ${months[Number(m) - 1]} ${Number(y) + 543}`;
}
export default function BlogPage() {
return (
<>
<section className="hero hero--short">
<img className="hero__map" src={HERO_MAP} alt="" aria-hidden="true" />
<div className="hero__blob one" aria-hidden />
<div className="hero__blob two" aria-hidden />
<div className="hero__blob three" aria-hidden />
<div className="container hero__inner">
<span className="hero__badge">บ่นไปเรื่อย</span>
<h1>
บ่นไปเรื่อย
<br />
<span className="hero__grad">เรื่องเล่าระหว่างทาง</span>
</h1>
<p className="hero__lead">รวมข้อเขียน ความฝัน และความกังวลเกี่ยวกับรถโดยสารในจังหวัดอ่างทอง</p>
</div>
</section>
<main className="main">
<div className="container">
<div className="blog-wrap">
{POSTS.map((p, i) => (
<article className="blog-card" key={p.date + p.th.title}>
<div className="blog-card__media">
<img src={p.pic} alt={p.th.title} loading="lazy" decoding="async" />
</div>
<div className="blog-card__body">
<div className="blog-card__meta">
<time dateTime={p.date}>{fmtDate(p.date)}</time>
{p.th.tag && <span className="blog-card__tag">{p.th.tag}</span>}
</div>
<h2>{p.th.title}</h2>
{p.th.body.slice(0, 2).map((para, j) => (
<p key={j}>{para}</p>
))}
</div>
</article>
))}
</div>
</div>
</main>
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
</>
<PageRuntime page="blog" /> </>
);
}
+51 -2
View File
@@ -1,12 +1,61 @@
import CheckView from "@/components/views/CheckView";
import PageRuntime from "@/components/PageRuntime";
import { BreadcrumbJsonLd, BusRouteJsonLd } from "@/components/JsonLd";
import { SITE_NAME } from "@/lib/site";
import { api } from "@/lib/api";
import type { Metadata } from "next";
export const metadata = { title: "เช็กเวลาเดินรถ" };
type Params = { params: Promise<{ routeId: string }> };
export default async function Page({ params }: { params: Promise<{ routeId: string }> }) {
async function loadRoute(id: string) {
try {
return await api.route(decodeURIComponent(id));
} catch {
return null;
}
}
export async function generateMetadata({ params }: Params): Promise<Metadata> {
const { routeId } = await params;
const r = await loadRoute(routeId);
if (!r) {
return { title: "เช็กเวลาเดินรถ", alternates: { canonical: `/check/${routeId}` } };
}
const title = `เวลาเดินรถ สาย ${r.route_id} ${r.name_th || ""}`.trim();
const description =
`ตารางเวลาเดินรถสาย ${r.route_id} ${r.name_th || ""} ทั้งวันทำการและวันหยุด ` +
`พร้อมเวลารถออกจากแต่ละจุดจอด — ${SITE_NAME}`;
return {
title,
description,
alternates: { canonical: `/check/${encodeURIComponent(r.route_id)}` },
openGraph: { type: "article", title, description, url: `/check/${encodeURIComponent(r.route_id)}` },
};
}
export default async function Page({ params }: Params) {
const { routeId } = await params;
const r = await loadRoute(routeId);
return (
<>
{r ? (
<>
<BreadcrumbJsonLd
items={[
{ name: "หน้าแรก", path: "/" },
{ name: `สาย ${r.route_id}`, path: `/routes/${r.route_id}` },
{ name: "เช็กเวลาเดินรถ", path: `/check/${r.route_id}` },
]}
/>
<BusRouteJsonLd
routeId={String(r.route_id)}
name={r.name_th || ""}
/>
</>
) : null}
<CheckView />
<PageRuntime page="check" params={{ routeId: decodeURIComponent(routeId) }} />
</>
+1 -153
View File
@@ -1,4 +1,3 @@
<<<<<<< HEAD
import CheckView from "@/components/views/CheckView";
import PageRuntime from "@/components/PageRuntime";
@@ -16,156 +15,5 @@ export default async function Page({
<>
<CheckView />
<PageRuntime page="check" query={query} />
</>
=======
import Link from "next/link";
import { api, type RouteListItem, type Schedule, type RouteStop, type RouteDetail } from "@/lib/api";
import { RouteSelect } from "@/components/RouteSelect";
import { VisitTracker } from "@/lib/visit-tracker";
import { Icon } from "@/components/Icons";
import { headers } from "next/headers";
import { t, langFromCookie } from "@/lib/i18n";
const TONES = ["sky", "purple", "pink", "mint", "amber"] as const;
function nextTrip(times: string[]): string | null {
if (times.length === 0) return null;
const now = new Date();
const cur = now.getHours() * 60 + now.getMinutes();
for (const t of [...times].sort()) {
const [h, m] = t.split(":").map(Number);
if (h * 60 + m >= cur) return t;
}
return null;
}
type CheckPageProps = {
searchParams: Promise<{ route?: string }>;
};
export default async function CheckPage({ searchParams }: CheckPageProps) {
const sp = await searchParams;
const h = await headers();
const lang = langFromCookie(h.get("cookie"));
const T = (k: string, v?: Record<string, string | number>) => t(k, lang, v);
const { items: allRoutes } = await api.routes().catch(() => ({ items: [] as RouteListItem[] }));
const routeId =
sp.route && allRoutes.some((r) => r.route_id === sp.route)
? sp.route
: allRoutes[0]?.route_id;
let route: RouteDetail | null = null;
let schedules: Schedule[] = [];
let stops: RouteStop[] = [];
if (routeId) {
try {
[route, { items: schedules }, { items: stops }] = await Promise.all([
api.route(routeId),
api.schedules({ route_id: routeId }),
api.routeStops(routeId),
]);
} catch {
route = null;
schedules = [];
stops = [];
}
}
const allTimes = schedules.flatMap((s) => s.departure_times);
const next = nextTrip(allTimes);
const provinceSet = new Set(stops.map((s) => s.province_th).filter((x): x is string => !!x));
return (
<main className="page">
<VisitTracker path="/check" />
<div className="container">
<p className="breadcrumb">
<Link href="/">หน้าแรก</Link> / <span>เช็กเวลาเดินรถ</span>
</p>
</div>
<section className="hero hero--short">
<div className="hero__blob one" aria-hidden />
<div className="hero__blob two" aria-hidden />
<div className="hero__blob three" aria-hidden />
<div className="container hero__inner">
<span className="hero__badge">
<Icon name="clock" size={14} className="icon" /> {T("cta.check")}
</span>
<h1>
{T("check.title")}
<br />
<span className="hero__grad">{route?.name_th ?? (lang === "en" ? "Select a route below" : "เลือกสายรถด้านล่าง")}</span>
</h1>
<p className="hero__lead">{T("check.lead")}</p>
{allRoutes.length > 0 && (
<div className="check-selector">
<RouteSelect
routes={allRoutes.map((r) => ({ route_id: r.route_id, name_th: r.name_th }))}
current={routeId ?? ""}
to={(id) => `/check?route=${encodeURIComponent(id)}`}
/>
</div>
)}
</div>
</section>
<div className="container">
{/* สรุปเส้นทาง */}
<div className="check-stats">
<div className="check-stat"><b>{stops.length}</b><span>{T("check.kpiStops")}</span></div>
<div className="check-stat"><b>{provinceSet.size}</b><span>{T("check.kpiProvince")}</span></div>
<div className="check-stat"><b>{allTimes.length}</b><span>{T("check.kpiTrips")}</span></div>
<div className="check-stat"><b>{next ?? "—"}</b><span>{next ? T("check.kpiNext") : (lang === "en" ? "No trips today" : "ไม่มีรอบวันนี้")}</span></div>
</div>
{/* ตารางเวลาทุกจุดจอด */}
<section className="check-schedule">
<h2 className="section-title">
{T("check.scheduleAll")} {route ? `— ${lang === "en" ? "Route" : "สาย"} ${route.route_id}` : ""}
</h2>
{schedules.length === 0 ? (
<p className="muted">ยังไม่มีข้อมูลตารางเวลาสำหรับสายนี้</p>
) : (
<div className="schedule-list">
{schedules.map((s, i) => {
const tone = TONES[i % TONES.length];
return (
<article key={s.id} className={`schedule-card schedule-card--${tone}`}>
<span className="schedule-card__rail" aria-hidden />
<div className="schedule-card__head">
<div className={`schedule-card__route ${tone}`}>
<span>{s.station_name_th}</span>
<small>จุดต้นทาง</small>
</div>
<div className="schedule-card__meta">
<strong>{s.direction_note || "ทุกทิศทาง"}</strong>
{s.schedule_note && <span>{s.schedule_note}</span>}
</div>
</div>
{s.departure_times.length === 0 ? (
<span className="schedule-card__empty">— ยังไม่มีรอบ —</span>
) : (
<div className="schedule-card__times">
{s.departure_times.map((t, j) => (
<span key={`${s.id}-${j}`} className="schedule-card__time">
<Icon name="clock" size={13} className="icon" /> {t}
</span>
))}
</div>
)}
</article>
);
})}
</div>
)}
</section>
</div>
</main>
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
);
</> );
}
+6 -85
View File
@@ -1,89 +1,10 @@
<<<<<<< HEAD
import CreditsView from "@/components/views/CreditsView";
export const metadata = { title: "เครดิต" };
export const metadata = {
title: "เครดิต",
description: "แหล่งที่มาของข้อมูล รูปภาพ ฟอนต์ และซอฟต์แวร์ที่ใช้บนเว็บนี้",
alternates: { canonical: "/credits" },
};
export default function Page() {
return <CreditsView />;
=======
import { HERO_MAP } from "@/lib/images";
export default function CreditsPage() {
return (
<>
<section className="hero hero--short">
<img className="hero__map" src={HERO_MAP} alt="" aria-hidden="true" />
<div className="hero__blob one" aria-hidden />
<div className="hero__blob two" aria-hidden />
<div className="hero__blob three" aria-hidden />
<div className="container hero__inner">
<span className="hero__badge">เครดิต</span>
<h1>
เครดิตและแหล่งที่มา
<br />
<span className="hero__grad">ขอบคุณทุกทรัพยากร</span>
</h1>
<p className="hero__lead">รายการทรัพยากรทั้งหมดที่ใช้ในเว็บนี้ พร้อมใบอนุญาตตามข้อกำหนดของเจ้าของแต่ละราย</p>
</div>
</section>
<main className="main">
<div className="container credit-wrap">
<section className="credit-section">
<h2>ไอคอน — Lucide</h2>
<p className="src">
แหล่งที่มา: <a href="https://lucide.dev" rel="noopener">lucide.dev</a> · ใบอนุญาต:{" "}
<a href="https://github.com/lucide-icons/lucide/blob/main/LICENSE" rel="noopener">MIT License</a>
</p>
<ul>
<li>ไอคอนที่ใช้ทั้งหมด 15 รายการ: alarm-clock, arrow-right, bus, bus-front, check, clock, globe, hourglass, map, map-pin, message-circle, phone, refresh-cw, search, triangle-alert</li>
</ul>
<div className="license">
<strong>MIT License (สรุป):</strong> อนุญาตให้ใช้ คัดลอก แก้ไข ผสาน เผยแพร่ แจกจ่าย ขาย และ/หรือให้สิทธิ์ใช้งานซอฟต์แวร์นี้ โดยมีเงื่อนไขให้ข้อความแสดงลิขสิทธิ์และข้อความอนุญาตข้างต้นปรากฏอยู่ในสำเนาทั้งหมด ซอฟต์แวร์นี้ให้บริการ "ตามสภาพ" โดยไม่มีการรับประกันใด ๆ
</div>
</section>
<section className="credit-section">
<h2>ฟอนต์ — Google Fonts</h2>
<p className="src">
แหล่งที่มา: <a href="https://fonts.google.com" rel="noopener">fonts.google.com</a> · ใบอนุญาต:{" "}
<a href="https://openfontlicense.org" rel="noopener">SIL Open Font License 1.1</a>
</p>
<ul>
<li><strong>K2D</strong> — ฟอนต์หลักของเว็บ (เนื้อหา + หัวเรื่อง)</li>
<li><strong>Noto Sans Thai</strong> — ตัวสำรองเนื้อหา</li>
<li><strong>Prompt</strong> — ตัวสำรองหัวเรื่อง/ตัวหนา</li>
<li><strong>IBM Plex Mono</strong> — เวลา · เลขสาย · ตัวเลข</li>
</ul>
</section>
<section className="credit-section">
<h2>แผนที่</h2>
<p className="src">
ใบอนุญาต: Leaflet <a href="https://github.com/Leaflet/Leaflet/blob/main/LICENSE" rel="noopener">BSD-2-Clause</a> · ชุดแผนที่:{" "}
<a href="https://www.openstreetmap.org/copyright" rel="noopener">OpenStreetMap © ผู้มีส่วนร่วม (ODbL)</a>
</p>
<ul>
<li>Leaflet — ไลบรารีแผนที่แบบ open-source</li>
<li>OpenStreetMap — ภาพ tiles และข้อมูลแผนที่</li>
<li>เส้นทางเดินรถ จุดจอด และหมุดสถานี วาดจากข้อมูล GIS ของทีม (GeoJSON)</li>
</ul>
</section>
<section className="credit-section">
<h2>ขอขอบคุณภาพรถประจำทาง</h2>
<p className="src">ภาพรถโดยสารที่แสดงในหน้ารายละเอียดสาย มาจากแหล่งข้อมูลสาธารณะด้านล่างนี้</p>
<ul>
<li><strong>สาย 2194</strong> หัวเวียง-อยุธยา — จาก <a href="http://www.bangkokbusclub.com/cms/showthread.php?t=4968" rel="noopener">bangkokbusclub.com</a></li>
<li><strong>สาย 8</strong> กรุงเทพ-สรรคบุรี-ชัยนาท — จากกลุ่ม Facebook (web.facebook.com)</li>
<li><strong>สาย 954</strong> กรุงเทพ-ท่าช้าง — จาก <a href="https://gogo.town/route/bangkok-rangsit-angthong-thachang/" rel="noopener">gogo.town</a></li>
<li><strong>รถไฟฟ้าสายสีแดง</strong> กรุงเทพ-ชุมทางบ้านภาชี — จาก <a href="https://thelist.group" rel="noopener">thelist.group</a></li>
</ul>
<div className="license">และสายอื่น ๆ ที่ไม่ได้ระบุ ขอขอบคุณมา ณ ที่นี้</div>
</section>
</div>
</main>
</>
);
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
}
return <CreditsView />;}
+111 -50
View File
@@ -1,11 +1,29 @@
<<<<<<< HEAD
import type { Metadata } from "next";
import type { Metadata, Viewport } from "next";
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { SITE_URL, SITE_NAME, SITE_TITLE, SITE_DESCRIPTION, SITE_LOCALE, SITE_OG_IMAGE } from "@/lib/site";
import { SiteJsonLd } from "@/components/JsonLd";
/* รุ่นแอป — อ่านจาก public/version.json ตอน build
ใช้ฝังใน <html data-app-version> เพื่อให้ PwaBoot เทียบกับฝั่งเซิร์ฟเวอร์ได้ */
function readAppVersion(): string {
try {
const raw = readFileSync(join(process.cwd(), "public", "version.json"), "utf8");
return String(JSON.parse(raw).version || "");
} catch {
return "";
}
}
const APP_VERSION = readAppVersion();
import IconSprite from "@/components/IconSprite";
import PwaBoot from "@/components/PwaBoot";
import SiteBoot from "@/components/SiteBoot";
import MotionBoot from "@/components/MotionBoot";
import SiteFooter from "@/components/SiteFooter";
import SiteHeader from "@/components/SiteHeader";
// ลำดับ CSS ต้องตรงกับ mock: shared → map → shell → page → responsive
// ลำดับ CSS ต้องตรงกับ mock: shared → map → shell → responsive
import "@/styles/theme.css";
import "@/styles/_shared.css";
import "@/styles/map.css";
import "@/styles/shell.css";
@@ -14,78 +32,121 @@ import "@/styles/responsive.css";
// (router เดิม inject <style> ของ partial หลัง <link responsive.css>)
export const metadata: Metadata = {
title: {
default: "Atroute — สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง",
template: "Atroute — %s",
},
description:
"ศูนย์รวมข้อมูลตารางเดินรถ จุดจอด และเส้นทางในจังหวัดอ่างทองและจังหวัดใกล้เคียง",
manifest: "/ui-manifest.json",
icons: { icon: "/image/icons/minibus-512x512.png" },
=======
import "./globals.css";
import type { Metadata, Viewport } from "next";
import { headers } from "next/headers";
import { Header } from "@/components/Header";
import { Footer } from "@/components/Footer";
import { LangProvider } from "@/components/LangProvider";
import { langFromCookie } from "@/lib/i18n";
/* ฐาน URL — จำเป็นสำหรับ canonical / OG แบบ relative */
metadataBase: new URL(SITE_URL),
export const metadata: Metadata = {
title: "Atroute — สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง",
description:
"ค้นหาเส้นทาง ตารางเดินรถ และจุดจอดในจังหวัดอ่างทองและจังหวัดใกล้เคียง",
icons: {
icon: [{ url: "/images/icons/minibus-512x512.png", sizes: "512x512", type: "image/png" }],
apple: [{ url: "/images/icons/minibus-192x192.png", sizes: "192x192", type: "image/png" }],
title: {
default: SITE_TITLE,
template: `${SITE_NAME} — %s`,
},
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
description: SITE_DESCRIPTION,
keywords: [
"รถโดยสารอ่างทอง",
"ตารางเดินรถ",
"ป้ายหยุดรถ",
"สายรถ",
"สถานีขนส่งอ่างทอง",
"เวลาเดินรถ",
"bus schedule Ang Thong",
],
applicationName: SITE_NAME,
/* canonical — กัน duplicate content */
alternates: { canonical: "/" },
/* ให้บอทเก็บหน้าและรูป */
robots: {
index: true,
follow: true,
googleBot: {
index: true,
follow: true,
"max-image-preview": "large",
"max-snippet": -1,
"max-video-preview": -1,
},
},
/* การ์ดแชร์ (LINE / Facebook / X / Telegram) */
openGraph: {
type: "website",
siteName: SITE_NAME,
title: SITE_TITLE,
description: SITE_DESCRIPTION,
locale: SITE_LOCALE,
url: "/",
images: [
{
url: SITE_OG_IMAGE,
width: 1200,
height: 630,
alt: SITE_TITLE,
},
],
},
twitter: {
card: "summary_large_image",
title: SITE_TITLE,
description: SITE_DESCRIPTION,
images: [SITE_OG_IMAGE],
},
manifest: "/ui-manifest.json",
icons: {
icon: [
{ url: "/image/icons/minibus-512x512.png", sizes: "512x512", type: "image/png" },
{ url: "/image/icons/minibus-192x192.png", sizes: "192x192", type: "image/png" },
],
apple: [{ url: "/image/icons/minibus-192x192.png", sizes: "192x192", type: "image/png" }],
},
appleWebApp: {
capable: true,
title: "Atroute",
statusBarStyle: "default",
},
formatDetection: { telephone: false, address: false, email: false },
};
export const viewport: Viewport = {
themeColor: "#7a4cc0",
width: "device-width",
initialScale: 1,
// ห้าม maximumScale:1 / userScalable:false — ปิดการซูมจะไม่ผ่าน WCAG 1.4.4
maximumScale: 5,
viewportFit: "cover",
interactiveWidget: "resizes-content",
};
export default async function RootLayout({ children }: { children: React.ReactNode }) {
const h = await headers();
const lang = langFromCookie(h.get("cookie"));
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang={lang}>
<html lang="th" data-app-version={APP_VERSION}>
<head>
<<<<<<< HEAD
{/* ฟอนต์ K2D ฝังในโปรเจกต์ + Leaflet CSS (ไฟล์ static ใน public) */}
<link rel="stylesheet" href="/vendor/fonts/k2d.css" />
<link rel="stylesheet" href="/vendor/leaflet/leaflet.css" />
=======
{/* K2D (offline, local woff2 — ตรงกับ design) + Noto/Prompt fallback (CDN) */}
<link rel="stylesheet" href="/fonts/k2d.css" />
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700;800&family=Prompt:wght@400;500;600;700&display=swap"
/>
<meta name="theme-color" content="#7a4cc0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link rel="apple-touch-icon" href="/image/icons/minibus-192x192.png" />
{/* theme-color / apple-touch-icon / apple-mobile-web-app-* / mobile-web-app-capable
ถูก emit อัตโนมัติจาก metadata.appleWebApp + metadata.icons + viewport.themeColor
— อย่าใส่ซ้ำที่นี่ (จะได้ meta ซ้ำ 2 ชุด) */}
{/* ตั้งธีมก่อนวาดหน้าจอ (กันจอขาววูบตอนเปิดแอปในโหมดมืด) */}
<script
dangerouslySetInnerHTML={{
__html: `(function(){try{var m=localStorage.getItem('at_theme')||'auto';var d=window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches;var r=m==='auto'?(d?'dark':'light'):m;document.documentElement.dataset.theme=r;document.documentElement.dataset.themeMode=m;document.documentElement.style.colorScheme=r;}catch(e){}})();`,
}}
/>
<script src="/vendor/leaflet/leaflet.js" defer />
</head>
<<<<<<< HEAD
<body className="main-theme-page">
<SiteJsonLd />
<IconSprite />
<SiteHeader />
<div id="view">{children}</div>
<SiteFooter />
<SiteBoot />
=======
<body>
<LangProvider initial={lang}>
<Header />
{children}
<Footer />
</LangProvider>
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
<MotionBoot />
<PwaBoot />
</body>
</html>
);
+1 -61
View File
@@ -1,4 +1,3 @@
<<<<<<< HEAD
import HomeView from "@/components/views/HomeView";
import PageRuntime from "@/components/PageRuntime";
@@ -19,65 +18,6 @@ export default async function Page({
return (
<>
<HomeView />
<PageRuntime page="home" query={query} />
=======
import { api, type RouteListItem, type Schedule } from "@/lib/api";
import { VisitTracker } from "@/lib/visit-tracker";
import HomeClient from "@/components/HomeClient";
export default async function HomePage({
searchParams,
}: {
searchParams: Promise<{ p?: string; s?: string }>;
}) {
const sp = await searchParams;
const [groupsRes, routesRes, schedRes, provRes, stopsRes] = await Promise.allSettled([
api.routeGroups(),
api.routes(),
api.schedules({}),
api.provinces(),
api.stops(),
]);
const groups = groupsRes.status === "fulfilled" ? groupsRes.value.items : [];
const routes: RouteListItem[] = routesRes.status === "fulfilled" ? routesRes.value.items : [];
const schedules: Schedule[] = schedRes.status === "fulfilled" ? schedRes.value.items : [];
const provinces = provRes.status === "fulfilled" ? provRes.value.items : [];
const stops = stopsRes.status === "fulfilled" ? stopsRes.value.items : [];
// route_id -> all departure times
const timesByRoute: Record<string, string[]> = {};
for (const s of schedules) {
(timesByRoute[s.route_id] ??= []).push(...s.departure_times);
}
// route_id -> station ids (for station-level filtering)
const routeStations: Record<string, number[]> = {};
await Promise.all(
routes.map(async (r) => {
const { items } = await api.routeStops(r.route_id).catch(() => ({ items: [] }));
routeStations[r.route_id] = items.map((x) => x.station_id);
}),
);
const initialProvinceId = sp.p ? Number(sp.p) || undefined : undefined;
const initialStationCode = sp.s ?? undefined;
return (
<>
<VisitTracker path="/" />
<HomeClient
groups={groups}
routes={routes}
timesByRoute={timesByRoute}
provinces={provinces}
stops={stops}
routeStations={routeStations}
initialProvinceId={initialProvinceId}
initialStationCode={initialStationCode}
/>
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
</>
<PageRuntime page="home" query={query} /> </>
);
}
+24
View File
@@ -0,0 +1,24 @@
import type { MetadataRoute } from "next";
import { SITE_URL, DISALLOW_PATHS } from "@/lib/site";
/**
* robots.txt — บอกบอท Google / Bing / Brave / DuckDuckGo ว่าอะไรเก็บได้
*
* หมายเหตุ: DuckDuckGo ใช้ index ของ Bing เป็นหลัก, Brave ใช้ index ของตัวเอง
* ทั้งคู่เคารพ robots.txt มาตรฐานเดียวกัน
*/
export default function robots(): MetadataRoute.Robots {
return {
rules: [
{
userAgent: "*",
allow: "/",
disallow: DISALLOW_PATHS,
},
/* บอทสำคัญ — อนุญาตชัดเจน */
{ userAgent: ["Googlebot", "Bingbot", "DuckDuckBot", "Bravebot", "Applebot"], allow: "/", disallow: DISALLOW_PATHS },
],
sitemap: `${SITE_URL}/sitemap.xml`,
host: SITE_URL,
};
}
+51 -345
View File
@@ -1,357 +1,63 @@
<<<<<<< HEAD
import RouteView from "@/components/views/RouteView";
import PageRuntime from "@/components/PageRuntime";
=======
import Link from "next/link";
import { notFound } from "next/navigation";
import {
api,
isApiNotFoundError,
type RouteDetail,
type RouteStop,
type StopListItem,
type Schedule,
type RouteListItem,
} from "@/lib/api";
import LazyMapView from "@/components/LazyMapView";
import { RouteSelect } from "@/components/RouteSelect";
import { VisitTracker } from "@/lib/visit-tracker";
import { routePhoto } from "@/lib/images";
import { routePath } from "@/lib/geojson";
import { captionFor } from "@/lib/captions";
import { kmFor } from "@/lib/stop-km";
import { Icon } from "@/components/Icons";
import { headers } from "next/headers";
import { t, langFromCookie } from "@/lib/i18n";
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
import { BusRouteJsonLd, BreadcrumbJsonLd } from "@/components/JsonLd";
import { SITE_NAME } from "@/lib/site";
import { api } from "@/lib/api";
import type { Metadata } from "next";
export const metadata = { title: "รายละเอียดสายรถ" };
type Params = { params: Promise<{ routeId: string }> };
<<<<<<< HEAD
export default async function Page({ params }: { params: Promise<{ routeId: string }> }) {
async function loadRoute(id: string) {
try {
return await api.route(decodeURIComponent(id));
} catch {
return null;
}
}
export async function generateMetadata({ params }: Params): Promise<Metadata> {
const { routeId } = await params;
const r = await loadRoute(routeId);
if (!r) {
return { title: "รายละเอียดสายรถ", alternates: { canonical: `/routes/${routeId}` } };
}
const title = `สาย ${r.route_id} ${r.name_th || ""}`.trim();
const description =
`สาย ${r.route_id} ${r.name_th || ""} — เส้นทาง จุดจอดหลัก และเวลาเดินรถ ตารางเที่ยวจาก ${SITE_NAME}`;
return {
title,
description,
alternates: { canonical: `/routes/${encodeURIComponent(r.route_id)}` },
openGraph: { type: "article", title, description, url: `/routes/${encodeURIComponent(r.route_id)}` },
};
}
export default async function Page({ params }: Params) {
const { routeId } = await params;
const r = await loadRoute(routeId);
return (
<>
{r ? (
<>
<BreadcrumbJsonLd
items={[
{ name: "หน้าแรก", path: "/" },
{ name: "สายรถ", path: "/routes" },
{ name: `สาย ${r.route_id}`, path: `/routes/${r.route_id}` },
]}
/>
<BusRouteJsonLd
routeId={String(r.route_id)}
name={r.name_th || ""}
provinces={r.province_ids?.length ?? undefined}
/>
</>
) : null}
<RouteView />
<PageRuntime page="route" params={{ routeId: decodeURIComponent(routeId) }} />
</>
=======
type RouteDetailPageProps = {
params: Promise<{ routeId: string }>;
};
/** เที่ยวถัดไป = รอบแรกที่ยังไม่ผ่านของสายนี้ */
function nextTrip(schedules: Schedule[]): string | null {
const all = schedules.flatMap((s) => s.departure_times);
if (all.length === 0) return null;
const now = new Date();
const cur = now.getHours() * 60 + now.getMinutes();
for (const t of [...all].sort()) {
const [h, m] = t.split(":").map(Number);
if (h * 60 + m >= cur) return t;
}
return null;
}
export default async function RouteDetailPage({ params }: RouteDetailPageProps) {
const { routeId } = await params;
const h = await headers();
const lang = langFromCookie(h.get("cookie"));
const T = (k: string, v?: Record<string, string | number>) => t(k, lang, v);
let route: RouteDetail | null = null;
let stops: RouteStop[] = [];
let schedules: Schedule[] = [];
let allStops: StopListItem[] = [];
let allRoutes: RouteListItem[] = [];
try {
[route, { items: stops }, { items: schedules }, { items: allStops }, { items: allRoutes }] =
await Promise.all([
api.route(routeId),
api.routeStops(routeId),
api.schedules({ route_id: routeId }),
api.stops(),
api.routes(),
]);
} catch (error) {
if (isApiNotFoundError(error)) {
notFound();
}
route = null;
stops = [];
schedules = [];
allStops = [];
allRoutes = [];
}
if (!route) {
return (
<main className="page">
<VisitTracker path={`/routes/${routeId}`} />
<section className="hero">
<h1>ไม่สามารถโหลดข้อมูลเส้นทางได้</h1>
<p className="muted">ระบบยังเปิดอยู่ แต่ backend ตอบกลับไม่ได้ในตอนนี้</p>
<Link href="/routes">กลับไปหน้าสายรถ</Link>
</section>
</main>
);
}
const coordById = new Map<number, { lat: number; lng: number }>();
for (const s of allStops) {
if (s.lat != null && s.lng != null) coordById.set(s.id, { lat: s.lat, lng: s.lng });
}
const mapPoints = stops
.map((s) => {
const c = coordById.get(s.station_id);
if (!c) return null;
return {
id: s.station_id,
lat: c.lat,
lng: c.lng,
label: s.name_th,
code: s.code,
sequence: s.stop_sequence,
};
})
.filter((x): x is NonNullable<typeof x> => x !== null);
const stopPath: [number, number][] = mapPoints.map((p) => [p.lat, p.lng]);
const path: [number, number][] = routePath(route.route_id) ?? stopPath;
const provinceSet = new Set(stops.map((s) => s.province_th).filter((x): x is string => !!x));
const photo = routePhoto(route.route_id, "car") ?? routePhoto(route.route_id, "hero");
const cap = captionFor(route.route_id);
const next = nextTrip(schedules);
// ติดต่อผู้ประกอบการ (จาก design routes.json)
const contact = (route.contact ?? {}) as {
phones?: { label?: string; number: string }[];
web_url?: string;
};
const phones = Array.isArray(contact.phones) ? contact.phones : [];
const lineUrl = typeof contact.web_url === "string" ? contact.web_url : "";
const qr = cap?.qr ?? "";
return (
<main className="page">
<VisitTracker path={`/routes/${routeId}`} />
<div className="container">
<p className="breadcrumb">
<Link href="/">หน้าแรก</Link> / <Link href="/routes">รายละเอียดสายรถ</Link> /{" "}
<span>{route.route_id}</span>
</p>
</div>
<section className="page-hero page-hero--alt route-hero">
<span className="page-hero__blob page-hero__blob--a" aria-hidden />
<span className="page-hero__blob page-hero__blob--b" aria-hidden />
<span className="page-hero__blob page-hero__blob--c" aria-hidden />
<div className="route-hero__top">
<div className="route-hero__badge">{route.route_id}</div>
<div className="route-hero__title-wrap">
<div className="route-hero__chips">
<span className="chip-soft chip-soft--purple">{route.route_group_label_th || route.route_group_code}</span>
<span className="chip-soft chip-soft--sky">{route.vehicle_type}</span>
{provinceSet.size > 0 && (
<span className="chip-soft chip-soft--mint">{provinceSet.size} จังหวัด</span>
)}
</div>
<h1 className="page-hero__title">
<span className="page-hero__title-grad">{route.name_th}</span>
</h1>
<p className="page-hero__subtitle">
เส้นทางหมายเลข {route.route_id} · ผ่าน {stops.length} จุดจอด · {schedules.length} รอบเวลา
</p>
</div>
</div>
<div className="page-hero__stats">
<span className="page-hero__stat"><b>{stops.length}</b> จุดจอด</span>
<span className="page-hero__stat"><b>{schedules.length}</b> รอบเวลา</span>
<span className="page-hero__stat"><b>{provinceSet.size}</b> จังหวัด</span>
<span className="page-hero__stat">
<b>{next ?? "—"}</b> {next ? "รอบถัดไป" : "ไม่มีรอบวันนี้"}
</span>
</div>
<div className="route-hero__actions">
<Link href="/routes" className="route-hero__back">← กลับสายทั้งหมด</Link>
</div>
</section>
<div className="container">
{/* เลือกสายรถ (จาก design: route-select) */}
<div className="toolbar">
<RouteSelect
routes={allRoutes.map((r) => ({ route_id: r.route_id, name_th: r.name_th }))}
current={route.route_id}
/>
</div>
{/* รถประจำสาย + ติดต่อผู้ประกอบการ (การ์ดเดียว) */}
{(photo || cap || qr || phones.length > 0 || lineUrl) && (
<section className="vehicle-card" aria-label="รถประจำสายและติดต่อผู้ประกอบการ">
{photo && (
<img className="vehicle-card__img" src={photo} alt={`รถของสาย ${route.route_id}`} />
)}
<div className="vehicle-card__meta">
<p className="vehicle-card__label">{T("route.vehicle")}</p>
{cap?.vehicle_title && <h2>{cap.vehicle_title}</h2>}
{cap?.vehicle_desc && <p>{cap.vehicle_desc}</p>}
{!cap?.vehicle_title && !cap?.vehicle_desc && (
<p className="muted">สาย {route.route_id} · {route.vehicle_type}</p>
)}
</div>
<div className="vehicle-card__contact">
{qr && (
<a className="contact-item contact-item--qr" href={lineUrl || "#"} target="_blank" rel="noopener">
<img className="qr-img" src={qr} alt={`QR ติดตามสาย ${route.route_id}`} />
<span className="txt"><strong>สแกนติดตาม</strong><span>LINE / กลุ่มข่าวสาย</span></span>
</a>
)}
{phones.map((p, i) => (
<a key={i} className="contact-item" href={`tel:${p.number.replace(/\s/g, "")}`}>
<span className="ic-wrap"><Icon name="phone" size={20} /></span>
<span className="txt"><strong>{p.label || "โทร"}</strong><span>{p.number}</span></span>
</a>
))}
{lineUrl && (
<a className="contact-item" href={lineUrl} target="_blank" rel="noopener">
<span className="ic-wrap tone-green"><Icon name="message-circle" size={20} /></span>
<span className="txt"><strong>LINE</strong><span>ติดตามข่าวสารสาย</span></span>
</a>
)}
</div>
</section>
)}
{/* แผนที่เส้นทาง + จุดจอดตามเส้นทาง */}
<section className="route-map-section">
<div className="route-map-section__head">
<h2 className="section-title">{T("route.mapTitle")}</h2>
<span className="route-map-section__legend">
<span><i className="dot dot--start" /> ต้นทาง</span>
<span><i className="dot dot--mid" /> จุดผ่าน</span>
<span><i className="dot dot--end" /> ปลายทาง</span>
</span>
</div>
{mapPoints.length >= 1 ? (
<div className="map-wrap map-wrap--soft route-map">
<LazyMapView points={mapPoints} path={path} />
</div>
) : (
<p className="muted route-map-empty">— ยังไม่มีพิกัดสำหรับจุดจอดของสายนี้ —</p>
)}
{stops.length > 0 && (
<div className="km-wrap">
<h3 className="km-wrap__title">{T("map.alongRoute")}</h3>
<ol className="km-list">
{stops.map((s) => {
const km = kmFor(route.route_id, s.station_id);
return (
<li key={s.station_id}>
<span className="km-list__num">{km != null ? km.toFixed(1) : s.stop_sequence}</span>
<span className="km-list__name">{s.name_th}</span>
<span className="km-list__loc">{km != null ? "กม." : s.city_th ?? ""}</span>
</li>
);
})}
</ol>
</div>
)}
</section>
{/* จุดจอดตามลำดับ (รายละเอียด) */}
<section>
<h2 className="section-title">{T("route.stopsTitle")} ({stops.length})</h2>
<ol className="stop-timeline">
{stops.map((s, i) => {
const tone = TONES[i % TONES.length];
const isStart = i === 0;
const isEnd = i === stops.length - 1;
const hasCoord = coordById.has(s.station_id);
const stopHref = s.code ? `/stops/${encodeURIComponent(s.code)}` : null;
return (
<li key={s.station_id} className={`stop-node stop-node--${tone}`}>
<span className="stop-node__line" aria-hidden />
<span className={`stop-node__bullet ${isStart ? "is-start" : isEnd ? "is-end" : ""}`}>
{s.stop_sequence}
</span>
<div className="stop-node__body">
<div className="stop-node__head">
{stopHref ? (
<Link href={stopHref} className="stop-node__title">{s.name_th}</Link>
) : (
<span className="stop-node__title">{s.name_th}</span>
)}
{isStart && <span className="chip-soft chip-soft--mint">ต้นทาง</span>}
{isEnd && <span className="chip-soft chip-soft--pink">ปลายทาง</span>}
</div>
<div className="stop-node__meta">
<span className="chip-soft chip-soft--sky">{s.station_type}</span>
{(s.city_th || s.province_th) && (
<span className="stop-node__loc">
<Icon name="map-pin" size={13} className="icon" /> {[s.city_th, s.province_th].filter(Boolean).join(" · ")}
</span>
)}
{!hasCoord && <span className="stop-node__warn">ไม่มีพิกัดบนแผนที่</span>}
</div>
</div>
{stopHref ? (
<Link href={stopHref} className="stop-node__arrow" aria-label="ดูจุดจอด">→</Link>
) : (
<span className="stop-node__arrow" aria-hidden>→</span>
)}
</li>
);
})}
</ol>
</section>
{/* ตารางเวลา */}
<section>
<h2 className="section-title">{T("route.scheduleTitle")} ({schedules.length})</h2>
{schedules.length === 0 ? (
<p className="muted">ยังไม่มีข้อมูลตารางเวลา</p>
) : (
<div className="schedule-list">
{schedules.map((s, i) => {
const tone = TONES[i % TONES.length];
return (
<article key={s.id} className={`schedule-card schedule-card--${tone}`}>
<span className="schedule-card__rail" aria-hidden />
<div className="schedule-card__head">
<div className={`schedule-card__route ${tone}`}>
<span>{s.station_name_th}</span>
<small>จุดต้นทาง</small>
</div>
<div className="schedule-card__meta">
<strong>{s.direction_note || "ทุกทิศทาง"}</strong>
{s.schedule_note && <span>{s.schedule_note}</span>}
</div>
</div>
{s.departure_times.length === 0 ? (
<span className="schedule-card__empty">— ยังไม่มีรอบ —</span>
) : (
<div className="schedule-card__times">
{s.departure_times.map((t, j) => (
<span key={`${s.id}-${j}`} className="schedule-card__time"><Icon name="clock" size={13} className="icon" /> {t}</span>
))}
</div>
)}
</article>
);
})}
</div>
)}
</section>
</div>
</main>
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
);
}
+6 -79
View File
@@ -1,88 +1,15 @@
<<<<<<< HEAD
import RouteView from "@/components/views/RouteView";
import PageRuntime from "@/components/PageRuntime";
=======
import Link from "next/link";
import { api } from "@/lib/api";
import { VisitTracker } from "@/lib/visit-tracker";
import { Icon } from "@/components/Icons";
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
export const metadata = { title: "รายละเอียดสายรถ" };
export const metadata = {
title: "รายละเอียดสายรถ",
description: "รวมสายรถโดยสารทุกเส้นทางในจังหวัดอ่างทอง พร้อมจุดจอดหลักและตารางเดินรถ",
alternates: { canonical: "/routes" },
};
export default function Page() {
return (
<<<<<<< HEAD
<>
<RouteView />
<PageRuntime page="route" />
</>
=======
<main className="page">
<VisitTracker path="/routes" />
<section className="page-hero page-hero--alt">
<div className="page-hero__blob page-hero__blob--a" />
<div className="page-hero__blob page-hero__blob--b" />
<div className="page-hero__blob page-hero__blob--c" />
<div className="page-hero__inner">
<span className="page-hero__badge"><Icon name="bus" size={13} className="icon" /> ROUTE NETWORK</span>
<h1 className="page-hero__title">
เส้นทางเดินรถ<span className="page-hero__title-grad">ทั้งหมด</span>
</h1>
<p className="page-hero__subtitle">
{group ? `กรองหมวด: ${group}` : "ครอบคลุมทุกหมวด"}
{province ? ` · จังหวัด #${province}` : ""}
</p>
<div className="page-hero__stats">
<span className="page-hero__stat"><b>{items.length}</b> เส้นทาง</span>
<span className="page-hero__stat"><b>{Object.keys(groupCounts).length}</b> หมวด</span>
</div>
</div>
</section>
<div className="toolbar">
<div className="toolbar__search">
<Icon name="search" size={16} className="icon" />
<input placeholder="ค้นหาเลขสาย หรือชื่อเส้นทาง…" disabled />
</div>
<div className="toolbar__chips">
{Object.entries(groupCounts).map(([code, { label, n }]) => (
<span key={code} className={`chip-soft chip-soft--${GROUP_TONE[code] ?? "sky"}`}>
{label} · {n}
</span>
))}
</div>
</div>
<div className="tile-grid">
{items.map((r, i) => {
const tone = GROUP_TONE[r.route_group_code] ?? TONES[i % TONES.length];
return (
<Link
key={r.route_id}
href={`/routes/${encodeURIComponent(r.route_id)}`}
className={`tile tile--${tone}`}
>
<div className={`tile__badge tile__badge--${tone} tile__badge--num`}>
<span>{r.route_id}</span>
</div>
<div className="tile__body">
<p className="tile__title">{r.name_th}</p>
<p className="tile__meta">{r.route_group_label_th || r.route_group_code}</p>
<div className="tile__chips">
<span className={`chip-soft chip-soft--${tone}`}>
{r.route_group_label_th || r.route_group_code}
</span>
<span className="chip-soft chip-soft--mint"><Icon name="bus" size={13} className="icon" /> {r.vehicle_type}</span>
</div>
</div>
<span className="tile__arrow" aria-hidden>→</span>
</Link>
);
})}
</div>
</main>
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
);
</> );
}
+69
View File
@@ -0,0 +1,69 @@
import type { MetadataRoute } from "next";
import { SITE_URL, STATIC_PAGES } from "@/lib/site";
import { api } from "@/lib/api";
/**
* sitemap.xml — สร้างอัตโนมัติจากข้อมูลจริงใน backend
*
* ถ้า backend ล่ม อย่าให้ sitemap ล่ม → fallback เป็นหน้าคงที่
* (บอทจะได้ไม่เจอ 500 แล้วเลิก crawl)
*/
export const revalidate = 3600; /* สร้างใหม่ทุกชั่วโมง */
type Entry = {
url: string;
lastModified?: Date | string;
changeFrequency?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
priority?: number;
};
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const now = new Date();
const entries: Entry[] = STATIC_PAGES.map((p) => ({
url: SITE_URL + p.path,
lastModified: now,
changeFrequency: p.changeFrequency,
priority: p.priority,
}));
try {
const { items: routes } = await api.routes();
for (const r of routes) {
const id = String((r as { route_id?: string | number }).route_id ?? "");
if (!id) continue;
entries.push({
url: `${SITE_URL}/routes/${encodeURIComponent(id)}`,
lastModified: now,
changeFrequency: "weekly",
priority: 0.8,
});
/* หน้าเช็กเวลาเดินรถของสายเดียวกัน */
entries.push({
url: `${SITE_URL}/check/${encodeURIComponent(id)}`,
lastModified: now,
changeFrequency: "daily",
priority: 0.7,
});
}
} catch {
/* backend ไม่ตอบ — ปล่อยให้มีเฉพาะหน้าคงที่ */
}
try {
const { items: stops } = await api.stops();
for (const s of stops) {
const code = String((s as { station_code?: string }).station_code ?? "");
if (!code) continue;
entries.push({
url: `${SITE_URL}/stops/${encodeURIComponent(code)}`,
lastModified: now,
changeFrequency: "weekly",
priority: 0.6,
});
}
} catch {
/* backend ไม่ตอบ */
}
return entries as MetadataRoute.Sitemap;
}
+13
View File
@@ -0,0 +1,13 @@
import StatsView from "@/components/views/StatsView";
export const metadata = {
title: "สถิติการค้นหา",
description:
"สถิติการค้นหาและหน้าเว็บที่ถูกเปิด — เก็บในเบราว์เซอร์นี้เท่านั้น ไม่มีคุกกี้ ไม่ระบุตัวตน",
alternates: { canonical: "/stats" },
robots: { index: false, follow: true },
};
export default function Page() {
return <StatsView />;
}
+57 -2
View File
@@ -1,12 +1,67 @@
import StopView from "@/components/views/StopView";
import PageRuntime from "@/components/PageRuntime";
import { BusStopJsonLd, BreadcrumbJsonLd } from "@/components/JsonLd";
import { SITE_NAME, SITE_DESCRIPTION } from "@/lib/site";
import { api } from "@/lib/api";
import type { Metadata } from "next";
export const metadata = { title: "รายละเอียดป้าย" };
type Params = { params: Promise<{ code: string }> };
export default async function Page({ params }: { params: Promise<{ code: string }> }) {
/** ดึงข้อมูลป้าย (ทน backend ล่ม — คืน null) */
async function loadStop(code: string) {
try {
return await api.stop(decodeURIComponent(code));
} catch {
return null;
}
}
export async function generateMetadata({ params }: Params): Promise<Metadata> {
const { code } = await params;
const stop = await loadStop(code);
if (!stop) {
return { title: "รายละเอียดป้าย", alternates: { canonical: `/stops/${code}` } };
}
const name = stop.name_th || stop.name_en || `ป้าย ${code}`;
const place = [stop.city_th, stop.province_th].filter(Boolean).join(" · ");
const title = `${name} (${code})`;
const description = place
? `${name} ${place} — สายรถที่ผ่าน จุดจอด และเวลาเดินรถถัดไป ดูได้ที่ ${SITE_NAME}`
: `${name} — สายรถที่ผ่าน จุดจอด และเวลาเดินรถ ดูได้ที่ ${SITE_NAME}`;
return {
title,
description,
alternates: { canonical: `/stops/${encodeURIComponent(stop.code || code)}` },
openGraph: { type: "article", title, description, url: `/stops/${encodeURIComponent(stop.code || code)}` },
};
}
export default async function Page({ params }: Params) {
const { code } = await params;
const stop = await loadStop(code);
return (
<>
{stop ? (
<>
<BreadcrumbJsonLd
items={[
{ name: "หน้าแรก", path: "/" },
{ name: "ป้ายหยุดรถ", path: "/stops" },
{ name: stop.name_th || `ป้าย ${code}`, path: `/stops/${stop.code}` },
]}
/>
<BusStopJsonLd
name={stop.name_th || stop.name_en || `ป้าย ${code}`}
code={stop.code || code}
city={stop.city_th}
province={stop.province_th}
lat={stop.lat}
lng={stop.lng}
/>
</>
) : null}
<StopView />
<PageRuntime page="stop" params={{ code: decodeURIComponent(code) }} />
</>
+6 -155
View File
@@ -1,165 +1,16 @@
<<<<<<< HEAD
import StopsView from "@/components/views/StopsView";
import PageRuntime from "@/components/PageRuntime";
export const metadata = { title: "ป้ายหยุดรถ" };
export const metadata = {
title: "ป้ายหยุดรถ",
description: "ค้นหาป้ายหยุดรถด้วยรหัส หรือค้นหาตามชื่อ จังหวัด และเส้นทางที่ผ่าน",
alternates: { canonical: "/stops" },
};
export default function Page() {
return (
<>
<StopsView />
<PageRuntime page="stops" />
</>
=======
import Link from "next/link";
import { api } from "@/lib/api";
import LazyMapView from "@/components/LazyMapView";
import { VisitTracker } from "@/lib/visit-tracker";
import { Icon, type IconName } from "@/components/Icons";
import { StopSearch } from "@/components/StopSearch";
const TONES = ["sky", "purple", "pink", "mint", "amber"] as const;
const TYPE_TONE: Record<string, (typeof TONES)[number]> = {
main_terminal: "purple",
local_stop: "sky",
market: "pink",
private_stop: "amber",
other: "mint",
};
const TYPE_ICON: Record<string, IconName> = {
main_terminal: "bus-front",
local_stop: "map-pin",
market: "store",
private_stop: "bus",
other: "map-pin",
};
const TYPE_LABEL: Record<string, string> = {
main_terminal: "สถานีขนส่ง",
local_stop: "ป้ายหลัก",
market: "ตลาด/ชุมชน",
private_stop: "จุดรับส่ง",
other: "อื่น ๆ",
};
export default async function StopsPage({
searchParams,
}: {
searchParams: Promise<{ q?: string }>;
}) {
const sp = await searchParams;
const q = sp.q ?? "";
const { items } = await api.stops(q ? { q } : {}).catch(() => ({ items: [] }));
const points = items
.filter((s) => s.lat != null && s.lng != null)
.map((s) => ({ id: s.id, lat: s.lat as number, lng: s.lng as number, label: s.name_th, code: s.code }));
const typeCounts = items.reduce<Record<string, number>>((acc, s) => {
acc[s.station_type] = (acc[s.station_type] ?? 0) + 1;
return acc;
}, {});
return (
<main className="page">
<VisitTracker path="/stops" />
<div className="container">
<p className="breadcrumb">
<Link href="/">หน้าแรก</Link> / <span>ป้ายหยุดรถ</span>
</p>
</div>
<section className="page-hero">
<div className="page-hero__blob page-hero__blob--a" />
<div className="page-hero__blob page-hero__blob--b" />
<div className="page-hero__blob page-hero__blob--c" />
<div className="page-hero__inner">
<span className="page-hero__badge"><Icon name="map-pin" size={13} className="icon" /> STOP DIRECTORY</span>
<h1 className="page-hero__title">
จุดจอด<span className="page-hero__title-grad">ทั่วประเทศ</span>
</h1>
<p className="page-hero__subtitle">
ค้นหาป้าย / สถานีขนส่ง พร้อมแผนที่และเส้นทางที่ผ่าน
</p>
<div className="page-hero__stats">
<span className="page-hero__stat"><b>{items.length}</b> จุดจอด</span>
<span className="page-hero__stat"><b>{points.length}</b> มีพิกัด</span>
<span className="page-hero__stat"><b>{Object.keys(typeCounts).length}</b> ประเภท</span>
</div>
</div>
</section>
<div className="container">
{points.length > 0 && !q && (
<div className="map-wrap map-wrap--soft">
<LazyMapView points={points} />
</div>
)}
{/* ค้นหาป้ายทางหลวง: รหัส 5 หลัก + ชื่อสถานที่ + ป้ายใกล้ฉัน */}
<StopSearch />
<div className="toolbar">
<form className="toolbar__search" action="/stops" method="get" role="search">
<Icon name="search" size={16} className="icon" />
<input name="q" placeholder="ค้นหาชื่อป้าย หรือจังหวัด…" defaultValue={q} />
{q && (
<Link className="toolbar__clear" href="/stops" aria-label="ล้างคำค้นหา">✕</Link>
)}
<button type="submit" className="toolbar__submit">ค้นหา</button>
</form>
<div className="toolbar__chips">
{Object.entries(typeCounts).map(([t, n]) => (
<span key={t} className={`chip-soft chip-soft--${TYPE_TONE[t] ?? "sky"}`}>
<Icon name={TYPE_ICON[t] ?? "map-pin"} size={13} className="icon" /> {TYPE_LABEL[t] ?? t} · {n}
</span>
))}
</div>
</div>
{items.length === 0 ? (
<p className="muted">ไม่พบป้ายที่ตรงกับ “{q}”</p>
) : (
<div className="tile-grid">
{items.map((s, i) => {
const tone = TYPE_TONE[s.station_type] ?? TONES[i % TONES.length];
const icon = TYPE_ICON[s.station_type] ?? "map-pin";
const place = [s.city_th, s.province_th].filter(Boolean).join(" · ");
const stopHref = s.code ? `/stops/${encodeURIComponent(s.code)}` : null;
const body = (
<>
<div className={`tile__badge tile__badge--${tone}`}>
<Icon name={icon} size={26} />
</div>
<div className="tile__body">
<p className="tile__title">{s.name_th}</p>
<p className="tile__meta">{place || "—"}</p>
<div className="tile__chips">
<span className={`chip-soft chip-soft--${tone}`}>
{TYPE_LABEL[s.station_type] ?? s.station_type}
</span>
{s.lat != null && s.lng != null && (
<span className="chip-soft chip-soft--mint"><Icon name="map-pin" size={13} className="icon" /> บนแผนที่</span>
)}
</div>
</div>
<span className="tile__arrow" aria-hidden>→</span>
</>
);
return stopHref ? (
<Link key={s.id} href={stopHref} className={`tile tile--${tone}`}>
{body}
</Link>
) : (
<div key={s.id} className={`tile tile--${tone} tile--disabled`}>
{body}
</div>
);
})}
</div>
)}
</div>
</main>
>>>>>>> 1526c5b6d06989ba2d865f6df4d339d680dbd3f8
);
</> );
}
+148
View File
@@ -0,0 +1,148 @@
/**
* JSON-LD (structured data) — ให้บอทเข้าใจว่าเว็บนี้คืออะไร
*
* ทำไมสำคัญ
* Google / Bing / Brave อ่าน JSON-LD เพื่อสร้าง rich result
* (sitelinks searchbox, breadcrumb, ชื่อเว็บใต้ลิงก์)
* DuckDuckGo อ่านผ่าน index ของ Bing
*
* กฎ
* - ต้องเป็น server component (ไม่ใส่ "use client")
* - ใช้ค่าจาก lib/site.ts เท่านั้น — เปลี่ยนชื่อเว็บที่ env ที่เดียว
*/
import { SITE_URL, SITE_NAME, SITE_TITLE, SITE_DESCRIPTION, SITE_OG_IMAGE, absUrl } from "@/lib/site";
type Json = Record<string, unknown>;
function Script({ data }: { data: Json | Json[] }) {
return (
<script
type="application/ld+json"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }}
/>
);
}
/** เว็บไซต์ + ช่องค้นหา + องค์กร — ใส่ครั้งเดียวใน layout */
export function SiteJsonLd() {
return (
<Script
data={[
{
"@context": "https://schema.org",
"@type": "WebSite",
"@id": `${SITE_URL}/#website`,
url: SITE_URL,
name: SITE_NAME,
description: SITE_DESCRIPTION,
inLanguage: "th-TH",
publisher: { "@id": `${SITE_URL}/#organization` },
// ช่องค้นหาบนหน้าเว็บ (Google sitelinks searchbox)
potentialAction: {
"@type": "SearchAction",
target: {
"@type": "EntryPoint",
urlTemplate: `${SITE_URL}/stops?q={search_term_string}`,
},
"query-input": "required name=search_term_string",
},
},
{
"@context": "https://schema.org",
"@type": "Organization",
"@id": `${SITE_URL}/#organization`,
name: SITE_NAME,
url: SITE_URL,
logo: {
"@type": "ImageObject",
url: absUrl("/image/icons/minibus-512x512.png"),
width: 512,
height: 512,
},
image: absUrl(SITE_OG_IMAGE),
description: SITE_TITLE,
},
]}
/>
);
}
/** ทางเดินหน้า (breadcrumb) — ขึ้นใน SERP แทน URL ดิบ */
export function BreadcrumbJsonLd({ items }: { items: Array<{ name: string; path: string }> }) {
return (
<Script
data={{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
itemListElement: items.map((it, i) => ({
"@type": "ListItem",
position: i + 1,
name: it.name,
item: absUrl(it.path),
})),
}}
/>
);
}
/** ป้ายหยุดรถ */
export function BusStopJsonLd(props: {
name: string;
code: string;
city?: string | null;
province?: string | null;
lat?: number | null;
lng?: number | null;
}) {
const { name, code, city, province, lat, lng } = props;
const data: Json = {
"@context": "https://schema.org",
"@type": "BusStop",
"@id": absUrl(`/stops/${encodeURIComponent(code)}`),
name,
identifier: code,
url: absUrl(`/stops/${encodeURIComponent(code)}`),
};
if (city || province) {
data.address = {
"@type": "PostalAddress",
addressLocality: city || undefined,
addressRegion: province || undefined,
addressCountry: "TH",
};
}
if (typeof lat === "number" && typeof lng === "number") {
data.geo = { "@type": "GeoCoordinates", latitude: lat, longitude: lng };
}
return <Script data={data} />;
}
/** สายรถ */
export function BusRouteJsonLd(props: {
routeId: string;
name: string;
description?: string | null;
stops?: number;
provinces?: number;
}) {
const { routeId, name, description, stops, provinces } = props;
return (
<Script
data={{
"@context": "https://schema.org",
"@type": "Service",
"@id": absUrl(`/routes/${encodeURIComponent(routeId)}`),
name: `สาย ${routeId} ${name}`.trim(),
serviceType: "รถโดยสารประจำทาง",
description: description || undefined,
provider: { "@id": `${SITE_URL}/#organization` },
areaServed: { "@type": "AdministrativeArea", name: "จังหวัดอ่างทอง" },
url: absUrl(`/routes/${encodeURIComponent(routeId)}`),
...(typeof stops === "number" ? { additionalProperty: { "@type": "PropertyValue", name: "จุดจอดหลัก", value: stops } } : {}),
...(typeof provinces === "number" ? {} : {}),
}}
/>
);
}
+129
View File
@@ -0,0 +1,129 @@
/**
* Atroute — ปุ่มสลับภาษา (ปุ่มเดียว + เมนู)
*
* เดิม: ปุ่ม "ไทย" และ "EN" วางคู่กันในแถบนำทาง → navbar แน่น
* ตอนนี้: ปุ่มเดียวแสดงรหัสภาษาที่ใช้อยู่ (ไทย / EN) กดแล้วเปิดเมนู
*
* การสลับภาษายังใช้กลไกเดิมของ i18n.ts — ปุ่มในเมนูมี [data-i18n-switch]
* ซึ่ง i18n ฟังคลิกอยู่แล้ว จึงไม่ต้องเขียน logic แปลภาษาใหม่
*
* Accessibility: aria-haspopup/aria-expanded · role="menuitemradio" ·
* ปิดด้วย Esc หรือคลิกนอกเมนู · คืนโฟกัสที่ปุ่มเมื่อปิด
*/
"use client";
import { useEffect, useRef, useState } from "react";
type Lang = "th" | "en";
const SHORT: Record<Lang, string> = { th: "ไทย", en: "EN" };
const FULL: Record<Lang, string> = { th: "ภาษาไทย", en: "English" };
function currentLang(): Lang {
const w = window as unknown as { I18N?: { getLang?: () => string } };
const v = w.I18N?.getLang?.();
return v === "en" ? "en" : "th";
}
function Chevron() {
return (
<svg
viewBox="0 0 24 24"
width={12}
height={12}
fill="none"
stroke="currentColor"
strokeWidth={2.5}
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="m6 9 6 6 6-6" />
</svg>
);
}
export default function LangSwitch() {
const [lang, setLang] = useState<Lang>("th");
const [open, setOpen] = useState(false);
const boxRef = useRef<HTMLDivElement>(null);
const btnRef = useRef<HTMLButtonElement>(null);
/* sync กับ I18N — หลัง mount และทุกครั้งที่ภาษาเปลี่ยน
• langchange = ผู้ใช้สลับภาษา
• i18nready = runtime โหลด i18n เสร็จ (ตอน mount I18N อาจยังไม่มี → ปุ่มจะค้างภาษาเดิม) */
useEffect(() => {
setLang(currentLang());
const onLang = () => setLang(currentLang());
window.addEventListener("langchange", onLang);
window.addEventListener("i18nready", onLang);
return () => {
window.removeEventListener("langchange", onLang);
window.removeEventListener("i18nready", onLang);
};
}, []);
/* ปิดเมนู: คลิกนอก / Esc */
useEffect(() => {
if (!open) return;
const onDown = (e: MouseEvent) => {
if (!boxRef.current?.contains(e.target as Node)) setOpen(false);
};
const onKey = (e: KeyboardEvent) => {
if (e.key === "Escape") {
setOpen(false);
btnRef.current?.focus();
}
};
document.addEventListener("mousedown", onDown);
document.addEventListener("keydown", onKey);
return () => {
document.removeEventListener("mousedown", onDown);
document.removeEventListener("keydown", onKey);
};
}, [open]);
const langs: Lang[] = ["th", "en"];
return (
<div className="mu-pop" ref={boxRef}>
<button
type="button"
ref={btnRef}
className="mu-pop-btn mu-pop-btn-lang"
aria-haspopup="menu"
aria-expanded={open}
aria-label={`ภาษา: ${FULL[lang]} / Language`}
title={`ภาษา: ${FULL[lang]}`}
onClick={() => setOpen((v) => !v)}
>
<span>{SHORT[lang]}</span>
<Chevron />
</button>
{open ? (
<div className="mu-pop-panel" role="menu" aria-label="ภาษา / Language">
{langs.map((l) => (
<button
key={l}
type="button"
role="menuitemradio"
aria-checked={lang === l}
className="mu-pop-item"
data-active={lang === l ? "1" : undefined}
data-i18n-switch={l}
onClick={() => {
setLang(l);
setOpen(false);
btnRef.current?.focus();
}}
>
<span className="mu-pop-item-th">{FULL[l]}</span>
<span className="mu-pop-item-en">{l.toUpperCase()}</span>
</button>
))}
</div>
) : null}
</div>
);
}
+46
View File
@@ -0,0 +1,46 @@
"use client";
import { useEffect } from "react";
import { usePathname } from "next/navigation";
import { ensureRuntime } from "@/lib/runtime";
/**
* MotionBoot — อนิเมชันเข้าหน้า + สถิติการเปิดหน้า (ต่อจาก mock's router)
*
* mock: router.js เรียก `Motion.enter(viewEl)` หลัง inject partial ทุกครั้ง
* Next: App Router เปลี่ยน pathname → เรียกเองตรงนี้ (ผลลัพธ์เดียวกัน)
*
* ทำ 3 อย่างต่อการเปลี่ยนหน้า
* 1. Analytics.pageview(pathname) → นับครั้งเปิดหน้าแบบไม่ระบุตัวตน
* 2. Motion.enter(#view) → หน้าใหม่ค่อย ๆ โผล่ + เริ่ม scan reveal
* 3. Motion.scan() → เก็บการ์ดที่ hydrate ทีหลัง (MutationObserver ช่วยอีกแรง)
*/
export default function MotionBoot() {
const pathname = usePathname();
useEffect(() => {
let cancelled = false;
(async () => {
await ensureRuntime();
if (cancelled) return;
const w = window as unknown as {
Analytics?: { pageview?: (p: string) => void };
Motion?: { enter?: (el: Element | null) => void; scan?: () => void };
};
w.Analytics?.pageview?.(pathname || "/");
const view = document.getElementById("view");
w.Motion?.enter?.(view);
w.Motion?.scan?.();
})();
return () => {
cancelled = true;
};
}, [pathname]);
return null;
}
+167
View File
@@ -0,0 +1,167 @@
/**
* Atroute — PWA bootstrap (Next.js client component)
*
* ทำ 3 อย่าง
* 1. ลงทะเบียน /sw.js + reg.update() ทุกครั้งที่เปิดหน้า และทุก 30 นาที
* 2. เทียบ /version.json กับ <html data-app-version> (เปิดหน้า · ทุก 5 นาที ·
* กลับมาที่แท็บ · เน็ตกลับมา) → ต่างกัน = ขึ้น toast + รีโหลดเองครั้งเดียว
* (guard ด้วย sessionStorage: กันลูปเมื่อเซิร์ฟเวอร์ลงไฟล์ไม่ครบ)
* 3. วาดเลขรุ่นที่ footer ([data-app-ver])
*
* ผู้ใช้ไม่ต้องกด Ctrl+Shift+R ทั้งคอมและมือถือ
*
* หมายเหตุ: ไม่มีปุ่ม "ติดตั้งแอป" ลอยมุมขวาล่างแล้ว (เอาออกตามคำขอ)
* — Chrome/Edge ยังมีไอคอนติดตั้งของเบราว์เซอร์เองตามปกติ
*/
"use client";
import { useEffect } from "react";
const CHECK_INTERVAL_MS = 5 * 60 * 1000; // version.json
const SW_INTERVAL_MS = 30 * 60 * 1000; // sw.js
const RELOAD_GUARD = "at_reloaded_for"; // sessionStorage — กันรีโหลดวน
function localVersion(): string {
return document.documentElement.dataset.appVersion || "";
}
function alreadyReloaded(ver: string): boolean {
try {
return sessionStorage.getItem(RELOAD_GUARD) === ver;
} catch {
return false;
}
}
function reloadOnce(ver: string) {
try {
if (alreadyReloaded(ver)) return;
sessionStorage.setItem(RELOAD_GUARD, ver);
} catch {
/* โหมดส่วนตัว: ยอมให้รีโหลดได้ */
}
window.location.reload();
}
function t(key: string, fallback: string): string {
const w = window as unknown as { I18N?: { t?: (k: string) => string } };
const got = w.I18N?.t?.(key);
return !got || got === key ? fallback : got;
}
/* ---------- toast เล็ก ๆ ล่างจอ (ไม่บล็อกการใช้งาน) ---------- */
function showToast(message: string) {
if (document.querySelector(".mu-update-toast")) return;
const el = document.createElement("div");
el.className = "mu-update-toast";
el.setAttribute("role", "status");
el.setAttribute("aria-live", "polite");
const dot = document.createElement("span");
dot.className = "mu-update-dot";
dot.setAttribute("aria-hidden", "true");
const text = document.createElement("span");
text.textContent = message;
el.appendChild(dot);
el.appendChild(text);
document.body.appendChild(el);
setTimeout(() => el.classList.add("is-in"), 20);
}
function applyUpdate(nextVersion: string) {
/* รีโหลดเพื่อเวอร์ชันนี้ไปแล้วแต่ยังไม่ตรง (เซิร์ฟเวอร์ยังไม่ลงไฟล์ครบ)
→ หยุดเงียบ ๆ ไม่เด้ง toast ซ้ำให้รำคาญ */
if (alreadyReloaded(nextVersion)) return;
showToast(t("update.applying", "มีเวอร์ชันใหม่ — กำลังอัปเดต…"));
/* แท็บถูกซ่อน = รีโหลดเลย ไม่รบกวน */
if (document.hidden) {
reloadOnce(nextVersion);
return;
}
let done = false;
const finish = () => {
if (done) return;
done = true;
reloadOnce(nextVersion);
};
if (navigator.serviceWorker) {
navigator.serviceWorker.addEventListener("controllerchange", finish, { once: true });
navigator.serviceWorker
.getRegistration()
.then((reg) => reg?.update())
.catch(() => undefined);
}
/* ไม่ว่า SW จะทันหรือไม่ ภายใน 2.5 วิ รีโหลดเพื่อรับ HTML/JS ใหม่ */
setTimeout(finish, 2500);
}
function paintVersion() {
const v = localVersion();
if (!v) return;
document.querySelectorAll("[data-app-ver]").forEach((el) => {
el.textContent = "v" + v;
});
}
export default function PwaBoot() {
useEffect(() => {
if (typeof window === "undefined") return;
paintVersion();
/* เทียบรุ่นที่โหลดอยู่ กับ /version.json บนเซิร์ฟเวอร์
— ต่างกัน = deploy รุ่นใหม่แล้ว → toast + รีโหลด (กันลูปด้วย guard) */
const checkVersion = () => {
if (!localVersion()) return;
fetch("/version.json?t=" + Date.now(), { cache: "no-store" })
.then((r) => (r.ok ? r.json() : null))
.then((data: { version?: string } | null) => {
const remote = String(data?.version || "");
const local = localVersion();
paintVersion();
if (remote && local && remote !== local) applyUpdate(remote);
})
.catch(() => undefined);
};
/* ---------- 1) service worker ---------- */
if ("serviceWorker" in navigator) {
const register = () => {
navigator.serviceWorker
.register("/sw.js", { scope: "/", updateViaCache: "none" })
.then((reg) => {
reg.update().catch(() => undefined);
// ตรวจอัปเดต SW ซ้ำทุก 30 นาที (จอที่เปิดค้าง)
setInterval(() => reg.update().catch(() => undefined), SW_INTERVAL_MS);
})
.catch(() => undefined);
};
if (document.readyState === "complete") register();
else window.addEventListener("load", register, { once: true });
/* SW ใหม่เข้าควบคุม → รับเวอร์ชันใหม่ (ครั้งเดียวต่อเวอร์ชัน) */
navigator.serviceWorker.addEventListener("controllerchange", () => {
reloadOnce(localVersion() || "sw");
});
}
/* ---------- 2) ตรวจ version.json ---------- */
checkVersion();
setInterval(checkVersion, CHECK_INTERVAL_MS);
/* กลับมาที่แท็บ/สลับแอปกลับมา (มือถือ) · เน็ตกลับมา → ตรวจทันที */
const onVisible = () => {
if (document.visibilityState === "visible") checkVersion();
};
const onOnline = () => checkVersion();
document.addEventListener("visibilitychange", onVisible);
window.addEventListener("online", onOnline);
}, []);
return null;
}
+14 -19
View File
@@ -86,6 +86,11 @@ export default function SiteFooter() {
เครดิต
</a>
</li>
<li>
<a href="/stats" data-i18n="nav.stats">
สถิติ
</a>
</li>
</ul>
</div>
@@ -104,34 +109,24 @@ export default function SiteFooter() {
<div className="mu-footer-col mu-footer-contact">
<h4 data-i18n="footer.contact">ติดต่อ</h4>
<div className="row">
<a href="mailto:atroute@hobbygirds.com">
<a href="mailto:atroute@hobbypj.com">
<svg className="ic" aria-hidden="true">
<use href="#ic-mail" />
</svg>{" "}
atroute@hobbygirds.com
atroute@hobbypj.com
</a>
</div>
</div>
</div>
<div className="mu-footer-bottom">
<p>© 2026 Atroute</p>
<span className="mu-visitor" title="จำนวนผู้เข้าชมเว็บไซต์">
<svg
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" />
<circle cx="12" cy="12" r="3" />
</svg>
<span>ผู้เข้าชม</span>
<strong id="visitor-count">12,834</strong>
</span>
<p>
© 2026 Atroute{" "}
{/* รุ่นแอป — เห็นด้วยตาได้ว่าเบราว์เซอร์โหลดของใหม่แล้วหรือยัง */}
<span className="mu-app-ver" data-app-ver="">
v—
</span>
</p>
</div>
</div>
</footer>
+6 -7
View File
@@ -2,6 +2,8 @@
import { useEffect, useRef } from "react";
import { usePathname } from "next/navigation";
import ThemeSwitch from "@/components/ThemeSwitch";
import LangSwitch from "@/components/LangSwitch";
const NAV = [
{ href: "/", key: "nav.home", label: "หน้าแรก" },
@@ -104,13 +106,10 @@ export default function SiteHeader() {
</div>
</details>
<div className="mu-lang-switch" role="group" aria-label="ภาษา / Language">
<button type="button" className="mu-lang-btn" data-i18n-switch="th">
ไทย
</button>
<button type="button" className="mu-lang-btn" data-i18n-switch="en">
EN
</button>
{/* ปุ่มลัด: ปุ่มละเรื่อง (ธีม 1 ปุ่ม · ภาษา 1 ปุ่ม) — ลดความแน่นของ navbar */}
<div className="mu-topbar-tools">
<ThemeSwitch />
<LangSwitch />
</div>
<a className="mu-action-btn" href="/check" data-i18n="cta.check">
-177
View File
@@ -1,177 +0,0 @@
"use client";
import { useMemo, useState } from "react";
import { allBusStops, findBusStopByCode, nearestBusStops, type BusStop } from "@/lib/busstops";
import { Icon } from "@/components/Icons";
import { useLang } from "@/components/LangProvider";
type Mode = "code" | "place";
function BusStopCard({ stop, distM }: { stop: BusStop; distM?: number }) {
const { lang } = useLang();
return (
<div className="busstop-result">
<div className="busstop-result__head">
<span className="busstop-result__km">{stop.kilometer}</span>
<span className="busstop-result__name">{stop.route_name}</span>
{distM != null && (
<span className="busstop-result__dist">
{distM < 1000 ? `${Math.round(distM)} m` : `${(distM / 1000).toFixed(1)} km`}
</span>
)}
</div>
<p className="busstop-result__meta">
{stop.position} · {stop.type}
</p>
{(stop["buses-line"] ?? []).length > 0 && (
<div className="busstop-result__chips">
{(stop["buses-line"] ?? []).map((r) => (
<span key={r} className="chip-soft chip-soft--purple">{lang === "en" ? "Route" : "สาย"} {r}</span>
))}
</div>
)}
</div>
);
}
export function StopSearch() {
const { t, lang } = useLang();
const [mode, setMode] = useState<Mode>("code");
const [code, setCode] = useState("");
const [query, setQuery] = useState("");
const [nearby, setNearby] = useState<{ stop: BusStop; distM: number }[] | null>(null);
const [geoErr, setGeoErr] = useState(false);
const pad = (d: string) => {
if (code.length >= 5) return;
setCode(code + d);
setNearby(null);
};
const backspace = () => setCode(code.slice(0, -1));
const clearAll = () => {
setCode("");
setQuery("");
setNearby(null);
setGeoErr(false);
};
const codeResult = code.length === 5 ? findBusStopByCode(code) : undefined;
const placeResults = useMemo(() => {
const q = query.trim();
if (q.length < 2) return [];
return allBusStops()
.filter(
(b) =>
b.route_name.includes(q) || b.type.includes(q) || b.position.includes(q),
)
.slice(0, 20);
}, [query]);
const nearMe = () => {
if (typeof navigator === "undefined" || !navigator.geolocation) {
setGeoErr(true);
return;
}
navigator.geolocation.getCurrentPosition(
(pos) => setNearby(nearestBusStops(pos.coords.latitude, pos.coords.longitude, 8)),
() => setGeoErr(true),
{ timeout: 10000 },
);
};
const N = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
return (
<div className="stop-search">
<div className="stop-search__tabs" role="tablist" aria-label="รูปแบบการค้นหา">
<button
type="button"
className={`stop-search__tab ${mode === "code" ? "on" : ""}`}
onClick={() => setMode("code")}
>
<Icon name="map-pin" size={14} className="icon" /> {t("stops.modeCode")}
</button>
<button
type="button"
className={`stop-search__tab ${mode === "place" ? "on" : ""}`}
onClick={() => setMode("place")}
>
<Icon name="search" size={14} className="icon" /> {t("stops.modePlace")}
</button>
</div>
{mode === "code" ? (
<div className="stop-search__panel">
<div className="code-boxes" aria-label={t("stops.codePh")}>
{[0, 1, 2, 3, 4].map((i) => (
<span key={i} className={`code-cell ${i < code.length ? "filled" : ""}`}>
{code[i] ?? ""}
</span>
))}
</div>
<div className="numpad">
{N.map((n) => (
<button key={n} type="button" onClick={() => pad(String(n))}>
{n}
</button>
))}
<button type="button" onClick={backspace} aria-label={t("stops.padDelete")}>
<Icon name="arrow-right" size={16} className="icon" style={{ transform: "rotate(180deg)" }} />
</button>
</div>
<div className="stop-search__actions">
<button type="button" className="mu-btn ghost" onClick={clearAll}>
{t("stops.reset")}
</button>
<button type="button" className="mu-btn ghost" onClick={nearMe}>
<Icon name="map-pin" size={14} className="icon" /> {t("map.useMyLocation")}
</button>
</div>
</div>
) : (
<div className="stop-search__panel">
<div className="stop-search__field">
<Icon name="search" size={16} className="icon" />
<input
type="search"
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder={t("stops.searchPh")}
/>
</div>
{placeResults.length > 0 && (
<ul className="stop-search__suggest">
{placeResults.map((b, i) => (
<li key={`${b.kilometer}-${i}`}>
<button type="button" onClick={() => setCode(b.kilometer.replace("+", ""))}>
<span className="km">{b.kilometer}</span>
<span className="name">{b.route_name}</span>
<span className="meta">{b.position}</span>
</button>
</li>
))}
</ul>
)}
</div>
)}
{geoErr && (
<p className="stop-search__err">
{lang === "en" ? "Cannot access your location." : "ไม่สามารถเข้าถึงตำแหน่งของคุณได้"}
</p>
)}
{codeResult && <BusStopCard stop={codeResult} />}
{nearby && nearby.length > 0 && (
<div className="stop-search__nearby">
<h3>{t("map.nearestTitle")}</h3>
{nearby.map((n, i) => (
<BusStopCard key={`${n.stop.kilometer}-${i}`} stop={n.stop} distM={n.distM} />
))}
</div>
)}
</div>
);
}
+214
View File
@@ -0,0 +1,214 @@
/**
* Atroute — ตัวสลับธีม 3 โหมด
*
* light = สว่าง
* dark = มืด
* auto = ตามธีมของอุปกรณ์ (prefers-color-scheme) ← ค่าเริ่มต้น
*
* หลักการ
* - เก็บค่าที่ localStorage 'at_theme' ("light" | "dark" | "auto")
* - ตั้ง <html data-theme="light|dark"> ให้ CSS ใน theme.css ทำงาน
* - โหมด auto ฟัง event ของ matchMedia → เปลี่ยนตามอุปกรณ์ทันทีที่ผู้ใช้
* สลับโหมดมืด/สว่างที่ระบบ (ไม่ต้อง reload, ไม่ผูกกับเวลาเครื่อง)
* - กันจอขาววูบ: มีสคริปต์ inline ใน layout.tsx ที่ตั้ง data-theme ก่อน paint
* (ใช้ logic เดียวกันกับที่นี่)
*/
"use client";
import { useCallback, useEffect, useRef, useState } from "react";
export type ThemeMode = "light" | "dark" | "auto";
const LS_KEY = "at_theme";
const DARK_QUERY = "(prefers-color-scheme: dark)";
/** ธีมที่อุปกรณ์กำลังใช้อยู่ */
export function deviceTheme(): "light" | "dark" {
try {
return window.matchMedia(DARK_QUERY).matches ? "dark" : "light";
} catch {
return "light";
}
}
/** ค่าที่ใช้วาดจริง (auto → ตามอุปกรณ์) */
export function resolveTheme(mode: ThemeMode): "light" | "dark" {
return mode === "auto" ? deviceTheme() : mode;
}
function readMode(): ThemeMode {
try {
const v = localStorage.getItem(LS_KEY);
if (v === "light" || v === "dark" || v === "auto") return v;
} catch {
/* localStorage ปิด */
}
return "auto";
}
function applyMode(mode: ThemeMode) {
const resolved = resolveTheme(mode);
document.documentElement.dataset.theme = resolved;
document.documentElement.style.colorScheme = resolved;
// ให้ CSS รู้ว่ากำลังใช้โหมดไหน (สำหรับไอคอน active)
document.documentElement.dataset.themeMode = mode;
}
const LABEL: Record<ThemeMode, string> = {
light: "สว่าง",
dark: "มืด",
auto: "ตามอุปกรณ์",
};
const LABEL_EN: Record<ThemeMode, string> = {
light: "Light",
dark: "Dark",
auto: "Device",
};
function Icon({ mode, size = 18 }: { mode: ThemeMode; size?: number }) {
const common = {
viewBox: "0 0 24 24",
width: size,
height: size,
fill: "none",
stroke: "currentColor",
strokeWidth: 2,
strokeLinecap: "round" as const,
strokeLinejoin: "round" as const,
"aria-hidden": true,
};
if (mode === "light")
return (
<svg {...common}>
<circle cx="12" cy="12" r="4" />
<path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M6.3 17.7l-1.4 1.4M19.1 4.9l-1.4 1.4" />
</svg>
);
if (mode === "dark")
return (
<svg {...common}>
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
</svg>
);
return (
<svg {...common}>
<rect x="2" y="4" width="20" height="14" rx="2" />
<path d="M8 21h8M12 18v3" />
</svg>
);
}
export default function ThemeSwitch() {
const [mode, setMode] = useState<ThemeMode>("auto");
const [open, setOpen] = useState(false);
const boxRef = useRef<HTMLDivElement>(null);
const btnRef = useRef<HTMLButtonElement>(null);
/* อ่านค่าที่เก็บไว้หลัง mount (กัน hydration mismatch) */
useEffect(() => {
const m = readMode();
setMode(m);
applyMode(m);
}, []);
const choose = useCallback((m: ThemeMode) => {
/* ปิดเมนูก่อน — ถ้า applyMode() ล้ม เมนูต้องไม่ค้างเปิด */
setOpen(false);
setMode(m);
try {
localStorage.setItem(LS_KEY, m);
} catch {
/* เพิกเฉย */
}
try {
applyMode(m);
} catch {
/* เขียนธีมไม่สำเร็จ — ไม่ให้ UI พัง */
}
btnRef.current?.focus();
}, []);
/* โหมด auto: ตามธีมอุปกรณ์ — ฟัง event แทนการตั้งเวลา
อุปกรณ์สลับโหมดมืด/สว่าง (ตั้งเวลาเอง/กดที่ระบบ) → หน้าอัปเดตทันที */
useEffect(() => {
if (mode !== "auto") return;
const mq = window.matchMedia(DARK_QUERY);
const onChange = () => applyMode("auto");
/* Safari < 14 ใช้ addListener */
if (typeof mq.addEventListener === "function") mq.addEventListener("change", onChange);
else mq.addListener(onChange);
const onVisible = () => {
if (!document.hidden) applyMode("auto");
};
document.addEventListener("visibilitychange", onVisible);
return () => {
if (typeof mq.removeEventListener === "function") mq.removeEventListener("change", onChange);
else mq.removeListener(onChange);
document.removeEventListener("visibilitychange", onVisible);
};
}, [mode]);
/* ปิดเมนู: คลิกนอก / Esc */
useEffect(() => {
if (!open) return;
const onDown = (e: MouseEvent) => {
if (!boxRef.current?.contains(e.target as Node)) setOpen(false);
};
const onKey = (e: KeyboardEvent) => {
if (e.key === "Escape") {
setOpen(false);
btnRef.current?.focus();
}
};
document.addEventListener("mousedown", onDown);
document.addEventListener("keydown", onKey);
return () => {
document.removeEventListener("mousedown", onDown);
document.removeEventListener("keydown", onKey);
};
}, [open]);
const modes: ThemeMode[] = ["light", "dark", "auto"];
return (
<div className="mu-pop" ref={boxRef}>
<button
type="button"
ref={btnRef}
className="mu-pop-btn"
aria-haspopup="menu"
aria-expanded={open}
aria-label={`ธีม: ${LABEL[mode]} / Theme`}
title={`ธีม: ${LABEL[mode]}`}
onClick={() => setOpen((v) => !v)}
>
<Icon mode={mode} />
</button>
{open ? (
<div className="mu-pop-panel" role="menu" aria-label="ธีม / Theme">
{modes.map((m) => (
<button
key={m}
type="button"
role="menuitemradio"
aria-checked={mode === m}
className="mu-pop-item"
data-active={mode === m ? "1" : undefined}
onClick={() => choose(m)}
>
<Icon mode={m} size={16} />
<span className="mu-pop-item-th">{LABEL[m]}</span>
<span className="mu-pop-item-en">{LABEL_EN[m]}</span>
</button>
))}
</div>
) : null}
</div>
);
}
@@ -55,6 +55,17 @@ export default function CheckView() {
</div>
</div>
</section>
{/* ปุ่มแชร์หน้านี้ — ลิงก์สั้น ใช้ path ปัจจุบัน ไม่ฝังชื่อเว็บ
ต้องอยู่ใน .mu-container ให้ขอบขวาเท่าหน้าอื่น (routes/stops) */}
<div className="mu-container">
<div className="mu-share-row">
<button type="button" className="mu-share-btn" id="share-btn">
<svg className="ic" aria-hidden="true"><use href="#ic-share-2" /></svg>
<span data-i18n="share.label">แชร์หน้านี้</span>
</button>
<p className="mu-share-status" id="share-status" aria-live="polite" />
</div>
</div>
</>
);
+2 -2
View File
@@ -75,11 +75,11 @@ export default function HomeView() {
{/* หมวดเส้นทางทั้งหมด: สร้างจาก resource/data/route_groups.json + routes.json (+ routes_municipal.json)
ที่มา: ui/partials/home.init.js → initRouteZones() — ห้าม hardcode การ์ดในไฟล์นี้ */}
<div id="route-zones" />
{/* ปุ่มแชร์ลิงก์สั้น (มุมล่างขวา ต่อจากการ์ดหมวดเส้นทางภายในจังหวัด) */}
{/* ปุ่มแชร์หน้านี้ (มุมล่างขวา ต่อจากการ์ดหมวดเส้นทางภายในจังหวัด) */}
<div className="mu-share-row">
<button type="button" className="mu-share-btn" id="share-btn">
<svg className="ic" aria-hidden="true"><use href="#ic-share-2" /></svg>
<span data-i18n="share.label">แชร์ลิงก์สั้น</span>
<span data-i18n="share.label">แชร์หน้านี้</span>
</button>
<p className="mu-share-status" id="share-status" aria-live="polite" />
</div>
@@ -48,6 +48,14 @@ export default function RouteView() {
</div>
</div>
</section>
{/* ปุ่มแชร์หน้านี้ — ลิงก์สั้น ใช้ path ปัจจุบัน ไม่ฝังชื่อเว็บ */}
<div className="mu-share-row">
<button type="button" className="mu-share-btn" id="share-btn">
<svg className="ic" aria-hidden="true"><use href="#ic-share-2" /></svg>
<span data-i18n="share.label">แชร์หน้านี้</span>
</button>
<p className="mu-share-status" id="share-status" aria-live="polite" />
</div>
</div>
</main>
+342
View File
@@ -0,0 +1,342 @@
"use client";
/**
* StatsView — หน้าสถิติในเครื่อง (ported from web-at-transit-mock #/stats)
*
* อ่านข้อมูลจาก window.Analytics (lib/ui/analytics.ts) อย่างเดียว
* ไม่ยิงเน็ต · ไม่มีคุกกี้ · ตัวเลขเป็นของเบราว์เซอร์นี้เท่านั้น
*/
import { useCallback, useEffect, useState } from "react";
import { ensureRuntime } from "@/lib/runtime";
import "@/styles/pages/stats.css";
type Row = { term?: string; kind?: string; id?: string; count: number; last: number };
type Report = {
since: number;
totals: { pageviews: number; searches: number; noResult: number; terms: number; views: number };
days: { date: string; pageviews: number; searches: number; noResult: number }[];
topTerms: Row[];
topEmpty: Row[];
topViews: Row[];
};
type AnalyticsApi = {
report: () => Report;
exportJSON: () => string;
clear: () => void;
optOut: (on: boolean) => void;
tracking: () => boolean;
};
const EMPTY: Report = {
since: 0,
totals: { pageviews: 0, searches: 0, noResult: 0, terms: 0, views: 0 },
days: [],
topTerms: [],
topEmpty: [],
topViews: [],
};
/* ข้อความไทย = fallback ถ้า I18N ยังไม่โหลด · คีย์จริงอยู่ใน locales */
const FALLBACK: Record<string, string> = {
"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.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": "หน้า",
"stats.views.stopPrefix": "ป้าย {code}",
"stats.views.routePrefix": "สาย {n}",
};
function tr(key: string, vars?: Record<string, string | number>) {
let out = FALLBACK[key] || key;
if (typeof window !== "undefined") {
const w = window as unknown as {
I18N?: { t?: (k: string, v?: Record<string, string | number>) => string };
};
const got = w.I18N?.t?.(key, vars);
if (got && got !== key) out = got;
}
if (vars) {
Object.keys(vars).forEach((k) => {
out = out.replace(new RegExp(`\\{${k}\\}`, "g"), String(vars[k]));
});
}
return out;
}
const pad = (n: number) => String(n).padStart(2, "0");
function when(ts: number) {
if (!ts) return "—";
const d = new Date(ts);
const now = new Date();
const hm = `${pad(d.getHours())}:${pad(d.getMinutes())}`;
return d.toDateString() === now.toDateString()
? hm
: `${pad(d.getDate())}/${pad(d.getMonth() + 1)} ${hm}`;
}
const num = (n: number) => {
try { return Number(n || 0).toLocaleString("th-TH"); } catch { return String(n || 0); }
};
const short = (s: string, n: number) => (s.length > n ? `${s.slice(0, n - 1)}…` : s);
export default function StatsView() {
const [report, setReport] = useState<Report>(EMPTY);
const [tracking, setTracking] = useState(true);
const [status, setStatus] = useState("");
const [ready, setReady] = useState(false);
const api = useCallback((): AnalyticsApi | undefined => {
return (window as unknown as { Analytics?: AnalyticsApi }).Analytics;
}, []);
const paint = useCallback(() => {
const a = api();
if (!a) return;
setReport(a.report());
setTracking(a.tracking());
}, [api]);
useEffect(() => {
let cancelled = false;
(async () => {
await ensureRuntime();
if (cancelled) return;
paint();
setReady(true);
})();
return () => { cancelled = true; };
}, [paint]);
const onToggle = (on: boolean) => {
api()?.optOut(on);
setTracking(!on);
setStatus(on ? tr("stats.privacy.off") : tr("stats.privacy.on"));
};
const onExport = () => {
const a = api();
if (!a) return;
const d = new Date();
const name = `atroute-stats-${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}.json`;
const url = URL.createObjectURL(new Blob([a.exportJSON()], { type: "application/json" }));
const link = document.createElement("a");
link.href = url;
link.download = name;
document.body.appendChild(link);
link.click();
link.remove();
setTimeout(() => URL.revokeObjectURL(url), 1500);
setStatus(tr("stats.export.done"));
};
const onClear = () => {
if (!window.confirm(tr("stats.clear.confirm"))) return;
api()?.clear();
paint();
setStatus(tr("stats.clear.done"));
};
/* ---------- กราฟ 14 วัน (เติมวันขาดให้ครบ) ---------- */
const byDate = new Map(report.days.map((d) => [d.date, d]));
const today = new Date();
today.setHours(12, 0, 0, 0);
const series = Array.from({ length: 14 }, (_, i) => {
const d = new Date(today.getTime() - (13 - i) * 86400000);
const key = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
const hit = byDate.get(key);
return { key, day: d.getDate(), pv: hit?.pageviews || 0, q: hit?.searches || 0 };
});
const max = Math.max(1, ...series.map((s) => Math.max(s.pv, s.q)));
return (
<main className="mu-page">
<div className="st-wrap">
<div className="st-hero">
<p className="mu-breadcrumb">
<a href="/" data-i18n="nav.home">หน้าแรก</a>/ <span data-i18n="nav.stats">สถิติ</span>
</p>
<h1>{tr("stats.title")}</h1>
<p>{tr("stats.lead")}</p>
</div>
<section className="st-kpis" aria-label="summary">
<div className="st-kpi"><b>{num(report.totals.pageviews)}</b><span>{tr("stats.kpi.views")}</span></div>
<div className="st-kpi"><b>{num(report.totals.searches)}</b><span>{tr("stats.kpi.searches")}</span></div>
<div className="st-kpi"><b>{num(report.totals.terms)}</b><span>{tr("stats.kpi.terms")}</span></div>
<div className="st-kpi"><b>{num(report.totals.noResult)}</b><span>{tr("stats.kpi.noResult")}</span></div>
</section>
<section className="st-card">
<h2>{tr("stats.chart.title")}</h2>
<p className="lead">{tr("stats.chart.lead")}</p>
<div className="st-chart" role="img" aria-label={tr("stats.chart.title")}>
{series.map((s, idx) => (
<div className="st-bar" key={s.key} title={`${s.key} · ${num(s.pv)} / ${num(s.q)}`}>
<i style={{ height: `${Math.round((s.pv / max) * 92)}px` }} />
<u style={{ height: `${Math.round((s.q / max) * 92)}px` }} />
<em style={series.length > 8 && idx % 2 === 1 ? { opacity: 0 } : undefined}>{s.day}</em>
</div>
))}
</div>
<div className="st-legend">
<span><b style={{ background: "linear-gradient(180deg,#b694f6,var(--c-brand))" }} />{tr("stats.kpi.views")}</span>
<span><b style={{ background: "var(--c-brand-soft)" }} />{tr("stats.kpi.searches")}</span>
</div>
</section>
<div className="st-grid2">
<section className="st-card">
<h2>{tr("stats.terms.title")}</h2>
<p className="lead">{tr("stats.terms.lead")}</p>
<table className="st-table">
<thead>
<tr>
<th>{tr("stats.col.term")}</th>
<th className="num">{tr("stats.col.count")}</th>
<th>{tr("stats.col.last")}</th>
</tr>
</thead>
<tbody>
{report.topTerms.map((row) => (
<tr key={row.term}>
<td className="term" title={row.term}>{short(row.term || "", 42)}</td>
<td className="num">{num(row.count)}</td>
<td className="when">{when(row.last)}</td>
</tr>
))}
</tbody>
</table>
{!report.topTerms.length && <p className="st-empty">{tr("stats.terms.empty")}</p>}
</section>
<section className="st-card">
<h2>{tr("stats.views.title")}</h2>
<p className="lead">{tr("stats.views.lead")}</p>
<table className="st-table">
<thead>
<tr>
<th>{tr("stats.col.target")}</th>
<th className="num">{tr("stats.col.count")}</th>
<th>{tr("stats.col.last")}</th>
</tr>
</thead>
<tbody>
{report.topViews.map((row) => (
<tr key={`${row.kind}:${row.id}`}>
<td>
<a href={row.kind === "route" ? `/routes/${row.id}` : `/stops/${row.id}`}>
{row.kind === "route"
? tr("stats.views.routePrefix", { n: row.id || "" })
: tr("stats.views.stopPrefix", { code: row.id || "" })}
</a>
</td>
<td className="num">{num(row.count)}</td>
<td className="when">{when(row.last)}</td>
</tr>
))}
</tbody>
</table>
{!report.topViews.length && <p className="st-empty">{tr("stats.views.empty")}</p>}
</section>
</div>
{report.topEmpty.length > 0 && (
<section className="st-card">
<h2>{tr("stats.noresult.title")}</h2>
<p className="lead">{tr("stats.noresult.lead")}</p>
<table className="st-table">
<thead>
<tr>
<th>{tr("stats.col.term")}</th>
<th className="num">{tr("stats.col.count")}</th>
<th>{tr("stats.col.last")}</th>
</tr>
</thead>
<tbody>
{report.topEmpty.map((row) => (
<tr key={row.term}>
<td className="term" title={row.term}>{short(row.term || "", 42)}</td>
<td className="num">{num(row.count)}</td>
<td className="when">{when(row.last)}</td>
</tr>
))}
</tbody>
</table>
</section>
)}
<section className="st-card">
<h2>{tr("stats.privacy.title")}</h2>
<ul className="st-list">
<li>{tr("stats.privacy.collect")}</li>
<li>{tr("stats.privacy.reject")}</li>
<li>{tr("stats.privacy.local")}</li>
</ul>
<label className="st-toggle" htmlFor="st-optout">
<input
type="checkbox"
id="st-optout"
checked={!tracking}
onChange={(e) => onToggle(e.target.checked)}
disabled={!ready}
/>
<span>
<strong>{tr("stats.privacy.optoutTitle")}</strong>
<span>{tr("stats.privacy.optoutLead")}</span>
</span>
</label>
<div className="st-actions">
<button type="button" className="st-btn is-solid" onClick={onExport} disabled={!ready}>
{tr("stats.btn.export")}
</button>
<button type="button" className="st-btn is-danger" onClick={onClear} disabled={!ready}>
{tr("stats.btn.clear")}
</button>
</div>
<p className="st-status" role="status" aria-live="polite">{status}</p>
<p className="st-note">
{tr("stats.since")}: {report.since ? new Date(report.since).toLocaleDateString("th-TH", { year: "numeric", month: "short", day: "numeric" }) : "—"}
</p>
</section>
</div>
</main>
);
}
@@ -47,6 +47,14 @@ export default function StopView() {
<div id="stop-chips" style={{display: 'flex', flexWrap: 'wrap', gap: 8, marginTop: 14}} />
</aside>
</section>
{/* ปุ่มแชร์หน้านี้ — จำตัวกรองสายรถที่เลือกอยู่ลงลิงก์ */}
<div className="mu-share-row">
<button type="button" className="mu-share-btn" id="share-btn">
<svg className="ic" aria-hidden="true"><use href="#ic-share-2" /></svg>
<span data-i18n="share.label">แชร์หน้านี้</span>
</button>
<p className="mu-share-status" id="share-status" aria-live="polite" />
</div>
</div>
</main>
+17 -19
View File
@@ -30,6 +30,11 @@ export default function StopsView() {
<svg className="ic" aria-hidden="true"><use href="#ic-landmark" /></svg>
<span data-i18n="stops.modePlace">ค้นหาด้วยชื่อสถานที่</span>
</button>
{/* หมวดที่ 3: หาป้ายจากพิกัดผู้ใช้ — ซ่อนอัตโนมัติเมื่อไม่ได้ HTTPS (ดู stops.nearme.ts) */}
<button type="button" className="mu-search-tab" data-mode="near" role="tab" aria-selected="false" id="stops-near-tab" hidden>
<svg className="ic" aria-hidden="true"><use href="#ic-map-pin" /></svg>
<span data-i18n="stops.modeNear">ป้ายใกล้ฉัน</span>
</button>
</div>
{/* โหมด 1: รหัสป้าย (5 ช่อง: 2 หน้า + 3 หลัง) */}
<div className="mu-search-mode" id="stops-code-wrap">
@@ -43,19 +48,6 @@ export default function StopsView() {
</div>
<p className="mu-code-display" id="stops-code-display" hidden />
<p className="mu-search-hint" data-i18n="stops.codeHintBox">พิมพ์ตัวเลขในช่อง ระบบจะเติม 0 ให้อัตโนมัติเมื่อเว้นว่าง</p>
<div className="mu-numpad" id="stops-numpad">
<button type="button" data-key={1}>1</button>
<button type="button" data-key={2}>2</button>
<button type="button" data-key={3}>3</button>
<button type="button" data-key={4}>4</button>
<button type="button" data-key={5}>5</button>
<button type="button" data-key={6}>6</button>
<button type="button" data-key={7}>7</button>
<button type="button" data-key={8}>8</button>
<button type="button" data-key={9}>9</button>
<button type="button" data-key={0}>0</button>
<button type="button" data-key="back"><span data-i18n="stops.padDelete">ลบ</span></button>
</div>
</div>
{/* โหมด 2: ชื่อสถานที่ */}
<div className="mu-search-mode" id="stops-place-wrap" hidden>
@@ -66,18 +58,24 @@ export default function StopsView() {
<div className="mu-suggest" id="stops-suggest" hidden />
<p className="mu-search-hint" data-i18n="stops.placeHint">พิมพ์ชื่อสถานที่สำคัญ เช่น โรงพยาบาล สำนักงานที่ดิน แล้วเลือกรายการที่ตรงกัน</p>
</div>
<div className="mu-toolbar-actions">
<button type="button" className="mu-btn primary" id="stops-search-btn"><span data-i18n="common.search">ค้นหา</span></button>
<button type="button" className="mu-btn ghost" id="stops-reset-btn"><span data-i18n="stops.reset">ล้างค่า</span></button>
<button type="button" className="mu-btn ghost" id="near-me-btn">
{/* หมวดที่ 3: ป้ายใกล้ฉัน — ขอพิกัดจากมือถือ แล้วเรียงป้ายตามระยะจริง */}
<div className="mu-search-mode" id="stops-near-wrap" hidden>
<button type="button" className="mu-btn primary" id="near-me-btn">
<svg className="ic" aria-hidden="true"><use href="#ic-map-pin" /></svg>
<span data-i18n="map.useMyLocation">ป้ายใกล้ฉัน</span>
<span data-i18n="stops.nearCta">ขอพิกัดและหาป้ายใกล้ฉัน</span>
</button>
<p className="mu-search-hint" data-i18n="stops.nearHint">
ระบบจะขอตำแหน่งจากเครื่อง แล้วคำนวณระยะจากพิกัดป้าย/ศาลารถ เรียงจากใกล้ไปไกล
</p>
<div id="near-me-result" className="mu-near-wrap" hidden />
</div>
<div className="mu-toolbar-actions">
{/* การกรองทำงานทันทีขณะพิมพ์ — ไม่ต้องมีปุ่มค้นหา */}
<button type="button" className="mu-btn primary" id="stops-reset-btn"><span data-i18n="stops.reset">ล้างค่า</span></button>
<a className="mu-btn ghost" href="/"><span data-i18n="common.back">ย้อนกลับ</span></a>
</div>
<p className="mu-toolbar-count" id="stops-count" hidden />
</form>
<div id="near-me-result" className="mu-near-wrap" hidden />
<ul className="mu-stop-grid" id="stops-list" />
<div className="mu-show-more">
<button type="button" className="mu-btn outline" id="stops-show-all" data-i18n="stops.showAll" hidden>แสดงป้ายทั้งหมด</button>
+128 -3
View File
@@ -89,7 +89,7 @@
"home.lead": "Browse routes, find stops, and preview a route right from this page",
"home.chooseProvince": "Select Province",
"home.chooseStation": "Select Terminal",
"share.label": "Share short link",
"share.label": "Share this page",
"share.copied": "Link copied",
"share.short": "Short link",
"share.line": "Share on LINE",
@@ -131,6 +131,9 @@
"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.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.codePh": "3+000",
"stops.codeHint": "Type 4 digits and the + sign is added automatically (e.g. 3000 → 3+000)",
@@ -138,7 +141,6 @@
"stops.codeFull": "Stop code:",
"stops.placePh": "Ang Thong Hospital",
"stops.placeHint": "Type a place name such as a hospital or land office, then pick a match",
"stops.padDelete": "Del",
"stops.reset": "Clear",
"stops.section": "Section",
"stops.showing": "Showing {a} of {b} stops",
@@ -265,5 +267,128 @@
"check.noMoreToday": "No departures left today",
"check.stopsCount": "stops",
"check.toStopDetail": "View stop detail",
"common.routes": "routes"
"common.routes": "routes",
"stops.padDelete": "Del",
"page.home": "Home | Atroute",
"page.stops": "Bus Stops | Atroute",
"page.routes": "Route Details | Atroute",
"page.check": "Departure Schedule | Atroute",
"page.stop": "Stop Details | Atroute",
"page.credits": "Credits | Atroute",
"page.about": "About | Atroute",
"page.blog": "Blog | Atroute",
"router.loadFail": "Could not load content — please serve over HTTP (e.g. python3 -m http.server)",
"common.routePrefix": "Route {n}",
"common.stopPrefix": "Stop {n}",
"route.qrAlt": "LINE QR for route {n}",
"route.vehicleAlt": "Vehicle photo for route {n}",
"check.fromName": "From {name}",
"check.stopNameN": "Stop {n}",
"map.mUnit": "m",
"map.originShort": "Origin",
"day.sun": "Sunday",
"day.mon": "Monday",
"day.tue": "Tuesday",
"day.wed": "Wednesday",
"day.thu": "Thursday",
"day.fri": "Friday",
"day.sat": "Saturday",
"day.sunS": "Sun",
"day.monS": "Mon",
"day.tueS": "Tue",
"day.wedS": "Wed",
"day.thuS": "Thu",
"day.friS": "Fri",
"day.satS": "Sat",
"visitors.resetTitle": "Reset visitor counter",
"visitors.resetPass": "Reset code",
"visitors.cancel": "Cancel",
"visitors.confirm": "Reset",
"visitors.done": "Reset done — counting restarts from 0",
"visitors.unsupported": "Browser not supported — needs https or localhost",
"visitors.badPass": "Incorrect code",
"aria.mapsView": "View",
"aria.searchMode": "Search mode",
"aria.stopCode": "Stop code",
"aria.digitN": "Digit {n}",
"aria.routeSummary": "Route summary",
"aria.routeMap": "Route map",
"aria.routeGeom": "Route geometry map",
"aria.vehicleSection": "Vehicle and operator contact",
"aria.legend": "Card colours by route group",
"aria.sponsors": "Sponsors and partners",
"aria.networkMapAlt": "Atroute stop network map",
"aria.stopRoutesMap": "Routes through this stop map",
"route.kpiNext": "Next trip",
"route.mapSection": "Route map",
"route.summarySection": "Route summary",
"credits.lead": "Every resource used on this site, with the licence required by each owner",
"credits.src": "Source:",
"credits.lic": "Licence:",
"credits.iconsCount": "15 icons in use, stored at",
"credits.iconsUsage": "Usage: sprite",
"credits.iconNames": "alarm-clock, arrow-right, bus, bus-front, check, clock, globe, hourglass, map, map-pin, message-circle, phone, refresh-cw, search, triangle-alert",
"credits.mitStrong": "MIT License (summary):",
"credits.mitText": "Permission is granted, free of charge, to any person obtaining a copy of this software to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies, subject to the copyright and permission notice above being included in all copies or substantial portions of the software. The software is provided \"as is\", without warranty of any kind.",
"credits.fontK2D": "Primary typeface for body and headings · Thai looped style, weights 300–800",
"credits.fontNoto": "Body fallback (loaded via Google Fonts CDN)",
"credits.fontPrompt": "Heading / bold fallback",
"credits.fontMono": "Times, route numbers and figures (tabular alignment)",
"credits.mapLeaflet": "Leaflet — open-source mapping library",
"credits.mapOSM": "OpenStreetMap — map tiles and map data rendered here",
"credits.mapGIS": "Bus routes, stops and station pins are drawn from the team's own GIS data (GeoJSON) layered over the map",
"credits.photosLead": "Bus photos on the route detail pages come from the public sources below — thanks to every photographer and compiler",
"credits.breadHome": "Home",
"credits.breadSelf": "Credits",
"credits.lineRed": "SRT Red Line",
"visitors.label": "Visitors",
"visitors.tip": "Site visitor count",
"pwa.install": "Install app",
"aria.brandHome": "Atroute — home",
"aria.mainMenu": "Main menu",
"aria.langSwitch": "Language",
"credits.iconsFree": "— free for personal and commercial use without attribution, credited here for transparency",
"credits.tiles": "Map tiles:",
"credits.osmCredit": "OpenStreetMap © contributors (ODbL)",
"credits.facebookGroup": "Facebook group (web.facebook.com)",
"credits.from": "from",
"credits.routeN": "Route {n}",
"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"
}
+128 -3
View File
@@ -89,7 +89,7 @@
"home.lead": "ดูสายรถ, ค้นหาป้าย และเปิดตัวอย่างเส้นทางได้ทันทีจากหน้าแรก",
"home.chooseProvince": "เลือกจังหวัด",
"home.chooseStation": "เลือกสถานีขนส่งผู้โดยสาร",
"share.label": "แชร์ลิงก์สั้น",
"share.label": "แชร์หน้านี้",
"share.copied": "คัดลอกลิงก์แล้ว",
"share.short": "ลิงก์สั้น",
"share.line": "แชร์ผ่าน LINE",
@@ -131,6 +131,9 @@
"stops.noOffset": "ยังไม่ระบุเวลาเดินทางจากจุดแรก",
"stops.noBusLine": "ยังไม่ระบุสายรถ",
"stops.modeCode": "ค้นหาด้วยรหัสป้าย",
"stops.modeNear": "ป้ายใกล้ฉัน",
"stops.nearCta": "ขอพิกัดและหาป้ายใกล้ฉัน",
"stops.nearHint": "ระบบจะขอตำแหน่งจากเครื่อง แล้วคำนวณระยะจากพิกัดป้าย/ศาลารถ เรียงจากใกล้ไปไกล",
"stops.modePlace": "ค้นหาด้วยชื่อสถานที่",
"stops.codePh": "3+000",
"stops.codeHint": "พิมพ์ตัวเลข 4 หลัก ระบบจะเติมเครื่องหมาย + ให้อัตโนมัติ (เช่น 3000 → 3+000)",
@@ -138,7 +141,6 @@
"stops.codeFull": "รหัสป้าย:",
"stops.placePh": "โรงพยาบาลอ่างทอง",
"stops.placeHint": "พิมพ์ชื่อสถานที่สำคัญ เช่น โรงพยาบาล สำนักงานที่ดิน แล้วเลือกรายการที่ตรงกัน",
"stops.padDelete": "ลบ",
"stops.reset": "ล้างค่า",
"stops.section": "ตอน",
"stops.showing": "แสดง {a} จาก {b} ป้าย",
@@ -265,5 +267,128 @@
"check.noMoreToday": "ไม่มีรถเหลือในวันนี้แล้ว",
"check.stopsCount": "จุดจอด",
"check.toStopDetail": "ไปหน้ารายละเอียดจุดจอด",
"common.routes": "เส้นทาง"
"common.routes": "เส้นทาง",
"stops.padDelete": "ลบ",
"page.home": "หน้าแรก | Atroute",
"page.stops": "ป้ายหยุดรถ | Atroute",
"page.routes": "รายละเอียดสายรถ | Atroute",
"page.check": "เช็กเวลาเดินรถ | Atroute",
"page.stop": "รายละเอียดป้าย | Atroute",
"page.credits": "เครดิต | Atroute",
"page.about": "เกี่ยวกับเรา | Atroute",
"page.blog": "บ่นไปเรื่อย | Atroute",
"router.loadFail": "โหลดเนื้อหาไม่สำเร็จ — กรุณาเปิดผ่าน HTTP server (เช่น python3 -m http.server)",
"common.routePrefix": "สาย {n}",
"common.stopPrefix": "ป้าย {n}",
"route.qrAlt": "LINE QR สาย {n}",
"route.vehicleAlt": "รถของสาย {n}",
"check.fromName": "จาก {name}",
"check.stopNameN": "จุดจอด {n}",
"map.mUnit": "ม.",
"map.originShort": "ต้นทาง",
"day.sun": "อาทิตย์",
"day.mon": "จันทร์",
"day.tue": "อังคาร",
"day.wed": "พุธ",
"day.thu": "พฤหัสบดี",
"day.fri": "ศุกร์",
"day.sat": "เสาร์",
"day.sunS": "อา",
"day.monS": "จ",
"day.tueS": "อ.",
"day.wedS": "พ.",
"day.thuS": "พฤ.",
"day.friS": "ศ.",
"day.satS": "ส.",
"visitors.resetTitle": "รีเซ็ตจำนวนผู้เข้าชม",
"visitors.resetPass": "รหัสรีเซ็ต",
"visitors.cancel": "ยกเลิก",
"visitors.confirm": "รีเซ็ต",
"visitors.done": "รีเซ็ตแล้ว — เริ่มนับใหม่จาก 0",
"visitors.unsupported": "เบราว์เซอร์ไม่รองรับ — ต้องเปิดผ่าน https หรือ localhost",
"visitors.badPass": "รหัสไม่ถูกต้อง",
"aria.mapsView": "มุมมอง",
"aria.searchMode": "รูปแบบการค้นหา",
"aria.stopCode": "รหัสป้าย",
"aria.digitN": "หลักที่ {n}",
"aria.routeSummary": "สรุปเส้นทาง",
"aria.routeMap": "แผนที่เส้นทาง",
"aria.routeGeom": "แผนที่เส้นทางเดินรถ",
"aria.vehicleSection": "รถประจำสายและติดต่อผู้ประกอบการ",
"aria.legend": "คำอธิบายสีการ์ดตามหมวดเส้นทาง",
"aria.sponsors": "ผู้สนับสนุนและพาร์ทเนอร์",
"aria.networkMapAlt": "แผนที่เครือข่ายป้าย Atroute",
"aria.stopRoutesMap": "แผนที่เส้นทางที่ผ่านป้ายนี้",
"route.kpiNext": "รอบถัดไป",
"route.mapSection": "แผนที่เส้นทาง",
"route.summarySection": "สรุปเส้นทาง",
"credits.lead": "รายการทรัพยากรทั้งหมดที่ใช้ในเว็บนี้ พร้อมใบอนุญาต (license) ตามข้อกำหนดของเจ้าของแต่ละราย",
"credits.src": "แหล่งที่มา:",
"credits.lic": "ใบอนุญาต:",
"credits.iconsCount": "ไอคอนที่ใช้ทั้งหมด 15 รายการ เก็บที่",
"credits.iconsUsage": "วิธีใช้งาน: sprite",
"credits.iconNames": "alarm-clock, arrow-right, bus, bus-front, check, clock, globe, hourglass, map, map-pin, message-circle, phone, refresh-cw, search, triangle-alert",
"credits.mitStrong": "MIT License (สรุป):",
"credits.mitText": "อนุญาตให้ใช้ คัดลอก แก้ไข ผสาน เผยแพร่ แจกจ่าย ขาย และ/หรือให้สิทธิ์ใช้งานซอฟต์แวร์นี้ โดยมีเงื่อนไขให้ข้อความแสดงลิขสิทธิ์และข้อความอนุญาตข้างต้นปรากฏอยู่ในสำเนาทั้งหมดหรือส่วนสำคัญของซอฟต์แวร์ ซอฟต์แวร์นี้ให้บริการ \"ตามสภาพ\" โดยไม่มีการรับประกันใด ๆ",
"credits.fontK2D": "ฟอนต์หลักของเว็บ (เนื้อหา + หัวเรื่อง) · มีหัวแบบไทย น้ำหนัก 300–800",
"credits.fontNoto": "ตัวสำรองเนื้อหา (โหลดผ่าน Google Fonts CDN)",
"credits.fontPrompt": "ตัวสำรองหัวเรื่อง/ตัวหนา",
"credits.fontMono": "เวลา · เลขสาย · ตัวเลข (เรียงตรงกัน)",
"credits.mapLeaflet": "Leaflet — ไลบรารีแผนที่แบบ open-source",
"credits.mapOSM": "OpenStreetMap — ภาพ tiles และข้อมูลแผนที่ที่ใช้แสดงผล",
"credits.mapGIS": "เส้นทางเดินรถ จุดจอด และหมุดสถานี วาดจากข้อมูล GIS ของทีม (GeoJSON) ทับบนแผนที่",
"credits.photosLead": "ภาพรถโดยสารประจำทางที่แสดงในหน้ารายละเอียดสาย มาจากแหล่งข้อมูลสาธารณะด้านล่างนี้ — ขอบคุณเจ้าของภาพและผู้รวบรวมทุกท่าน",
"credits.breadHome": "หน้าแรก",
"credits.breadSelf": "เครดิต",
"credits.lineRed": "รถไฟฟ้าสายสีแดง",
"visitors.label": "ผู้เข้าชม",
"visitors.tip": "จำนวนผู้เข้าชมเว็บไซต์",
"pwa.install": "ติดตั้งแอป",
"aria.brandHome": "Atroute — หน้าแรก",
"aria.mainMenu": "เมนูหลัก",
"aria.langSwitch": "ภาษา / Language",
"credits.iconsFree": "— ใช้ได้ฟรีทั้งส่วนบุคคลและเชิงพาณิชย์ โดยไม่ต้องระบุเครดิต แต่เราระบุไว้เพื่อความโปร่งใส",
"credits.tiles": "ชุดแผนที่ (tiles):",
"credits.osmCredit": "OpenStreetMap © ผู้มีส่วนร่วม (ODbL)",
"credits.facebookGroup": "กลุ่ม Facebook (web.facebook.com)",
"credits.from": "จาก",
"credits.routeN": "สาย {n}",
"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": "หน้า"
}
+10 -1
View File
@@ -24,11 +24,18 @@ export function ensureRuntime(): Promise<void> {
await import("./ui/imageurl");
await import("./ui/i18n");
await import("./ui/popular");
await import("./ui/visitors");
await import("./ui/analytics");
await import("./ui/motion");
await import("./ui/map");
await import("./ui/schedules");
await import("./ui/otherStop");
/* ตัวกลางลิงก์แชร์ — ต้องพร้อมก่อนหน้าไหนจะกดแชร์ */
const share = await import("./share");
/* ต้อง spread — ES module namespace object ไม่ extensible (ใส่ property ใหม่ไม่ได้) */
(window as unknown as { AtShare?: unknown }).AtShare = { ...share };
await import("./ui/share.init");
const w = window as unknown as {
I18N?: { ready?: Promise<unknown>; apply?: () => void };
};
@@ -69,4 +76,6 @@ export async function mountPage(
const mod = await load();
mod.default();
w.I18N?.apply?.();
/* ผูกปุ่ม "แชร์หน้านี้" หลัง DOM ของหน้าเรนเดอร์เสร็จ */
(window as unknown as { AtShareInit?: () => void }).AtShareInit?.();
}
+88
View File
@@ -0,0 +1,88 @@
/**
* Atroute — ลิงก์แชร์ (ตัวกลาง)
*
* เป้าหมาย
* 1) สั้น — ใช้ querystring key สั้น ไม่ยัด JSON/base64
* 2) ไม่ฝังชื่อเว็บ — ใช้ location.origin + location.pathname
* → ปีหน้าเปลี่ยนชื่อเว็บ/โดเมน ลิงก์เก่าที่แชร์ไปแล้วยังเปิดได้ที่โดเมนเดิม
* และลิงก์ใหม่สร้างจากโดเมนที่ผู้ใช้กำลังเปิดอยู่โดยอัตโนมัติ
* 3) จำสถานะ — เก็บ "ตัวกรองที่ผู้ใช้เลือกอยู่" ณ ขณะกดแชร์ลงในลิงก์
*
* กติกา key ต่อหน้า (สั้น อ่านรู้เรื่อง)
* / ?s=<station_code> เลือกสถานีอยู่
* ?p=<province_id> เลือกจังหวัดอยู่
* /stops/:code ?q=<ข้อความค้นหา> กรองสายรถในป้ายนั้น
* /routes/:id — อยู่ใน path แล้ว
* /check/:id — อยู่ใน path แล้ว
*
* หมายเหตุ: ค่าที่เป็นค่าเริ่มต้น (ว่าง/0/'all') จะไม่ถูกใส่ลิงก์ → ลิงก์สั้นที่สุด
*/
export type ShareState = Record<string, string | number | null | undefined>;
/** key ที่ยอมรับได้ต่อหน้า — กันไม่ให้ query แปลกปลอมหลุดเข้า state */
export const SHARE_KEYS = ["s", "p", "q"] as const;
export type ShareKey = (typeof SHARE_KEYS)[number];
/** ค่าที่ถือว่า "ไม่มีอะไรต้องแชร์" → ไม่ต้องใส่ใน query */
function isEmpty(v: unknown): boolean {
if (v === null || v === undefined) return true;
const s = String(v).trim();
return s === "" || s === "all" || s === "0";
}
/**
* สร้างลิงก์แชร์จากที่อยู่ปัจจุบัน + state ที่ส่งมา
* - ใช้ origin/pathname ของผู้ใช้ → เปลี่ยนชื่อเว็บแล้วไม่พัง
* - ตัด trailing `/index.html` เผื่อรันแบบ static
*/
export function buildShareUrl(state?: ShareState): string {
const origin = typeof window !== "undefined" ? window.location.origin : "";
const path =
typeof window !== "undefined"
? window.location.pathname.replace(/\/index\.html$/, "")
: "/";
const parts: string[] = [];
if (state) {
for (const k of SHARE_KEYS) {
const v = state[k];
if (isEmpty(v)) continue;
parts.push(encodeURIComponent(k) + "=" + encodeURIComponent(String(v).trim()));
}
}
const qs = parts.length ? "?" + parts.join("&") : "";
return origin + (path || "/") + qs;
}
/** อ่าน state จาก query ปัจจุบัน — คืนเฉพาะ key ที่รู้จัก */
export function readShareState(): Partial<Record<ShareKey, string>> {
if (typeof window === "undefined") return {};
const out: Partial<Record<ShareKey, string>> = {};
try {
const sp = new URLSearchParams(window.location.search);
for (const k of SHARE_KEYS) {
const v = sp.get(k);
if (v != null && v !== "") out[k] = v;
}
} catch {
/* เพิกเฉย — query เพี้ยน */
}
return out;
}
/**
* เขียน state ลง URL แบบไม่ reload ไม่เพิ่ม history
* ใช้เมื่อผู้ใช้เปลี่ยนตัวกรอง → แชร์/บุ๊กมาร์กได้ตรงสถานะล่าสุด
* และคัดลอกลิงก์จาก omnibox ได้ด้วย
*/
export function syncShareState(state: ShareState): void {
if (typeof window === "undefined" || !window.history?.replaceState) return;
try {
const url = buildShareUrl(state);
window.history.replaceState(window.history.state, "", url);
} catch {
/* เพิกเฉย */
}
}
+51
View File
@@ -0,0 +1,51 @@
/**
* Atroute — ค่าคงที่ของเว็บ (SEO / meta / sitemap / robots)
*
* ทำไมต้องมีไฟล์นี้
* ปีหน้าจะเปลี่ยนชื่อเว็บ — ทุกอย่างที่อ้างชื่อ/โดเมนให้ดึงจากที่นี่ที่เดียว
* เปลี่ยนชื่อ = แก้ `NEXT_PUBLIC_SITE_NAME` + `NEXT_PUBLIC_SITE_URL` ใน .env
* ไม่ต้องแก้โค้ด (สอดคล้องกับระบบลิงก์แชร์ที่ไม่ฝังชื่อเว็บไว้ใน URL)
*/
const rawUrl = (process.env.NEXT_PUBLIC_SITE_URL || "").replace(/\/+$/, "");
/** โดเมนจริงของเว็บ — ใช้ทำ canonical / OG / sitemap */
export const SITE_URL = rawUrl || "http://localhost:3100";
/** ชื่อแบรนด์ — เปลี่ยนได้ที่ env */
export const SITE_NAME = process.env.NEXT_PUBLIC_SITE_NAME || "Atroute";
/** ชื่อเต็มที่ขึ้นใน <title> และ OG */
export const SITE_TITLE = `${SITE_NAME} — สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง`;
/** คำอธิบายมาตรฐาน (ความยาว ~150 ตัวอักษร เหมาะกับ SERP) */
export const SITE_DESCRIPTION =
"ตารางเดินรถ รหัสป้าย จุดจอด และเส้นทางรถโดยสารในจังหวัดอ่างทองและจังหวัดใกล้เคียง ดูเวลาเที่ยวถัดไปได้ทันที";
/** ภาษาหลักของหน้า (หน้าเว็บสลับ TH/EN ด้วยตัวเอง ไม่มี path แยก) */
export const SITE_LOCALE = "th_TH";
/** รูป OG มาตรฐาน (1200×630) */
export const SITE_OG_IMAGE = "/og-image.png";
/** พาธที่ไม่อยากให้บอทเก็บ (API + ไฟล์ไบนารี + หน้าดิบ) */
export const DISALLOW_PATHS = ["/api/", "/files/", "/offline.html"];
/** หน้าคงที่ที่ควรอยู่ใน sitemap (path, changefreq, priority) */
export const STATIC_PAGES: Array<{
path: string;
changeFrequency: "daily" | "weekly" | "monthly";
priority: number;
}> = [
{ path: "/", changeFrequency: "daily", priority: 1.0 },
{ path: "/routes", changeFrequency: "daily", priority: 0.9 },
{ path: "/stops", changeFrequency: "daily", priority: 0.9 },
{ path: "/blog", changeFrequency: "weekly", priority: 0.6 },
{ path: "/about", changeFrequency: "monthly", priority: 0.5 },
{ path: "/credits", changeFrequency: "monthly", priority: 0.3 },
];
/** ต่อ path กับโดเมนให้เป็น URL เต็ม */
export function absUrl(path: string): string {
return SITE_URL + (path.startsWith("/") ? path : "/" + path);
}
+302
View File
@@ -0,0 +1,302 @@
// @ts-nocheck
/**
* analytics.ts — สถิติการค้นหา/เปิดหน้า แบบไม่ระบุตัวตน (ported from
* web-at-transit-mock/ui/analytics.js)
*
* หลักความเป็นส่วนตัว (เหมือนต้นแบบ):
* - ไม่มีคุกกี้ · ไม่มี fingerprint · ไม่เก็บ IP/UA/พิกัด
* - session id สุ่มต่อแท็บ (sessionStorage) — ใช้แค่กันนับซ้ำ
* - เคารพ Do Not Track + Global Privacy Control + สวิตช์ opt-out
* - เก็บรวมในเครื่อง (localStorage at_stats_v1) — ค่าเริ่มต้นไม่ส่งออกเน็ต
* - ถ้าตั้ง window.AT_ANALYTICS = { endpoint, siteId } จึง POST สเปก Umami
*
* API: window.Analytics.search({q,scope,results}) · pageview(path) · view(kind,id)
* report() · exportJSON() · clear() · optOut(bool) · isOptedOut() · cleanTerm()
*/
(function () {
'use strict';
var KEY = 'at_stats_v1';
var OPTOUT_KEY = 'at_stats_optout';
var SESSION_KEY = 'at_stats_sid';
var MAX_TERMS = 300;
var MAX_VIEWS = 200;
var MAX_DAYS = 120;
var TERM_MAX_LEN = 60;
var DEBOUNCE_MS = 900;
var DAY_MS = 86400000;
function cfg() {
return (typeof window !== 'undefined' && window.AT_ANALYTICS) || {};
}
function dntOn() {
var d = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
if (d === '1' || d === 'yes' || d === 'on') return true;
if (navigator.globalPrivacyControl === true) return true;
return false;
}
function optedOut() {
try { return localStorage.getItem(OPTOUT_KEY) === '1'; }
catch (e) { return true; }
}
function tracking() { return !dntOn() && !optedOut(); }
function now() { return Date.now(); }
function dayKey(ts) {
var d = new Date(ts);
var m = ('0' + (d.getMonth() + 1)).slice(-2);
var day = ('0' + d.getDate()).slice(-2);
return d.getFullYear() + '-' + m + '-' + day;
}
/** ตัดข้อมูลส่วนตัวออกจากคำค้นก่อนบันทึกเสมอ */
function cleanTerm(q) {
var s = String(q == null ? '' : q).replace(/\s+/g, ' ').trim();
if (!s) return '';
s = s
.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g, ' ')
.replace(/@[\w.]+/g, ' ')
.replace(/\d{5,}/g, ' ')
.replace(/\s+/g, ' ')
.trim()
.toLowerCase();
if (s.length > TERM_MAX_LEN) s = s.slice(0, TERM_MAX_LEN);
return s;
}
function blank() {
return { v: 1, since: now(), days: {}, terms: {}, empty: {}, views: {} };
}
function read() {
try {
var raw = localStorage.getItem(KEY);
if (!raw) return blank();
var d = JSON.parse(raw);
if (!d || typeof d !== 'object' || d.v !== 1) return blank();
d.days = d.days || {}; d.terms = d.terms || {}; d.empty = d.empty || {}; d.views = d.views || {};
return d;
} catch (e) { return blank(); }
}
function write(d) {
try { localStorage.setItem(KEY, JSON.stringify(d)); } catch (e) { /* เงียบ */ }
}
function cap(map, max) {
var keys = Object.keys(map);
if (keys.length <= max) return false;
keys.sort(function (a, b) { return ((map[a] && map[a][1]) || 0) - ((map[b] && map[b][1]) || 0); });
var cut = keys.length - max;
for (var i = 0; i < cut; i++) delete map[keys[i]];
return true;
}
function bump(map, key, ts, max) {
if (!key) return;
var e = map[key];
map[key] = [(e && Number(e[0])) || 0, ts];
map[key][0] += 1;
cap(map, max);
}
function pruneDays(d, ts) {
var cut = dayKey(ts - (MAX_DAYS - 1) * DAY_MS);
Object.keys(d.days).forEach(function (k) { if (k < cut) delete d.days[k]; });
}
function day(d, ts) {
var k = dayKey(ts);
if (!d.days[k]) d.days[k] = { pv: 0, q: 0, nores: 0 };
return d.days[k];
}
/* ---------- ส่งออก Umami (เฉพาะเมื่อเจ้าของเว็บตั้งค่า) ---------- */
var sid = null;
function sessionId() {
if (sid) return sid;
try {
sid = sessionStorage.getItem(SESSION_KEY);
if (!sid) {
sid = Math.random().toString(36).slice(2) + now().toString(36);
sessionStorage.setItem(SESSION_KEY, sid);
}
} catch (e) { sid = 'anon'; }
return sid;
}
function send(name, data) {
var c = cfg();
if (!c || !c.endpoint || !c.siteId) return;
var body = {
type: 'event',
payload: {
website: c.siteId,
hostname: location.hostname,
url: location.pathname + location.search,
referrer: document.referrer || '',
title: document.title || '',
language: navigator.language || '',
screen: (screen.width || 0) + 'x' + (screen.height || 0),
event_name: name,
event_data: data || {}
}
};
var url = String(c.endpoint).replace(/\/+$/, '') + '/api/send';
try {
var blob = new Blob([JSON.stringify(body)], { type: 'application/json' });
if (navigator.sendBeacon && navigator.sendBeacon(url, blob)) return;
fetch(url, {
method: 'POST', body: JSON.stringify(body), keepalive: true,
headers: { 'Content-Type': 'application/json' }
}).catch(function () {});
} catch (e) { /* analytics ต้องไม่ทำให้หน้าเว็บพัง */ }
}
/* ---------- บันทึก ---------- */
var pending = null;
var lastPV = { key: '', ts: 0 };
var lastView = { key: '', ts: 0 };
function recordSearch(q, scope, results) {
var term = cleanTerm(q);
if (!term || term.replace(/\s/g, '').length < 2) return;
var ts = now();
var d = read();
var bucket = day(d, ts);
bucket.q += 1;
if (results === 0) { bucket.nores += 1; bump(d.empty, term, ts, MAX_TERMS); }
else bump(d.terms, term, ts, MAX_TERMS);
pruneDays(d, ts);
write(d);
if (tracking()) send('search', { term: term, scope: scope || '', results: results });
}
function flush() {
if (!pending) return;
var p = pending;
pending = null;
clearTimeout(p.timer);
recordSearch(p.q, p.scope, p.results);
}
function trackViewOnce(kind, id) {
if (!id) return;
var key = kind + ':' + id;
var ts = now();
if (lastView.key === key && ts - lastView.ts < 1200) return;
lastView = { key: key, ts: ts };
var d = read();
bump(d.views, key, ts, MAX_VIEWS);
write(d);
if (tracking()) send('view', { kind: kind, id: String(id) });
}
var Analytics = {
/** นับการเปิดหน้า — เรียกจาก MotionBoot ตอน pathname เปลี่ยน */
pageview: function (path) {
if (!tracking()) { flush(); return; }
var key = String(path || (typeof location !== 'undefined' ? location.pathname : '/'));
var ts = now();
if (lastPV.key === key && ts - lastPV.ts < 1200) return;
lastPV = { key: key, ts: ts };
var d = read();
day(d, ts).pv += 1;
pruneDays(d, ts);
write(d);
var seg = key.split('/').filter(Boolean);
if (seg[0] === 'routes' && seg[1]) trackViewOnce('route', decodeURIComponent(seg[1]));
else if (seg[0] === 'stops' && seg[1]) trackViewOnce('stop', decodeURIComponent(seg[1]));
if (tracking()) send('pageview', { path: key });
},
/** เรียกได้ทุกครั้งที่ผลค้นเปลี่ยน — debounce 900ms ในตัว */
search: function (opts) {
if (!tracking()) return;
var o = opts || {};
var q = String(o.q == null ? '' : o.q);
if (!cleanTerm(q) || cleanTerm(q).replace(/\s/g, '').length < 2) return;
if (pending) clearTimeout(pending.timer);
pending = {
q: q,
scope: o.scope || '',
results: (typeof o.results === 'number') ? o.results : null,
timer: setTimeout(flush, DEBOUNCE_MS)
};
},
view: function (kind, id) { if (tracking()) trackViewOnce(kind, id); },
/* ---------- รายงานสำหรับหน้า /stats ---------- */
report: function () {
var d = read();
var ts = now();
function rows(map, n, fn) {
var arr = Object.keys(map).map(function (k) {
var e = map[k] || [];
return fn(k, Number(e[0]) || 0, Number(e[1]) || 0);
}).filter(function (r) { return r.count > 0; });
arr.sort(function (a, b) { return b.count - a.count || b.last - a.last; });
return arr.slice(0, n || 10);
}
var days = Object.keys(d.days).sort().slice(-14).map(function (k) {
var v = d.days[k];
return { date: k, pageviews: v.pv || 0, searches: v.q || 0, noResult: v.nores || 0 };
});
var pv = 0, q = 0, nores = 0;
Object.keys(d.days).forEach(function (k) {
pv += d.days[k].pv || 0; q += d.days[k].q || 0; nores += d.days[k].nores || 0;
});
return {
since: d.since || ts,
totals: {
pageviews: pv, searches: q, noResult: nores,
terms: Object.keys(d.terms).length, views: Object.keys(d.views).length
},
days: days,
topTerms: rows(d.terms, 12, function (k, c, l) { return { term: k, count: c, last: l }; }),
topEmpty: rows(d.empty, 8, function (k, c, l) { return { term: k, count: c, last: l }; }),
topViews: rows(d.views, 12, function (k, c, l) {
var at = k.indexOf(':');
return { kind: k.slice(0, at), id: k.slice(at + 1), count: c, last: l };
})
};
},
exportJSON: function () { return JSON.stringify(read(), null, 2); },
clear: function () {
try { localStorage.removeItem(KEY); } catch (e) {}
pending = null;
lastPV = { key: '', ts: 0 };
lastView = { key: '', ts: 0 };
},
optOut: function (on) {
if (pending) { clearTimeout(pending.timer); pending = null; }
try { localStorage.setItem(OPTOUT_KEY, on ? '1' : '0'); } catch (e) {}
},
isOptedOut: function () { return optedOut() || dntOn(); },
tracking: tracking,
cleanTerm: cleanTerm,
_key: KEY
};
window.Analytics = Analytics;
})();
export {};
+24 -43
View File
@@ -317,7 +317,8 @@ function nm(o: any, base: string): string {
host.appendChild(zoneSection(g, mine, ZDATA.timesByRoute, tr));
});
if (shareRefresh) shareRefresh(); /* อัปเดตลิงก์สั้นตามที่เลือก */
refreshShareLink(); /* อัปเดตลิงก์แชร์ตามที่เลือก */
syncHomeUrl(); /* เขียนสถานะลง URL ตรง ๆ */
if (!zoneTimer && chipSlots.length) {
zoneTimer = setInterval(refreshChips, 60000);
document.addEventListener('visibilitychange', function () {
@@ -328,7 +329,7 @@ function nm(o: any, base: string): string {
}
var zoneTimer = null;
var shareRefresh = null;
/* ตัวอัปเดตลิงก์แชร์ — ใช้ AtShare.refresh() จาก share.init.ts */
function zoneSection(group, allRoutes, timesByRoute, tr) {
var meta = GROUP_META[group.route_group] || {};
@@ -421,55 +422,35 @@ function nm(o: any, base: string): string {
}
/* ============================================================
ลิงก์สั้นสำหรับแชร์ (ส่งไลน์หากัน)
#/?s=<รหัสสถานี> = เปิดหน้าแรกพร้อมเลือกสถานีนั้น
#/?p=<province_id> = เปิดพร้อมเลือกจังหวัด
ลิงก์แชร์ — ใช้ตัวกลาง lib/ui/share.init.ts
หน้านี้แค่บอกสถานะที่ผู้ใช้เลือกอยู่ (สถานี/จังหวัด)
รูปแบบลิงก์: <origin>/ ? s=<รหัสสถานี> หรือ ? p=<province_id>
ไม่ฝังชื่อเว็บ → เปลี่ยนชื่อเว็บปีหน้าแล้วลิงก์ยังใช้ได้
============================================================ */
function shortUrl() {
var base = location.origin + location.pathname.replace(/index\.html$/, '');
var q = state.stationCode ? 's=' + encodeURIComponent(state.stationCode)
: (state.provinceId ? 'p=' + state.provinceId : '');
return base + (q ? '/?' + q : '/');
(window as any).AtHomeState = function () {
var out = {};
if (state.stationCode) out.s = state.stationCode;
else if (state.provinceId) out.p = state.provinceId;
return out;
};
/* เขียนตัวเลือกที่ใช้อยู่ลง URL (ไม่ reload) → คัดลอกลิงก์จาก omnibox ได้ตรงสถานะ */
function syncHomeUrl() {
var S = (window as any).AtShare;
if (S && S.syncShareState) S.syncShareState((window as any).AtHomeState());
}
function initShare() {
var btn = document.getElementById('share-btn');
var status = document.getElementById('share-status');
if (!btn) return;
var tr = window.I18N ? window.I18N.t : function (k) { return k; };
function paint(msg) {
if (!status) return;
status.innerHTML = esc(msg) + ' <code class="mu-share-url">' + esc(shortUrl()) + '</code> ' +
'<a class="mu-share-line" href="https://social-plugins.line.me/lineit/share?url=' +
encodeURIComponent(shortUrl()) + '" target="_blank" rel="noopener">' + esc(tr('share.line')) + '</a>';
}
shareRefresh = function () { if (status && status.dataset.shown) paint(status.dataset.msg || ''); };
btn.addEventListener('click', function () {
var url = shortUrl();
if (navigator.share) {
navigator.share({ title: document.title, url: url }).catch(function () { /* ผู้ใช้ยกเลิก */ });
}
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(url).then(function () {
status.dataset.shown = '1'; status.dataset.msg = tr('share.copied'); paint(tr('share.copied'));
}, function () {
status.dataset.shown = '1'; status.dataset.msg = tr('share.short'); paint(tr('share.short'));
});
} else {
status.dataset.shown = '1'; status.dataset.msg = tr('share.short'); paint(tr('share.short'));
}
});
function refreshShareLink() {
var S = (window as any).AtShare;
if (typeof (window as any).AtShareRefresh === 'function') (window as any).AtShareRefresh();
}
initHomeSelectors();
initHomeSelectors();
initSponsors().then(initMarquee); /* เติมไทล์จาก JSON ก่อน แล้วค่อย clone (ไม่งั้นไทล์ที่เพิ่มจะไม่ถูก clone) */
initShare();
refreshShareLink();
export default function mount(): void {
initHomeSelectors();
initSponsors().then(initMarquee);
initShare();
refreshShareLink();
}
+5 -2
View File
@@ -37,8 +37,9 @@
var saved = localStorage.getItem(LS_KEY);
if (saved && SUPPORTED.indexOf(saved) !== -1) return saved;
} catch (e) { /* localStorage ไม่พร้อมใช้งาน */ }
var nav = (navigator.language || BASE).toLowerCase();
return nav.indexOf('en') === 0 ? 'en' : BASE;
/* ภาษาเริ่มต้น = ไทยเสมอ (ไม่เดาจาก navigator.language)
ผู้ใช้เปลี่ยนเองได้ที่ปุ่ม dropdown แล้วเลือกจำไว้ใน at_lang */
return BASE;
}
/* ---------- โหลดไฟล์ภาษา (cache ต่อภาษา · ล้มเหลว = {} ไม่ให้พัง) ---------- */
@@ -131,6 +132,8 @@
Promise.all([dict(BASE), dict(current)]).then(function () {
apply();
resolveReady();
/* บอก UI ที่ mount ไปก่อนภาษาโหลดเสร็จ (เช่นปุ่ม dropdown) ให้ sync สถานะ */
window.dispatchEvent(new CustomEvent('i18nready', { detail: current }));
});
})();
export {};
+4
View File
@@ -602,6 +602,10 @@ window.ATMap = (function () {
items.sort(function (a, b) { return a.d - b.d; });
var near = items.slice(0, opts.limit || 8);
renderNear(resultEl, near, me, opts);
/* ปลดล็อกปุ่มหลังหาป้ายเสร็จ — ผู้ใช้เดินไปที่ใหม่แล้วกดซ้ำได้ */
button.disabled = false;
}).catch(function () {
button.disabled = false;
});
}, function () {
button.disabled = false;
+205
View File
@@ -0,0 +1,205 @@
// @ts-nocheck
/**
* motion.ts — อนิเมชันร่วมทุกหน้า (ported from web-at-transit-mock/ui/motion.js)
*
* window.Motion.enter(#view) ← MotionBoot เรียกทุกครั้งที่ pathname เปลี่ยน
* window.Motion.scan() ← สแกนการ์ดที่จะค่อย ๆ โผล่ตอนเลื่อน
* window.Motion.loading(bool) ← แถบโหลดบางบนสุด
*
* หลักการเดียวกับต้นแบบ:
* - แตะเฉพาะ opacity + transform (ไม่เกิด CLS) · ใช้ของที่ยังไม่เห็นบนจอเท่านั้น
* - เคลียร์ class/transform หลังจบ → hover เดิมของแต่ละหน้าไม่ถูกทับ
* - ไม่แตะของที่ครอบแผนที่ (Leaflet) · prefers-reduced-motion = ปิดทั้งหมด
*/
(function () {
'use strict';
var mqReduce = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;
function reduced() { return !!(mqReduce && mqReduce.matches); }
/* ----------------------------------------------------------
1) แถบโหลดด้านบน
---------------------------------------------------------- */
var bar = null, barFill = null, growTimer = null, outTimer = null;
function ensureBar() {
if (bar && document.body.contains(bar)) return;
bar = document.createElement('div');
bar.className = 'mu-loadbar';
bar.setAttribute('aria-hidden', 'true');
barFill = document.createElement('div');
barFill.className = 'mu-loadbar-fill';
bar.appendChild(barFill);
document.body.appendChild(bar);
}
function setProgress(p) {
if (!barFill) return;
barFill.style.transition = 'transform .4s cubic-bezier(.22,.61,.36,1)';
barFill.style.transform = 'scaleX(' + p + ')';
}
function loading(on) {
if (reduced() || !document.body) return;
ensureBar();
clearTimeout(growTimer);
clearTimeout(outTimer);
if (on) {
bar.classList.add('is-on');
barFill.style.transition = 'none';
barFill.style.transform = 'scaleX(0)';
void barFill.offsetWidth;
setProgress(0.18);
growTimer = setTimeout(function () { setProgress(0.5); }, 200);
growTimer = setTimeout(function () { setProgress(0.78); }, 700);
return;
}
setProgress(1);
outTimer = setTimeout(function () {
bar.classList.remove('is-on');
outTimer = setTimeout(function () {
if (!barFill) return;
barFill.style.transition = 'none';
barFill.style.transform = 'scaleX(0)';
}, 260);
}, 180);
}
/* ----------------------------------------------------------
2) เข้าหน้า
---------------------------------------------------------- */
function enter(el) {
if (!el || reduced()) { firstPass = false; return; }
el.classList.remove('mu-view-in');
void el.offsetWidth;
el.classList.add('mu-view-in');
firstPass = true;
scan(el);
setTimeout(function () { firstPass = false; scan(el); }, 400);
}
/* ----------------------------------------------------------
3) เลื่อนแล้วค่อยโผล่
---------------------------------------------------------- */
var SELECTOR = [
'.mu-zone', '.mu-card', '.mu-stop-card', '.mu-blog-card', '.mu-blog-row',
'.mu-credit-section', '.mu-summary', '.mu-stat', '.mu-zone-head',
'.mu-sponsor-head', '.mu-schedule', '.mu-kpi', '.mu-post-figure',
'.mu-nearby', '.mu-route-tools', '.st-card', '.st-kpi'
].join(',');
var SKIP_INSIDE = '.leaflet-container, .at-map, .blog-mapx, [data-no-reveal]';
var io = ('IntersectionObserver' in window)
? new IntersectionObserver(onIntersect, { rootMargin: '0px 0px -8% 0px', threshold: 0.05 })
: null;
var firstPass = false;
var pending = [];
function reveal(el) {
if (!el || el.classList.contains('is-in')) return;
var at = pending.indexOf(el);
if (at !== -1) pending.splice(at, 1);
io.unobserve(el);
el.classList.add('is-in');
var d = parseFloat(el.style.getPropertyValue('--mu-d')) || 0;
setTimeout(function () {
el.classList.remove('mu-reveal', 'is-in');
el.style.removeProperty('--mu-d');
}, 700 + d);
}
function onIntersect(entries) {
for (var i = 0; i < entries.length; i++) {
if (entries[i].isIntersecting) reveal(entries[i].target);
}
sweep();
}
function sweep() {
if (!pending.length) return;
var vh = window.innerHeight || document.documentElement.clientHeight;
for (var i = pending.length - 1; i >= 0; i--) {
var el = pending[i];
if (!el.isConnected) { pending.splice(i, 1); io.unobserve(el); continue; }
if (el.getBoundingClientRect().top < vh) reveal(el);
}
}
var sweepQueued = 0;
function queueSweep() {
if (sweepQueued) return;
sweepQueued = 1;
setTimeout(function () { sweepQueued = 0; sweep(); }, 90);
}
function scan(root) {
if (!io || reduced()) return;
root = root || document.getElementById('view');
if (!root) return;
var nodes = root.querySelectorAll(SELECTOR);
if (!nodes.length) return;
pending = pending.filter(function (el) { return el.isConnected; });
var vh = window.innerHeight || document.documentElement.clientHeight;
var idx = 0;
for (var i = 0; i < nodes.length; i++) {
var el = nodes[i];
if (el.classList.contains('mu-reveal') || el.classList.contains('is-in')) continue;
if (el.closest(SKIP_INSIDE)) continue;
if (el.parentElement && el.parentElement.closest(SELECTOR) && root.contains(el.parentElement.closest(SELECTOR))) continue;
var rect = el.getBoundingClientRect();
if (rect.width === 0 && rect.height === 0) continue;
if (firstPass && rect.top < vh) continue;
el.style.setProperty('--mu-d', (Math.min(idx, 4) * 45) + 'ms');
el.classList.add('mu-reveal');
pending.push(el);
idx++;
io.observe(el);
}
if (idx) setTimeout(sweep, 300);
}
window.addEventListener('scroll', queueSweep, { passive: true });
window.addEventListener('resize', queueSweep);
document.addEventListener('visibilitychange', function () {
if (document.visibilityState === 'visible') queueSweep();
});
window.addEventListener('beforeprint', function () {
var rest = pending.slice();
for (var i = 0; i < rest.length; i++) reveal(rest[i]);
});
/* การ์ดที่ JS สร้างทีหลัง (fetch JSON / กรอง / เปลี่ยนภาษา) → สแกนซ้ำให้เอง */
var scanTimer = 0;
function scheduleScan() {
if (scanTimer) return;
scanTimer = setTimeout(function () { scanTimer = 0; scan(); }, 80);
}
function watch() {
var host = document.getElementById('view');
if (!host || !window.MutationObserver) return;
new MutationObserver(function (list) {
for (var i = 0; i < list.length; i++) {
if (list[i].addedNodes && list[i].addedNodes.length) { scheduleScan(); return; }
}
}).observe(host, { childList: true, subtree: true });
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', watch);
else watch();
window.Motion = { enter: enter, scan: scan, loading: loading, reduced: reduced };
})();
export {};
+142
View File
@@ -0,0 +1,142 @@
/**
* Atroute — ปุ่ม "แชร์หน้านี้" (ใช้ร่วมทุกหน้า)
*
* หลักการ
* - ปุ่มคือ [id="share-btn"] ในหน้านั้น (มีหลายหน้าวางปุ่มตัวเดียวกัน)
* - ตอนกด จะรวบรวม "สถานะที่ผู้ใช้กำลังเลือกอยู่" ของหน้านั้น แล้วสร้างลิงก์สั้น
* - ใช้ navigator.share ถ้ามี (มือถือ) + คัดลอกลงคลิปบอร์ดพร้อมกัน
*
* สถานะที่เก็บต่อหน้า
* / → s = รหัสสถานีที่เลือก, p = province_id
* /stops/:code → q = ข้อความในช่องค้นหาสายรถ
* /routes/:id → อยู่ใน path แล้ว ไม่ต้องใส่ query
* /check/:id → อยู่ใน path แล้ว ไม่ต้องใส่ query
*
* ดึง buildShareUrl/readShareState/syncShareState จาก lib/share.ts ผ่าน window.AtShare
* (ตั้งค่าไว้ใน lib/runtime.ts)
*/
export {}; /* ทำให้ไฟล์นี้เป็น ES module (runtime.ts import ได้) */
(function () {
"use strict";
var AtShare = (window as any).AtShare;
if (!AtShare) return;
function t(key: string): string {
return (window as any).I18N ? (window as any).I18N.t(key) : key;
}
function esc(v: unknown): string {
return String(v == null ? "" : v)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");
}
/** หน้าแรก: อ่านสถานี/จังหวัดที่ผู้ใช้เลือกอยู่จริงจาก DOM */
function homeState(): Record<string, string> {
/* หน้าแรกประกาศ getter ไว้แล้ว (home.init.ts) — ใช้ก่อนเสมอ */
if (typeof (window as any).AtHomeState === "function") {
return (window as any).AtHomeState() || {};
}
var out: Record<string, string> = {};
var sel = document.querySelector("[data-home-station].is-active, #home-station-select") as HTMLElement | null;
var code = sel && (sel as any).dataset ? (sel as any).dataset.homeStation : "";
if (code) out.s = String(code);
var prov = document.querySelector("[data-home-province].is-active") as HTMLElement | null;
var pid = prov && (prov as any).dataset ? (prov as any).dataset.homeProvince : "";
if (pid) out.p = String(pid);
return out;
}
/** /stops/:code: เก็บข้อความค้นหาสายรถ */
function stopsState(): Record<string, string> {
var out: Record<string, string> = {};
var input = document.getElementById("mu-route-filter") as HTMLInputElement | null;
if (input && input.value.trim()) out.q = input.value.trim();
return out;
}
/** เลือกชุด state ตาม path ปัจจุบัน — ไม่ผูกกับชื่อโดเมน */
function collectState(): Record<string, string> {
var path = window.location.pathname.replace(/\/index\.html$/, "");
if (/^\/stops\/[^/]+/.test(path)) return stopsState();
if (path === "/" || path === "") return homeState();
return {}; /* routes/:id, check/:id → path พอแล้ว */
}
function shareUrlNow(): string {
return AtShare.buildShareUrl(collectState());
}
function initShare(): void {
var btn = document.getElementById("share-btn");
var status = document.getElementById("share-status");
if (!btn) return;
function paint(msg: string): void {
if (!status) return;
var url = shareUrlNow();
status.innerHTML =
esc(msg) +
' <code class="mu-share-url">' + esc(url) + "</code> " +
'<a class="mu-share-line" href="https://social-plugins.line.me/lineit/share?url=' +
encodeURIComponent(url) +
'" target="_blank" rel="noopener">' + esc(t("share.line")) + "</a>";
status.dataset.shown = "1";
status.dataset.msg = msg;
}
/* ให้หน้าอื่นเรียกอัปเดตได้เมื่อตัวกรองเปลี่ยน
(ห้ามเขียนทับ window.AtShare.refresh — namespace object เป็น read-only) */
(window as any).AtShareRefresh = function () {
if (status && status.dataset.shown) paint(status.dataset.msg || "");
};
btn.addEventListener("click", function () {
var url = shareUrlNow();
if ((navigator as any).share) {
(navigator as any).share({ title: document.title, url: url }).catch(function () {
/* ผู้ใช้ยกเลิก — ไม่ต้องแจ้ง */
});
}
function done(ok: boolean): void {
paint(ok ? t("share.copied") : t("share.short"));
}
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(url).then(
function () { done(true); },
function () { legacyCopy(url); done(false); }
);
} else {
legacyCopy(url);
done(false);
}
});
}
/* คัดลอกแบบเก่า — เบราว์เซอร์ไม่รองรับ Clipboard API หรือไม่ได้ https */
function legacyCopy(text: string): void {
try {
var ta = document.createElement("textarea");
ta.value = text;
ta.setAttribute("readonly", "");
ta.style.position = "fixed";
ta.style.top = "-1000px";
document.body.appendChild(ta);
ta.select();
document.execCommand("copy");
document.body.removeChild(ta);
} catch {
/* เพิกเฉย */
}
}
(window as any).AtShareInit = initShare;
})();
+25 -1
View File
@@ -341,13 +341,37 @@ function nm(o: any, base: string): string {
if (ok) shown++;
});
setCount(shown, items.length);
/* สถิติคำค้นในหน้ารายละเอียดป้าย (debounce อยู่ใน Analytics) */
if (kw.length >= 2 && (window as any).Analytics) {
(window as any).Analytics.search({ q: kw, scope: 'stop', results: shown });
}
}
function setupFilter() {
var input = $('mu-route-filter');
if (input && !input.dataset.bound) {
input.dataset.bound = '1';
input.addEventListener('input', applyFilter);
input.addEventListener('input', function () {
applyFilter();
/* จำคำค้นหาลง URL → แชร์/บุ๊กมาร์กได้ตรงสถานะล่าสุด */
var S = (window as any).AtShare;
if (S && S.syncShareState) S.syncShareState({ q: input.value.trim() });
if (typeof (window as any).AtShareRefresh === 'function') (window as any).AtShareRefresh();
});
}
restoreFilterFromUrl();
}
/* อ่าน ?q= จากลิงก์ที่แชร์มา แล้วเติมช่องค้นหา + กรองทันที */
function restoreFilterFromUrl() {
var input = $('mu-route-filter');
if (!input) return;
var S = (window as any).AtShare;
if (!S || !S.readShareState) return;
var st = S.readShareState();
if (!st || !st.q) return;
input.value = st.q;
applyFilter();
}
/* ---------- ไฮไลต์เที่ยวถัดไป + นาฬิกา (เดิมอยู่ใน partial) ---------- */
+60 -6
View File
@@ -1,9 +1,63 @@
// @ts-nocheck
/* Ported from the inline <script> in web-at-transit-mock/ui/partials/busStop.html
(ปุ่ม "ใกล้ฉัน" — ผูกกับแผนที่ Leaflet) */
export default function mount(): void {
var btn = document.getElementById("near-me-btn");
var out = document.getElementById("near-me-result");
if (!btn || !out || !window.ATMap) return;
window.ATMap.nearMe(btn, out, { limit: 8 });
}
(function () {
"use strict";
/* ---------- เงื่อนไขความปลอดภัย ----------
navigator.geolocation ใช้ได้เฉพาะ secure context
(HTTPS หรือ http://localhost) — ถ้าไม่ผ่าน ให้ซ่อนแท็บที่ 3 ทั้งแท็บ
เพราะกดไปก็ได้แต่ error ว่าไม่ได้รับอนุญาต */
function geoAllowed(): boolean {
return (
typeof window !== "undefined" &&
window.isSecureContext === true &&
typeof navigator !== "undefined" &&
!!navigator.geolocation
);
}
function applySecurity() {
var tab = document.getElementById("stops-near-tab");
var wrap = document.getElementById("stops-near-wrap");
if (!tab) return;
if (geoAllowed()) {
tab.hidden = false;
return;
}
/* ไม่ปลอดภัย → ซ่อนแท็บ และถ้าผู้ใช้เปิดโหมดนี้ค้างไว้ ให้กลับไปโหมดรหัสป้าย */
tab.hidden = true;
if (wrap) wrap.hidden = true;
var codeTab = document.querySelector('.mu-search-tab[data-mode="code"]');
if (codeTab && typeof codeTab.click === "function") codeTab.click();
}
function bind(): boolean {
var btn = document.getElementById("near-me-btn");
var out = document.getElementById("near-me-result");
if (!btn || !out) return false;
if (!window.ATMap || typeof window.ATMap.nearMe !== "function") return false;
/* กันผูกซ้ำเมื่อ mount ใหม่ (React StrictMode / เดินหน้า-ถอยหลังไปมา) */
if (btn.dataset.nearBound === "1") return true;
btn.dataset.nearBound = "1";
window.ATMap.nearMe(btn, out, { limit: 8 });
return true;
}
/* ATMap อาจยังไม่พร้อมตอน import → ลองซ้ำเบา ๆ ไม่เกิน ~2 วินาที */
var tries = 0;
function retry(): void {
applySecurity();
if (bind()) return;
if (++tries > 20) return;
setTimeout(retry, 100);
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", retry);
} else {
retry();
}
})();
export {};
+40 -53
View File
@@ -3,7 +3,7 @@
/* ============================================================
ระบบค้นหาป้ายหยุดรถ — 2 โหมด (เลือกอย่างใดอย่างหนึ่ง)
------------------------------------------------------------
โหมด 1 "รหัสป้าย" : พิมพ์/กด numpad → auto-insert "+" → 00+000
โหมด 1 "รหัสป้าย" : พิมพ์ในช่อง 5 ช่อง → auto-insert "+" → 00+000
โหมด 2 "ชื่อสถานที่" : พิมพ์หา → จับคู่ place/route_name ใน JSON + suggest
กติกากันการชนกัน:
@@ -15,6 +15,7 @@
var MODE_CODE = 'code';
var MODE_PLACE = 'place';
var MODE_NEAR = 'near'; /* หมวดที่ 3: ป้ายใกล้ฉัน (ต้องมี HTTPS) */
var state = {
mode: MODE_CODE,
@@ -59,7 +60,7 @@
return (head + tail).split('');
}
/* เก็บของเดิมไว้ใช้กับ numpad/plantext เดิม (ถ้ามีคนเรียก) */
/* เก็บของเดิมไว้ใช้กับ plantext เดิม (ถ้ามีคนเรียก) */
/* พิมพ์ "3000" → "3+000" · "5005" → "5+005" */
function formatCode(raw) {
var digits = String(raw || '').replace(/\D/g, '').slice(0, 4);
@@ -92,6 +93,10 @@
}
function currentFilter() {
// โหมดใกล้ฉัน: ไม่กรองรายการ (ผลลัพธ์แสดงในโซนของตัวเอง)
if (state.mode === MODE_NEAR) {
return { fn: function () { return true; }, value: '' };
}
// โหมดรหัส: ถ้ายังไม่กรอกช่องไหนเลย → ไม่กรอง (แสดงทั้งหมด)
if (state.mode === MODE_CODE && !state.codeTouched) {
return { fn: function () { return true; }, value: '' };
@@ -154,6 +159,15 @@
/* จำกัด 6 ใบเมื่อ "ไม่ได้กรองอะไร" (เปิดหน้าปกติ) · ค้นหา/กรอง = แสดงผลทั้งหมดที่เจอ */
var searching = !!f.value;
/* สถิติคำค้น (เฉพาะตอนมีคำจริง · Analytics ทำ debounce 900ms ให้เอง) */
if (searching && (window as any).Analytics) {
(window as any).Analytics.search({
q: f.value,
scope: state.mode === MODE_CODE ? 'code' : 'place',
results: filtered.length
});
}
var limit = (searching || state.showAll) ? filtered.length : PREVIEW_LIMIT;
var cards = [].filter.call(host.children, function (el) { return el.tagName === 'LI' && el.hasAttribute('data-idx'); });
@@ -208,23 +222,33 @@
/* ---------- สลับโหมด (หัวใจของการกันชน) ---------- */
function setMode(mode) {
if (mode !== MODE_CODE && mode !== MODE_PLACE) return;
if (mode !== MODE_CODE && mode !== MODE_PLACE && mode !== MODE_NEAR) return;
/* โหมดใกล้ฉันใช้ได้เฉพาะ secure context (HTTPS / localhost) */
if (mode === MODE_NEAR && !(window.isSecureContext && navigator.geolocation)) return;
state.mode = mode;
var codeWrap = document.getElementById('stops-code-wrap');
var placeWrap = document.getElementById('stops-place-wrap');
var nearWrap = document.getElementById('stops-near-wrap');
var placeInput = document.getElementById('stops-place-input');
var suggest = document.getElementById('stops-suggest');
var pad = document.getElementById('stops-numpad');
var cells = codeCells();
var isCode = mode === MODE_CODE;
var isPlace = mode === MODE_PLACE;
var isNear = mode === MODE_NEAR;
// แสดง/ซ่อนช่องกรอก
// แสดง/ซ่อนช่องกรอก — เลือกได้ทีละโหมดเท่านั้น
if (codeWrap) codeWrap.hidden = !isCode;
if (placeWrap) placeWrap.hidden = isCode;
if (pad) pad.hidden = !isCode;
if (suggest) suggest.hidden = isCode;
if (placeWrap) placeWrap.hidden = !isPlace;
if (nearWrap) nearWrap.hidden = !isNear;
if (suggest) suggest.hidden = !isPlace;
/* โหมดใกล้ฉัน: ซ่อนรายการป้ายทั้งหมด เพราะผลลัพธ์หลักคือการ์ดเรียงตามระยะ */
var list = document.getElementById('stops-list');
if (list) list.hidden = isNear;
var showAll = document.getElementById('stops-show-all');
if (showAll && isNear) showAll.hidden = true;
// ปิดการใช้งานช่องของโหมดที่ไม่ได้เลือก + ล้างค่า → กันการค้น 2 ทางพร้อมกัน
Array.prototype.forEach.call(cells, function (c) {
@@ -238,8 +262,8 @@
updateCodeDisplay();
}
if (placeInput) {
placeInput.disabled = isCode;
if (isCode) { placeInput.value = ''; state.placeQuery = ''; }
placeInput.disabled = !isPlace;
if (!isPlace) { placeInput.value = ''; state.placeQuery = ''; }
}
// ไฮไลต์ปุ่ม toggle
@@ -251,7 +275,11 @@
// โฟกัสช่องที่เพิ่งเปิด
if (isCode) focusCell(0);
if (!isCode && placeInput) placeInput.focus();
if (isPlace && placeInput) placeInput.focus();
if (isNear) {
var nearBtn = document.getElementById('near-me-btn');
if (nearBtn) nearBtn.focus();
}
apply();
}
@@ -281,7 +309,7 @@
return state.codeValue;
}
/* เขียน digits[] กลับลงช่อง (ใช้ตอน paste / ล้างค่า / numpad) */
/* เขียน digits[] กลับลงช่อง (ใช้ตอน paste / ล้างค่า) */
function paintCells(digits) {
var cells = codeCells();
for (var i = 0; i < CODE_CELLS; i++) {
@@ -353,46 +381,6 @@
});
}
/* ---------- numpad (ใช้กับ 5 ช่อง) ---------- */
function initNumpad() {
var pad = document.getElementById('stops-numpad');
if (!pad) return;
pad.addEventListener('click', function (e) {
var key = e.target.closest('[data-key]');
if (!key) return;
e.preventDefault();
var k = key.getAttribute('data-key');
var cells = codeCells();
if (!cells.length) return;
/* ตำแหน่งเป้าหมาย = ช่องแรกที่ว่าง (ช่องท้ายสุดถ้าเต็มหมด) */
var idx = CODE_CELLS - 1;
for (var i = 0; i < CODE_CELLS; i++) {
if (!cells[i].value) { idx = i; break; }
}
if (k === 'back') {
// ถอยจากท้าย: ล้างช่องขวาสุดที่มีค่า แล้วเลื่อนเป้าไปช่องนั้น
var last = -1;
for (var j = CODE_CELLS - 1; j >= 0; j--) {
if (cells[j].value) { last = j; break; }
}
idx = last === -1 ? 0 : last;
cells[idx].value = '';
} else {
cells[idx].value = k;
}
syncCodeFromCells();
updateCodeDisplay();
apply();
// โฟกัสช่องถัดไป (ไม่ select — กันกด numpad แล้วทับค่าเดิม)
var next = Math.min(idx + (k === 'back' ? 0 : 1), CODE_CELLS - 1);
if (cells[next]) cells[next].focus();
});
}
/* ---------- init ---------- */
function init(stops) {
if (stops) state.stops = stops;
@@ -483,7 +471,6 @@
suggest.hidden = true;
});
initNumpad();
setMode(MODE_CODE); // เริ่มที่โหมดรหัส
}
-227
View File
@@ -1,227 +0,0 @@
// @ts-nocheck
/* Ported from web-at-transit-mock/ui/visitors.js — logic unchanged. */
/* visitors.js — นับผู้เข้าชมจริง (ฝั่งเบราว์เซอร์ ไม่มี backend) + รีเซ็ตด้วยรหัส
แนวคิด
แสดงผล = ฐาน + จำนวนผู้เข้าชมจริง (unique)
ฐานเริ่มต้น = 12,834 (แสดงเมื่อยังไม่เคยรีเซ็ต)
รีเซ็ต (รหัส) = ล้างฐานทิ้งด้วย → เริ่มนับใหม่จาก 0
กันจำนวนเฟ้อ 3 ชั้น
1. sessionStorage → 1 รอบการเข้าชม (เปิดแท็บใหม่) นับ 1 · กด F5 ไม่นับ
2. localStorage → 1 ครั้ง/วัน/เครื่อง (วันเดียวกันนับครั้งเดียว)
3. dayKey กำกับ → ล้าง session/incognito เปิดซ้ำวันเดิม = ไม่นับ (เพดาน/วัน)
ประหยัดพื้นที่
เก็บแค่ {"v": <จำนวนจริง>, "d": <วัน YYYY-MM-DD>} ≈ 35 ไบต์ · ไม่เก็บ log/IP/UA
รีเซ็ต
กดที่ตัวเลขผู้เข้าชม 5 ครั้งติด → เปิดช่องกรอกรหัส (ซ่อน ไม่มีปุ่มให้คนอื่นกด)
รหัสตรวจแบบ SHA-256 (ไม่เก็บรหัสจริงในโค้ด — เปิด view-source ไม่เจอ)
*/
(function () {
'use strict';
var KEY = 'at_visitors'; /* { v: จำนวนจริง, d: 'YYYY-MM-DD' } */
var SESSION_KEY = 'at_visitors_seen';
var BASE = 12834; /* ฐานตั้งต้น — รีเซ็ตแล้วกลับมาที่นี่ */
var TAPS = 5; /* จำนวนครั้งที่ต้องกดตัวเลข */
var TAP_WINDOW = 2000; /* ต้องกดรัวภายใน 2 วิต่อครั้ง */
/* SHA-256 ของรหัสรีเซ็ต — เก็บเฉพาะ hash (ไม่เก็บรหัสจริงในไฟล์นี้) */
var PASS_HASH = '4f23cd6ac8e7da56b92974cd0cf146eee9d995208a6645ed17eba91813c1d323';
function today() {
var d = new Date();
var m = String(d.getMonth() + 1);
var day = String(d.getDate());
if (m.length < 2) m = '0' + m;
if (day.length < 2) day = '0' + day;
return d.getFullYear() + '-' + m + '-' + day;
}
function read() {
try {
var raw = localStorage.getItem(KEY);
var d = raw ? JSON.parse(raw) : null;
if (!d || typeof d !== 'object') return { b: null, v: 0, d: '' };
return {
b: (d.b === undefined || d.b === null) ? null : Math.max(0, Number(d.b) || 0),
v: Math.max(0, Number(d.v) || 0),
d: String(d.d || '')
};
} catch (e) { return { b: null, v: 0, d: '' }; }
}
function write(d) {
try { localStorage.setItem(KEY, JSON.stringify(d)); } catch (e) { /* เงียบ */ }
}
/* ตรวจว่ารอบการเข้าชมนี้ "ควรนับ" — ผ่านครบ 3 ชั้น */
function shouldCount(store) {
/* ชั้น 1: sessionStorage — รอบนี้เคยนับแล้ว? (F5 ไม่นับ) */
var seen = null;
try { seen = sessionStorage.getItem(SESSION_KEY); } catch (e) { /* เงียบ */ }
if (seen) return false;
/* ชั้น 2+3: วันเดียวกันห้ามเพิ่ม (แม้ sessionStorage ถูกล้าง) */
if (store.d === today()) return false;
return true;
}
function fmt(n) { return Number(n).toLocaleString('en-US'); }
/* ── รหัส: SHA-256 ผ่าน SubtleCrypto (มีในทุกเบราว์เซอร์สมัยใหม่) ── */
function hash(text, cb) {
if (window.crypto && crypto.subtle && crypto.subtle.digest) {
crypto.subtle.digest('SHA-256', new TextEncoder().encode(text))
.then(function (buf) {
var b = new Uint8Array(buf), s = '';
for (var i = 0; i < b.length; i++) s += ('0' + b[i].toString(16)).slice(-2);
cb(s);
})
.catch(function () { cb(null); });
} else {
cb(null); /* เบราว์เซอร์เก่า/ไม่มี https → กรุณาใช้ http://localhost */
}
}
/* เทียบแบบ constant-time (กัน timing attack) */
function safeEqual(a, b) {
if (typeof a !== 'string' || typeof b !== 'string' || a.length !== b.length) return false;
var diff = 0;
for (var i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
return diff === 0;
}
var Visitors = {
BASE: BASE, /* ฐานตั้งต้น (ค่าคงที่) — ดู Visitors._base สำหรับฐานที่ใช้จริง */
_base: BASE,
/* เรียกครั้งเดียวตอนโหลดหน้า — นับ (ถ้าควรนับ) แล้วคืนค่าที่จะแสดง */
init: function () {
var store = read();
if (shouldCount(store)) {
store.v = (Number(store.v) || 0) + 1;
store.d = today();
write(store);
try { sessionStorage.setItem(SESSION_KEY, '1'); } catch (e) { /* เงียบ */ }
}
/* ฐาน: ยังไม่เคยรีเซ็ต → BASE · เคยรีเซ็ต → ค่าที่บันทึกไว้ (0) */
var base = (store.b === null) ? BASE : store.b;
var el = document.getElementById('visitor-count');
if (el) el.textContent = fmt(base + store.v);
Visitors._base = base;
Visitors._store = store;
return base + store.v;
},
/* จำนวนจริง (ไม่รวม BASE) */
actual: function () { return read().v; },
/* รีเซ็ต: ล้างฐานทิ้งด้วย → เริ่มนับใหม่จาก 0 (ตามที่เลือก) */
reset: function () {
write({ b: 0, v: 0, d: today() });
/* ไม่ล้าง sessionStorage — กันการนับซ้ำทันทีหลังรีเซ็ตในรอบเดียวกัน */
Visitors._base = 0;
var el = document.getElementById('visitor-count');
if (el) el.textContent = fmt(0);
return 0;
},
/* ตรวจรหัสแล้วรีเซ็ต (async — SHA-256) */
resetWith: function (pass, done) {
hash(String(pass == null ? '' : pass), function (h) {
if (!h) { done(false, 'unsupported'); return; }
if (!safeEqual(h, PASS_HASH)) { done(false, 'wrong'); return; }
Visitors.reset();
done(true, 'ok');
});
},
_hash: hash,
_key: KEY
};
window.Visitors = Visitors;
/* ── ช่องทางลับ: กดที่ตัวเลข 5 ครั้งติด → เปิดช่องกรอกรหัส ── */
function mountTap() {
var el = document.getElementById('visitor-count');
if (!el) return;
var taps = 0, timer = null;
el.style.cursor = 'pointer';
el.addEventListener('click', function () {
taps++;
if (timer) clearTimeout(timer);
timer = setTimeout(function () { taps = 0; }, TAP_WINDOW);
if (taps >= TAPS) {
taps = 0;
clearTimeout(timer);
openDialog();
}
});
}
function openDialog() {
if (document.querySelector('.mu-vreset')) return;
var wrap = document.createElement('div');
wrap.className = 'mu-vreset';
wrap.innerHTML =
'<div class="mu-vreset-card" role="dialog" aria-modal="true" aria-labelledby="vreset-title">' +
'<h4 id="vreset-title">รีเซ็ตจำนวนผู้เข้าชม</h4>' +
'<label for="vreset-pass">รหัสรีเซ็ต</label>' +
'<input id="vreset-pass" type="password" autocomplete="off" inputmode="text">' +
'<p class="mu-vreset-msg" role="status"></p>' +
'<div class="mu-vreset-row">' +
'<button type="button" class="mu-vreset-cancel">ยกเลิก</button>' +
'<button type="button" class="mu-vreset-ok">รีเซ็ต</button>' +
'</div>' +
'</div>';
var input = wrap.querySelector('#vreset-pass');
var msg = wrap.querySelector('.mu-vreset-msg');
function close() { wrap.remove(); }
function submit() {
msg.textContent = '';
Visitors.resetWith(input.value, function (ok, why) {
if (ok) {
msg.className = 'mu-vreset-msg is-ok';
msg.textContent = 'รีเซ็ตแล้ว — เริ่มนับใหม่จาก 0';
input.value = '';
setTimeout(close, 1200);
} else if (why === 'unsupported') {
msg.textContent = 'เบราว์เซอร์ไม่รองรับ — ต้องเปิดผ่าน https หรือ localhost';
} else {
msg.className = 'mu-vreset-msg is-bad';
msg.textContent = 'รหัสไม่ถูกต้อง';
input.value = '';
input.focus();
}
});
}
wrap.querySelector('.mu-vreset-ok').addEventListener('click', submit);
wrap.querySelector('.mu-vreset-cancel').addEventListener('click', close);
wrap.addEventListener('click', function (e) { if (e.target === wrap) close(); });
input.addEventListener('keydown', function (e) {
if (e.key === 'Enter') submit();
if (e.key === 'Escape') close();
});
document.body.appendChild(wrap);
input.focus();
}
/* ── nับตอนโหลด + ติดช่องทางลับ ── */
function boot() {
Visitors.init();
mountTap();
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot);
else boot();
})();
export {};
+369 -61
View File
@@ -7,7 +7,7 @@
.mu-logo-img {
width: 44px;
height: 44px;
border-radius: 12px;
border-radius: var(--radius);
object-fit: cover;
box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}
@@ -20,7 +20,7 @@
.mu-cover {
position: relative;
aspect-ratio: 16 / 10;
background: linear-gradient(135deg, #eef1ff 0%, #f7f0ff 100%);
background: linear-gradient(135deg, var(--c-tint-purple) 0%, var(--c-tint-purple) 100%);
overflow: hidden;
}
.mu-cover > img {
@@ -52,12 +52,12 @@
align-items: center;
gap: 6px;
padding: 5px 10px;
border-radius: 999px;
border-radius: var(--radius-pill);
font-size: .72rem;
font-weight: 800;
letter-spacing: .02em;
background: rgba(255, 255, 255, .92);
color: #1f2a44;
background: var(--c-glass);
color: var(--c-ink);
backdrop-filter: blur(8px);
box-shadow: 0 4px 10px rgba(15, 23, 42, .15);
}
@@ -69,7 +69,7 @@
z-index: 1;
margin: 0;
color: #fff;
font-size: 1.05rem;
font-size: 1rem;
font-weight: 800;
line-height: 1.25;
text-shadow: 0 2px 6px rgba(0, 0, 0, .45);
@@ -84,12 +84,12 @@
.mu-cover.no-photo {
background:
radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .35), transparent 55%),
linear-gradient(135deg, #7a4cc0 0%, #3071b8 100%);
linear-gradient(135deg, var(--c-brand) 0%, #3071b8 100%);
}
.mu-cover.no-photo::after {
background: linear-gradient(180deg, rgba(15, 23, 42, 0) 40%, rgba(15, 23, 42, .35) 100%);
}
.mu-cover.tone-purple { background: linear-gradient(135deg, #7a4cc0, #c084fc); }
.mu-cover.tone-purple { background: linear-gradient(135deg, var(--c-brand), #c084fc); }
.mu-cover.tone-sky { background: linear-gradient(135deg, #3071b8, #60a5fa); }
.mu-cover.tone-pink { background: linear-gradient(135deg, #bb3a78, #f472b6); }
.mu-cover.tone-mint { background: linear-gradient(135deg, #1f8765, #34d399); }
@@ -143,20 +143,20 @@
left: 12px;
z-index: 1;
padding: 4px 10px;
border-radius: 999px;
font-size: .7rem;
border-radius: var(--radius-pill);
font-size: 0.72rem;
font-weight: 700;
background: rgba(255, 255, 255, .92);
color: #1f2a44;
background: var(--c-glass);
color: var(--c-ink);
backdrop-filter: blur(6px);
box-shadow: 0 4px 10px rgba(15, 23, 42, .14);
}
.mu-card-head.no-photo {
background:
radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .25), transparent 55%),
linear-gradient(135deg, #7a4cc0 0%, #3071b8 100%);
linear-gradient(135deg, var(--c-brand) 0%, #3071b8 100%);
}
.mu-card-head.no-photo.bg-purple { background: linear-gradient(135deg, #7a4cc0, #c084fc); }
.mu-card-head.no-photo.bg-purple { background: linear-gradient(135deg, var(--c-brand), #c084fc); }
.mu-card-head.no-photo.bg-sky { background: linear-gradient(135deg, #3071b8, #60a5fa); }
.mu-card-head.no-photo.bg-pink { background: linear-gradient(135deg, #bb3a78, #f472b6); }
.mu-card-head.no-photo.bg-mint { background: linear-gradient(135deg, #1f8765, #34d399); }
@@ -165,11 +165,11 @@
disjoint thumbnails) ---------- */
.mu-stop-grid li.mu-stop-cell {
list-style: none;
border-radius: 18px;
border-radius: var(--radius);
overflow: hidden;
box-shadow: 0 10px 24px rgba(63, 43, 94, .08);
border: 1px solid rgba(231, 224, 246, .95);
background: #fff;
background: var(--c-surface);
display: flex;
flex-direction: column;
transition: transform .18s ease, box-shadow .18s ease;
@@ -220,34 +220,34 @@
.mu-footer-brand-row img {
width: 48px;
height: 48px;
border-radius: 12px;
background: #fff;
border-radius: var(--radius);
background: var(--c-surface);
padding: 4px;
object-fit: contain;
}
.mu-footer-brand-row strong {
display: block;
color: #fff;
font-size: 1.05rem;
font-size: 1rem;
font-weight: 800;
letter-spacing: .01em;
}
.mu-footer-brand-row span {
display: block;
color: #9aa3c3;
font-size: .82rem;
color: var(--c-info);
font-size: 0.85rem;
margin-top: 2px;
}
.mu-footer-brand p.about {
margin: 0;
color: #b6bdda;
font-size: .88rem;
font-size: 0.85rem;
line-height: 1.6;
}
.mu-footer-col h4 {
margin: 0 0 10px;
color: #fff;
font-size: .9rem;
font-size: 0.95rem;
font-weight: 800;
letter-spacing: .03em;
text-transform: uppercase;
@@ -263,7 +263,7 @@
.mu-footer-col ul a {
color: #cfd5ec;
text-decoration: none;
font-size: .9rem;
font-size: 0.95rem;
line-height: 1.5;
transition: color .15s ease;
display: inline-flex;
@@ -273,7 +273,7 @@
.mu-footer-col ul a:hover { color: #fff; }
.mu-footer-col ul a::before {
content: "›";
color: #7a4cc0;
color: var(--c-brand-ink);
font-weight: 800;
}
.mu-footer-contact a,
@@ -283,7 +283,7 @@
gap: 8px;
color: #cfd5ec;
text-decoration: none;
font-size: .88rem;
font-size: 0.85rem;
}
.mu-footer-contact .row { margin-bottom: 4px; }
@@ -301,7 +301,7 @@
}
.mu-footer-sponsors p.lead {
margin: 0 0 18px;
color: #9aa3c3;
color: var(--c-info);
font-size: .85rem;
line-height: 1.5;
}
@@ -311,8 +311,8 @@
gap: 12px;
}
.mu-sponsor-tile {
background: #fff;
border-radius: 12px;
background: var(--c-surface);
border-radius: var(--radius);
padding: 14px;
display: flex;
align-items: center;
@@ -343,15 +343,15 @@
}
.mu-footer-bottom p {
margin: 0;
color: #8d96b8;
font-size: .82rem;
color: var(--c-info);
font-size: 0.85rem;
letter-spacing: .02em;
}
.mu-footer-bottom .pill {
display: inline-block;
margin-left: 10px;
padding: 2px 10px;
border-radius: 999px;
border-radius: var(--radius-pill);
background: rgba(122, 76, 192, .25);
color: #d8c7ff;
font-size: .72rem;
@@ -398,7 +398,7 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
.mu-search-field .ic {
position: absolute;
left: 12px;
color: #6f7b95;
color: var(--c-ink-2);
pointer-events: none;
}
.mu-search-field input {
@@ -411,31 +411,13 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
display: inline-flex;
align-items: center;
gap: 2px;
background: #f0edf7;
background: var(--c-tint-purple);
border: 1px solid #e4dcf2;
border-radius: 999px;
border-radius: var(--radius-pill);
padding: 3px;
flex-shrink: 0;
}
.mu-lang-btn {
border: 0;
background: transparent;
color: #6d28d9;
font-family: inherit;
font-weight: 700;
font-size: .72rem;
line-height: 1;
padding: 6px 10px;
border-radius: 999px;
cursor: pointer;
transition: background .15s ease, color .15s ease;
}
.mu-lang-btn:hover { color: #5b21b6; }
.mu-lang-btn.active {
background: #fff;
color: #7a4cc0;
box-shadow: 0 1px 4px rgba(63, 43, 94, .18);
}
/* ============================================================
ปุ่ม + ฟอร์มคอนโทรล (shared — ทุกหน้าใช้ร่วมกัน)
@@ -448,7 +430,7 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
gap: 6px;
min-height: 44px;
padding: 10px 18px;
border-radius: 12px;
border-radius: var(--radius);
font-family: inherit;
font-weight: 700;
font-size: .85rem;
@@ -466,12 +448,12 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
}
.mu-btn.primary:hover { box-shadow: 0 10px 22px rgba(124, 58, 237, .35); }
.mu-btn.ghost {
background: #fff;
border-color: #e7e2f6;
color: #5b3b71;
background: var(--c-surface);
border-color: var(--c-border);
color: var(--c-brand-ink);
box-shadow: 0 2px 8px rgba(63, 43, 94, .05);
}
.mu-btn.ghost:hover { border-color: #d8c9f2; background: #faf7ff; }
.mu-btn.ghost:hover { border-color: #d8c9f2; background: var(--c-surface-2); }
/* select แบบโมเดิร์น — custom chevron แทนลูกศร native (prefix #view ชนะ partial style) */
#view .mu-toolbar select {
@@ -490,10 +472,22 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
#view .mu-toolbar input:focus-visible,
#view .mu-toolbar select:focus-visible,
#view .mu-toolbar .mu-btn:focus-visible {
outline: 2px solid #7a4cc0;
outline: 2px solid var(--c-brand-ink);
outline-offset: 2px;
}
/* ปุ่มขอบ (outline) — ตัวอักษร/ขอบม่วง พื้นโปร่งใส
เดิมไม่มีกฎนี้ → เบราว์เซอร์ใส่พื้นเทาอ่อนเอง ทำให้โหมดมืดหลุดธีม */
.mu-btn.outline {
background: transparent;
border-color: var(--c-brand-ink);
color: var(--c-brand-ink);
}
.mu-btn.outline:hover {
background: var(--c-tint-purple);
border-color: var(--c-brand-ink);
}
/* ---------- ปุ่มติดตั้งแอป (PWA — inject จาก pwa.js) ---------- */
.mu-install-btn {
position: fixed;
@@ -506,7 +500,7 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
min-height: 48px;
padding: 12px 20px;
border: none;
border-radius: 999px;
border-radius: var(--radius-pill);
cursor: pointer;
font-family: inherit;
font-size: .95rem;
@@ -518,3 +512,317 @@ body:has(.mu-site-footer) .mu-footer { display: none; }
}
.mu-install-btn:active { transform: translateY(1px); }
.mu-install-btn svg { width: 20px; height: 20px; }
/* ============================================================
ปุ่ม "แชร์หน้านี้" — ใช้ร่วมทุกหน้า (/ · /stops/:code · /routes/:id · /check/:id)
เดิมอยู่ใน pages/home.css → หน้าอื่นไม่มีสไตล์เลย = หลุดธีม
ตอนนี้ยึดสเกลเดียวกับ .mu-btn ตาม DESIGN.md §5:
radius 12px · min-height 44px (48px บนจอสัมผัส) · font-size .85rem · weight 700
variant = ปุ่มรอง (ghost) เพราะไม่ใช่ CTA หลักของหน้า
============================================================ */
.mu-share-row {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 8px;
margin: 22px 0 44px;
}
.mu-share-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 44px;
padding: 10px 18px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
background: var(--c-surface);
color: var(--c-brand-ink);
font-family: inherit;
font-size: .85rem;
font-weight: 700;
line-height: 1;
cursor: pointer;
transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.mu-share-btn:hover {
border-color: #d8c9f2;
background: var(--c-surface-2);
}
.mu-share-btn:active { transform: translateY(1px); }
.mu-share-btn:focus-visible {
outline: 2px solid var(--c-focus);
outline-offset: 2px;
}
.mu-share-btn .ic { width: 16px; height: 16px; }
/* ข้อความใต้ปุ่ม */
.mu-share-status {
margin: 0;
font-size: 0.85rem;
line-height: 1.7;
color: var(--c-ink-2);
text-align: right;
}
.mu-share-status:empty { display: none; }
/* ลิงก์ที่คัดลอก — mono + tabular เพื่อให้อ่านง่าย/คัดลอกถูก */
.mu-share-url {
display: inline-block;
padding: 2px 8px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
background: var(--c-tint-purple);
font-size: 0.78rem;
font-variant-numeric: tabular-nums;
word-break: break-all;
}
/* ปุ่มแชร์ผ่าน LINE — ม่วง (แอคเซนต์เดียวตาม DESIGN.md §7) ไม่ใช่เขียว */
.mu-share-line {
display: inline-block;
margin-left: 6px;
font-weight: 700;
color: var(--c-brand-ink);
text-decoration: none;
}
.mu-share-line:hover { text-decoration: underline; }
.mu-share-line:focus-visible {
outline: 2px solid var(--c-focus);
outline-offset: 2px;
}
/* จอแคบ: ปุ่มเต็มความกว้าง ข้อความชิดซ้าย */
@media (max-width: 560px) {
.mu-share-row { align-items: stretch; }
.mu-share-btn { justify-content: center; }
.mu-share-status { text-align: left; }
}
/* จอสัมผัส: 48dp ตาม Android guideline */
@media (pointer: coarse) {
.mu-share-btn { min-height: 48px; }
}
/* ============================================================
ปุ่มเครื่องมือในแถบนำทาง — ปุ่มละเรื่อง (ไม่ใช่กลุ่มปุ่มเรียง)
เดิม: ธีม 3 ปุ่ม + ภาษา 2 ปุ่ม = 5 ปุ่มในแถวเดียว → navbar แน่น
ตอนนี้: ธีม 1 ปุ่ม · ภาษา 1 ปุ่ม แต่ละปุ่มกดแล้วเปิดเมนูของตัวเอง
ตรงสเกลเดียวกับ .mu-btn (radius 8px · min-height 44px บนจอสัมผัส)
============================================================ */
.mu-topbar-tools {
display: flex;
align-items: center;
gap: 8px; /* WCAG 2.5.8 — เว้นระหว่างเป้ากด ≥ 8px */
flex-shrink: 0;
}
.mu-pop { position: relative; display: inline-flex; }
.mu-pop-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 4px;
min-width: 40px;
height: 40px;
padding: 0 8px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
background: var(--c-surface);
color: var(--c-brand-ink);
font-family: inherit;
font-size: .78rem;
font-weight: 700;
line-height: 1;
cursor: pointer;
transition: border-color .15s ease, background .15s ease;
}
.mu-pop-btn-lang { min-width: 56px; padding: 0 10px; }
.mu-pop-btn:hover { border-color: #d8c9f2; background: var(--c-surface-2); }
.mu-pop-btn:active { transform: translateY(1px); }
.mu-pop-btn:focus-visible {
outline: 2px solid var(--c-focus);
outline-offset: 2px;
}
.mu-pop-btn[aria-expanded="true"] {
border-color: var(--c-brand-ink);
background: var(--c-surface-2);
}
/* เมนูที่กางออก */
.mu-pop-panel {
position: absolute;
top: calc(100% + 6px);
right: 0;
z-index: 1200; /* เหนือ topbar (1100) แต่ใต้ visitor dialog (3000) */
min-width: 168px;
padding: 6px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
background: var(--c-surface);
box-shadow: 0 10px 24px var(--c-shadow);
}
.mu-pop-item {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
min-height: 40px;
padding: 8px 10px;
border: 0;
border-radius: var(--radius-sm);
background: transparent;
color: var(--c-ink);
font-family: inherit;
font-size: .85rem;
font-weight: 600;
text-align: start;
cursor: pointer;
}
.mu-pop-item:hover { background: var(--c-surface-2); }
.mu-pop-item:focus-visible {
outline: 2px solid var(--c-focus);
outline-offset: -2px;
}
.mu-pop-item[data-active="1"] {
background: var(--c-tint-purple);
color: var(--c-brand-ink);
font-weight: 700;
}
.mu-pop-item-th { flex: 1 1 auto; }
.mu-pop-item-en {
flex: 0 0 auto;
font-size: .72rem;
font-weight: 600;
color: var(--c-ink-2);
letter-spacing: .04em;
}
.mu-pop-item[data-active="1"] .mu-pop-item-en { color: var(--c-brand-ink); }
/* จอสัมผัส: เป้ากด 44px */
@media (pointer: coarse) {
.mu-pop-btn { min-width: 44px; height: 44px; }
.mu-pop-btn-lang { min-width: 60px; }
.mu-pop-item { min-height: 44px; }
}
/* รุ่นแอปที่แสดงท้ายเว็บ — ตัวเล็ก ๆ ไว้ตรวจว่าหน้านี้เป็น build ล่าสุดไหม */
.mu-app-ver {
margin-left: 6px;
font-family: ui-monospace, "IBM Plex Mono", monospace;
font-size: .72rem;
font-variant-numeric: tabular-nums;
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; }
}
/* กันกรณีโทเคนโหลดไม่ครบ (เช่น cache เก่า) — dropdown ต้องอ่านออกเสมอ */
.mu-pop-panel { background: var(--c-surface, #fff); border-color: var(--c-border, #e7e2f6); }
:root[data-theme="dark"] .mu-pop-panel { background: var(--c-surface, #171225); border-color: var(--c-border, #352b52); }
.mu-pop-item { color: var(--c-ink, #1f2a44); }
:root[data-theme="dark"] .mu-pop-item { color: var(--c-ink, #ece9f7); }
.mu-pop-item[data-active="1"] { background: var(--c-tint-purple, #f4f1fb); color: var(--c-brand-ink, #7a4cc0); }
:root[data-theme="dark"] .mu-pop-item[data-active="1"] { background: var(--c-tint-purple, #241c3b); color: var(--c-brand-ink, #b892f5); }
.mu-pop-btn { background: var(--c-surface, #fff); color: var(--c-brand-ink, #7a4cc0); }
:root[data-theme="dark"] .mu-pop-btn { background: var(--c-surface, #171225); color: var(--c-brand-ink, #b892f5); }
+48 -48
View File
@@ -10,31 +10,31 @@
width: 100%;
height: 300px;
border: 1px solid #ddd5c0;
border-radius: 8px;
background: #f7f1e2; /* --paper — พื้นตอน tile ยังไม่มา/ออฟไลน์ */
border-radius: var(--radius);
background: var(--c-tint-amber); /* --paper — พื้นตอน tile ยังไม่มา/ออฟไลน์ */
overflow: hidden;
}
.at-map.is-offline { background: repeating-linear-gradient(45deg, #f7f1e2 0 12px, #f2ebd8 12px 24px); }
.at-map.is-offline { background: repeating-linear-gradient(45deg, var(--c-tint-amber) 0 12px, var(--c-tint-amber) 12px 24px); }
.at-map .leaflet-container { background: transparent; font-family: inherit; }
/* ปุ่ม zoom — ให้เข้าธีม (ขอบบาง ไม่มีเงา) */
.at-map .leaflet-control-zoom a {
border-radius: 4px;
border-radius: var(--radius-sm);
border: 1px solid #ddd5c0;
background: #fffdf6;
color: #14211a;
background: var(--c-tint-amber);
color: var(--c-ok);
font-weight: 700;
box-shadow: none;
}
.at-map .leaflet-control-zoom a:hover { background: #e4efe4; color: #14532d; }
.at-map .leaflet-control-zoom a:hover { background: var(--c-tint-green); color: var(--c-ok); }
.at-map .leaflet-bar { border: 0; box-shadow: none; }
/* attribution — เล็ก อ่านได้ ไม่ทับข้อมูล */
.at-map .leaflet-control-attribution {
background: rgba(255, 253, 246, .88);
border-top-left-radius: 4px;
font-size: .68rem;
color: #6b7268;
font-size: 0.72rem;
color: var(--c-ink-2);
}
/* ---------- หมุด: สี่เหลี่ยมมน (ไม่ใช่หยดน้ำ ไม่มีเงา) ---------- */
@@ -42,7 +42,7 @@
.at-pin {
display: block;
width: 14px; height: 14px;
border-radius: 4px;
border-radius: var(--radius-sm);
border: 2px solid #fffdf6;
box-sizing: border-box;
}
@@ -52,18 +52,18 @@
/* ป้ายที่กำลังเปิดดูอยู่ — ใหญ่กว่าเพื่อให้เห็นชัด */
.at-pin.here { background: #f2a900; width: 18px; height: 18px; border-width: 3px; }
/* จุดย่อย (จุดขึ้นรถประจำทางอื่นๆ) — สี่เหลี่ยมม่วง ต่างจากหมุดกลม */
.at-pin.sub { background: #7a4cc0; border-radius: 2px; }
.at-pin.sub { background: var(--c-brand); border-radius: var(--radius-sm); }
.at-map .leaflet-tooltip {
border-radius: 4px;
border-radius: var(--radius-sm);
border: 1px solid #ddd5c0;
background: #fffdf6;
color: #14211a;
background: var(--c-tint-amber);
color: var(--c-ok);
box-shadow: none;
font-size: .78rem;
padding: 5px 8px;
}
.at-map .leaflet-tooltip b { color: #14532d; }
.at-map .leaflet-tooltip b { color: var(--c-ok); }
/* ---------- legend (มุมซ้ายล่าง) ---------- */
.at-legend {
@@ -72,30 +72,30 @@
z-index: 500;
background: rgba(255, 253, 246, .94);
border: 1px solid #ddd5c0;
border-radius: 4px;
border-radius: var(--radius-sm);
padding: 7px 10px;
font-size: .74rem;
color: #14211a;
font-size: 0.72rem;
color: var(--c-ok);
line-height: 1.65;
pointer-events: none;
}
.at-legend i {
display: inline-block;
width: 14px; height: 5px;
border-radius: 2px;
border-radius: var(--radius-sm);
margin-right: 6px;
vertical-align: middle;
}
.at-legend i.sq { width: 10px; height: 10px; border-radius: 3px; border: 2px solid #fffdf6; box-sizing: border-box; }
.at-legend i.sq { width: 10px; height: 10px; border-radius: var(--radius-sm); border: 2px solid #fffdf6; box-sizing: border-box; }
/* ---------- caption ใต้แผนที่ ---------- */
.at-map-caption {
margin: 9px 0 0;
color: #6b7268;
font-size: .82rem;
color: var(--c-ink-2);
font-size: 0.85rem;
}
.at-map-caption b { color: #14211a; }
.at-map-caption .at-offline { color: #8a6100; }
.at-map-caption b { color: var(--c-ok); }
.at-map-caption .at-offline { color: var(--c-warn); }
@media (min-width: 768px) {
.at-map { height: 380px; }
@@ -103,47 +103,47 @@
/* ---------- popup บนแผนที่ (ป้าย/สถานี) ---------- */
.at-map .leaflet-popup-content-wrapper {
border-radius: 4px;
border-radius: var(--radius-sm);
border: 1px solid #ddd5c0;
background: #fffdf6;
background: var(--c-tint-amber);
box-shadow: none;
color: #14211a;
color: var(--c-ok);
}
.at-map .leaflet-popup-tip { background: #fffdf6; box-shadow: none; }
.at-map .leaflet-popup-content { margin: 10px 12px; font-size: .8rem; }
.at-map .leaflet-popup-tip { background: var(--c-tint-amber); box-shadow: none; }
.at-map .leaflet-popup-content { margin: 10px 12px; font-size: 0.78rem; }
.at-pop { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.at-pop b { font-size: .86rem; color: #14532d; }
.at-pop span { color: #6b7268; }
.at-pop a { margin-top: 4px; color: #14532d; font-weight: 700; text-decoration: none; border-bottom: 1px solid #1f7a3d; align-self: flex-start; }
.at-pop a:hover { color: #1f7a3d; }
.at-pop b { font-size: 0.85rem; color: var(--c-ok); }
.at-pop span { color: var(--c-ink-2); }
.at-pop a { margin-top: 4px; color: var(--c-ok); font-weight: 700; text-decoration: none; border-bottom: 1px solid #1f7a3d; align-self: flex-start; }
.at-pop a:hover { color: var(--c-ok); }
/* ---------- รายการจุดจอดตามเส้นทาง + กม. จากต้นทาง ---------- */
.at-km-wrap { margin-top: 14px; border-top: 1px solid #ddd5c0; padding-top: 12px; }
.at-km-wrap > h3 { margin: 0 0 8px; font-size: .9rem; font-weight: 800; color: #14211a; }
.at-km-wrap > h3 { margin: 0 0 8px; font-size: 0.95rem; font-weight: 800; color: var(--c-ok); }
.at-km-wrap ul { list-style: none; margin: 0; padding: 0; }
.at-km-wrap li + li { border-top: 1px dashed #ddd5c0; }
.at-km-row { display: flex; align-items: center; gap: 9px; padding: 7px 2px; text-decoration: none; color: #14211a; font-size: .86rem; }
.at-km-row:hover .at-km-name { color: #1f7a3d; text-decoration: underline; }
.at-km-dot { width: 9px; height: 9px; border-radius: 3px; background: #f2a900; flex: none; }
.at-km-row { display: flex; align-items: center; gap: 9px; padding: 7px 2px; text-decoration: none; color: var(--c-ok); font-size: 0.85rem; }
.at-km-row:hover .at-km-name { color: var(--c-ok); text-decoration: underline; }
.at-km-dot { width: 9px; height: 9px; border-radius: var(--radius-sm); background: #f2a900; flex: none; }
.at-km-name { flex: 1; font-weight: 600; }
.at-km-val { font-variant-numeric: tabular-nums; font-weight: 700; color: #14532d; }
.at-km-val { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--c-ok); }
/* จุดจอดที่ไม่มีหน้ารายละเอียด (มาจาก 8 other_stop.json) — ไม่ใช่ลิงก์ */
.at-km-row.is-plain { cursor: default; }
.at-km-row.is-plain .at-km-dot { background: #7a4cc0; }
.at-km-row.is-sub .at-km-dot { background: #7a4cc0; } /* จุดย่อย (จุดขึ้นรถอื่นๆ) — ม่วง ให้ตรงกับหมุดบนแผนที่ */
.at-km-row.is-plain .at-km-dot { background: var(--c-brand); }
.at-km-row.is-sub .at-km-dot { background: var(--c-brand); } /* จุดย่อย (จุดขึ้นรถอื่นๆ) — ม่วง ให้ตรงกับหมุดบนแผนที่ */
.at-km-row.is-plain:hover .at-km-name { color: inherit; text-decoration: none; }
.at-km-row .at-km-val.is-off { color: #a3560f; font-weight: 600; font-size: .78rem; }
.at-km-row .at-km-val.is-off { color: var(--c-warn); font-weight: 600; font-size: .78rem; }
/* ---------- ป้ายใกล้ฉัน ---------- */
.at-near-msg { margin: 14px 0 0; color: #6b7268; font-size: .86rem; }
.at-near-err { color: #8a6100; }
.at-near-msg { margin: 14px 0 0; color: var(--c-ink-2); font-size: 0.85rem; }
.at-near-err { color: var(--c-warn); }
.at-near-list { list-style: none; margin: 12px 0 0; padding: 0; }
.at-near-list li + li { border-top: 1px dashed #ddd5c0; }
.at-near-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 2px; text-decoration: none; color: #14211a; align-items: center; }
.at-near-row:hover .at-near-name { color: #1f7a3d; text-decoration: underline; }
.at-near-name { font-weight: 700; font-size: .9rem; }
.at-near-meta { grid-column: 1; color: #6b7268; font-size: .76rem; }
.at-near-dist { grid-column: 2; grid-row: 1 / span 2; font-variant-numeric: tabular-nums; font-weight: 800; color: #14532d; white-space: nowrap; }
.at-near-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 2px; text-decoration: none; color: var(--c-ok); align-items: center; }
.at-near-row:hover .at-near-name { color: var(--c-ok); text-decoration: underline; }
.at-near-name { font-weight: 700; font-size: 0.95rem; }
.at-near-meta { grid-column: 1; color: var(--c-ink-2); font-size: 0.78rem; }
.at-near-dist { grid-column: 2; grid-row: 1 / span 2; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--c-ok); white-space: nowrap; }
/* ---------- กัน CSS ภายนอกทำลายขนาด SVG ของ Leaflet ----------
responsive.css ตั้ง `img, svg, video { max-width: 100%; height: auto; }` และบาง partial
+9 -9
View File
@@ -3,7 +3,7 @@
.mu-hero-lead {
margin: 14px auto 0;
max-width: 640px;
color: #5b3b71;
color: var(--c-brand-ink);
font-size: .95rem;
}
@@ -15,9 +15,9 @@
grid-template-columns: 1fr;
gap: 16px;
align-items: center;
background: #fff;
border: 1px solid #ebe8f4;
border-radius: 18px;
background: var(--c-surface);
border: 1px solid var(--c-border-2);
border-radius: var(--radius);
padding: 16px;
box-shadow: 0 10px 26px rgba(63, 43, 94, .07);
}
@@ -27,16 +27,16 @@
height: auto;
max-height: 420px;
object-fit: cover;
border-radius: 14px;
border-radius: var(--radius);
display: block;
box-shadow: 0 10px 24px rgba(63, 43, 94, .14);
}
.mu-about-block h2 { margin: 0 0 10px; font-size: 1.2rem; color: #1f2a44; font-weight: 800; line-height: 1.35; }
.mu-about-block p { margin: 0 0 10px; color: #4a5568; font-size: .95rem; line-height: 1.8; }
.mu-about-block h2 { margin: 0 0 10px; font-size: 1.2rem; color: var(--c-ink); font-weight: 800; line-height: 1.35; }
.mu-about-block p { margin: 0 0 10px; color: var(--c-ink-2); font-size: .95rem; line-height: 1.8; }
.mu-about-block p:last-child { margin-bottom: 0; }
.mu-about-skeleton { color: #6f7b95; font-size: .9rem; text-align: center; padding: 18px 0; }
.mu-about-skel-card { height: 180px; border-radius: 18px; background: linear-gradient(90deg, #f4f2fa 25%, #ece8f6 37%, #f4f2fa 63%); background-size: 400% 100%; animation: muSkel 1.4s ease infinite; }
.mu-about-skeleton { color: var(--c-ink-2); font-size: 0.95rem; text-align: center; padding: 18px 0; }
.mu-about-skel-card { height: 180px; border-radius: var(--radius); background: linear-gradient(90deg, var(--c-surface-3) 25%, var(--c-tint-purple) 37%, var(--c-surface-3) 63%); background-size: 400% 100%; animation: muSkel 1.4s ease infinite; }
@keyframes muSkel { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
/* แท็บเล็ต/เดสก์ท็อป: 2 คอลัมน์ + สลับข้าง (คี่ = ข้อความซ้าย, คู่ = รูปซ้าย) */
+61 -61
View File
@@ -3,7 +3,7 @@
.mu-hero-lead {
margin: 14px auto 0;
max-width: 640px;
color: #5b3b71;
color: var(--c-brand-ink);
font-size: .95rem;
}
@@ -17,14 +17,14 @@
gap: 12px;
margin-bottom: 18px;
}
.mu-blog-count { margin: 0; color: #6f7b95; font-size: .88rem; }
.mu-blog-count { margin: 0; color: var(--c-ink-2); font-size: 0.85rem; }
.mu-view-switch {
margin-left: auto;
display: inline-flex;
gap: 2px;
background: #f0edf7;
background: var(--c-tint-purple);
border: 1px solid #e4dcf2;
border-radius: 999px;
border-radius: var(--radius-pill);
padding: 3px;
}
.mu-view-btn {
@@ -33,19 +33,19 @@
gap: 6px;
border: 0;
background: transparent;
color: #6d28d9;
color: var(--c-brand-ink);
font-family: inherit;
font-weight: 700;
font-size: .8rem;
font-size: 0.78rem;
min-height: 36px;
padding: 6px 14px;
border-radius: 999px;
border-radius: var(--radius-pill);
cursor: pointer;
transition: background .15s ease, color .15s ease;
}
.mu-view-btn .ic { width: 15px; height: 15px; }
.mu-view-btn.active { background: #fff; color: #7a4cc0; box-shadow: 0 1px 4px rgba(63, 43, 94, .18); }
.mu-view-btn:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 2px; }
.mu-view-btn.active { background: var(--c-surface); color: var(--c-brand-ink); box-shadow: 0 1px 4px rgba(63, 43, 94, .18); }
.mu-view-btn:focus-visible { outline: 2px solid var(--c-brand-ink); outline-offset: 2px; }
/* --- โหมดตาราง (grid) --- */
#blog-list.mode-grid {
@@ -56,9 +56,9 @@
.mu-blog-card {
display: flex;
flex-direction: column;
background: #fff;
border: 1px solid #ebe8f4;
border-radius: 18px;
background: var(--c-surface);
border: 1px solid var(--c-border-2);
border-radius: var(--radius);
overflow: hidden;
box-shadow: 0 10px 26px rgba(63, 43, 94, .07);
text-decoration: none;
@@ -67,14 +67,14 @@
}
.mu-blog-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(63, 43, 94, .14); }
.mu-blog-card .mu-cover { aspect-ratio: 16 / 9; }
.mu-blog-card .mu-cover.no-img { background: linear-gradient(135deg, #7a4cc0, #3071b8); }
.mu-blog-card .mu-cover.no-img { background: linear-gradient(135deg, var(--c-brand), #3071b8); }
.mu-blog-card .mu-cover.no-img::after { background: linear-gradient(180deg, rgba(15,23,42,0) 40%, rgba(15,23,42,.4) 100%); }
.mu-blog-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.mu-blog-meta { display: flex; align-items: center; gap: 8px; color: #6f7b95; font-size: .78rem; }
.mu-blog-meta { display: flex; align-items: center; gap: 8px; color: var(--c-ink-2); font-size: .78rem; }
.mu-blog-meta time { font-variant-numeric: tabular-nums; }
.mu-blog-card h2 { margin: 0; font-size: 1.02rem; color: #1f2a44; font-weight: 800; line-height: 1.4; }
.mu-blog-excerpt { margin: 0; color: #4a5568; font-size: .88rem; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mu-blog-more { margin-top: auto; padding-top: 6px; color: #7a4cc0; font-weight: 700; font-size: .85rem; }
.mu-blog-card h2 { margin: 0; font-size: 1rem; color: var(--c-ink); font-weight: 800; line-height: 1.4; }
.mu-blog-excerpt { margin: 0; color: var(--c-ink-2); font-size: 0.85rem; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mu-blog-more { margin-top: auto; padding-top: 6px; color: var(--c-brand-ink); font-weight: 700; font-size: .85rem; }
/* --- โหมดรายการ (list) --- */
#blog-list.mode-list { display: flex; flex-direction: column; gap: 14px; }
@@ -83,9 +83,9 @@
grid-template-columns: 108px 1fr;
gap: 14px;
align-items: center;
background: #fff;
border: 1px solid #ebe8f4;
border-radius: 16px;
background: var(--c-surface);
border: 1px solid var(--c-border-2);
border-radius: var(--radius);
padding: 12px;
box-shadow: 0 8px 20px rgba(63, 43, 94, .06);
text-decoration: none;
@@ -95,28 +95,28 @@
.mu-blog-row:hover { border-color: #d8c9f2; box-shadow: 0 12px 26px rgba(63, 43, 94, .12); }
.mu-blog-row .thumb {
width: 108px; height: 84px;
border-radius: 12px;
border-radius: var(--radius);
object-fit: cover;
display: block;
background: linear-gradient(135deg, #7a4cc0, #3071b8);
background: linear-gradient(135deg, var(--c-brand), #3071b8);
}
.mu-blog-row h2 { margin: 4px 0 6px; font-size: .98rem; color: #1f2a44; font-weight: 800; line-height: 1.4; }
.mu-blog-row h2 { margin: 4px 0 6px; font-size: 1rem; color: var(--c-ink); font-weight: 800; line-height: 1.4; }
.mu-blog-row .mu-blog-excerpt { -webkit-line-clamp: 2; }
.mu-blog-empty { color: #6f7b95; text-align: center; padding: 34px 0; }
.mu-blog-skel { height: 220px; border-radius: 18px; background: linear-gradient(90deg, #f4f2fa 25%, #ece8f6 37%, #f4f2fa 63%); background-size: 400% 100%; animation: muSkelB 1.4s ease infinite; }
.mu-blog-empty { color: var(--c-ink-2); text-align: center; padding: 34px 0; }
.mu-blog-skel { height: 220px; border-radius: var(--radius); background: linear-gradient(90deg, var(--c-surface-3) 25%, var(--c-tint-purple) 37%, var(--c-surface-3) 63%); background-size: 400% 100%; animation: muSkelB 1.4s ease infinite; }
@keyframes muSkelB { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
/* --- หน้าอ่านบทความ --- */
.mu-post { background: #fff; border: 1px solid #ebe8f4; border-radius: 20px; overflow: hidden; box-shadow: 0 12px 30px rgba(63, 43, 94, .08); }
.mu-post { background: var(--c-surface); border: 1px solid var(--c-border-2); border-radius: var(--radius); overflow: hidden; box-shadow: 0 12px 30px rgba(63, 43, 94, .08); }
.mu-post .mu-cover { aspect-ratio: 16 / 8; }
/* --- แผนที่เส้นทางแทนรูปปก (textN.json → "map") --- */
.mu-post .mu-cover.is-map { aspect-ratio: auto; height: 280px; position: relative; }
.mu-post .mu-cover.is-map .at-map { height: 100%; border: 0; border-radius: 0; }
.mu-post .mu-cover.is-map .at-map { height: 100%; border: 0; border-radius: var(--radius-sm); }
.mu-cover.is-map .at-map.is-static { pointer-events: none; } /* ปิดซูม/ลาก */
.mu-cover-cap {
position: absolute; left: 0; right: 0; bottom: 0; z-index: 500;
padding: 8px 12px; color: #fff; font-size: .8rem; line-height: 1.4;
padding: 8px 12px; color: #fff; font-size: 0.78rem; line-height: 1.4;
background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, .62));
}
/* --- แผนที่ "เส้นทางที่เสนอ" (ความฝัน) + รายการคลิกได้ + แผงรายละเอียด --- */
@@ -127,79 +127,79 @@
.blog-mapx-tag {
position: absolute; top: 12px; right: 12px; z-index: 500;
display: inline-flex; align-items: center; gap: 6px;
padding: 5px 10px; border-radius: 999px;
padding: 5px 10px; border-radius: var(--radius-pill);
font-size: .72rem; font-weight: 800; letter-spacing: .02em;
background: rgba(255, 255, 255, .92); color: #1f2a44;
background: var(--c-glass); color: var(--c-ink);
backdrop-filter: blur(8px);
box-shadow: 0 4px 10px rgba(15, 23, 42, .15);
pointer-events: none;
}
.blog-mapx-map { height: 280px; border-radius: 16px; }
.blog-mapx-map { height: 280px; border-radius: var(--radius); }
.blog-mapx-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.blog-mapx-group {
margin: 10px 0 2px; font-size: .78rem; font-weight: 700; letter-spacing: .01em;
color: #7a4cc0; list-style: none;
color: var(--c-brand-ink); list-style: none;
}
.blog-mapx-group:first-child { margin-top: 0; }
.blog-mapx-group::before { content: ''; display: inline-block; width: 14px; height: 2px;
background: #cbb8e8; vertical-align: middle; margin-right: 8px; border-radius: 2px; }
background: #cbb8e8; vertical-align: middle; margin-right: 8px; border-radius: var(--radius-sm); }
.blog-mapx-row {
display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
padding: 9px 11px; border: 1px solid #e8e4f2; border-radius: 12px;
background: #fff; cursor: pointer; font-size: .88rem; color: #3d4a63;
padding: 9px 11px; border: 1px solid #e8e4f2; border-radius: var(--radius);
background: var(--c-surface); cursor: pointer; font-size: 0.85rem; color: var(--c-info);
}
.blog-mapx-row:hover { border-color: #cbb8e8; background: #faf8ff; }
.blog-mapx-row.is-on { border-color: #7a4cc0; background: #f6f2ff; }
.blog-mapx-row:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 1px; }
.blog-mapx-row:hover { border-color: #cbb8e8; background: var(--c-tint-purple); }
.blog-mapx-row.is-on { border-color: #7a4cc0; background: var(--c-tint-purple); }
.blog-mapx-row:focus-visible { outline: 2px solid var(--c-brand-ink); outline-offset: 2px; }
.blog-mapx-sw { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.blog-mapx-nm { font-weight: 700; color: #1f2a44; }
.blog-mapx-ds { color: #6b7a94; }
.blog-mapx-nm { font-weight: 700; color: var(--c-ink); }
.blog-mapx-ds { color: var(--c-ink-2); }
.blog-mapx-ds::before { content: '\00b7'; margin-right: 6px; color: #c9c2dc; }
.blog-mapx-badge {
margin-left: auto; font-size: .72rem; padding: 2px 8px; border-radius: 999px;
background: #fdf4e3; color: #8a6100; border: 1px solid #f0dfb8;
margin-left: auto; font-size: .72rem; padding: 2px 8px; border-radius: var(--radius-pill);
background: var(--c-tint-amber); color: var(--c-warn); border: 1px solid #f0dfb8;
}
.blog-mapx-panel { margin-top: 10px; padding: 12px 14px; border: 1px solid #e8e4f2; border-radius: 14px; background: #fbfaff; }
.blog-mapx-panel { margin-top: 10px; padding: 12px 14px; border: 1px solid #e8e4f2; border-radius: var(--radius); background: var(--c-surface-2); }
.blog-mapx-panel[hidden] { display: none; }
.blog-mapx-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.blog-mapx-head strong { color: #1f2a44; font-size: .95rem; }
.blog-mapx-line { margin: 4px 0; font-size: .85rem; color: #6b7a94; }
.blog-mapx-head strong { color: var(--c-ink); font-size: .95rem; }
.blog-mapx-line { margin: 4px 0; font-size: .85rem; color: var(--c-ink-2); }
.blog-mapx-line span::after { content: ':'; margin-right: 6px; }
.blog-mapx-line b { color: #1f2a44; font-weight: 600; }
.blog-mapx-facts { margin: 8px 0 0; font-size: .82rem; color: #7a4cc0; font-weight: 700; }
.blog-mapx-hint { margin: 8px 0 0; font-size: .8rem; color: #8b93a7; }
.blog-mapx-src { margin: 0 0 14px; font-size: .78rem; color: #8b93a7; word-break: break-all; }
.blog-mapx-line b { color: var(--c-ink); font-weight: 600; }
.blog-mapx-facts { margin: 8px 0 0; font-size: 0.85rem; color: var(--c-brand-ink); font-weight: 700; }
.blog-mapx-hint { margin: 8px 0 0; font-size: 0.78rem; color: var(--c-ink-2); }
.blog-mapx-src { margin: 0 0 14px; font-size: .78rem; color: var(--c-ink-2); word-break: break-all; }
.at-tip-org { background: #1f2a44; color: #fff; border: 0; font-weight: 700; }
@media (min-width: 768px) { .blog-mapx-map { height: 380px; } }
.mu-cover-note {
position: absolute; left: 12px; bottom: 12px; z-index: 500;
padding: 4px 10px; border-radius: 999px; font-size: .78rem;
background: rgba(255, 255, 255, .9); color: #8a6100; border: 1px solid #f0d9a8;
padding: 4px 10px; border-radius: var(--radius-pill); font-size: .78rem;
background: rgba(255, 255, 255, .9); color: var(--c-warn); border: 1px solid #f0d9a8;
}
.mu-post-body { padding: 20px 18px 26px; }
.mu-post-body h1 { margin: 6px 0 12px; font-size: 1.35rem; color: #1f2a44; font-weight: 800; line-height: 1.4; }
.mu-post-body h1 { margin: 6px 0 12px; font-size: 1.35rem; color: var(--c-ink); font-weight: 800; line-height: 1.4; }
/* ย่อหน้า: เว้นระยะ 20px + ย่อหน้าหน้าบรรทัด 1.5em (แบบหนังสือไทย) */
.mu-post-body p { margin: 0 0 20px; color: #4a5568; font-size: .96rem; line-height: 1.9; text-indent: 1.5em; }
.mu-post-body p { margin: 0 0 20px; color: var(--c-ink-2); font-size: 0.95rem; line-height: 1.9; text-indent: 1.5em; }
.mu-post-body p:last-child { margin-bottom: 0; }
/* ย่อหน้าที่เป็นรูป/บรรทัดข้อมูลไม่ต้องย่อหน้า */
.mu-post-body p.mu-post-figure, .mu-post-figure, .mu-post-body p:empty { text-indent: 0; }
/* มาร์กดาวน์เบา ๆ ในเนื้อหา (จาก textN.json) */
.mu-post-body strong { color: #1f2a44; font-weight: 800; }
.mu-post-body strong { color: var(--c-ink); font-weight: 800; }
.mu-post-body em { font-style: italic; }
.mu-post-body a { color: #7a4cc0; font-weight: 700; text-decoration: none; border-bottom: 1px solid #d9cbf3; }
.mu-post-body a { color: var(--c-brand-ink); font-weight: 700; text-decoration: none; border-bottom: 1px solid #d9cbf3; }
.mu-post-body a:hover { border-bottom-color: #7a4cc0; }
.mu-post-body code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .88em;
background: #f4f1fb; border: 1px solid #e7e0f6; border-radius: 4px; padding: 1px 5px; color: #5b4a80; }
background: var(--c-tint-purple); border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 1px 5px; color: var(--c-brand-ink); }
.mu-post-body ul { margin: 0 0 20px; padding-left: 20px; }
.mu-post-body li { color: #4a5568; font-size: .96rem; line-height: 1.9; margin-bottom: 4px; }
.mu-post-body li { color: var(--c-ink-2); font-size: 0.95rem; line-height: 1.9; margin-bottom: 4px; }
.mu-post-figure { margin: 4px 0 16px; }
.mu-post-figure img { width: 100%; height: auto; border-radius: 10px; border: 1px solid #e7e0f6; display: block; }
.mu-post-figure figcaption { margin-top: 6px; color: #6f7b95; font-size: .82rem; text-align: center; }
.mu-post-figure img { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--c-border); display: block; }
.mu-post-figure figcaption { margin-top: 6px; color: var(--c-ink-2); font-size: 0.85rem; text-align: center; }
.mu-post-back {
display: inline-flex; align-items: center; gap: 6px;
margin-bottom: 16px; color: #7a4cc0; font-weight: 700;
text-decoration: none; font-size: .9rem;
margin-bottom: 16px; color: var(--c-brand-ink); font-weight: 700;
text-decoration: none; font-size: 0.95rem;
}
.mu-post-back:hover { text-decoration: underline; }
+17 -17
View File
@@ -10,7 +10,7 @@
.mu-hero-lead {
margin: 14px auto 0;
max-width: 640px;
color: #5b3b71;
color: var(--c-brand-ink);
font-size: .95rem;
}
@@ -26,8 +26,8 @@
gap: 14px;
}
.mu-stop-card {
background: #fff;
border-radius: 16px;
background: var(--c-surface);
border-radius: var(--radius);
overflow: hidden;
box-shadow: 0 4px 14px rgba(20, 40, 90, .06);
transition: transform .15s ease, box-shadow .15s ease;
@@ -47,7 +47,7 @@
padding: 14px 16px;
color: #fff;
}
.mu-stop-head.tone-purple { background: linear-gradient(135deg, #7a4cc0 0%, #b07ce0 100%); }
.mu-stop-head.tone-purple { background: linear-gradient(135deg, var(--c-brand) 0%, #b07ce0 100%); }
.mu-stop-head.tone-sky { background: linear-gradient(135deg, #3071b8 0%, #6ea7e8 100%); }
.mu-stop-head.tone-mint { background: linear-gradient(135deg, #1f8765 0%, #51c39c 100%); }
.mu-stop-head.tone-pink { background: linear-gradient(135deg, #bb3a78 0%, #f08bb9 100%); }
@@ -57,9 +57,9 @@
align-items: center;
gap: 6px;
padding: 5px 12px;
border-radius: 999px;
background: rgba(255, 255, 255, .24);
font-size: .74rem;
border-radius: var(--radius-pill);
background: var(--c-glass-24);
font-size: 0.72rem;
font-weight: 700;
white-space: nowrap;
}
@@ -70,11 +70,11 @@
.mu-stop-card[open] > summary .mu-stop-chevron { transform: rotate(180deg); }
.mu-stop-body { padding: 16px; }
.mu-stop-sub { font-weight: 700; color: #1f2a44; margin: 0 0 10px; font-size: .9rem; }
.mu-stop-sub { font-weight: 700; color: var(--c-ink); margin: 0 0 10px; font-size: 0.95rem; }
.mu-direction-tag {
background: #7a4cc0;
background: var(--c-brand);
color: #fff;
border-radius: 999px;
border-radius: var(--radius-pill);
padding: 3px 10px;
font-size: .72rem;
margin-left: 8px;
@@ -83,9 +83,9 @@
.mu-time-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.mu-time-chip {
padding: 6px 12px;
border-radius: 10px;
background: #f1f4fb;
color: #2b2f42;
border-radius: var(--radius);
background: var(--c-tint-purple);
color: var(--c-ink);
font-weight: 700;
font-size: .85rem;
border: 1px solid #e6eaf3;
@@ -99,13 +99,13 @@
}
.mu-schedule-note {
color: #9a3b6e;
font-size: .82rem;
color: var(--c-danger);
font-size: 0.85rem;
margin: 12px 0 0;
padding: 8px 12px;
background: #fff5f9;
background: var(--c-tint-pink);
border-left: 3px solid #bb3a78;
border-radius: 8px;
border-radius: var(--radius);
display: flex;
align-items: center;
gap: 6px;
+10 -10
View File
@@ -1,16 +1,16 @@
/* Ported from credits.html <style> block */
.mu-page { background: linear-gradient(180deg, #fcfbff 0%, #f5f9ff 100%); }
.mu-page { background: linear-gradient(180deg, var(--c-surface-2) 0%, var(--c-tint-purple) 100%); }
.mu-credit-wrap { max-width: 46rem; margin: 0 auto; padding: 40px 28px 56px; }
.mu-credit-hero { margin-bottom: 28px; }
.mu-credit-hero h1 { margin: 0 0 8px; font-size: 1.9rem; color: #1f2a44; }
.mu-credit-hero p { margin: 0; color: #66728f; }
.mu-credit-hero h1 { margin: 0 0 8px; font-size: 1.8rem; color: var(--c-ink); }
.mu-credit-hero p { margin: 0; color: var(--c-ink-2); }
.mu-credit-section {
background: #fff; border: 1px solid #e7e0f6; border-radius: 16px;
background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
padding: 20px 22px; margin-bottom: 16px;
}
.mu-credit-section h2 { margin: 0 0 6px; font-size: 1.05rem; color: #1f2a44; }
.mu-credit-section .src { margin: 0 0 12px; color: #6f7b95; font-size: .85rem; }
.mu-credit-section ul { margin: 0; padding-left: 1.2rem; color: #3a4462; font-size: .92rem; line-height: 1.7; }
.mu-credit-section code { background: #f5eeff; color: #7a4cc0; padding: 1px 6px; border-radius: 6px; font-size: .85em; }
.mu-credit-section a { color: #7a4cc0; }
.mu-license { margin: 14px 0 0; padding: 12px 14px; background: #f9f7ff; border-left: 3px solid #7a4cc0; border-radius: 8px; font-size: .85rem; color: #4a5573; line-height: 1.6; }
.mu-credit-section h2 { margin: 0 0 6px; font-size: 1rem; color: var(--c-ink); }
.mu-credit-section .src { margin: 0 0 12px; color: var(--c-ink-2); font-size: .85rem; }
.mu-credit-section ul { margin: 0; padding-left: 1.2rem; color: var(--c-info); font-size: 0.95rem; line-height: 1.7; }
.mu-credit-section code { background: var(--c-tint-purple); color: var(--c-brand-ink); padding: 1px 6px; border-radius: var(--radius-sm); font-size: .85em; }
.mu-credit-section a { color: var(--c-brand-ink); }
.mu-license { margin: 14px 0 0; padding: 12px 14px; background: var(--c-surface-2); border-left: 3px solid #7a4cc0; border-radius: var(--radius); font-size: .85rem; color: var(--c-ink-2); line-height: 1.6; }
-17
View File
@@ -1,21 +1,4 @@
/* Ported from home.html <style> block */
/* ปุ่มแชร์ลิงก์สั้น — มุมล่างขวา ต่อจากการ์ดหมวดเส้นทาง */
.mu-share-row { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin: 22px 0 44px; }
.mu-share-btn {
display: inline-flex; align-items: center; gap: 8px;
padding: 10px 16px; border: 1px solid #7a4cc0; border-radius: 8px;
background: #7a4cc0; color: #fff; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer;
}
.mu-share-btn:hover { background: #6a3cae; }
.mu-share-btn:focus-visible { outline: 2px solid #2b2f42; outline-offset: 2px; }
.mu-share-btn .ic { width: 18px; height: 18px; }
.mu-share-status { margin: 0; font-size: .82rem; line-height: 1.7; color: #4b5570; text-align: right; }
.mu-share-status:empty { display: none; }
.mu-share-url { display: inline-block; padding: 2px 6px; border: 1px solid #e7e2f6; border-radius: 8px; background: #faf9ff; font-size: .8rem; }
.mu-share-line { display: inline-block; margin-left: 6px; font-weight: 700; color: #06c755; text-decoration: none; }
.mu-share-line:hover { text-decoration: underline; }
@media (max-width: 560px) {
.mu-share-row { align-items: stretch; }
.mu-share-btn { justify-content: center; }
.mu-share-status { text-align: left; }
}
+40 -40
View File
@@ -7,42 +7,42 @@
.mu-page { padding: 20px 0 48px; }
/* --- header --- */
.mu-breadcrumb { color: #6f7b95; font-size: .88rem; margin: 0 0 12px; }
.mu-breadcrumb a { color: #7a4cc0; text-decoration: none; font-weight: 600; }
.mu-breadcrumb { color: var(--c-ink-2); font-size: 0.85rem; margin: 0 0 12px; }
.mu-breadcrumb a { color: var(--c-brand-ink); text-decoration: none; font-weight: 600; }
.mu-page-title {
display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
margin: 0 0 16px; font-size: 1.6rem; color: #1f2a44; font-weight: 800; line-height: 1.25;
margin: 0 0 16px; font-size: 1.6rem; color: var(--c-ink); font-weight: 800; line-height: 1.25;
}
.mu-route-chip {
display: inline-flex; align-items: center; justify-content: center;
min-width: 54px; height: 54px; padding: 0 16px; border-radius: 14px;
background: linear-gradient(135deg, #7a4cc0, #b07ce0); color: #fff;
min-width: 54px; height: 54px; padding: 0 16px; border-radius: var(--radius);
background: linear-gradient(135deg, var(--c-brand), #b07ce0); color: #fff;
font-weight: 800; font-size: 1.35rem; flex: none;
box-shadow: 0 6px 14px rgba(122, 76, 192, .25);
}
/* สีพื้นหลังของเลขสาย เปลี่ยนตามหมวดเส้นทาง (route_groups.json)
น้ำเงิน = เข้ากรุงเทพฯ · ม่วง = ระหว่างจังหวัด · ชมพู = ภายในจังหวัด · เทา = หมวดอื่น/ไม่ระบุ */
.mu-route-chip.grp-bangkok { background: linear-gradient(135deg, #1a53a8, #3f82d8); box-shadow: 0 6px 14px rgba(31, 95, 191, .25); }
.mu-route-chip.grp-interprovincial { background: linear-gradient(135deg, #7a4cc0, #b07ce0); box-shadow: 0 6px 14px rgba(122, 76, 192, .25); }
.mu-route-chip.grp-interprovincial { background: linear-gradient(135deg, var(--c-brand), #b07ce0); box-shadow: 0 6px 14px rgba(122, 76, 192, .25); }
.mu-route-chip.grp-in_province { background: linear-gradient(135deg, #c02c7d, #e86aae); box-shadow: 0 6px 14px rgba(214, 56, 143, .25); }
.mu-route-chip.grp-municipal { background: linear-gradient(135deg, #5b6560, #8b948f); box-shadow: 0 6px 14px rgba(107, 114, 104, .25); }
.mu-toolbar {
display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
background: #fff; border: 1px solid #e7e2f6; border-radius: 14px;
background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
padding: 12px; margin-bottom: 22px;
box-shadow: 0 8px 20px rgba(63, 43, 94, .06);
}
.mu-toolbar select {
flex: 1; min-width: 180px; min-height: 46px;
border: 1px solid #dfe6f1; background: linear-gradient(180deg, #fff, #f8fbff);
border-radius: 10px; padding: 0 12px; font-family: inherit; font-size: .95rem; color: #1f2a44;
border: 1px solid #dfe6f1; background: linear-gradient(180deg, var(--c-surface), var(--c-tint-purple));
border-radius: var(--radius); padding: 0 12px; font-family: inherit; font-size: .95rem; color: var(--c-ink);
}
/* --- รถประจำสาย + ติดต่อ (การ์ดเดียว ขึ้นก่อน) --- */
.mu-vehicle-card {
background: #fff;
border: 1px solid #e7e2f6;
border-radius: 18px;
background: var(--c-surface);
border: 1px solid var(--c-border);
border-radius: var(--radius);
overflow: hidden;
box-shadow: 0 4px 14px rgba(20, 40, 90, .06);
display: grid;
@@ -61,11 +61,11 @@
display: flex; flex-direction: column; justify-content: center; gap: 8px;
}
.mu-vehicle-card .meta .label {
margin: 0; font-size: .78rem; font-weight: 700; color: #7a4cc0;
margin: 0; font-size: .78rem; font-weight: 700; color: var(--c-brand-ink);
text-transform: uppercase; letter-spacing: .05em;
}
.mu-vehicle-card .meta h2 { margin: 0; font-size: 1.25rem; color: #1f2a44; }
.mu-vehicle-card .meta p { margin: 0; color: #6f7b95; font-size: .95rem; line-height: 1.6; }
.mu-vehicle-card .meta h2 { margin: 0; font-size: 1.2rem; color: var(--c-ink); }
.mu-vehicle-card .meta p { margin: 0; color: var(--c-ink-2); font-size: .95rem; line-height: 1.6; }
/* ติดต่อผู้ประกอบการ — อยู่ใน footer ของการ์ด */
.mu-vehicle-contact {
@@ -73,14 +73,14 @@
display: flex; flex-wrap: wrap; gap: 10px;
padding: 14px 18px;
border-top: 1px solid #f0ecf8;
background: #faf9ff;
background: var(--c-tint-purple);
}
.mu-contact-item {
flex: 1; min-width: 220px;
display: flex; align-items: center; gap: 12px;
padding: 12px 14px;
border-radius: 12px;
background: #fff; border: 1px solid #eee;
border-radius: var(--radius);
background: var(--c-surface); border: 1px solid #eee;
text-decoration: none; color: inherit;
transition: transform .15s ease, box-shadow .15s ease;
}
@@ -88,27 +88,27 @@
.mu-contact-item .ic-wrap {
width: 42px; height: 42px; flex: none;
display: flex; align-items: center; justify-content: center;
border-radius: 12px;
background: linear-gradient(135deg, #7a4cc0, #b07ce0); color: #fff;
border-radius: var(--radius);
background: linear-gradient(135deg, var(--c-brand), #b07ce0); color: #fff;
}
.mu-contact-item .ic-wrap.tone-green { background: linear-gradient(135deg, #1f8765, #51c39c); }
.mu-contact-item .ic-wrap.tone-sky { background: linear-gradient(135deg, #1877f2, #4a9bf8); }
.mu-contact-item .ic-wrap.tone-purple { background: linear-gradient(135deg, #7a4cc0, #a583e0); }
.mu-contact-item .mu-link-go { flex: 0 0 auto; display: flex; align-items: center; color: #7a4cc0; opacity: .8; }
.mu-contact-item .ic-wrap.tone-purple { background: linear-gradient(135deg, var(--c-brand), #a583e0); }
.mu-contact-item .mu-link-go { flex: 0 0 auto; display: flex; align-items: center; color: var(--c-brand-ink); opacity: .8; }
.mu-contact-item:hover .mu-link-go { opacity: 1; transform: translateX(2px); }
.mu-contact-item .ic-wrap svg { width: 22px; height: 22px; }
.mu-contact-item .txt { flex: 1; min-width: 0; }
.mu-contact-item .txt strong { display: block; color: #1f2a44; font-size: .98rem; margin-bottom: 2px; }
.mu-contact-item .txt span { display: block; color: #6f7b95; font-size: .86rem; }
.mu-contact-item .txt strong { display: block; color: var(--c-ink); font-size: 1rem; margin-bottom: 2px; }
.mu-contact-item .txt span { display: block; color: var(--c-ink-2); font-size: 0.85rem; }
.mu-qr-img {
width: 72px; height: 72px; flex: none; display: block;
object-fit: contain; background: #fff;
border-radius: 10px; padding: 4px; border: 1px solid #eee;
object-fit: contain; background: var(--c-surface);
border-radius: var(--radius); padding: 4px; border: 1px solid #eee;
}
/* ปุ่มครอบ QR — กดเพื่อขยาย (ไม่ให้หน้าตาเปลี่ยน) */
.mu-qr-btn { flex: none; padding: 0; border: 0; background: none; cursor: zoom-in;
border-radius: 10px; line-height: 0; }
.mu-qr-btn:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 2px; }
border-radius: var(--radius); line-height: 0; }
.mu-qr-btn:focus-visible { outline: 2px solid var(--c-brand-ink); outline-offset: 2px; }
.mu-qr-btn:hover .mu-qr-img { border-color: #c9b6ec; }
/* --- ขยาย QR ลอยกลางจอ --- */
@@ -116,31 +116,31 @@
.mu-qr-modal::backdrop { background: rgba(20, 28, 48, .55); }
.mu-qr-modal-card {
position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px;
padding: 22px 22px 18px; border-radius: 14px; background: #fff; border: 1px solid #e7e2f6;
padding: 22px 22px 18px; border-radius: var(--radius); background: var(--c-surface); border: 1px solid var(--c-border);
max-width: min(92vw, 360px);
}
.mu-qr-modal-card strong { color: #1f2a44; font-size: 1.02rem; text-align: center; }
.mu-qr-big { width: min(72vw, 260px); height: auto; border-radius: 10px; background: #fff; }
.mu-qr-modal-card strong { color: var(--c-ink); font-size: 1rem; text-align: center; }
.mu-qr-big { width: min(72vw, 260px); height: auto; border-radius: var(--radius); background: var(--c-surface); }
.mu-qr-close {
position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; padding: 0;
display: flex; align-items: center; justify-content: center;
border: 0; border-radius: 10px; background: #f4f1fb; color: #5b4a80; cursor: pointer;
border: 0; border-radius: var(--radius); background: var(--c-tint-purple); color: var(--c-brand-ink); cursor: pointer;
}
.mu-qr-close:hover { background: #e9e2f8; }
.mu-qr-close:hover { background: var(--c-tint-purple); }
.mu-qr-close svg { width: 18px; height: 18px; }
.mu-qr-modal-card .mu-btn { display: inline-flex; align-items: center; gap: 6px; }
.mu-qr-modal-card .mu-btn .ic { width: 16px; height: 16px; }
/* กดรูป QR = เปิดลิงก์ (ทั้งใบ กดได้) */
.mu-qr-link { display: block; line-height: 0; border-radius: 10px; }
.mu-qr-link:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 3px; }
.mu-qr-link { display: block; line-height: 0; border-radius: var(--radius); }
.mu-qr-link:focus-visible { outline: 2px solid var(--c-brand-ink); outline-offset: 2px; }
.mu-qr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mu-copy-link.is-done { border-color: #1f8765; color: #1f8765; }
.mu-copy-link.is-done { border-color: #1f8765; color: var(--c-ok); }
/* --- แผนที่ --- */
.mu-map-card {
background: #fff;
border: 1px solid #e7e2f6;
border-radius: 16px;
background: var(--c-surface);
border: 1px solid var(--c-border);
border-radius: var(--radius);
padding: 16px;
box-shadow: 0 4px 14px rgba(20, 40, 90, .06);
}
@@ -150,7 +150,7 @@
.mu-summary-grid { gap: 14px; }
@media (max-width: 640px) {
.mu-page-title { font-size: 1.4rem; }
.mu-page-title { font-size: 1.35rem; }
.mu-summary-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mu-vehicle-card { grid-template-columns: 1fr; }
.mu-vehicle-card > img { grid-column: 1; min-height: 200px; }
+137
View File
@@ -0,0 +1,137 @@
/* Ported from web-at-transit-mock/ui/partials/stats.html — ใช้โทเคนของ target */
.mu-page { background: linear-gradient(180deg, var(--c-surface) 0%, var(--c-bg) 100%); }
.st-wrap { max-width: 62rem; margin: 0 auto; padding: 32px 20px 64px; }
.st-hero { margin-bottom: 22px; }
.st-hero h1 {
margin: 0 0 8px;
font-size: clamp(1.5rem, 1.2rem + 1.4vw, 1.9rem);
color: var(--c-ink);
letter-spacing: -.01em;
}
.st-hero p {
margin: 0;
max-width: 62ch;
color: var(--c-ink-2);
font-size: .92rem;
line-height: 1.65;
}
.st-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.st-kpi {
min-width: 0;
padding: 14px 16px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
background: var(--c-surface);
}
.st-kpi b {
display: block;
font-size: 1.55rem;
line-height: 1.2;
color: var(--c-ink);
font-variant-numeric: tabular-nums;
}
.st-kpi span {
display: block;
margin-top: 4px;
font-size: .76rem;
font-weight: 700;
color: var(--c-ink-2);
letter-spacing: .01em;
}
.st-card {
margin-top: 16px;
padding: 18px 20px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
background: var(--c-surface);
}
.st-card h2 { margin: 0 0 4px; font-size: 1rem; color: var(--c-ink); }
.st-card .lead { margin: 0 0 14px; color: var(--c-ink-2); font-size: .84rem; line-height: 1.6; }
.st-grid2 { display: grid; gap: 16px; margin-top: 16px; }
.st-grid2 > .st-card { margin-top: 0; }
/* กราฟแท่ง 14 วัน — CSS ล้วน */
.st-chart { display: flex; align-items: flex-end; gap: 5px; height: 128px; padding-top: 10px; }
.st-bar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.st-bar i, .st-bar u { display: block; border-radius: 4px 4px 0 0; min-height: 2px; }
.st-bar i { background: linear-gradient(180deg, #b694f6, var(--c-brand)); }
.st-bar u { background: var(--c-brand-soft); }
.st-bar em {
margin-top: 4px;
font-style: normal;
font-size: .6rem;
color: var(--c-ink-3);
text-align: center;
white-space: nowrap;
}
.st-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: .76rem; color: var(--c-ink-2); }
.st-legend b { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.st-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.st-table th {
padding: 0 8px 6px 0;
text-align: left;
font-size: .7rem;
font-weight: 800;
letter-spacing: .04em;
text-transform: uppercase;
color: var(--c-ink-3);
border-bottom: 1px solid var(--c-border);
}
.st-table td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--c-border-2); color: var(--c-ink); vertical-align: top; }
.st-table tr:last-child td { border-bottom: 0; }
.st-table .num { width: 3.5rem; text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; }
.st-table .when { color: var(--c-ink-3); font-size: .74rem; white-space: nowrap; }
.st-table .term { font-weight: 700; word-break: break-word; }
.st-table a { color: var(--c-brand-ink); text-decoration: none; font-weight: 600; }
.st-table a:hover { text-decoration: underline; }
.st-empty { margin: 0; padding: 14px 0 4px; color: var(--c-ink-3); font-size: .86rem; }
.st-list { margin: 0 0 14px; padding-left: 1.15rem; color: var(--c-ink); font-size: .88rem; line-height: 1.75; }
.st-toggle {
display: flex;
gap: 10px;
align-items: flex-start;
padding: 12px 14px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
background: var(--c-brand-soft);
font-size: .88rem;
color: var(--c-ink);
cursor: pointer;
}
.st-toggle input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--c-brand); flex: none; }
.st-toggle strong { display: block; margin-bottom: 2px; font-size: .9rem; color: var(--c-ink); }
.st-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.st-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 40px;
padding: 9px 16px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
background: var(--c-surface);
color: var(--c-brand-ink);
font: inherit;
font-size: .86rem;
font-weight: 700;
cursor: pointer;
}
.st-btn:hover { background: var(--c-surface-2); }
.st-btn.is-solid { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-on-brand); }
.st-btn.is-solid:hover { background: #6a3fb0; }
.st-btn.is-danger { border-color: var(--c-border); color: var(--c-danger); }
.st-btn.is-danger:hover { background: var(--c-surface-2); }
.st-note { margin: 12px 0 0; font-size: .78rem; color: var(--c-ink-3); }
.st-status { margin: 10px 0 0; min-height: 18px; font-size: .82rem; color: var(--c-ok); }
@media (min-width: 520px) { .st-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 768px) {
.st-grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.st-wrap { padding: 40px 28px 72px; }
}
+78 -78
View File
@@ -1,25 +1,25 @@
/* Ported from stopDetail.html <style> block */
.mu-other-stops { margin: 16px 0 6px; }
.mu-other-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mu-other-item { display: block; padding: 10px 12px; background: #fff;
border: 1px solid #eef0f6; border-radius: 12px; min-width: 0; }
.mu-other-item { display: block; padding: 10px 12px; background: var(--c-surface);
border: 1px solid #eef0f6; border-radius: var(--radius); min-width: 0; }
.mu-other-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mu-other-item .mu-time-grid { margin-top: 8px; }
.mu-other-item .mu-est-note { margin-top: 4px; }
.mu-other-idx { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: #f1e9ff;
color: #7a4cc0; font-size: .78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.mu-other-idx { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--c-tint-purple);
color: var(--c-brand-ink); font-size: .78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.mu-other-txt { flex: 1; min-width: 0; }
.mu-other-txt strong { display: block; color: #1f2a44; font-size: .94rem; }
.mu-other-txt span { display: block; color: #6f7b95; font-size: .8rem; }
.mu-other-txt strong { display: block; color: var(--c-ink); font-size: 0.95rem; }
.mu-other-txt span { display: block; color: var(--c-ink-2); font-size: 0.78rem; }
.mu-other-item .mu-chip { flex: 0 0 auto; font-family: ui-monospace, Consolas, monospace; font-size: .72rem; }
.mu-other-item .mu-chip.warn { background: #fff5e6; color: #9a6b00; border-color: #f2d9a8; }
.mu-other-item .mu-chip.warn { background: var(--c-tint-amber); color: var(--c-warn); border-color: #f2d9a8; }
:root {
--mu-accent: #7a4cc0;
--mu-accent-soft: #f3eafe;
--mu-ink: #1f2a44;
--mu-muted: #6f7b95;
--mu-ink: var(--c-ink);
--mu-muted: var(--c-ink-2);
--mu-border: #ecd7e6;
--mu-surface: #ffffff;
--mu-surface: var(--c-surface);
--mu-rose: #ec4899;
--mu-sky: #3071b8;
--mu-mint: #1f8765;
@@ -28,14 +28,14 @@
background:
radial-gradient(circle at 8% 10%, rgba(122, 76, 192, 0.09), transparent 30%),
radial-gradient(circle at 100% 0%, rgba(48, 113, 184, 0.10), transparent 28%),
linear-gradient(180deg, #fcfbff 0%, #f8f9ff 100%);
linear-gradient(180deg, var(--c-surface-2) 0%, var(--c-tint-purple) 100%);
}
.mu-stop-hero {
position: relative;
overflow: hidden;
border: 1px solid rgba(231, 224, 246, 0.95);
border-radius: 22px;
background: linear-gradient(135deg, #f8f4ff 0%, #f2f6ff 45%, #eefaf5 100%);
border-radius: var(--radius);
background: linear-gradient(135deg, var(--c-tint-purple) 0%, var(--c-tint-purple) 45%, var(--c-tint-green) 100%);
box-shadow: 0 16px 34px rgba(122, 76, 192, 0.12);
padding: 18px;
margin-bottom: 14px;
@@ -48,7 +48,7 @@
.mu-stop-hero::after {
content: "";
position: absolute;
border-radius: 999px;
border-radius: var(--radius-pill);
pointer-events: none;
opacity: .48;
}
@@ -74,22 +74,22 @@
.mu-stop-hero-title {
overflow-wrap: anywhere;
margin: 0;
font-size: 1.72rem;
font-size: 1.8rem;
color: var(--mu-ink);
line-height: 1.2;
}
.mu-stop-hero-sub {
margin: 8px 0 0;
color: var(--mu-muted);
font-size: .9rem;
font-size: 0.95rem;
}
.mu-meta-row { display:flex; flex-wrap:wrap; gap:8px; margin: 12px 0 0; }
.mu-meta-pill { max-width: 100%; overflow-wrap: anywhere; background:linear-gradient(135deg, #ffffff, #f7f9ff); border:1px solid rgba(231, 224, 246, 0.9); color:#5b3b71; padding:6px 14px; border-radius:999px; font-size:.85rem; font-weight:600; box-shadow: 0 4px 10px rgba(122, 76, 192, 0.08); }
.mu-meta-pill.purple { background:linear-gradient(135deg, #f5eeff, #fce7f3); color:#7a4cc0; border-color:#e8d9f0; }
.mu-meta-pill.sky { background:linear-gradient(135deg, #ebf5ff, #eff6ff); color:#3071b8; border-color:#d7e7fb; }
.mu-meta-pill.mint { background:linear-gradient(135deg, #eafaf4, #ecfeff); color:#1f8765; border-color:#d1efdf; }
.mu-direction-tag { background:#7a4cc0; color:#fff; border-radius:999px; padding:2px 10px; font-size:.78rem; margin-left:8px; }
.mu-schedule-note { color:#9a3b6e; font-size:.8rem; margin-top:8px; padding:8px 12px; background:#fff5f9; border-left:3px solid #bb3a78; border-radius:4px; }
.mu-meta-pill { max-width: 100%; overflow-wrap: anywhere; background:linear-gradient(135deg, var(--c-surface), var(--c-tint-purple)); border:1px solid rgba(231, 224, 246, 0.9); color:var(--c-brand-ink); padding:6px 14px; border-radius:var(--radius-pill); font-size:.85rem; font-weight:600; box-shadow: 0 4px 10px rgba(122, 76, 192, 0.08); }
.mu-meta-pill.purple { background:linear-gradient(135deg, var(--c-tint-purple), var(--c-tint-purple)); color:var(--c-brand-ink); border-color:#e8d9f0; }
.mu-meta-pill.sky { background:linear-gradient(135deg, var(--c-tint-cyan), var(--c-tint-cyan)); color:var(--c-info); border-color:#d7e7fb; }
.mu-meta-pill.mint { background:linear-gradient(135deg, var(--c-tint-green), var(--c-tint-cyan)); color:var(--c-ok); border-color:#d1efdf; }
.mu-direction-tag { background:var(--c-brand); color:#fff; border-radius:var(--radius-pill); padding:2px 10px; font-size:.78rem; margin-left:8px; }
.mu-schedule-note { color:var(--c-danger); font-size: 0.78rem; margin-top:8px; padding:8px 12px; background:var(--c-tint-pink); border-left:3px solid #bb3a78; border-radius: var(--radius-sm); }
.mu-hero-metric-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -98,21 +98,21 @@
}
.mu-hero-metric {
border: 1px solid rgba(231, 224, 246, 0.9);
border-radius: 12px;
border-radius: var(--radius);
padding: 10px;
background: #fff;
background: var(--c-surface);
box-shadow: 0 6px 14px rgba(122, 76, 192, 0.08);
min-width: 0;
overflow-wrap: anywhere;
}
.mu-hero-metric:nth-child(1) { background: linear-gradient(135deg, #f5efff, #fdf2f8); }
.mu-hero-metric:nth-child(2) { background: linear-gradient(135deg, #ecfeff, #eef6ff); }
.mu-hero-metric:nth-child(3) { background: linear-gradient(135deg, #fff1f2, #fff7ed); }
.mu-hero-metric:nth-child(4) { background: linear-gradient(135deg, #ecfdf5, #f0fdfa); }
.mu-hero-metric:nth-child(1) { background: linear-gradient(135deg, var(--c-tint-purple), var(--c-tint-pink)); }
.mu-hero-metric:nth-child(2) { background: linear-gradient(135deg, var(--c-tint-cyan), var(--c-tint-cyan)); }
.mu-hero-metric:nth-child(3) { background: linear-gradient(135deg, var(--c-tint-pink), var(--c-tint-amber)); }
.mu-hero-metric:nth-child(4) { background: linear-gradient(135deg, var(--c-tint-green), var(--c-tint-green)); }
.mu-hero-metric-label {
margin: 0;
color: var(--mu-muted);
font-size: .76rem;
font-size: 0.78rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: .03em;
@@ -120,17 +120,17 @@
.mu-hero-metric-value {
margin: 4px 0 0;
color: var(--mu-ink);
font-size: 1.06rem;
font-size: 1.1rem;
font-weight: 800;
line-height: 1.2;
}
.mu-stop-summary-main { order: 2; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.mu-stop-summary-main strong { font-size: .95rem; line-height: 1.3; }
.mu-stop-summary-main .mu-stop-summary-meta { color: #6f7b95; font-size: .78rem; }
.mu-route-type-badge { display: inline-flex; align-items: center; gap: 5px; order: 3; flex: none; background: linear-gradient(135deg, #f5eeff, #fce7f3); color: #7a4cc0; padding: 4px 8px; border-radius: 8px; font-size: .8rem; font-weight: 700; border: 1px solid #e8d9f0; white-space: nowrap; }
.mu-stop-summary-main .mu-stop-summary-meta { color: var(--c-ink-2); font-size: .78rem; }
.mu-route-type-badge { display: inline-flex; align-items: center; gap: 5px; order: 3; flex: none; background: linear-gradient(135deg, var(--c-tint-purple), var(--c-tint-purple)); color: var(--c-brand-ink); padding: 4px 8px; border-radius: var(--radius); font-size: 0.78rem; font-weight: 700; border: 1px solid #e8d9f0; white-space: nowrap; }
.mu-stop-summary-rail { order: 4; flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.mu-route-chip { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 38px; padding: 5px 9px; border-radius: 8px; background: linear-gradient(135deg, #7a4cc0, #b07ce0); color: #fff; font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.mu-stop-chevron { display: inline-block; color: #7a4cc0; font-size: .9rem; line-height: 1; transition: transform .2s ease; }
.mu-route-chip { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 38px; padding: 5px 9px; border-radius: var(--radius); background: linear-gradient(135deg, var(--c-brand), #b07ce0); color: #fff; font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 700; font-size: 0.95rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.mu-stop-chevron { display: inline-block; color: var(--c-brand-ink); font-size: 0.95rem; line-height: 1; transition: transform .2s ease; }
.mu-stop-expander[open] .mu-stop-chevron { transform: rotate(180deg); }
.mu-live-clock-card {
display: flex;
@@ -140,13 +140,13 @@
margin: 6px 0 14px;
padding: 12px 14px;
border: 1px solid rgba(240, 191, 224, 0.9);
border-radius: 14px;
background: linear-gradient(135deg, #ffe8f4 0%, #f5f0ff 50%, #e8f7ff 100%);
border-radius: var(--radius);
background: linear-gradient(135deg, var(--c-tint-purple) 0%, var(--c-tint-purple) 50%, var(--c-tint-cyan) 100%);
box-shadow: 0 8px 20px rgba(122, 76, 192, 0.10);
}
.mu-live-clock-title {
margin: 0;
color: #6f7b95;
color: var(--c-ink-2);
font-size: .78rem;
font-weight: 700;
letter-spacing: .04em;
@@ -154,19 +154,19 @@
}
.mu-live-clock-time {
margin: 2px 0 0;
font-size: 1.65rem;
font-size: 1.6rem;
line-height: 1;
color: #1f2a44;
color: var(--c-ink);
font-weight: 800;
font-family: "K2D", "Prompt", "Noto Sans Thai", sans-serif;
}
.mu-live-clock-note {
margin: 0;
padding: 6px 10px;
border-radius: 999px;
background: linear-gradient(135deg, #ffffff, #fff7fb);
border-radius: var(--radius-pill);
background: linear-gradient(135deg, var(--c-surface), var(--c-tint-pink));
border: 1px solid #eec7df;
color: #9333ea;
color: var(--c-brand-ink);
font-size: .78rem;
font-weight: 600;
white-space: nowrap;
@@ -175,7 +175,7 @@
display: inline-block;
width: 10px;
height: 10px;
border-radius: 999px;
border-radius: var(--radius-pill);
background: #ec4899;
margin-right: 6px;
animation: muPulse 1.6s infinite;
@@ -185,12 +185,12 @@
display: inline-flex;
align-items: center;
gap: 6px;
background: #fff;
background: var(--c-surface);
border: 1px solid #f0d6e6;
color: #9a3b6e;
border-radius: 999px;
color: var(--c-danger);
border-radius: var(--radius-pill);
padding: 3px 10px;
font-size: .76rem;
font-size: 0.78rem;
font-weight: 700;
line-height: 1;
}
@@ -208,8 +208,8 @@
}
.mu-panel {
border: 1px solid rgba(231, 224, 246, 0.95);
border-radius: 18px;
background: linear-gradient(180deg, #ffffff, #fffbfe);
border-radius: var(--radius);
background: linear-gradient(180deg, var(--c-surface), var(--c-tint-purple));
box-shadow: 0 10px 24px rgba(122, 76, 192, 0.09);
}
@@ -220,13 +220,13 @@
margin: 16px 0 18px;
}
.mu-info-card {
border-radius: 14px;
border-radius: var(--radius);
padding: 12px 14px;
border: 1px solid #e9e2fb;
box-shadow: 0 8px 24px rgba(67, 56, 202, 0.08);
}
.mu-info-card .label { font-size: .78rem; color:#66728f; margin:0; font-weight:700; }
.mu-info-card .value { margin:4px 0 0; font-size:1rem; font-weight:700; color:#2b2f42; }
.mu-info-card .label { font-size: .78rem; color:var(--c-ink-2); margin:0; font-weight:700; }
.mu-info-card .value { margin:4px 0 0; font-size:1rem; font-weight:700; color:var(--c-ink); }
.mu-layout-grid {
display: grid;
@@ -236,9 +236,9 @@
}
.mu-card-panel {
background: #fff;
border: 1px solid #ebe8f4;
border-radius: 16px;
background: var(--c-surface);
border: 1px solid var(--c-border-2);
border-radius: var(--radius);
padding: 18px;
box-shadow: 0 8px 24px rgba(67, 56, 202, 0.08);
}
@@ -250,8 +250,8 @@
align-items:center;
gap:6px;
padding:6px 10px;
border-radius:999px;
font-size:.8rem;
border-radius:var(--radius-pill);
font-size: 0.78rem;
font-weight:700;
}
@@ -271,7 +271,7 @@
top: 4px;
width: 6px;
height: 24px;
border-radius: 999px;
border-radius: var(--radius-pill);
background: linear-gradient(180deg, #ec4899, #8b5cf6);
}
.mu-route-tools {
@@ -285,11 +285,11 @@
flex: 1;
min-width: 240px;
border: 1px solid rgba(214, 199, 226, 0.9);
border-radius: 12px;
border-radius: var(--radius);
padding: 10px 12px;
font-size: .9rem;
font-size: 0.95rem;
color: var(--mu-ink);
background: linear-gradient(180deg, #ffffff, #f8fbff);
background: linear-gradient(180deg, var(--c-surface), var(--c-tint-purple));
outline: none;
box-shadow: 0 2px 4px rgba(0,0,0,.02);
}
@@ -299,26 +299,26 @@
}
.mu-route-count {
border: 1px solid rgba(233, 200, 251, 0.9);
background: linear-gradient(135deg, #faf5ff, #fdf2f8);
color: #6b21a8;
border-radius: 999px;
background: linear-gradient(135deg, var(--c-tint-purple), var(--c-tint-pink));
color: var(--c-brand-ink);
border-radius: var(--radius-pill);
padding: 8px 12px;
font-size: .8rem;
font-size: 0.78rem;
font-weight: 700;
}
.mu-stop-expander {
border: 1px solid rgba(243, 228, 238, 0.95);
border-radius: 14px;
border-radius: var(--radius);
margin-bottom: 8px;
overflow: hidden;
background: linear-gradient(180deg, #fff, #fffafe);
background: linear-gradient(180deg, var(--c-surface), var(--c-tint-purple));
}
.mu-stop-expander[open] {
border-color: rgba(226, 201, 245, 0.95);
box-shadow: 0 8px 18px rgba(122, 76, 192, 0.10);
}
.mu-stop-expander > summary {
background: linear-gradient(180deg, #fff, #fff6fb);
background: linear-gradient(180deg, var(--c-surface), var(--c-tint-purple));
padding: 14px;
/* flex + wrap: จอกว้างเรียงบรรทัดเดียว / จอแคบพับลงมา ไม่ทับกัน */
display: flex;
@@ -334,7 +334,7 @@
.mu-stop-list > li:nth-child(4n + 3) .mu-stop-expander > summary { border-left: 4px solid #f472b6; }
.mu-stop-list > li:nth-child(4n + 4) .mu-stop-expander > summary { border-left: 4px solid #34d399; }
.mu-stop-expander-body {
background: linear-gradient(180deg, #fffcff, #fffcfd);
background: linear-gradient(180deg, var(--c-tint-purple), var(--c-tint-pink));
padding-left: 58px;
border-top: 1px solid #f6eaf2;
}
@@ -344,7 +344,7 @@
background: rgba(255,255,255,.8);
backdrop-filter: blur(8px);
border: 1px solid rgba(231, 224, 246, 0.9);
border-radius: 14px;
border-radius: var(--radius);
padding: 10px;
}
@media (max-width: 980px) {
@@ -390,24 +390,24 @@
}
/* === Modern image polish === */
.mu-logo-img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.mu-stop-hero-photo { width: 100%; height: 220px; object-fit: cover; border-radius: 16px; display: block; margin-bottom: 12px; box-shadow: 0 10px 24px rgba(63,43,94,.16); }
.mu-logo-img { width: 44px; height: 44px; border-radius: var(--radius); object-fit: cover; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.mu-stop-hero-photo { width: 100%; height: 220px; object-fit: cover; border-radius: var(--radius); display: block; margin-bottom: 12px; box-shadow: 0 10px 24px rgba(63,43,94,.16); }
/* รูปสำรอง (สถานียังไม่มีรูป) — เป็นไอคอนโปร่งใส จึงใช้ contain + พื้นอ่อน ไม่ให้ยืด/ตัด */
.mu-stop-hero-photo.is-fallback {
object-fit: contain; padding: 22px; box-sizing: border-box;
background: #f7f4fd; box-shadow: none; border: 1px solid #e8e4f2;
background: var(--c-surface-2); box-shadow: none; border: 1px solid #e8e4f2;
}
.mu-nearby {
background: #fff; border: 1px solid var(--mu-border); border-radius: 20px;
background: var(--c-surface); border: 1px solid var(--mu-border); border-radius: var(--radius);
padding: 18px; margin: 14px 0; box-shadow: 0 10px 24px rgba(63,43,94,.06);
}
.mu-nearby h2 { margin: 0 0 4px; font-size: 1.15rem; color: var(--mu-ink); }
.mu-nearby h2 { margin: 0 0 4px; font-size: 1.1rem; color: var(--mu-ink); }
.mu-nearby p.sub { margin: 0 0 14px; color: var(--mu-muted); font-size: .85rem; }
.mu-nearby-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.mu-nearby-card { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 4/3; box-shadow: 0 6px 14px rgba(63,43,94,.10); cursor: pointer; transition: transform .2s ease; }
.mu-nearby-card { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/3; box-shadow: 0 6px 14px rgba(63,43,94,.10); cursor: pointer; transition: transform .2s ease; }
.mu-nearby-card:hover { transform: translateY(-3px); }
.mu-nearby-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.mu-nearby-card:hover img { transform: scale(1.06); }
.mu-nearby-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,23,42,0) 50%, rgba(15,23,42,.65) 100%); }
.mu-nearby-card .cap { position: absolute; left: 12px; right: 12px; bottom: 10px; color: #fff; z-index: 1; font-weight: 700; font-size: .92rem; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.mu-nearby-card .cap small { display: block; font-weight: 500; opacity: .85; font-size: .76rem; }
.mu-nearby-card .cap { position: absolute; left: 12px; right: 12px; bottom: 10px; color: #fff; z-index: 1; font-weight: 700; font-size: 0.95rem; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.mu-nearby-card .cap small { display: block; font-weight: 500; opacity: .85; font-size: 0.78rem; }
+99 -104
View File
@@ -1,13 +1,14 @@
/* Ported from busStop.html <style> block */
.mu-page {
background:
linear-gradient(180deg, #ffffff 0%, #faf7ff 55%, #f4f0fd 100%);
linear-gradient(180deg, var(--c-surface) 0%, var(--c-surface-2) 55%, var(--c-tint-purple) 100%);
}
.mu-hero-panel {
background: linear-gradient(135deg, #ffffff 0%, #f7f2ff 60%, #efe6ff 100%);
border: 1px solid #e7e0f6;
border-radius: 8px;
/* พื้นขาวเรียบ + ขอบดำ (ตามที่ผู้ใช้สั่ง) — ใช้ --c-ink เพื่อให้โหมดมืดขอบสว่างอ่านออก */
background: var(--c-surface);
border: 1px solid var(--c-ink);
border-radius: var(--radius);
padding: 18px;
margin-bottom: 16px;
display: grid;
@@ -15,37 +16,37 @@
gap: 16px;
align-items: stretch;
}
.mu-hero-title { margin: 0; font-size: 1.6rem; line-height: 1.2; color: #1f2a44; }
.mu-hero-subtitle { margin: 8px 0 0; color: #66728f; font-size: .95rem; max-width: 48rem; }
.mu-hero-title { margin: 0; font-size: 1.6rem; line-height: 1.2; color: var(--c-ink); }
.mu-hero-subtitle { margin: 8px 0 0; color: var(--c-ink-2); font-size: .95rem; max-width: 48rem; }
.mu-kpi-grid { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.mu-kpi {
border: 1px solid #d9c9f2;
border-radius: 8px;
border-radius: var(--radius);
padding: 12px;
background: linear-gradient(135deg, #f0e7fc, #e6d8f8);
background: linear-gradient(135deg, var(--c-tint-purple), var(--c-tint-purple));
}
.mu-kpi .label { margin: 0; color:#6b5b8a; font-size:.76rem; font-weight:700; letter-spacing:.03em; text-transform: uppercase; }
.mu-kpi .value { margin:4px 0 0; color:#2b1f4d; font-size:1.03rem; font-weight:800; font-variant-numeric: tabular-nums; }
.mu-kpi .label { margin: 0; color:var(--c-ink-2); font-size: 0.78rem; font-weight:700; letter-spacing:.03em; text-transform: uppercase; }
.mu-kpi .value { margin:4px 0 0; color:var(--c-brand-ink); font-size: 1rem; font-weight:800; font-variant-numeric: tabular-nums; }
.mu-hero-map {
border: 1px solid #e7e0f6;
border-radius: 8px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
padding: 14px;
display:flex;
flex-direction:column;
gap: 10px;
justify-content:space-between;
}
.mu-hero-map-title { margin:0; font-size:1rem; font-weight:800; color:#2c3e50; }
.mu-hero-map-title { margin:0; font-size:1rem; font-weight:800; color:var(--c-info); }
.mu-hero-map-box {
flex:1;
min-height: 160px;
border-radius: 8px;
background: linear-gradient(135deg, #faf7ff, #f2ecfd);
border-radius: var(--radius);
background: linear-gradient(135deg, var(--c-surface-2), var(--c-tint-purple));
border: 1px dashed #d9cdf2;
display:flex;
align-items:center;
justify-content:center;
color:#66728f;
color:var(--c-ink-2);
font-weight:700;
text-align:center;
padding: 18px;
@@ -53,9 +54,9 @@
/* ===== Search toolbar: 2 โหมด ===== */
.mu-toolbar {
background: linear-gradient(135deg, #f0e7fc, #e6d8f8);
background: var(--c-surface);
border: 1px solid #d9c9f2;
border-radius: 8px;
border-radius: var(--radius);
padding: 14px;
margin-bottom: 12px;
}
@@ -63,7 +64,7 @@
display: flex;
gap: 0;
border: 1px solid #d5c3f0;
border-radius: 8px;
border-radius: var(--radius);
overflow: hidden;
margin-bottom: 12px;
width: fit-content;
@@ -71,13 +72,13 @@
}
.mu-search-tab {
font-family: inherit;
font-size: .88rem;
font-size: 0.85rem;
font-weight: 700;
padding: 10px 18px;
border: none;
border-right: 1px solid #d5c3f0;
background: #fff;
color: #5b3b71;
background: var(--c-surface);
color: var(--c-brand-ink);
cursor: pointer;
display: inline-flex;
align-items: center;
@@ -85,28 +86,27 @@
transition: background .15s ease, color .15s ease;
}
.mu-search-tab:last-child { border-right: none; }
.mu-search-tab:hover { background: #f3ecff; }
.mu-search-tab.active { background: linear-gradient(135deg, #7a4cc0, #b07ce0); color: #fff; }
.mu-search-tab:hover { background: var(--c-tint-purple); }
.mu-search-tab.active { background: linear-gradient(135deg, var(--c-brand), #b07ce0); color: #fff; }
.mu-search-tab .ic { width: 16px; height: 16px; }
.mu-search-mode { display: block; }
/* กัน .display:block ทับ attribute [hidden] — โหมดที่ไม่ได้ใช้ต้องซ่อนจริง */
.mu-search-mode[hidden],
.mu-numpad[hidden] { display: none; }
.mu-search-mode[hidden] { display: none; }
.mu-search-field {
display: flex;
align-items: center;
gap: 10px;
border: 1px solid #d5c3f0;
border-radius: 8px;
background: #fff;
border-radius: var(--radius);
background: var(--c-surface);
padding: 0 12px;
min-height: 48px;
transition: border-color .15s ease;
}
.mu-search-field:focus-within { border-color: #a855f7; }
.mu-search-field .ic { position: static; width: 18px; height: 18px; color: #8b5cf6; flex: none; }
.mu-search-field .ic { position: static; width: 18px; height: 18px; color: var(--c-brand-ink); flex: none; }
.mu-search-field input {
flex: 1;
min-width: 0;
@@ -116,10 +116,10 @@
font-family: inherit;
font-size: 1rem;
font-weight: 600;
color: #1f2a44;
color: var(--c-ink);
padding: 12px 0;
}
.mu-search-field input::placeholder { color: #6f7b95; font-weight: 500; opacity: .8; }
.mu-search-field input::placeholder { color: var(--c-ink-2); font-weight: 500; opacity: .8; }
/* ===== ช่องรหัสป้าย 6 ช่อง: [x] + [x][x][x][x] ===== */
.mu-code-boxes {
@@ -135,10 +135,10 @@
font-size: 1.35rem;
font-weight: 700;
font-variant-numeric: tabular-nums;
color: #1f2a44;
background: #fff;
border: 2px solid #e0d6f5;
border-radius: 8px;
color: var(--c-ink);
background: var(--c-surface);
border: 2px solid var(--c-border);
border-radius: var(--radius);
outline: none;
padding: 0;
transition: border-color .15s ease, background .15s ease;
@@ -146,17 +146,17 @@
}
.mu-code-cell::-webkit-outer-spin-button,
.mu-code-cell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mu-code-cell::placeholder { color: #7a6a9e; font-weight: 600; opacity: 1; }
.mu-code-cell::placeholder { color: var(--c-ink-2); font-weight: 600; opacity: 1; }
.mu-code-cell:focus {
border-color: #a855f7;
background: #faf7ff;
background: var(--c-surface-2);
}
.mu-code-cell:disabled { opacity: .45; }
/* 2 หลักหน้า (ก่อน +) — เน้นให้เห็นว่าเป็นหัวของรหัส */
.mu-code-cell:nth-of-type(1),
.mu-code-cell:nth-of-type(2) {
border-color: #b07ce0;
background: linear-gradient(135deg, #7a4cc0, #b07ce0);
background: linear-gradient(135deg, var(--c-brand), #b07ce0);
color: #fff;
}
.mu-code-cell:nth-of-type(1)::placeholder,
@@ -167,45 +167,27 @@
font-family: "IBM Plex Mono", ui-monospace, monospace;
font-size: 1.5rem;
font-weight: 700;
color: #7a4cc0;
color: var(--c-brand-ink);
line-height: 1;
padding: 0 2px;
}
.mu-code-display {
margin: 10px 0 0;
font-family: "IBM Plex Mono", ui-monospace, monospace;
font-size: .9rem;
font-size: 0.95rem;
font-weight: 700;
color: #6d28d9;
color: var(--c-brand-ink);
font-variant-numeric: tabular-nums;
}
.mu-search-hint { margin: 8px 0 0; font-size: .82rem; color: #6f7b95; }
/* numpad — โชว์เฉพาะจอเล็ก */
.mu-numpad { display: none; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; max-width: 320px; }
.mu-numpad button {
font-family: "IBM Plex Mono", ui-monospace, monospace;
font-size: 1.2rem;
font-weight: 700;
padding: 14px 0;
border: 1px solid #e0d6f5;
border-radius: 8px;
background: #fff;
color: #1f2a44;
cursor: pointer;
font-variant-numeric: tabular-nums;
transition: background .12s ease, border-color .12s ease;
}
.mu-numpad button:active { background: #f3ecff; border-color: #b07ce0; }
.mu-numpad button[data-key="back"] { grid-column: span 2; font-size: 1rem; }
.mu-search-hint { margin: 8px 0 0; font-size: 0.85rem; color: var(--c-ink-2); }
/* suggest */
.mu-suggest {
border: 1px solid #e0d6f5;
border-radius: 8px;
border: 1px solid var(--c-border);
border-radius: var(--radius);
margin-top: 8px;
overflow: hidden;
background: #fff;
background: var(--c-surface);
max-height: 260px;
overflow-y: auto;
}
@@ -218,23 +200,23 @@
padding: 11px 14px;
border: none;
border-bottom: 1px solid #f1edfa;
background: #fff;
background: var(--c-surface);
font-family: inherit;
font-size: .9rem;
font-size: 0.95rem;
text-align: left;
cursor: pointer;
color: #1f2a44;
color: var(--c-ink);
}
.mu-suggest-item:last-child { border-bottom: none; }
.mu-suggest-item:hover { background: #faf7ff; }
.mu-suggest-item:hover { background: var(--c-surface-2); }
.mu-suggest-code {
font-family: "IBM Plex Mono", ui-monospace, monospace;
font-size: .85rem;
font-weight: 700;
color: #fff;
background: linear-gradient(135deg, #7a4cc0, #b07ce0);
background: linear-gradient(135deg, var(--c-brand), #b07ce0);
padding: 3px 9px;
border-radius: 4px;
border-radius: var(--radius-sm);
flex: none;
font-variant-numeric: tabular-nums;
}
@@ -242,12 +224,13 @@
.mu-toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.mu-show-more { display: flex; justify-content: center; margin: 14px 0 4px; }
.mu-show-more .mu-btn { min-width: 220px; }
.mu-stop-card.is-stub { min-height: 120px; background: #faf8ff; border: 1px dashed #ddd2f2; box-shadow: none; }
.mu-stop-card.is-stub { min-height: 120px; background: var(--c-tint-purple); border: 1px dashed #ddd2f2; box-shadow: none; }
.mu-toolbar-count { margin: 10px 0 0; font-size: .84rem; color: #6f7b95; }
.mu-toolbar-count b { color: #7a4cc0; font-variant-numeric: tabular-nums; }
.mu-toolbar-count { margin: 10px 0 0; font-size: 0.85rem; color: var(--c-ink-2); }
.mu-toolbar-count b { color: var(--c-brand-ink); font-variant-numeric: tabular-nums; }
/* ===== การ์ดป้าย ===== */
.mu-stop-grid[hidden] { display: none; }
.mu-stop-grid {
display:grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -257,17 +240,17 @@
}
.mu-stop-grid li {
margin: 0;
border-radius: 8px;
border-radius: var(--radius);
overflow: hidden;
border: 1px solid #e7e0f6;
background: #fff;
border: 1px solid var(--c-border);
background: var(--c-surface);
transition: border-color .15s ease, transform .15s ease;
}
.mu-stop-grid li:hover { border-color: #a855f7; transform: translateY(-1px); }
.mu-stop-card {
height: 100%;
padding: 16px;
background: #fff;
background: var(--c-surface);
display:flex;
flex-direction:column;
gap: 12px;
@@ -276,40 +259,40 @@
.mu-stop-top { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.mu-type-pill {
display:inline-block;
border-radius: 4px;
border-radius: var(--radius-sm);
padding: 4px 9px;
font-size:.74rem;
font-size: 0.72rem;
font-weight:800;
letter-spacing:.01em;
}
.mu-type-pill.local { background: #f3ecff; color: #6d28d9; }
.mu-stop-title { margin:6px 0 0; font-size:1.05rem; line-height:1.3; color:#1f2a44; }
.mu-loc { color:#6f7b95; font-size:.85rem; margin-top:4px; }
.mu-type-pill.local { background: var(--c-tint-purple); color: var(--c-brand-ink); }
.mu-stop-title { margin:6px 0 0; font-size: 1rem; line-height:1.3; color:var(--c-ink); }
.mu-loc { color:var(--c-ink-2); font-size:.85rem; margin-top:4px; }
.mu-chip-row { display:flex; flex-wrap:wrap; gap:8px; }
.mu-chip {
display:inline-flex;
align-items:center;
gap:6px;
padding:5px 10px;
border-radius: 4px;
background: #faf7ff;
border: 1px solid #e7e0f6;
color:#5b3b71;
font-size:.8rem;
border-radius: var(--radius-sm);
background: var(--c-surface-2);
border: 1px solid var(--c-border);
color:var(--c-brand-ink);
font-size: 0.78rem;
font-weight:700;
}
.mu-chip.route { background: #f3ecff; color:#6d28d9; border-color: #e0d6f5; }
.mu-chip.route { background: var(--c-tint-purple); color:var(--c-brand-ink); border-color: var(--c-border); }
/* ชิปสายที่เป็นลิงก์ → ไปหน้าเช็กเวลาของสายนั้น (หน้าตาเหมือนชิปเดิม + มี hover/focus) */
a.mu-chip.route { text-decoration: none; cursor: pointer; }
a.mu-chip.route:hover { background:#e9dcff; border-color:#cdb5f2; }
a.mu-chip.route:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 2px; }
a.mu-chip.route:hover { background:var(--c-tint-purple); border-color:#cdb5f2; }
a.mu-chip.route:focus-visible { outline: 2px solid var(--c-brand-ink); outline-offset: 2px; }
/* รหัสป้าย = ม่วง-ขาว แบบเดียวกับป้ายสายรถ */
.mu-chip.count.stop-code {
background: linear-gradient(135deg, #7a4cc0, #b07ce0);
background: linear-gradient(135deg, var(--c-brand), #b07ce0);
color: #fff;
border-color: transparent;
font-family: "IBM Plex Mono", ui-monospace, monospace;
font-size: .92rem;
font-size: 0.95rem;
font-weight: 700;
letter-spacing: .05em;
font-variant-numeric: tabular-nums;
@@ -317,21 +300,21 @@
padding: 7px 11px;
}
.mu-stop-action { margin-top:auto; display:flex; justify-content:space-between; align-items:center; gap:12px; }
.mu-stop-note { color:#6f7b95; font-size:.8rem; margin:0; }
.mu-stop-note { color:var(--c-ink-2); font-size: 0.78rem; margin:0; }
.mu-stop-thumb {
display: block;
width: 100%;
height: 180px;
object-fit: cover;
background: #f7f9fd;
border-bottom: 1px solid #e7e0f6;
background: var(--c-tint-purple);
border-bottom: 1px solid var(--c-border);
}
/* รูป placeholder — ย่อและจัดกลาง ไม่ให้ครอปโลโก้ */
.mu-stop-thumb.is-placeholder {
object-fit: contain;
padding: 34px;
background: linear-gradient(135deg, #faf7ff, #f2ecfd);
background: linear-gradient(135deg, var(--c-surface-2), var(--c-tint-purple));
}
.mu-stop-empty {
@@ -339,10 +322,10 @@
list-style: none;
padding: 40px 16px;
text-align: center;
color: #6f7b95;
border: 1px dashed #e0d6f5;
border-radius: 8px;
background: #fff;
color: var(--c-ink-2);
border: 1px dashed var(--c-border);
border-radius: var(--radius);
background: var(--c-surface);
}
@media (max-width: 980px) {
@@ -353,14 +336,26 @@
@media (max-width: 640px) {
.mu-kpi-grid { grid-template-columns: 1fr; }
.mu-numpad { display: grid; }
.mu-search-tabs { width: 100%; }
.mu-search-tab { flex: 1; justify-content: center; padding: 10px 12px; font-size: .84rem; }
.mu-search-tab { flex: 1; justify-content: center; padding: 10px 12px; font-size: 0.85rem; }
/* 3 แท็บบนจอแคบ: ข้อความไทยยาว → ให้ห่อเป็น 2 บรรทัดอย่างเรียบร้อย
และทุกแท็บสูงเท่ากัน (flex stretch) */
.mu-search-tabs { align-items: stretch; }
.mu-search-tab {
min-height: 56px;
text-align: center;
line-height: 1.25;
padding: 10px 8px;
gap: 6px;
}
.mu-search-tab .ic { flex: none; }
.mu-search-tab span { display: block; }
.mu-stop-action { flex-direction: column; align-items: flex-start; }
/* กล่องรหัส: ย่อให้พอดีจอ 375px (5×40 + เครื่องหมาย + gap = ~244px) */
.mu-code-boxes { gap: 5px; }
.mu-code-cell { width: 40px; height: 48px; font-size: 1.15rem; }
.mu-code-plus { font-size: 1.25rem; }
.mu-code-cell { width: 40px; height: 48px; font-size: 1.1rem; }
.mu-code-plus { font-size: 1.2rem; }
}
.mu-hero-map-photo { width: 100%; height: 100%; min-height: 160px; object-fit: cover; border-radius: 8px; display: block; }
.mu-hero-map-photo { width: 100%; height: 100%; min-height: 160px; object-fit: cover; border-radius: var(--radius); display: block; }
+75 -28
View File
@@ -22,9 +22,9 @@ body { font-size: 16px; }
/* --- ขยายขนาด component บนมือถือ (desktop-oriented เดิมเล็กเกิน) --- */
/* topbar อยู่ใน section ด้านล่าง — content ใน #view ใช้ prefix ชนะ partial style */
#view .mu-btn { font-size: .95rem; min-height: 48px; }
#view .mu-badge { font-size: 1.05rem; }
#view .mu-badge { font-size: 1rem; }
#view .mu-zone-tag { font-size: 1rem; }
#view .mu-zone-desc, #view .mu-zone-sub { font-size: 1.05rem; }
#view .mu-zone-desc, #view .mu-zone-sub { font-size: 1rem; }
#view .mu-route-name { font-size: 1.2rem; }
#view .mu-next-trip { font-size: .95rem; }
#view .mu-meta-pill { font-size: .95rem; }
@@ -33,7 +33,7 @@ body { font-size: 16px; }
#view .mu-time-chip { font-size: .95rem; min-height: 40px; }
#view .mu-info-card .label { font-size: .85rem; }
#view .mu-info-card .value { font-size: 1.1rem; }
#view .mu-stat p { font-size: .9rem; }
#view .mu-stat p { font-size: 0.95rem; }
#view .mu-hero-lead { font-size: 1rem; }
#view .mu-select-box select { font-size: 1rem; }
@@ -54,31 +54,35 @@ img, svg, video { max-width: 100%; height: auto; }
main.mu-container { padding-top: 24px; padding-bottom: 24px; }
/* --- topbar: hamburger menu บนมือถือ (brand + lang + ☰ บรรทัดเดียว) --- */
.mu-topbar-inner { gap: 8px; padding: 10px 14px; flex-wrap: wrap; }
.mu-topbar-inner { gap: 8px; padding: 10px 14px; flex-wrap: nowrap; }
.mu-logo-img { width: 36px; height: 36px; }
.mu-brand { gap: 8px; flex-shrink: 0; }
.mu-brand-title { font-size: 1.05rem; white-space: nowrap; }
.mu-brand { gap: 8px; flex: 1 1 auto; min-width: 0; }
.mu-brand-title { font-size: 1rem; white-space: nowrap; }
.mu-brand-subtitle { display: none; } /* กันล้น — โผล่กลับ ≥768px */
.mu-nav { display: none; } /* ซ่อน nav — ใช้ hamburger แทน */
.mu-lang-switch { order: 3; margin-left: auto; padding: 2px; }
.mu-lang-btn { font-size: .8rem; padding: 8px 12px; min-height: 40px; min-width: 40px; } /* tap target */
.mu-lang-btn { font-size: 0.78rem; padding: 8px 12px; min-height: 40px; min-width: 40px; } /* tap target */
.mu-action-btn { display: none; } /* กันล้นบนจอเล็ก — โผล่กลับ ≥1024px */
/* hamburger menu (ขวาสุด) */
.mu-menu { display: block; position: relative; order: 4; margin-left: 2px; }
.mu-menu { display: block; position: relative; order: 3; margin-left: 0; flex-shrink: 0; }
/* ตัวดันชิดขวาอยู่ที่กลุ่มเครื่องมือ (ตัวแรกของกลุ่มขวา) แล้วให้ 3 ขีดตามท้าย → ขีดอยู่มุมขวาสุด */
.mu-topbar-tools { order: 2; margin-inline-start: auto; }
.mu-menu-btn {
display: flex; align-items: center; justify-content: center;
width: 44px; height: 44px;
border: none; background: transparent; cursor: pointer;
color: #1f2a44; list-style: none;
border-radius: 10px;
color: var(--c-ink); list-style: none;
border-radius: var(--radius);
}
.mu-menu-btn::-webkit-details-marker { display: none; }
.mu-menu-btn svg { width: 26px; height: 26px; }
.mu-menu-panel {
position: absolute; top: calc(100% + 8px); right: 0;
min-width: 220px;
background: #fff; border: 1px solid #e7e2f6; border-radius: 14px;
background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
box-shadow: 0 12px 28px rgba(20, 40, 90, .16);
padding: 8px;
z-index: 60;
@@ -87,11 +91,11 @@ main.mu-container { padding-top: 24px; padding-bottom: 24px; }
.mu-menu-panel a {
display: flex; align-items: center;
min-height: 48px; padding: 10px 14px;
border-radius: 10px;
color: #1f2a44; text-decoration: none;
font-size: 1.05rem; font-weight: 600;
border-radius: var(--radius);
color: var(--c-ink); text-decoration: none;
font-size: 1rem; font-weight: 600;
}
.mu-menu-panel a:hover, .mu-menu-panel a:active { background: #f5efff; }
.mu-menu-panel a:hover, .mu-menu-panel a:active { background: var(--c-tint-purple); }
/* --- hero (หน้าแรก) — ช่องว่าง + ตัวหนังสือใหญ่ขึ้น --- */
.mu-hero { padding: 30px 0 34px; }
@@ -99,7 +103,7 @@ main.mu-container { padding-top: 24px; padding-bottom: 24px; }
.mu-badge { margin-bottom: 10px; padding: 5px 14px; }
.mu-hero-lead { margin: 0 0 8px; }
.mu-hero-actions { flex-direction: column; align-items: stretch; padding: 0 6px; margin-top: 10px; gap: 8px; }
.mu-pill-link { justify-content: center; padding: 11px 18px; font-size: .9rem; }
.mu-pill-link { justify-content: center; padding: 11px 18px; font-size: 0.95rem; }
/* --- ตัวเลือกจังหวัด/สถานี (หน้าแรก) --- */
#view .mu-route-selector { flex-direction: column; align-items: stretch; gap: 8px; margin-top: 12px; }
@@ -111,7 +115,7 @@ main.mu-container { padding-top: 24px; padding-bottom: 24px; }
/* --- marquee (สปอนเซอร์) — การ์ดเล็กลงบนมือถือ --- */
.mu-marquee-track { padding: 2px 0 10px; }
.mu-marquee-tile { width: 132px; height: 68px; margin-right: 10px; border-radius: 10px; }
.mu-marquee-tile { width: 132px; height: 68px; margin-right: 10px; border-radius: var(--radius); }
/* --- โซนเส้นทาง + การ์ด — ระยะห่างกระชับ --- */
main.mu-container { padding-top: 14px; padding-bottom: 14px; }
@@ -125,14 +129,14 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
#view .mu-zone-seg { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
#view .mu-zone-seg:not(:last-child)::after { content: "\00b7"; color: #c4bcd8; margin-left: 8px; } /* คั่นท้ายชิ้น → ตัดบรรทัดแล้วจุดไม่ไปอยู่ต้นบรรทัด */
#view .mu-zone-seg .ic { align-self: center; flex: none; }
#view .mu-zone-now b { color: #1f2a44; font-variant-numeric: tabular-nums; }
#view .mu-zone-at { color: #8a93a8; } /* ชื่อสถานีในวงเล็บ — จางกว่ารอบรถ */
#view .mu-zone-updated { color: #8a7aa8; font-size: .95rem; }
#view .mu-zone-now b { color: var(--c-ink); font-variant-numeric: tabular-nums; }
#view .mu-zone-at { color: var(--c-ink-2); } /* ชื่อสถานีในวงเล็บ — จางกว่ารอบรถ */
#view .mu-zone-updated { color: var(--c-ink-2); font-size: .95rem; }
.mu-grid { gap: 12px; }
.mu-route-info { padding: 16px 16px 18px; }
.mu-route-name { margin-bottom: 6px; }
.mu-route-chip-wrap { gap: 6px; }
.mu-next-trip { padding: 3px 10px; font-size: .74rem; }
.mu-next-trip { padding: 3px 10px; font-size: 0.72rem; }
/* --- busStop --- */
#view .mu-hero-panel { grid-template-columns: 1fr; padding: 14px; gap: 12px; }
@@ -148,7 +152,7 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
/* --- busDetail / expanded --- */
#view .mu-layout-grid { grid-template-columns: 1fr; gap: 12px; }
#view .mu-page-title { font-size: 1.45rem; }
#view .mu-page-title { font-size: 1.5rem; }
#view .mu-route-hero { padding: 16px; }
#view .mu-info-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
#view .mu-panel,
@@ -157,7 +161,7 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
#view .mu-quickpick { display: flex; flex-wrap: wrap; gap: 8px; }
#view .mu-inline-actions { flex-wrap: wrap; }
#view .mu-back-btn { width: 100%; justify-content: center; padding: 10px; min-height: 44px; }
#view .mu-schedule-note { font-size: .82rem; }
#view .mu-schedule-note { font-size: 0.85rem; }
/* --- stopDetail --- */
#view .mu-hero-metric-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
@@ -197,11 +201,11 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
@media (min-width: 640px) {
body { font-size: 16px; }
.mu-container { padding: 0 28px; }
.mu-brand-title { font-size: 1.05rem; }
.mu-brand-title { font-size: 1rem; }
.mu-topbar-inner { gap: 18px; padding: 14px 28px; flex-wrap: nowrap; }
.mu-logo-img { width: 44px; height: 44px; }
.mu-nav { order: 0; width: auto; margin-left: auto; justify-content: flex-start; gap: 24px; display: flex; }
.mu-nav a { font-size: .92rem; }
.mu-nav a { font-size: 0.95rem; }
.mu-menu { display: none; }
.mu-lang-btn { font-size: .72rem; padding: 6px 10px; }
.mu-hero { padding: 44px 0 52px; }
@@ -275,12 +279,55 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
/* เวลาที่ "คำนวณจากต้นทาง" (ไม่ใช่ตารางจริงของผู้ประกอบการ) — ทำเครื่องหมายให้ผู้ใช้รู้ ไม่ให้เข้าใจผิด */
.mu-time-grid.is-est .mu-time-chip {
border: 1px dashed #a892d4;
background: #faf7ff;
color: #6b5a8e;
background: var(--c-surface-2);
color: var(--c-brand-ink);
font-style: italic;
}
.mu-est-note {
margin: 6px 0 0;
font-size: .78rem;
color: #6b5a8e;
color: var(--c-brand-ink);
}
/* ============================================================
Touch target บนมือถือ — WCAG 2.5.8 / Android 48dp
วัดที่ 375px แล้วพบ: ลิงก์ท้ายเว็บ 34px · breadcrumb 21px ·
ปุ่มย้อนกลับ 41px · ปุ่มซูมแผนที่ 30px → เล็กกว่า 44px ทั้งหมด
============================================================ */
@media (max-width: 639px) {
/* ลิงก์ในเนื้อหา/เมนูต้องกดง่าย (selector เจาะจงพอให้ชนะกฎของหน้า) */
.mu-site-footer .mu-footer-col a,
.mu-site-footer .mu-footer-brand a,
.mu-site-footer .mu-footer-bottom a,
.mu-breadcrumb a,
.mu-menu-panel a {
display: inline-flex;
align-items: center;
min-height: 44px;
}
/* โลโก้ = ลิงก์กลับหน้าแรก */
.mu-brand { min-height: 44px; }
/* ปุ่มย้อนกลับ */
/* min-height ไม่มีผลกับ display:inline — ต้องเป็น inline-flex ก่อน */
#view .mu-back-btn {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 44px;
}
/* ช่องค้นหาสายรถ (ป้ายหยุดรถ) */
#view .mu-route-filter { min-height: 44px; }
/* ปุ่มซูมของ Leaflet — ต้องชนะ leaflet.css ที่โหลดทีหลัง จึงใช้ specificity สูง */
/* leaflet.css ถูกโหลดจาก public หลัง CSS ของแอป จึงต้องใช้ !important */
.leaflet-container .leaflet-control-zoom a,
.leaflet-bar a.leaflet-control-zoom-in,
.leaflet-bar a.leaflet-control-zoom-out {
width: 44px !important;
height: 44px !important;
line-height: 44px !important;
font-size: 20px;
}
/* ปุ่มเครื่องมือใน topbar (สำรองกรณีเบราว์เซอร์ไม่รายงาน pointer: coarse) */
.mu-pop-btn { min-width: 44px; height: 44px; }
.mu-pop-btn-lang { min-width: 60px; }
}
+77 -121
View File
@@ -1,5 +1,5 @@
/* Ported from web-at-transit-mock/ui/index.html <style> */
.mu-card.empty { width: 100%; padding: 16px; text-align: center; color: #6f7b95; background: #fff7fb; border: 1px dashed #f4c7df; }
.mu-card.empty { width: 100%; padding: 16px; text-align: center; color: var(--c-ink-2); background: var(--c-tint-pink); border: 1px dashed #f4c7df; }
a.mu-card { text-decoration: none; color: inherit; display: block; }
/* Page-specific: hero */
@@ -27,12 +27,12 @@
letter-spacing: .02em;
}
/* zone tint — พื้นหลังการ์ดตามหมวดเส้นทาง (ตัวการ์ด = เฉดอ่อน / หัวการ์ด = เฉดสด) */
.mu-zone:has(.tag-sky) { --zone-tint: #eff6ff; }
.mu-zone:has(.tag-purple) { --zone-tint: #f5f3ff; }
.mu-zone:has(.tag-pink) { --zone-tint: #fdf2f8; }
.mu-zone:has(.tag-yellow) { --zone-tint: #fffbeb; }
.mu-zone:has(.tag-sky) { --zone-tint: var(--c-tint-cyan); }
.mu-zone:has(.tag-purple) { --zone-tint: var(--c-tint-purple); }
.mu-zone:has(.tag-pink) { --zone-tint: var(--c-tint-pink); }
.mu-zone:has(.tag-yellow) { --zone-tint: var(--c-tint-amber); }
.mu-zone .mu-card,
.mu-zone .mu-route-info { background: var(--zone-tint, #fff); }
.mu-zone .mu-route-info { background: var(--zone-tint, var(--c-surface)); }
.mu-zone:has(.tag-sky) .mu-card-head { background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%); }
.mu-zone:has(.tag-purple) .mu-card-head { background: linear-gradient(135deg, #8b5cf6 0%, #c084fc 100%); }
@@ -40,46 +40,46 @@
.mu-zone:has(.tag-yellow) .mu-card-head { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); }
/* การ์ดที่ยังไม่มีข้อมูล (is-empty): พื้นเทา + N/A แทนเลขสาย ไม่มีเงาตัวอักษร */
.mu-card.is-empty,
.mu-card.is-empty .mu-route-info { background: #f0f2f5; }
.mu-card.is-empty .mu-card-head { background: #e4e7eb; }
.mu-card.is-empty .mu-route-number { color: #5b636e !important; text-shadow: none !important; font-size: 42px !important; }
.mu-card.is-empty .mu-route-info { background: var(--c-tint-cyan); }
.mu-card.is-empty .mu-card-head { background: var(--c-surface-3); }
.mu-card.is-empty .mu-route-number { color: var(--c-ink-2) !important; text-shadow: none !important; font-size: 42px !important; }
.mu-card.is-empty { cursor: default; }
.mu-card.is-empty:hover { transform: none; box-shadow: 0 4px 14px rgba(20,40,90,.06); }
.mu-route-info { padding: 14px 16px 16px; background: #fff; }
.mu-route-name { margin: 0 0 10px; font-size: .95rem; color: #1f2a44; font-weight: 700; }
.mu-route-info { padding: 14px 16px 16px; background: var(--c-surface); }
.mu-route-name { margin: 0 0 10px; font-size: .95rem; color: var(--c-ink); font-weight: 700; }
/* ===== maintheme.png look: topbar, hero, zones, grid, summary, footer ===== */
body.main-theme-page { margin: 0; font-family: 'K2D','Noto Sans Thai','Prompt',system-ui,sans-serif; color: #1f2a44; background: #f7f9fd; }
body.main-theme-page { margin: 0; font-family: 'K2D','Noto Sans Thai','Prompt',system-ui,sans-serif; color: var(--c-ink); background: var(--c-bg); }
.mu-container { max-width: 1200px; margin: 0 auto; padding: 0 28px; }
/* Topbar */
/* z-index 1100 — ต้องสูงกว่า Leaflet (pane 400 · control 800 · .leaflet-top 1000)
ไม่งั้นแผนที่จะบัง nav ตอนเลื่อน */
.mu-topbar { background: #ffffff; border-bottom: 1px solid #e9eef7; position: sticky; top: 0; z-index: 1100; box-shadow: 0 2px 8px rgba(20,40,90,.04); }
.mu-topbar { background: var(--c-surface); border-bottom: 1px solid var(--c-border); position: sticky; top: 0; z-index: 1100; box-shadow: 0 2px 8px rgba(20,40,90,.04); }
.mu-topbar-inner { display: flex; align-items: center; gap: 18px; padding: 14px 28px; }
.mu-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.mu-logo-img { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg,#8b5cf6,#ec4899); padding: 4px; transition: transform .15s ease; }
.mu-logo-img { width: 44px; height: 44px; border-radius: var(--radius); background: linear-gradient(135deg,#8b5cf6,#ec4899); padding: 4px; transition: transform .15s ease; }
.mu-brand:hover .mu-logo-img { transform: scale(1.06); }
.mu-brand-title { display: block; margin: 0; font-weight: 800; font-size: 1.05rem; color: #1f2a44; transition: color .15s ease; }
.mu-brand:hover .mu-brand-title { color: #7a4cc0; }
.mu-brand-subtitle { display: block; margin: 0; font-size: .72rem; color: #6f7b95; }
.mu-brand-title { display: block; margin: 0; font-weight: 800; font-size: 1rem; color: var(--c-ink); transition: color .15s ease; }
.mu-brand:hover .mu-brand-title { color: var(--c-brand-ink); }
.mu-brand-subtitle { display: block; margin: 0; font-size: .72rem; color: var(--c-ink-2); }
.mu-nav { margin-left: auto; display: flex; gap: 28px; }
.mu-nav a { color: #4a5876; text-decoration: none; font-size: .92rem; font-weight: 600; padding: 6px 4px; border-bottom: 2px solid transparent; }
.mu-nav a.active { color: #d6336c; border-bottom-color: #ec4899; }
.mu-nav a:hover { color: #1f2a44; }
.mu-action-btn { background: linear-gradient(135deg,#a855f7,#7c3aed); color:#fff; padding: 10px 22px; border-radius: 999px; text-decoration:none; font-weight: 700; font-size:.88rem; box-shadow: 0 6px 14px rgba(124,58,237,.3); }
.mu-nav a { color: var(--c-info); text-decoration: none; font-size: 0.95rem; font-weight: 600; padding: 6px 4px; border-bottom: 2px solid transparent; }
.mu-nav a.active { color: var(--c-danger); border-bottom-color: #ec4899; }
.mu-nav a:hover { color: var(--c-ink); }
.mu-action-btn { background: linear-gradient(135deg,#a855f7,#7c3aed); color:#fff; padding: 10px 22px; border-radius: var(--radius-pill); text-decoration:none; font-weight: 700; font-size: 0.85rem; box-shadow: 0 6px 14px rgba(124,58,237,.3); }
/* Hero */
.mu-hero { position: relative; overflow: hidden; padding: 56px 0 64px; background: linear-gradient(180deg, #f0ebff 0%, #ffe8ee 50%, #fff4d6 100%); text-align: center; }
.mu-hero { position: relative; overflow: hidden; padding: 56px 0 64px; background: linear-gradient(180deg, var(--c-tint-purple) 0%, var(--c-tint-pink) 50%, var(--c-tint-amber) 100%); text-align: center; }
.mu-hero-map { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .3; filter: saturate(1.1); z-index: 0; pointer-events: none; }
.mu-blob { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .55; z-index: 0; }
.mu-blob.one { width: 220px; height: 220px; background: #b794f4; top: -50px; left: 8%; }
.mu-blob.two { width: 260px; height: 260px; background: #f9a8d4; top: 40%; right: 8%; }
.mu-blob.three{ width: 180px; height: 180px; background: #fde68a; bottom: -40px; left: 38%; }
.mu-blob.three{ width: 180px; height: 180px; background: var(--c-tint-amber); bottom: -40px; left: 38%; }
.mu-hero-content { position: relative; z-index: 1; }
.mu-badge { display: inline-block; background: rgba(255,255,255,.7); backdrop-filter: blur(6px); color: #6d28d9; padding: 6px 16px; border-radius: 999px; font-size: .82rem; font-weight: 700; margin-bottom: 18px; box-shadow: 0 4px 10px rgba(124,58,237,.12); }
.mu-hero h1 { margin: 0 0 26px; font-size: 2.2rem; font-weight: 800; line-height: 1.35; color: #1f2a44; }
.mu-badge { display: inline-block; background: var(--c-glass-70); backdrop-filter: blur(6px); color: var(--c-brand-ink); padding: 6px 16px; border-radius: var(--radius-pill); font-size: 0.85rem; font-weight: 700; margin-bottom: 18px; box-shadow: 0 4px 10px rgba(124,58,237,.12); }
.mu-hero h1 { margin: 0 0 26px; font-size: 2.2rem; font-weight: 800; line-height: 1.35; color: var(--c-ink); }
.mu-gradient-text { background: linear-gradient(120deg, #d946ef 10%, #a855f7 60%, #6366f1 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
/* ===== Route selector: จังหวัด → สถานีขนส่งผู้โดยสาร (cascade) ===== */
.mu-route-selector {
@@ -98,25 +98,25 @@
align-items: center;
gap: 6px;
margin: 0 0 7px 8px;
font-size: .8rem;
font-size: 0.78rem;
font-weight: 700;
color: #6f7b95;
color: var(--c-ink-2);
letter-spacing: .01em;
}
.mu-select-field > label svg { width: 15px; height: 15px; color: #8b5cf6; flex: none; }
.mu-select-field > label svg { width: 15px; height: 15px; color: var(--c-brand-ink); flex: none; }
.mu-select-box {
position: relative;
display: flex;
align-items: center;
background: #fff;
border: 1px solid #e7e2f6;
border-radius: 14px;
background: var(--c-surface);
border: 1px solid var(--c-border);
border-radius: var(--radius);
box-shadow: 0 8px 20px rgba(63, 43, 94, .08);
transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.mu-select-box:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(63,43,94,.12); }
.mu-select-box:focus-within { border-color: #c8b4ec; box-shadow: 0 0 0 4px rgba(122,76,192,.14), 0 10px 24px rgba(63,43,94,.10); }
.mu-select-box .mu-select-icon { width: 20px; height: 20px; margin-left: 14px; color: #8b5cf6; flex: none; }
.mu-select-box .mu-select-icon { width: 20px; height: 20px; margin-left: 14px; color: var(--c-brand-ink); flex: none; }
.mu-select-box select {
flex: 1;
min-width: 0;
@@ -126,16 +126,16 @@
font-family: inherit;
font-size: .95rem;
font-weight: 600;
color: #1f2a44;
color: var(--c-ink);
padding: 14px 12px;
cursor: pointer;
appearance: none;
-webkit-appearance: none;
}
.mu-select-box .mu-select-chevron { width: 18px; height: 18px; margin-right: 14px; color: #8b5cf6; flex: none; pointer-events: none; }
.mu-select-arrow { display: none; align-self: center; color: #c4b5e6; font-weight: 700; font-size: 1.15rem; padding-bottom: 18px; }
.mu-select-hint { margin: 12px 0 0; font-size: .84rem; color: #6f7b95; min-height: 1.25em; }
.mu-select-hint b { color: #7a4cc0; font-weight: 700; }
.mu-select-box .mu-select-chevron { width: 18px; height: 18px; margin-right: 14px; color: var(--c-brand-ink); flex: none; pointer-events: none; }
.mu-select-arrow { display: none; align-self: center; color: #c4b5e6; font-weight: 700; font-size: 1.1rem; padding-bottom: 18px; }
.mu-select-hint { margin: 12px 0 0; font-size: 0.85rem; color: var(--c-ink-2); min-height: 1.25em; }
.mu-select-hint b { color: var(--c-brand-ink); font-weight: 700; }
/* ===== Hero actions ===== */
.mu-hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 18px; }
@@ -144,12 +144,12 @@
align-items: center;
gap: 7px;
padding: 11px 20px;
border-radius: 999px;
background: #fff;
border: 1px solid #e7e2f6;
color: #5b3b71;
border-radius: var(--radius-pill);
background: var(--c-surface);
border: 1px solid var(--c-border);
color: var(--c-brand-ink);
text-decoration: none;
font-size: .88rem;
font-size: 0.85rem;
font-weight: 700;
box-shadow: 0 6px 16px rgba(63,43,94,.08);
transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
@@ -165,114 +165,70 @@
main.mu-container { padding-top: 40px; padding-bottom: 40px; }
.mu-zone { margin-bottom: 32px; }
.mu-zone-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 14px; }
.mu-zone-tag { padding: 5px 14px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.mu-zone-tag.tag-sky { background: #dbeafe; color: #1d4ed8; }
.mu-zone-tag.tag-pink { background: #fce7f3; color: #be185d; }
.mu-zone-tag.tag-purple { background: #ede9fe; color: #6d28d9; }
.mu-zone-tag.tag-yellow { background: #fdf1d3; color: #8a6100; }
.mu-zone-tag { padding: 5px 14px; border-radius: var(--radius-pill); font-size: 0.85rem; font-weight: 700; }
.mu-zone-tag.tag-sky { background: var(--c-tint-cyan); color: var(--c-info); }
.mu-zone-tag.tag-pink { background: var(--c-tint-purple); color: var(--c-danger); }
.mu-zone-tag.tag-purple { background: var(--c-tint-purple); color: var(--c-brand-ink); }
.mu-zone-tag.tag-yellow { background: var(--c-tint-amber); color: var(--c-warn); }
/* คำอธิบายสีการ์ดตามหมวดเส้นทาง */
.mu-legend { background: #fff; border: 1px solid #e9eef7; border-radius: 14px; padding: 16px 18px; margin-bottom: 26px; box-shadow: 0 4px 14px rgba(20,40,90,.05); }
.mu-legend-title { margin: 0 0 12px; font-size: .95rem; font-weight: 800; color: #1f2a44; }
.mu-legend { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 26px; box-shadow: 0 4px 14px rgba(20,40,90,.05); }
.mu-legend-title { margin: 0 0 12px; font-size: .95rem; font-weight: 800; color: var(--c-ink); }
.mu-legend-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 18px; }
.mu-legend-list li { display: flex; align-items: center; gap: 9px; font-size: .86rem; color: #3d4a63; }
.mu-legend-list .sw { width: 26px; height: 16px; border-radius: 4px; flex: none; border: 1px solid rgba(20,40,90,.12); }
.mu-legend-list li { display: flex; align-items: center; gap: 9px; font-size: 0.85rem; color: var(--c-info); }
.mu-legend-list .sw { width: 26px; height: 16px; border-radius: var(--radius-sm); flex: none; border: 1px solid rgba(20,40,90,.12); }
.sw-bangkok { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.sw-interprov { background: linear-gradient(135deg, #8b5cf6, #c084fc); }
.sw-inprov { background: linear-gradient(135deg, #ec4899, #f472b6); }
.sw-municipal { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.sw-empty { background: #e4e7eb; }
.mu-legend-note { margin: 12px 0 0; color: #6f7b95; font-size: .82rem; }
.mu-zone-sub, .mu-zone-desc { color: #6f7b95; font-size: .88rem; margin: 0; }
.sw-empty { background: var(--c-surface-3); }
.mu-legend-note { margin: 12px 0 0; color: var(--c-ink-2); font-size: 0.85rem; }
.mu-zone-sub, .mu-zone-desc { color: var(--c-ink-2); font-size: 0.85rem; margin: 0; }
/* ทุกบรรทัดคำอธิบายกินเต็มความกว้างของตัวเอง — ไม่ถูกบีบไปรวมแถวเดียวกับป้ายหัวข้อ
(เดิม flex ไม่มี wrap → ทุกบรรทัดถูกย่อรวมกันหมด ข้อความไทยจึงตัดคำมั่ว) */
.mu-zone-head .mu-zone-desc { flex-basis: 100%; min-width: 0; line-height: 1.65; }
/* แถวข้อมูลแบบ "ชิ้น" (segment) — กฎจริงอยู่ใน responsive.css (#view …) เพราะต้องชนะ
<style> ของ partial ที่ถูก inject ทีหลัง · ที่นี่เก็บเฉพาะสีที่ใช้ร่วมทุกหน้า */
.mu-zone-updated { color: #8a7aa8; }
.mu-zone-updated { color: var(--c-ink-2); }
.mu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
/* Cards */
.mu-card { display: block; text-decoration: none; color: inherit; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 14px rgba(20,40,90,.06); transition: transform .15s, box-shadow .15s; }
.mu-card { display: block; text-decoration: none; color: inherit; background: var(--c-surface); border-radius: var(--radius); overflow: hidden; box-shadow: 0 4px 14px rgba(20,40,90,.06); transition: transform .15s, box-shadow .15s; }
.mu-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20,40,90,.1); }
.mu-card-head { aspect-ratio: auto !important; height: 130px !important; display: flex !important; align-items: center; justify-content: center; position: relative; }
.mu-card-head::after { display: none !important; }
.mu-card-head .mu-route-number { position: static !important; color: #fff !important; font-size: 52px !important; font-weight: 900; text-shadow: 0 4px 12px rgba(0,0,0,.2) !important; letter-spacing: .02em; margin: 0; }
.mu-route-info { padding: 14px 14px 14px; }
.mu-route-name { margin: 0 0 10px; font-size: .9rem; color: #1f2a44; font-weight: 700; }
.mu-card .mu-badge { background: #dcfce7; color: #15803d; padding: 4px 10px; font-size: .78rem; font-weight: 700; box-shadow: none; backdrop-filter: none; }
.mu-next-trip { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #dcfce7; color: #15803d; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-sky { background: #dbeafe; color: #1d4ed8; }
.badge-pink { background: #fce7f3; color: #be185d; }
.badge-mint { background: #d1fae5; color: #047857; }
.badge-gray { background: #e8eaed; color: #5b636e; }
.mu-route-name { margin: 0 0 10px; font-size: 0.95rem; color: var(--c-ink); font-weight: 700; }
.mu-card .mu-badge { background: var(--c-tint-green); color: var(--c-ok); padding: 4px 10px; font-size: .78rem; font-weight: 700; box-shadow: none; backdrop-filter: none; }
.mu-next-trip { display: inline-block; padding: 4px 12px; border-radius: var(--radius-pill); font-size: .78rem; font-weight: 700; background: var(--c-tint-green); color: var(--c-ok); }
.badge-purple { background: var(--c-tint-purple); color: var(--c-brand-ink); }
.badge-sky { background: var(--c-tint-cyan); color: var(--c-info); }
.badge-pink { background: var(--c-tint-purple); color: var(--c-danger); }
.badge-mint { background: var(--c-tint-green); color: var(--c-ok); }
.badge-gray { background: var(--c-tint-cyan); color: var(--c-ink-2); }
.mu-route-chip-wrap { display:flex; gap: 8px; }
/* Summary stats */
.mu-summary { padding: 20px 0 40px; }
.mu-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.mu-stat { padding: 28px 18px; text-align: center; border-radius: 18px; font-weight: 700; margin: 0; }
.mu-stat h3 { margin: 0 0 4px; font-size: 2rem; color: #1f2a44; font-weight: 800; }
.mu-stat p { margin: 0; font-size: .82rem; color: #4a5876; font-weight: 600; }
.mu-stat.tag-pink { background: #fce7f3; }
.mu-stat.tag-sky { background: #dbeafe; }
.mu-stat.tag-purple { background: #ede9fe; }
.mu-stat.tag-mint { background: #d1fae5; }
.mu-stat { padding: 28px 18px; text-align: center; border-radius: var(--radius); font-weight: 700; margin: 0; }
.mu-stat h3 { margin: 0 0 4px; font-size: 2rem; color: var(--c-ink); font-weight: 800; }
.mu-stat p { margin: 0; font-size: 0.85rem; color: var(--c-info); font-weight: 600; }
.mu-stat.tag-pink { background: var(--c-tint-purple); }
.mu-stat.tag-sky { background: var(--c-tint-cyan); }
.mu-stat.tag-purple { background: var(--c-tint-purple); }
.mu-stat.tag-mint { background: var(--c-tint-green); }
/* ===== Visitor counter (footer bottom bar) ===== */
/* ===== Footer bottom bar ===== */
.mu-footer-bottom { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.mu-visitor {
display: inline-flex;
align-items: center;
gap: 7px;
margin: 0;
padding: 5px 12px;
border-radius: 999px;
background: rgba(255,255,255,.06);
border: 1px solid rgba(255,255,255,.1);
color: #b6bdda;
font-size: .78rem;
font-weight: 600;
letter-spacing: .01em;
line-height: 1;
}
.mu-visitor svg { width: 14px; height: 14px; color: #b694f6; flex: none; }
.mu-visitor strong { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
/* ปุ่ม/ช่องรีเซ็ตผู้เข้าชม (ซ่อน — กดตัวเลข 5 ครั้ง) */
#visitor-count { cursor: pointer; }
.mu-vreset {
position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center;
padding: 20px; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px);
}
.mu-vreset-card {
width: 100%; max-width: 340px; background: #fff; border-radius: 16px; padding: 20px;
box-shadow: 0 18px 50px rgba(15, 23, 42, .28);
}
.mu-vreset-card h4 { margin: 0 0 12px; font-size: 1rem; color: #1f2a44; }
.mu-vreset-card label { display: block; font-size: .8rem; color: #6b7a94; margin-bottom: 6px; }
.mu-vreset-card input {
width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: .95rem;
border: 1px solid #d9d3e8; border-radius: 10px; color: #1f2a44; background: #fbfaff;
}
.mu-vreset-card input:focus { outline: 2px solid #7a4cc0; outline-offset: 1px; border-color: #7a4cc0; }
.mu-vreset-msg { margin: 10px 0 0; min-height: 18px; font-size: .8rem; color: #b3261e; }
.mu-vreset-msg.is-ok { color: #1f7a3d; }
.mu-vreset-row { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.mu-vreset-row button {
padding: 9px 16px; font-size: .85rem; font-weight: 700; border-radius: 10px; cursor: pointer;
border: 1px solid #d9d3e8; background: #fff; color: #3d4a63;
}
.mu-vreset-row button:hover { background: #fbfaff; }
.mu-vreset-ok { border-color: #7a4cc0 !important; background: #7a4cc0 !important; color: #fff !important; }
.mu-vreset-ok:hover { background: #6a3fb0 !important; }
/* ===== Sponsor marquee (between hero and main) ===== */
.mu-sponsor-marquee { padding: 26px 0 6px; background: #fff; border-bottom: 1px solid #f0f2f8; }
.mu-sponsor-marquee { padding: 26px 0 6px; background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.mu-sponsor-head { text-align: center; margin-bottom: 18px; }
.mu-sponsor-head h4 { margin: 0 0 4px; font-size: 1rem; font-weight: 800; color: #1f2a44; letter-spacing: .01em; }
.mu-sponsor-head .lead { margin: 0; color: #6f7b95; font-size: .84rem; }
.mu-sponsor-head h4 { margin: 0 0 4px; font-size: 1rem; font-weight: 800; color: var(--c-ink); letter-spacing: .01em; }
.mu-sponsor-head .lead { margin: 0; color: var(--c-ink-2); font-size: 0.85rem; }
.mu-marquee {
overflow: hidden;
position: relative;
@@ -300,9 +256,9 @@
display: flex;
align-items: center;
justify-content: center;
background: #fff;
background: var(--c-surface);
border: 1px solid #eef0f6;
border-radius: 14px;
border-radius: var(--radius);
box-shadow: 0 4px 12px rgba(63, 43, 94, .05);
transition: transform .2s ease, box-shadow .2s ease;
}
+178
View File
@@ -0,0 +1,178 @@
/* ============================================================
Atroute — Theme tokens (light / dark)
ทำไมมีไฟล์นี้
เดิม CSS ทุกไฟล์ใส่ hex ตรง ๆ (209 สี) → เปลี่ยนธีมไม่ได้
ไฟล์นี้วาง "semantic token" ทับ แล้วแมปสีที่ใช้บ่อยที่สุดไปที่ token
(ดูสคริปต์ remap — แมปเฉพาะ property ที่ปลอดภัย:
background → surface · color → ink · border → border)
โหมดที่รองรับ (ดู ThemeSwitch.tsx)
light = สว่าง
dark = มืด
auto = ตามเวลาเครื่อง 06:00–18:00 = สว่าง, นอกนั้น = มืด
⚠️ DESIGN.md เป็นรัฐธรรมนูญ — สีแบรนด์คือ #7a4cc0 (ม่วง) ห้ามเปลี่ยนเป็นฟ้า
============================================================ */
:root {
color-scheme: light;
/* พื้นผิว */
--c-surface: #ffffff;
--c-surface-2: #faf7ff;
--c-surface-3: #f4f2fa;
/* ตัวอักษร */
--c-ink: #1f2a44;
--c-ink-2: #5f6b83; /* ปรับให้ผ่าน AA บนพื้นขาว (4.25 → 5.1) */
--c-ink-3: #8b94a8;
/* เส้นขอบ */
--c-border: #e7e2f6;
--c-border-2: #ebe8f4;
/* แบรนด์ */
--c-brand: #7a4cc0;
--c-brand-ink: #7a4cc0; /* ม่วงที่ใช้เป็น "ตัวอักษร" บนพื้น */
--c-brand-soft: #f4f0fb;
--c-on-brand: #ffffff;
/* โฟกัส (คีย์บอร์ด) */
--c-focus: #7a4cc0;
/* มุมโค้ง — DESIGN.md §3: มีแค่ 4px / 8px (+ pill) */
--radius-sm: 4px;
--radius: 8px;
--radius-pill: 999px;
/* เงา */
--c-shadow: rgba(26, 18, 46, .10);
/* พื้นหลังหน้า (เข้มกว่าการ์ดเล็กน้อย) */
--c-bg: #f7f9fd;
/* tint พื้นผิวตามความหมาย (ม่วง/ชมพู/เขียว/เหลือง/ฟ้า) */
--c-tint-purple: #f4f1fb;
--c-tint-pink: #fff5f9;
--c-tint-green: #e8f8ef;
--c-tint-amber: #fffdf6;
--c-tint-cyan: #ecfeff;
/* สีความหมาย (ข้อความบนพื้น) */
--c-ok: #1f7a3d;
--c-warn: #8a6100;
--c-danger: #b02a37;
--c-info: #3071b8;
/* พื้นผิวโปร่งแสง (glass) */
--c-glass: rgba(255, 255, 255, .92);
--c-glass-70: rgba(255, 255, 255, .70);
--c-glass-24: rgba(255, 255, 255, .24);
}
:root[data-theme="dark"] {
color-scheme: dark;
--c-surface: #171225;
--c-surface-2: #1f1833;
--c-surface-3: #251d3d;
--c-ink: #ece9f7;
--c-ink-2: #a9a2c4;
--c-ink-3: #8d86ab;
--c-border: #352b52;
--c-border-2: #2c2444;
--c-brand: #7a4cc0;
--c-brand-ink: #b892f5; /* สว่างขึ้นเพื่อให้ผ่าน 4.5:1 บนพื้นมืด */
--c-brand-soft: #241b3b;
--c-on-brand: #ffffff;
--c-focus: #b892f5;
--c-shadow: rgba(0, 0, 0, .45);
--c-bg: #120e1e;
--c-tint-purple: #241c3b;
--c-tint-pink: #2e1a2a;
--c-tint-green: #15291f;
--c-tint-amber: #2b2416;
--c-tint-cyan: #16262b;
--c-ok: #6ee7a8;
--c-warn: #fbbf24;
--c-danger: #ff9db0;
--c-info: #7cc0ff;
--c-glass: rgba(23, 18, 37, .92);
--c-glass-70: rgba(23, 18, 37, .80);
--c-glass-24: rgba(255, 255, 255, .10);
}
/* ---------- ฐาน ---------- */
html {
background: var(--c-surface);
}
body {
color: var(--c-ink);
background: var(--c-bg);
}
/* ฟอร์ม/คอนโทรลใช้สีระบบให้เข้ากับธีม */
input,
select,
textarea,
button {
color-scheme: inherit;
}
/* ภาพที่อาจสว่างเกินไปบนพื้นมืด (โลโก้พาร์ทเนอร์/แผนที่) — ลดความจ้าเล็กน้อย */
:root[data-theme="dark"] img.mu-marquee-tile img,
:root[data-theme="dark"] .mu-marquee-tile img {
filter: brightness(.92);
}
/* กันจอขาววูบตอนสลับธีม */
@media (prefers-reduced-motion: no-preference) {
html,
body {
transition: background-color .18s ease, color .18s ease;
}
}
/* ============================================================
dropdown / <select> — ต้องอ่านออกทั้ง light และ dark
ปัญหาเดิม: select ใช้ color ของธีม แต่ option ใช้สีระบบ (ขาว-ขาว)
แก้: บังคับ color-scheme ตามธีม + กำหนดสี option ให้ตรงโทเคน
============================================================ */
select,
input,
textarea {
color-scheme: inherit;
}
:root[data-theme="dark"] select,
:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea {
color-scheme: dark;
}
:root[data-theme="light"] select,
:root[data-theme="light"] input,
:root[data-theme="light"] textarea {
color-scheme: light;
}
option,
optgroup {
background-color: var(--c-surface);
color: var(--c-ink);
}
/* Firefox: สีของ popup ตามสี option ที่ประกาศไว้ */
@supports (-moz-appearance: none) {
option:checked {
background-color: var(--c-tint-purple);
color: var(--c-brand-ink);
}
}
-1
View File
@@ -1 +0,0 @@
{"fileNames":["./node_modules/typescript/lib/lib.es5.d.ts","./node_modules/typescript/lib/lib.es2015.d.ts","./node_modules/typescript/lib/lib.es2016.d.ts","./node_modules/typescript/lib/lib.es2017.d.ts","./node_modules/typescript/lib/lib.es2018.d.ts","./node_modules/typescript/lib/lib.es2019.d.ts","./node_modules/typescript/lib/lib.es2020.d.ts","./node_modules/typescript/lib/lib.es2021.d.ts","./node_modules/typescript/lib/lib.es2022.d.ts","./node_modules/typescript/lib/lib.es2023.d.ts","./node_modules/typescript/lib/lib.es2024.d.ts","./node_modules/typescript/lib/lib.esnext.d.ts","./node_modules/typescript/lib/lib.dom.d.ts","./node_modules/typescript/lib/lib.dom.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.core.d.ts","./node_modules/typescript/lib/lib.es2015.collection.d.ts","./node_modules/typescript/lib/lib.es2015.generator.d.ts","./node_modules/typescript/lib/lib.es2015.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.promise.d.ts","./node_modules/typescript/lib/lib.es2015.proxy.d.ts","./node_modules/typescript/lib/lib.es2015.reflect.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2016.array.include.d.ts","./node_modules/typescript/lib/lib.es2016.intl.d.ts","./node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2017.date.d.ts","./node_modules/typescript/lib/lib.es2017.object.d.ts","./node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2017.string.d.ts","./node_modules/typescript/lib/lib.es2017.intl.d.ts","./node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","./node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","./node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","./node_modules/typescript/lib/lib.es2018.intl.d.ts","./node_modules/typescript/lib/lib.es2018.promise.d.ts","./node_modules/typescript/lib/lib.es2018.regexp.d.ts","./node_modules/typescript/lib/lib.es2019.array.d.ts","./node_modules/typescript/lib/lib.es2019.object.d.ts","./node_modules/typescript/lib/lib.es2019.string.d.ts","./node_modules/typescript/lib/lib.es2019.symbol.d.ts","./node_modules/typescript/lib/lib.es2019.intl.d.ts","./node_modules/typescript/lib/lib.es2020.bigint.d.ts","./node_modules/typescript/lib/lib.es2020.date.d.ts","./node_modules/typescript/lib/lib.es2020.promise.d.ts","./node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2020.string.d.ts","./node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2020.intl.d.ts","./node_modules/typescript/lib/lib.es2020.number.d.ts","./node_modules/typescript/lib/lib.es2021.promise.d.ts","./node_modules/typescript/lib/lib.es2021.string.d.ts","./node_modules/typescript/lib/lib.es2021.weakref.d.ts","./node_modules/typescript/lib/lib.es2021.intl.d.ts","./node_modules/typescript/lib/lib.es2022.array.d.ts","./node_modules/typescript/lib/lib.es2022.error.d.ts","./node_modules/typescript/lib/lib.es2022.intl.d.ts","./node_modules/typescript/lib/lib.es2022.object.d.ts","./node_modules/typescript/lib/lib.es2022.string.d.ts","./node_modules/typescript/lib/lib.es2022.regexp.d.ts","./node_modules/typescript/lib/lib.es2023.array.d.ts","./node_modules/typescript/lib/lib.es2023.collection.d.ts","./node_modules/typescript/lib/lib.es2023.intl.d.ts","./node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2024.collection.d.ts","./node_modules/typescript/lib/lib.es2024.object.d.ts","./node_modules/typescript/lib/lib.es2024.promise.d.ts","./node_modules/typescript/lib/lib.es2024.regexp.d.ts","./node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2024.string.d.ts","./node_modules/typescript/lib/lib.esnext.array.d.ts","./node_modules/typescript/lib/lib.esnext.collection.d.ts","./node_modules/typescript/lib/lib.esnext.intl.d.ts","./node_modules/typescript/lib/lib.esnext.disposable.d.ts","./node_modules/typescript/lib/lib.esnext.promise.d.ts","./node_modules/typescript/lib/lib.esnext.decorators.d.ts","./node_modules/typescript/lib/lib.esnext.iterator.d.ts","./node_modules/typescript/lib/lib.esnext.float16.d.ts","./node_modules/typescript/lib/lib.esnext.error.d.ts","./node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","./node_modules/typescript/lib/lib.decorators.d.ts","./node_modules/typescript/lib/lib.decorators.legacy.d.ts","./node_modules/@types/react/global.d.ts","./node_modules/csstype/index.d.ts","./node_modules/@types/prop-types/index.d.ts","./node_modules/@types/react/index.d.ts","./node_modules/next/dist/styled-jsx/types/css.d.ts","./node_modules/next/dist/styled-jsx/types/macro.d.ts","./node_modules/next/dist/styled-jsx/types/style.d.ts","./node_modules/next/dist/styled-jsx/types/global.d.ts","./node_modules/next/dist/styled-jsx/types/index.d.ts","./node_modules/next/dist/server/get-page-fLine truncated