พอร์ต UI จาก web-at-transit-mock เข้า Next.js + data sync เข้า Postgres/SeaweedFS

- 8 หน้า (home/stops/routes/stop/check/blog/about/credits) แปลง partials → React component ตรง mock
- ตรรกะพอร์ตเป็น src/lib/ui/*.ts (mount()) + runtime/PageRuntime
- CSS: base + pages/*.css import ต่อ route (คงลำดับ cascade ของ mock)
- asset/content: public/{image,resource/data,content,locales,vendor}
- แก้ path รูปไทล์พาร์ทเนอร์ (.image → /image) + fallback absolute
- ลบ UI เดิมที่ไม่ตรง mock (expanded/stops details/old components/globals.css)
- script/sync_data_to_postgres.mjs + sync_images_to_storage.mjs (dry-run/--apply, backup)
- docs/UI-PORT.md + DESIGN.md + README
This commit is contained in:
itmeadmin committed 2026-10-23 15:50:00 +07:00
1 parent 24187fc3b7
commit 138a3d15d8
300 files changed
+20213 -1978

No files matched your search

-115
View File
@@ -1,115 +0,0 @@
import Link from "next/link";
import Image from "next/image";
import { api, resolveFileUrl } from "@/lib/api";
const popularRoutes = [
{ id: "101", label: "สาย 101 · อ่างทอง-อยุธยา" },
{ id: "902", label: "สาย 902 · กรุงเทพ-อ่างทอง" },
{ id: "15", label: "สาย 15 · สายใน" },
{ id: "464", label: "สาย 464 · สุพรรณ-สระบุรี" },
];
const SPONSOR_LABELS: Record<string, string> = {
"7-11": "7-Eleven",
"shopee": "Shopee",
"lazada": "Lazada",
"airasia-move": "airasia MOVE",
"busonlineticket": "busonlineticket",
"trip": "Trip.com",
"truck2hand": "truck2hand",
"tcl999-angthong": "ทีซีแอล 999 อ่างทอง",
"bus-pingraow": "รถบัสปิ่นเกล้า",
};
function labelFor(entityId: string): string {
return SPONSOR_LABELS[entityId] ?? entityId;
}
export async function Footer() {
let sponsors: { entity_id: string; url_path: string }[] = [];
try {
const res = await api.images({ entity_type: "sponsor" });
sponsors = res.items.map((item) => ({
entity_id: item.entity_id,
url_path: item.url_path,
}));
} catch {
sponsors = [];
}
return (
<footer className="footer">
<div className="container">
<div className="footer__grid">
<div className="footer__brand">
<div className="footer__brand-row">
<Image src="/logo.svg" alt="AT Transit" width={48} height={48} />
<div>
<strong>AT Transit</strong>
<span>สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง</span>
</div>
</div>
<p>
ศูนย์รวมข้อมูลตารางเดินรถ จุดจอด และเส้นทางในจังหวัดอ่างทองและจังหวัดใกล้เคียง
อัปเดตข้อมูลล่าสุดจากผู้ประกอบการแต่ละสายโดยตรง
</p>
</div>
<div className="footer__col">
<h4>เมนู</h4>
<ul>
<li><Link href="/">หน้าแรก</Link></li>
<li><Link href="/stops">ค้นหาป้ายหยุดรถ</Link></li>
<li><Link href="/routes">รายละเอียดสายรถ</Link></li>
</ul>
</div>
<div className="footer__col">
<h4>สายยอดนิยม</h4>
<ul>
{popularRoutes.map((r) => (
<li key={r.id}>
<Link href={`/routes/${r.id}`}>{r.label}</Link>
</li>
))}
</ul>
</div>
<div className="footer__col footer__contact">
<h4>ติดต่อ</h4>
<div className="row"><a href="tel:+66649639025">📞 +66 64 963 9025</a></div>
<div className="row"><span>📍 ถนนเทศบาล 1 อ.เมือง อ่างทอง</span></div>
<div className="row"><span>🕒 บริการ 04:30 - 21:00 น.</span></div>
<div className="row"><a href="#">💬 LINE Official: @attransit</a></div>
</div>
</div>
<section className="footer__sponsors" aria-label="ผู้สนับสนุน">
<h4>ผู้สนับสนุน &amp; พาร์ทเนอร์</h4>
<p className="lead">จองตั๋ว · สั่งของ · เช็กของฝาก ที่ร้านค้าและบริการพันธมิตรของเรา</p>
<div className="sponsor-strip">
{sponsors.length > 0 ? (
sponsors.map((s) => (
<a
key={s.entity_id}
className="sponsor-tile"
href="#"
aria-label={labelFor(s.entity_id)}
title={labelFor(s.entity_id)}
>
<img src={resolveFileUrl(s.url_path)} alt={labelFor(s.entity_id)} loading="lazy" />
</a>
))
) : (
<span className="sponsor-tile sponsor-tile--empty">ยังไม่มีข้อมูลผู้สนับสนุน</span>
)}
</div>
</section>
<div className="footer__bottom">
<p>© {new Date().getFullYear()} AT Transit <span className="pill">mockup template</span></p>
</div>
</div>
</footer>
);
}
-45
View File
@@ -1,45 +0,0 @@
"use client";
import Link from "next/link";
import Image from "next/image";
import { usePathname } from "next/navigation";
const links = [
{ href: "/", label: "หน้าแรก" },
{ href: "/stops", label: "ป้ายหยุดรถ" },
{ href: "/routes", label: "รายละเอียดสายรถ" },
];
export function Header() {
const pathname = usePathname();
const isActive = (href: string) =>
href === "/" ? pathname === "/" : pathname.startsWith(href);
return (
<header className="topbar">
<div className="topbar__inner">
<Link href="/" className="brand">
<Image
src="/logo.svg"
alt="AT Transit"
width={44}
height={44}
className="brand__logo"
priority
/>
<div>
<p className="brand__title">AT Transit</p>
<p className="brand__subtitle">สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง</p>
</div>
</Link>
<nav className="nav" aria-label="เมนูหลัก">
{links.map((l) => (
<Link key={l.href} href={l.href} className={isActive(l.href) ? "active" : ""}>
{l.label}
</Link>
))}
</nav>
<Link href="/routes" className="cta-pill">เช็กเวลาเดินรถ</Link>
</div>
</header>
);
}
+95
View File
@@ -0,0 +1,95 @@
/* Ported from web-at-transit-mock/ui/partials/sprite.html — markup 1:1 with the mock. */
export default function IconSprite() {
return (
<>
<svg xmlns="http://www.w3.org/2000/svg" style={{display: 'none'}} aria-hidden="true">
<symbol id="ic-alarm-clock" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<circle cx={12} cy={13} r={8} />
<path d="M12 9v4l2 2" />
<path d="M5 3 2 6" />
<path d="m22 6-3-3" />
<path d="M6.38 18.7 4 21" />
<path d="M17.64 18.67 20 21" />
</symbol>
<symbol id="ic-x" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round"><path d="M18 6 6 18" /><path d="m6 6 12 12" /></symbol>
<symbol id="ic-arrow-right" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M5 12h14" />
<path d="m12 5 7 7-7 7" />
</symbol>
<symbol id="ic-bus" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M8 6v6" />
<path d="M15 6v6" />
<path d="M2 12h19.6" />
<path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3" />
<circle cx={7} cy={18} r={2} />
<path d="M9 18h5" />
<circle cx={16} cy={18} r={2} />
</symbol>
<symbol id="ic-bus-front" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M4 6 2 7" />
<path d="M10 6h4" />
<path d="m22 7-2-1" />
<rect width={16} height={16} x={4} y={3} rx={2} />
<path d="M4 11h16" />
<path d="M8 15h.01" />
<path d="M16 15h.01" />
<path d="M6 19v2" />
<path d="M18 21v-2" />
</symbol>
<symbol id="ic-check" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M20 6 9 17l-5-5" />
</symbol>
<symbol id="ic-clock" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<circle cx={12} cy={12} r={10} />
<path d="M12 6v6l4 2" />
</symbol>
<symbol id="ic-globe" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<circle cx={12} cy={12} r={10} />
<path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" />
<path d="M2 12h20" />
</symbol>
<symbol id="ic-hourglass" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M5 22h14" />
<path d="M5 2h14" />
<path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22" />
<path d="M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2" />
</symbol>
<symbol id="ic-map" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z" />
<path d="M15 5.764v15" />
<path d="M9 3.236v15" />
</symbol>
<symbol id="ic-map-pin" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" />
<circle cx={12} cy={10} r={3} />
</symbol>
<symbol id="ic-message-circle" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719" />
</symbol>
<symbol id="ic-phone" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384" />
</symbol>
<symbol id="ic-refresh-cw" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" />
<path d="M21 3v5h-5" />
<path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" />
<path d="M8 16H3v5" />
</symbol>
<symbol id="ic-search" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="m21 21-4.34-4.34" />
<circle cx={11} cy={11} r={8} />
</symbol>
<symbol id="ic-triangle-alert" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" />
<path d="M12 9v4" />
<path d="M12 17h.01" />
</symbol>
<symbol id="ic-share-2" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round"><circle cx={18} cy={5} r={3} /><circle cx={6} cy={12} r={3} /><circle cx={18} cy={19} r={3} /><line x1="8.59" y1="13.51" x2="15.42" y2="17.49" /><line x1="15.41" y1="6.51" x2="8.59" y2="10.49" /></symbol>
<symbol id="ic-link" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" /><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" /></symbol>
<symbol id="ic-facebook" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round"><path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z" /></symbol>
<symbol id="ic-copy" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round"><rect width={14} height={14} x={8} y={8} rx={2} ry={2} /><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" /></symbol>
</svg>
</>
);
}
-10
View File
@@ -1,10 +0,0 @@
"use client";
import dynamic from "next/dynamic";
import type { MapViewProps } from "@/components/MapView";
const ClientMapView = dynamic(() => import("@/components/MapView"), { ssr: false });
export default function LazyMapView(props: MapViewProps) {
return <ClientMapView {...props} />;
}
-102
View File
@@ -1,102 +0,0 @@
"use client";
import "leaflet/dist/leaflet.css";
import { MapContainer, TileLayer, Marker, Popup, Polyline, useMap } from "react-leaflet";
import L from "leaflet";
import { useEffect } from "react";
type LatLng = [number, number];
type Point = { id: number; lat: number; lng: number; label: string; code: string; sequence?: number };
// Fix default marker icon paths for webpack/Next
const icon = new L.Icon({
iconUrl: "https://unpkg.com/[email protected]/dist/images/marker-icon.png",
iconRetinaUrl: "https://unpkg.com/[email protected]/dist/images/marker-icon-2x.png",
shadowUrl: "https://unpkg.com/[email protected]/dist/images/marker-shadow.png",
iconSize: [25, 41],
iconAnchor: [12, 41],
});
function numberedIcon(n: number, tone: "start" | "mid" | "end") {
const colors: Record<string, string> = {
start: "linear-gradient(135deg,#34d399,#10b981)",
end: "linear-gradient(135deg,#fb7185,#e11d48)",
mid: "linear-gradient(135deg,#a78bfa,#7c3aed)",
};
const html =
'<div style="' +
'width:32px;height:32px;border-radius:50%;' +
'background:' + colors[tone] + ';' +
'color:#fff;font-weight:800;font-size:13px;font-family:system-ui;' +
'display:flex;align-items:center;justify-content:center;' +
'border:3px solid #fff;' +
'box-shadow:0 4px 10px rgba(31,28,68,.28), 0 0 0 1px rgba(124,58,237,.18);' +
'">' + String(n) + '</div>';
return L.divIcon({
html,
className: "route-marker",
iconSize: [32, 32],
iconAnchor: [16, 16],
popupAnchor: [0, -14],
});
}
function FitBounds({ positions }: { positions: LatLng[] }) {
const map = useMap();
useEffect(() => {
if (positions.length === 0) return;
if (positions.length === 1) {
map.setView(positions[0], 12);
return;
}
const bounds = L.latLngBounds(positions.map((p) => L.latLng(p[0], p[1])));
map.fitBounds(bounds, { padding: [36, 36] });
}, [map, positions]);
return null;
}
type Props = {
points: Point[];
path?: LatLng[];
};
export type MapViewProps = Props;
export default function MapView({ points, path }: Props) {
const fallback: LatLng[] = points.map((p) => [p.lat, p.lng]);
const positions: LatLng[] = path && path.length > 0 ? path : fallback;
const center: LatLng = positions.length > 0 ? positions[0] : [9.1, 99.3];
const isRoute = !!path && path.length > 0;
return (
<MapContainer center={center} zoom={9} style={{ height: "100%", width: "100%" }}>
<TileLayer
attribution='&copy; OpenStreetMap'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
{isRoute && path ? (
<Polyline
positions={path}
pathOptions={{ color: "#7c3aed", weight: 5, opacity: 0.85, lineCap: "round" }}
/>
) : null}
{points.map((p, idx) => {
let tone: "start" | "mid" | "end" = "mid";
if (isRoute) {
if (idx === 0) tone = "start";
else if (idx === points.length - 1) tone = "end";
}
const markerIcon = isRoute ? numberedIcon(p.sequence ?? idx + 1, tone) : icon;
const stopHref = p.code ? `/stops/${encodeURIComponent(p.code)}` : null;
return (
<Marker key={String(p.id) + "-" + String(idx)} position={[p.lat, p.lng]} icon={markerIcon}>
<Popup>
<strong>{p.label}</strong>
<br />
{stopHref ? <a href={stopHref}>รายละเอียด →</a> : <span>ไม่มีรหัสป้าย</span>}
</Popup>
</Marker>
);
})}
<FitBounds positions={positions} />
</MapContainer>
);
}
+48
View File
@@ -0,0 +1,48 @@
"use client";
import { useEffect } from "react";
import { mountPage } from "@/lib/runtime";
export type PageKey = "home" | "stops" | "route" | "stop" | "check" | "blog" | "about";
/**
* Static import map — keeps every ported module in the client bundle graph
* while letting server components pass only plain strings.
*/
const LOADERS: Record<PageKey, () => Promise<{ default: () => void }>> = {
home: () => import("@/lib/ui/home.init"),
stops: async () => {
await import("@/lib/ui/stops.nearme");
await import("@/lib/ui/stops.search");
return import("@/lib/ui/stops.init");
},
route: () => import("@/lib/ui/route.init"),
stop: () => import("@/lib/ui/stop.init"),
check: () => import("@/lib/ui/check.init"),
blog: () => import("@/lib/ui/blog.init"),
about: () => import("@/lib/ui/about.init"),
};
type Props = {
page: PageKey;
params?: Record<string, string>;
query?: Record<string, string>;
};
/**
* Mounts a ported mock page module after the shared runtime is ready.
* Rendered next to the view markup; the module hydrates it by id, exactly
* like the mock partials did.
*/
export default function PageRuntime({ page, params = {}, query = {} }: Props) {
const key = `${page}|${JSON.stringify(params)}|${JSON.stringify(query)}`;
useEffect(() => {
mountPage({ params, query }, LOADERS[page]).catch((error) => {
console.error("[mock-page] mount failed", page, error);
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [key]);
return null;
}
+40
View File
@@ -0,0 +1,40 @@
"use client";
import { useEffect } from "react";
import { usePathname } from "next/navigation";
import { ensureRuntime } from "@/lib/runtime";
/**
* App-wide mock runtime glue:
* - loads the shared window.* libraries once (i18n, map, schedules, ...)
* - re-applies translations after client navigation
* - a language switch reloads, mirroring the mock router's full re-render
*/
export default function SiteBoot() {
const pathname = usePathname();
useEffect(() => {
let cancelled = false;
(async () => {
await ensureRuntime();
if (cancelled) return;
const w = window as unknown as { I18N?: { apply?: () => void } };
w.I18N?.apply?.();
})();
return () => {
cancelled = true;
};
}, [pathname]);
useEffect(() => {
function onLangChange() {
// mock router re-rendered every partial on langchange; a reload gives the
// ported JS-built views the same clean slate.
window.location.reload();
}
window.addEventListener("langchange", onLangChange);
return () => window.removeEventListener("langchange", onLangChange);
}, []);
return null;
}
+139
View File
@@ -0,0 +1,139 @@
"use client";
import { useEffect } from "react";
import { ensureRuntime } from "@/lib/runtime";
const FALLBACK_POPULAR = [
{ id: "101", label: "สาย 101 · อ่างทอง-อยุธยา" },
{ id: "902", label: "สาย 902 · กรุงเทพ-อ่างทอง" },
{ id: "15", label: "สาย 15 · สายใน" },
{ id: "464", label: "สาย 464 · สุพรรณ-สระบุรี" },
];
export default function SiteFooter() {
// เดิม router.js เรียก mountPopular() ทุกครั้งที่ render — ที่นี่เรียกครั้งเดียวหลัง runtime พร้อม
useEffect(() => {
let cancelled = false;
(async () => {
await ensureRuntime();
const w = window as unknown as {
Popular?: { mount: (id: string, routes: unknown[]) => void };
};
if (cancelled || !w.Popular) return;
try {
const res = await fetch("/resource/data/routes.json", { cache: "no-store" });
const data = res.ok ? await res.json() : null;
const routes = (data && data.routes) || [];
if (routes.length && !cancelled) w.Popular.mount("footer-popular-list", routes);
} catch {
/* ไม่มีข้อมูล → คง li fallback ใน HTML */
}
})();
return () => {
cancelled = true;
};
}, []);
return (
<footer className="mu-site-footer">
<div className="mu-container">
<div className="mu-footer-grid">
<div className="mu-footer-brand">
<div className="mu-footer-brand-row">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src="/image/icons/minibus-512x512.png" alt="Atroute" />
<div>
<strong>Atroute</strong>
<span data-i18n="brand.subtitle">สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง</span>
</div>
</div>
<p className="about" data-i18n="footer.about">
ศูนย์รวมข้อมูลตารางเดินรถ จุดจอด และเส้นทางในจังหวัดอ่างทองและจังหวัดใกล้เคียง
อัปเดตข้อมูลล่าสุดจากผู้ประกอบการแต่ละสายโดยตรง
</p>
</div>
<div className="mu-footer-col">
<h4 data-i18n="footer.menu">เมนู</h4>
<ul>
<li>
<a href="/" data-i18n="nav.home">
หน้าแรก
</a>
</li>
<li>
<a href="/stops" data-i18n="nav.stops">
ค้นหาป้ายหยุดรถ
</a>
</li>
<li>
<a href="/routes" data-i18n="nav.routes">
รายละเอียดสายรถ
</a>
</li>
<li>
<a href="/about" data-i18n="nav.about">
เกี่ยวกับเรา
</a>
</li>
<li>
<a href="/blog" data-i18n="nav.blog">
บ่นไปเรื่อย
</a>
</li>
<li>
<a href="/credits" data-i18n="nav.credits">
เครดิต
</a>
</li>
</ul>
</div>
<div className="mu-footer-col">
<h4 data-i18n="footer.popular">สายที่เปิดดูบ่อย</h4>
{/* เติมด้วย Popular.mount() — li ข้างในเป็น fallback เมื่อ JS ปิด */}
<ul id="footer-popular-list" data-i18n-skip>
{FALLBACK_POPULAR.map((item) => (
<li key={item.id}>
<a href={`/routes/${item.id}`}>{item.label}</a>
</li>
))}
</ul>
</div>
<div className="mu-footer-col mu-footer-contact">
<h4 data-i18n="footer.contact">ติดต่อ</h4>
<div className="row">
<a href="mailto:[email protected]">
<svg className="ic" aria-hidden="true">
<use href="#ic-mail" />
</svg>{" "}
atroute@hobbygirds.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>
</div>
</div>
</footer>
);
}
+122
View File
@@ -0,0 +1,122 @@
"use client";
import { useEffect, useRef } from "react";
import { usePathname } from "next/navigation";
const NAV = [
{ href: "/", key: "nav.home", label: "หน้าแรก" },
{ href: "/stops", key: "nav.stops", label: "ป้ายหยุดรถ" },
{ href: "/routes", key: "nav.routes", label: "รายละเอียดสายรถ" },
{ href: "/about", key: "nav.about", label: "เกี่ยวกับเรา" },
{ href: "/blog", key: "nav.blog", label: "บ่นไปเรื่อย" },
{ href: "/credits", key: "nav.credits", label: "เครดิต" },
];
function isActive(pathname: string, href: string): boolean {
if (href === "/") return pathname === "/";
return pathname === href || pathname.startsWith(`${href}/`);
}
export default function SiteHeader() {
const pathname = usePathname() || "/";
const menuRef = useRef<HTMLDetailsElement>(null);
// ปิดเมนู hamburger เมื่อเปลี่ยนหน้า หรือคลิกนอกเมนู (เดิมอยู่ใน index.html)
useEffect(() => {
if (menuRef.current) menuRef.current.removeAttribute("open");
function onDocClick(event: MouseEvent) {
const menu = menuRef.current;
if (!menu) return;
const target = event.target as HTMLElement;
if (target.closest(".mu-menu-panel a")) {
menu.removeAttribute("open");
return;
}
if (!target.closest(".mu-menu")) menu.removeAttribute("open");
}
document.addEventListener("click", onDocClick);
return () => document.removeEventListener("click", onDocClick);
}, [pathname]);
return (
<header className="mu-topbar">
<div className="mu-container mu-topbar-inner">
<a className="mu-brand" href="/" aria-label="Atroute — หน้าแรก">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
className="mu-logo-img"
src="/image/icons/minibus-512x512.png"
alt="Atroute logo"
width={44}
height={44}
decoding="async"
/>
<span>
<span className="mu-brand-title">Atroute</span>
<span className="mu-brand-subtitle" data-i18n="brand.subtitle">
สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง
</span>
</span>
</a>
<nav className="mu-nav" aria-label="เมนูหลัก">
{NAV.map((item) => (
<a
key={item.href}
className={isActive(pathname, item.href) ? "active" : undefined}
href={item.href}
data-i18n={item.key}
>
{item.label}
</a>
))}
</nav>
<details className="mu-menu" id="topnav" ref={menuRef}>
<summary className="mu-menu-btn" aria-label="เมนูหลัก" aria-haspopup="true">
<svg
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={2}
strokeLinecap="round"
aria-hidden="true"
>
<line x1="4" x2="20" y1="6" y2="6" />
<line x1="4" x2="20" y1="12" y2="12" />
<line x1="4" x2="20" y1="18" y2="18" />
</svg>
</summary>
<div className="mu-menu-panel" role="menu">
{NAV.slice(0, 3).map((item) => (
<a key={item.href} href={item.href} data-i18n={item.key} role="menuitem">
{item.label}
</a>
))}
<a href="/check" data-i18n="cta.check" role="menuitem">
เช็กเวลาเดินรถ
</a>
{NAV.slice(3).map((item) => (
<a key={item.href} href={item.href} data-i18n={item.key} role="menuitem">
{item.label}
</a>
))}
</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>
</div>
<a className="mu-action-btn" href="/check" data-i18n="cta.check">
เช็กเวลาเดินรถ
</a>
</div>
</header>
);
}
@@ -0,0 +1,30 @@
/* Ported from web-at-transit-mock/ui/partials/about.html — markup 1:1 with the mock. */
import "@/styles/pages/about.css";
export default function AboutView() {
return (
<>
{/* ============ HERO (ภาษาเดียวกับหน้าแรก) ============ */}
<section className="mu-hero">
<img className="mu-hero-map" src="/image/network/overview-map.png" alt="" aria-hidden="true" decoding="async" />
<div className="mu-blob one" />
<div className="mu-blob two" />
<div className="mu-blob three" />
<div className="mu-container mu-hero-content">
<span className="mu-badge"><svg className="ic" aria-hidden="true"><use href="#ic-map-pin" /></svg> <span data-i18n="nav.about">เกี่ยวกับเรา</span></span>
<h1><span data-i18n="about.title">เกี่ยวกับเรา</span><br /><span className="mu-gradient-text" data-i18n="about.brand">เมื่อไหร่รถจะมา</span></h1>
<p className="mu-hero-lead" data-i18n="about.lead">เรื่องราวและที่มาของเว็บนี้ — อ่านเรียงตามบล็อกด้านล่างได้เลย</p>
</div>
</section>
{/* ============ เนื้อหา (โหลดจาก about-data: text1.json + pic1, text2.json + pic2 ...) ============ */}
<section className="mu-about-wrap">
<div className="mu-container">
<div id="about-blocks" aria-live="polite">
<div className="mu-about-skeleton"><div className="mu-about-skel-card" /></div>
</div>
</div>
</section>
</>
);
}
@@ -0,0 +1,43 @@
/* Ported from web-at-transit-mock/ui/partials/blog.html — markup 1:1 with the mock. */
import "@/styles/pages/blog.css";
export default function BlogView() {
return (
<>
{/* ============ HERO ============ */}
<section className="mu-hero">
<img className="mu-hero-map" src="/image/network/overview-map.png" alt="" aria-hidden="true" decoding="async" />
<div className="mu-blob one" />
<div className="mu-blob two" />
<div className="mu-blob three" />
<div className="mu-container mu-hero-content">
<span className="mu-badge"><svg className="ic" aria-hidden="true"><use href="#ic-message-circle" /></svg> <span data-i18n="nav.blog">บ่นไปเรื่อย</span></span>
<h1><span data-i18n="blog.title">บ่นไปเรื่อย</span><br /><span className="mu-gradient-text" data-i18n="blog.subtitle">หน้านี้ก็เหมือนไดอารี่ของเรา อยากบ่นอะไรก็บ่น</span></h1>
<p className="mu-hero-lead" data-i18n="blog.lead">ขอบคุณที่เข้ามาอ่านบางบทความก็มีสาระบางบทความก็ไม่มีสาระ </p>
</div>
</section>
{/* ============ รายการบทความ (โหลดจาก blog-data: text1.json + pic1, ...) ============ */}
<section className="mu-blog-wrap">
<div className="mu-container">
<div className="mu-blog-bar" id="blog-bar" hidden>
<p className="mu-blog-count" id="blog-count" />
<div className="mu-view-switch" role="group" aria-label="มุมมอง">
<button type="button" className="mu-view-btn" data-view="grid">
<svg className="ic" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><rect width={7} height={7} x={3} y={3} rx={1} /><rect width={7} height={7} x={14} y={3} rx={1} /><rect width={7} height={7} x={14} y={14} rx={1} /><rect width={7} height={7} x={3} y={14} rx={1} /></svg>
<span data-i18n="blog.viewGrid">ตาราง</span>
</button>
<button type="button" className="mu-view-btn" data-view="list">
<svg className="ic" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><line x1={8} x2={21} y1={6} y2={6} /><line x1={8} x2={21} y1={12} y2={12} /><line x1={8} x2={21} y1={18} y2={18} /><line x1={3} x2="3.01" y1={6} y2={6} /><line x1={3} x2="3.01" y1={12} y2={12} /><line x1={3} x2="3.01" y1={18} y2={18} /></svg>
<span data-i18n="blog.viewList">รายการ</span>
</button>
</div>
</div>
<div id="blog-list" aria-live="polite">
<div className="mu-blog-skel" />
</div>
</div>
</section>
</>
);
}
@@ -0,0 +1,61 @@
/* Ported from web-at-transit-mock/ui/partials/checkSchedule.html — markup 1:1 with the mock. */
import "@/styles/pages/check.css";
export default function CheckView() {
return (
<>
{/* ============ HERO (ภาษาเดียวกับหน้าแรก) ============ */}
<section className="mu-hero">
<img className="mu-hero-map" src="/image/network/overview-map.png" alt="" aria-hidden="true" fetchPriority="high" decoding="async" />
<div className="mu-blob one" />
<div className="mu-blob two" />
<div className="mu-blob three" />
<div className="mu-container mu-hero-content">
<span className="mu-badge"><svg className="ic" aria-hidden="true"><use href="#ic-clock" /></svg> <span data-i18n="cta.check">เช็กเวลาเดินรถ</span></span>
<h1><span data-i18n="check.title">ตารางเวลาเดินรถ</span><br /><span className="mu-gradient-text" id="check-hero-route" /></h1>
<p className="mu-hero-lead" data-i18n="check.lead">เลือกสายรถ แล้วดูรอบรถทุกจุดจอดในหน้าเดียว</p>
<div className="mu-route-selector single">
<div className="mu-select-field">
<label htmlFor="check-route-select">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M8 6v6" /><path d="M15 6v6" /><path d="M2 12h19.6" /><path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3" /><circle cx={7} cy={18} r={2} /><path d="M9 18h5" /><circle cx={16} cy={18} r={2} /></svg>
<span data-i18n="route.selectRoute">เลือกสายรถ</span>
</label>
<div className="mu-select-box">
<svg className="mu-select-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M8 6v6" /><path d="M15 6v6" /><path d="M2 12h19.6" /><path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3" /><circle cx={7} cy={18} r={2} /><path d="M9 18h5" /><circle cx={16} cy={18} r={2} /></svg>
<select id="check-route-select" data-i18n-attr="aria-label:route.selectRoute" />
<svg className="mu-select-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6" /></svg>
</div>
</div>
</div>
</div>
</section>
{/* ============ สรุปเส้นทาง (สถิติแบบ index) ============ */}
<section className="mu-summary" aria-label="สรุปเส้นทาง">
<div className="mu-container">
<div className="mu-summary-grid">
<div className="mu-stat tag-purple"><h3 id="check-stat-stops">–</h3><p data-i18n="check.kpiStops">จุดจอดหลัก</p></div>
<div className="mu-stat tag-sky"><h3 id="check-stat-provinces">–</h3><p data-i18n="check.kpiProvince">จังหวัดที่ผ่าน</p></div>
<div className="mu-stat tag-mint"><h3 id="check-stat-trips">–</h3><p data-i18n="check.kpiTrips">รอบต่อวัน</p></div>
<div className="mu-stat tag-pink"><h3 id="check-stat-next">–</h3><p data-i18n="check.kpiNext">รอบถัดไป</p></div>
</div>
</div>
</section>
{/* ============ ตารางเวลาเดินรถ ============ */}
<section className="mu-schedule" aria-label="ตารางเวลาเดินรถ">
<div className="mu-container">
<div className="mu-zone">
<div className="mu-zone-head">
<span className="mu-zone-tag tag-purple" data-i18n="check.scheduleAll">ตารางเวลาเดินรถทุกจุดจอด</span>
<p className="mu-zone-desc mu-zone-meta" id="check-zone-desc" />
<p className="mu-zone-desc mu-zone-meta mu-zone-now" id="check-now-line" />
<p className="mu-zone-desc mu-zone-updated" id="check-updated-line" />
</div>
{/* การ์ดจุดจอด + ชิปเวลา: สร้างจาก resource/data/schedules.json (checkSchedule.init.js) */}
<ul className="mu-schedule-list" id="check-schedule-list" />
</div>
</div>
</section>
</>
);
}
@@ -0,0 +1,62 @@
/* Ported from web-at-transit-mock/ui/partials/credits.html — markup 1:1 with the mock. */
import "@/styles/pages/credits.css";
export default function CreditsView() {
return (
<>
<main className="mu-page">
<div className="mu-credit-wrap">
<div className="mu-credit-hero">
<p className="mu-breadcrumb"><a href="/">หน้าแรก</a>/ เครดิต</p>
<h1><span data-i18n="credits.title">เครดิตและแหล่งที่มา</span></h1>
<p>รายการทรัพยากรทั้งหมดที่ใช้ในเว็บนี้ พร้อมใบอนุญาต (license) ตามข้อกำหนดของเจ้าของแต่ละราย</p>
</div>
<section className="mu-credit-section">
<h2><span data-i18n="credits.icons">ไอคอน — Lucide</span></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 รายการ เก็บที่ <code>/image/icons/lucide/</code></li>
<li>alarm-clock, arrow-right, bus, bus-front, check, clock, globe, hourglass, map, map-pin, message-circle, phone, refresh-cw, search, triangle-alert</li>
<li>วิธีใช้งาน: sprite <code>src/components/IconSprite.tsx</code> + <code>&lt;svg class="ic"&gt;&lt;use href="#ic-ชื่อ"&gt;</code></li>
</ul>
<div className="mu-license">
<strong>MIT License (สรุป):</strong> อนุญาตให้ใช้ คัดลอก แก้ไข ผสาน เผยแพร่ แจกจ่าย ขาย และ/หรือให้สิทธิ์ใช้งานซอฟต์แวร์นี้ โดยมีเงื่อนไขให้ข้อความแสดงลิขสิทธิ์และข้อความอนุญาตข้างต้นปรากฏอยู่ในสำเนาทั้งหมดหรือส่วนสำคัญของซอฟต์แวร์ ซอฟต์แวร์นี้ให้บริการ "ตามสภาพ" โดยไม่มีการรับประกันใด ๆ
</div>
</section>
<section className="mu-credit-section">
<h2><span data-i18n="credits.fonts">ฟอนต์ — Google Fonts</span></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> — ฟอนต์หลักของเว็บ (เนื้อหา + หัวเรื่อง) · มีหัวแบบไทย น้ำหนัก 300–800</li>
<li><strong>Noto Sans Thai</strong> — ตัวสำรองเนื้อหา (โหลดผ่าน Google Fonts CDN)</li>
<li><strong>Prompt</strong> — ตัวสำรองหัวเรื่อง/ตัวหนา</li>
<li><strong>IBM Plex Mono</strong> — เวลา · เลขสาย · ตัวเลข (เรียงตรงกัน)</li>
</ul>
</section>
<section className="mu-credit-section">
<h2><span data-i18n="credits.map">แผนที่</span></h2>
<p className="src">ใบอนุญาต: Leaflet <a href="https://github.com/Leaflet/Leaflet/blob/main/LICENSE" rel="noopener">BSD-2-Clause</a> · ชุดแผนที่ (tiles): <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 ของทีม (<code>GeoJSON</code>) ทับบนแผนที่</li>
</ul>
</section>
<section className="mu-credit-section">
<h2><span data-i18n="credits.photos">ขอขอบคุณภาพรถประจำทาง</span></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> กรุงเทพ-สรรคบุรี-ชัยนาท — จาก <a href="https://web.facebook.com/groups/431811197419587/posts/2006978336569524/" rel="noopener">กลุ่ม Facebook (web.facebook.com)</a></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/realist/blog/%E0%B8%A3%E0%B8%96%E0%B9%84%E0%B8%9F%E0%B8%9F%E0%B9%89%E0%B8%B2%E0%B8%AA%E0%B8%B2%E0%B8%A2%E0%B8%AA%E0%B8%B5%E0%B9%81%E0%B8%94%E0%B8%87/" rel="noopener">thelist.group</a></li>
</ul>
<p className="mu-license">
<span data-i18n="credits.photosNote">และสายอื่น ๆ ที่ไม่ได้ระบุ ขอขอบคุณมา ณ ที่นี้</span>
</p>
</section>
</div>
</main>
</>
);
}
@@ -0,0 +1,91 @@
/* Ported from web-at-transit-mock/ui/partials/home.html — markup 1:1 with the mock. */
import "@/styles/pages/home.css";
export default function HomeView() {
return (
<>
<section className="mu-hero">
<img className="mu-hero-map" src="/image/network/overview-map.png" alt="" aria-hidden="true" fetchPriority="high" decoding="async" />
<div className="mu-blob one" />
<div className="mu-blob two" />
<div className="mu-blob three" />
<div className="mu-container mu-hero-content">
<span className="mu-badge" data-i18n="home.welcome">ยินดีต้อนรับ</span>
<h1><span data-i18n="home.title1">สถานีขนส่งผู้โดยสารภายใน</span><br /><span className="mu-gradient-text" id="hero-province">จังหวัดอ่างทอง</span></h1>
<div className="mu-route-selector">
<div className="mu-select-field">
<label htmlFor="province-select">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" /><circle cx={12} cy={10} r={3} /></svg>
<span data-i18n="home.chooseProvince">เลือกจังหวัด</span>
</label>
<div className="mu-select-box">
<svg className="mu-select-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" /><circle cx={12} cy={10} r={3} /></svg>
<select id="province-select" data-i18n-attr="aria-label:home.chooseProvince" />
<svg className="mu-select-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6" /></svg>
</div>
</div>
<span className="mu-select-arrow" aria-hidden="true"><svg className="ic"><use href="#ic-arrow-right" /></svg></span>
<div className="mu-select-field">
<label htmlFor="station-select">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M8 6v6" /><path d="M15 6v6" /><path d="M2 12h19.6" /><path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3" /><circle cx={7} cy={18} r={2} /><path d="M9 18h5" /><circle cx={16} cy={18} r={2} /></svg>
<span data-i18n="home.chooseStation">สถานีขนส่งผู้โดยสาร</span>
</label>
<div className="mu-select-box">
<svg className="mu-select-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M8 6v6" /><path d="M15 6v6" /><path d="M2 12h19.6" /><path d="M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3" /><circle cx={7} cy={18} r={2} /><path d="M9 18h5" /><circle cx={16} cy={18} r={2} /></svg>
<select id="station-select" data-i18n-attr="aria-label:home.chooseStation" />
<svg className="mu-select-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6" /></svg>
</div>
</div>
</div>
<p className="mu-select-hint" id="station-hint" aria-live="polite" />
</div>
</section>
<section className="mu-sponsor-marquee" aria-label="ผู้สนับสนุนและพาร์ทเนอร์">
<div className="mu-sponsor-head">
<h4 data-i18n="footer.sponsors">ผู้สนับสนุน &amp; พาร์ทเนอร์</h4>
<p className="lead" data-i18n="footer.sponsorsLead">ร่วมเป็นผู้สนับสนุนเราได้ เมื่อซื้อของออนไลน์ หรือซื้อตั๋วรถทัวร์ เครื่องบิน ออนไลน์กดเลือกสินค้า หรือบริการผ่านลิงค์นายหน้าของเราไม่มีค่าใช้จ่ายเพิ่ม</p>
</div>
<div className="mu-marquee">
<div className="mu-marquee-track">
<a className="mu-marquee-tile" href="#" aria-label="7-Eleven"><img src="/image/partners/7-11.png" alt="7-Eleven" decoding="async" /></a>
<a className="mu-marquee-tile" href="#" aria-label="Shopee"><img src="/image/partners/shopee.png" alt="Shopee" decoding="async" /></a>
<a className="mu-marquee-tile" href="#" aria-label="Lazada"><img src="/image/partners/lazada.png" alt="Lazada" decoding="async" /></a>
<a className="mu-marquee-tile" href="#" aria-label="airasia MOVE"><img src="/image/partners/airasia-move.png" alt="airasia MOVE" decoding="async" /></a>
<a className="mu-marquee-tile" href="#" aria-label="busonlineticket"><img src="/image/partners/busonlineticket.png" alt="busonlineticket" decoding="async" /></a>
<a className="mu-marquee-tile" href="#" aria-label="Trip.com"><img src="/image/partners/trip.jpg" alt="Trip.com" decoding="async" /></a>
<a className="mu-marquee-tile" href="#" aria-label="truck2hand"><img src="/image/partners/truck2hand.png" alt="truck2hand" decoding="async" /></a>
<a className="mu-marquee-tile" href="#" aria-label="ทีซีแอล 999 อ่างทอง"><img src="/image/partners/tcl999-angthong.jpg" alt="ทีซีแอล 999 อ่างทอง" decoding="async" /></a>
</div>
</div>
</section>
<main className="mu-main">
<div className="mu-container">
{/* คำอธิบายสีการ์ดตามหมวดเส้นทาง */}
<section className="mu-legend" aria-label="คำอธิบายสีการ์ดตามหมวดเส้นทาง">
<h2 className="mu-legend-title" data-i18n="legend.title">คำอธิบายสีการ์ดตามหมวดเส้นทาง</h2>
<ul className="mu-legend-list">
<li><span className="sw sw-bangkok" aria-hidden="true" /><span data-i18n="legend.bangkok">หมวดเส้นทางเข้ากรุงเทพฯ — การ์ดสีน้ำเงิน</span></li>
<li><span className="sw sw-interprov" aria-hidden="true" /><span data-i18n="legend.interprov">หมวดเส้นทางระหว่างจังหวัด — การ์ดสีม่วง</span></li>
<li><span className="sw sw-inprov" aria-hidden="true" /><span data-i18n="legend.inprov">หมวดเส้นทางภายในจังหวัด — การ์ดสีชมพู</span></li>
<li><span className="sw sw-municipal" aria-hidden="true" /><span data-i18n="legend.municipal">หมวดเส้นทางภายในเทศบาล — การ์ดสีเหลืองอ่อน</span></li>
<li><span className="sw sw-empty" aria-hidden="true" /><span data-i18n="legend.empty">ยังไม่มีข้อมูล — การ์ดสีเทา แสดง N/A แทนเลขสาย</span></li>
</ul>
<p className="mu-legend-note" data-i18n="legend.note">อ่างทองยังไม่มีรถหมวด 1 (เส้นทางภายในเทศบาล) จึงแสดงการ์ดสีเทาและใช้ N/A แทนตัวเลขสายเส้นทาง</p>
</section>
{/* หมวดเส้นทางทั้งหมด: สร้างจาก 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>
</button>
<p className="mu-share-status" id="share-status" aria-live="polite" />
</div>
</div>
</main>
</>
);
}
@@ -0,0 +1,56 @@
/* Ported from web-at-transit-mock/ui/partials/busDetail.html — markup 1:1 with the mock. */
import "@/styles/pages/route.css";
export default function RouteView() {
return (
<>
<main className="mu-page">
<div className="mu-container">
<p className="mu-breadcrumb"><a href="/">หน้าแรก</a>/ <span data-i18n="nav.routes">รายละเอียดสายรถ</span></p>
<h1 className="mu-page-title"><span className="mu-route-chip" id="route-chip" /> <span id="route-title" /></h1>
{/* ตัวเลือกสายรถ: เติมจาก resource/data/routes.json (busDetail.init.js) */}
<form className="mu-toolbar" data-prevent-submit="1">
<select aria-label="เลือกสายรถ" id="route-select" />
</form>
{/* ============ รถประจำสาย + ติดต่อผู้ประกอบการ (การ์ดเดียว) ============ */}
{/* รูปรถ/คำอธิบาย/QR/เบอร์โทร: เติมจาก resource/data/captions/caption<รหัสสาย>.json + routes.json */}
<section className="mu-vehicle-card" aria-label="รถประจำสายและติดต่อผู้ประกอบการ" id="route-vehicle-card">
<img id="route-vehicle-img" alt="" loading="lazy" decoding="async" hidden />
<div className="meta">
<p className="label" data-i18n="route.vehicle">รถประจำสาย</p>
<h2 id="route-vehicle-title" hidden />
<p id="route-vehicle-desc" hidden />
</div>
<div className="mu-vehicle-contact" id="route-contact" />
</section>
{/* ============ สรุปเส้นทาง ============ */}
<section className="mu-summary" aria-label="สรุปเส้นทาง">
<div className="mu-container">
<div className="mu-summary-grid">
<div className="mu-stat tag-purple"><h3 id="stat-stops">–</h3><p>จุดจอดหลัก</p></div>
<div className="mu-stat tag-sky"><h3 id="stat-provinces">–</h3><p>จังหวัดที่ผ่าน</p></div>
<div className="mu-stat tag-mint"><h3 id="stat-trips">–</h3><p>รอบต่อวัน</p></div>
<div className="mu-stat tag-pink"><h3 id="stat-next">–</h3><p>รอบถัดไป</p></div>
</div>
</div>
</section>
{/* ============ แผนที่เส้นทาง (Leaflet + GeoJSON จาก QGIS) ============ */}
<section className="mu-zone" aria-label="แผนที่เส้นทาง">
<div className="mu-zone-head">
<span className="mu-zone-tag tag-sky" data-i18n="route.mapTitle">เส้นทางเดินรถ</span>
<p className="mu-zone-desc" data-i18n="route.mapDesc">เส้นทางจริงจากข้อมูล GIS · ป้ายหยุดรถตามเส้นทาง</p>
</div>
<div className="mu-map-card">
<div className="at-map" id="route-map" role="region" aria-label="แผนที่เส้นทางเดินรถ" />
<p className="at-map-caption" id="route-map-caption" />
<div className="at-km-wrap" hidden>
<h3><span data-i18n="map.alongRoute">จุดจอดตามเส้นทาง (กม. จากต้นทาง)</span></h3>
<ul id="route-map-list" />
</div>
</div>
</section>
</div>
</main>
</>
);
}
@@ -0,0 +1,55 @@
/* Ported from web-at-transit-mock/ui/partials/stopDetail.html — markup 1:1 with the mock. */
import "@/styles/pages/stop.css";
export default function StopView() {
return (
<>
<main className="mu-page">
<div className="mu-container">
<p className="mu-breadcrumb" id="stop-breadcrumb" />
<section className="mu-stop-hero">
<div>
<h1 className="mu-stop-hero-title"><svg className="ic" aria-hidden="true"><use href="#ic-map-pin" /></svg> <span id="stop-title" /></h1>
<p className="mu-stop-hero-sub" id="stop-sub" />
<div className="mu-meta-row" id="stop-meta" />
<div className="mu-hero-metric-grid" id="stop-metrics" />
</div>
<div>
<img className="mu-stop-hero-photo" id="stop-photo" alt="" fetchPriority="high" decoding="async" hidden />
<div className="mu-live-clock-card" id="mu-live-clock-card">
<div>
<p className="mu-live-clock-title" data-i18n="stop.nowAtStop">เวลาปัจจุบัน ณ ป้ายนี้</p>
<p className="mu-live-clock-time" id="mu-current-time">--:--</p>
</div>
<p className="mu-live-clock-note"><span className="mu-live-dot" /><span data-i18n="stop.autoNext">กำลังคำนวณเที่ยวถัดไปอัตโนมัติ</span></p>
</div>
</div>
</section>
<section className="mu-nearby" id="stop-nearby" aria-label="สถานที่ใกล้เคียง" hidden>
<h2><span data-i18n="stop.nearby">ใกล้เคียงป้าย</span></h2>
<p className="sub" id="stop-nearby-sub" />
<div className="mu-nearby-grid" id="stop-nearby-grid" />
</section>
<div className="mu-toolbar" id="stop-toolbar" />
<section className="mu-info-grid" id="stop-info" aria-label="stop highlights" />
<section className="mu-layout-grid">
<div className="mu-card-panel">
<h2><span data-i18n="stop.routes">สายรถที่ผ่านจุดนี้</span></h2>
<div className="mu-route-tools">
<input id="mu-route-filter" className="mu-route-filter" type="text" placeholder="ค้นหาสายรถหรือปลายทาง" data-i18n-attr="placeholder:stop.searchRoute,aria-label:stop.searchRoute" />
<span className="mu-route-count" id="mu-route-count" />
</div>
<ul className="mu-list mu-stop-list" id="stop-routes" />
</div>
<aside className="mu-card-panel">
<h2><span data-i18n="stop.mapInfo">แผนที่และข้อมูลป้าย</span></h2>
<div className="at-map" id="stop-map" role="region" aria-label="แผนที่เส้นทางที่ผ่านป้ายนี้" />
<p className="at-map-caption" id="stop-map-caption" />
<div id="stop-chips" style={{display: 'flex', flexWrap: 'wrap', gap: 8, marginTop: 14}} />
</aside>
</section>
</div>
</main>
</>
);
}
@@ -0,0 +1,90 @@
/* Ported from web-at-transit-mock/ui/partials/busStop.html — markup 1:1 with the mock. */
import "@/styles/pages/stops.css";
export default function StopsView() {
return (
<>
<main className="mu-page">
<div className="mu-container">
<p className="mu-breadcrumb"><a href="/" data-i18n="nav.home">หน้าแรก</a>/ <span data-i18n="nav.stops">ป้ายหยุดรถ</span></p>
<section className="mu-hero-panel">
<div>
<h1 className="mu-hero-title"><span data-i18n="stops.title">ค้นหาป้ายหยุดรถแบบรวดเร็ว</span></h1>
<p className="mu-hero-subtitle"><span data-i18n="stops.subtitle">ค้นหาด้วยรหัสหลักกิโลเมตรของป้าย หรือค้นหาด้วยชื่อสถานที่สำคัญ</span></p>
<div className="mu-kpi-grid" id="stops-kpi" aria-label="summary metrics" />
</div>
<div className="mu-hero-map">
<p className="mu-hero-map-title"><span data-i18n="stops.mapTitle">แผนที่ย่อของเครือข่ายป้าย</span></p>
<div className="mu-hero-map-box">
<img className="mu-hero-map-photo" src="/image/network/overview-map.png" alt="แผนที่เครือข่ายป้าย Atroute" loading="lazy" decoding="async" />
</div>
</div>
</section>
<form className="mu-toolbar" id="stops-form" data-prevent-submit="1">
{/* โหมดค้นหา: เลือกอย่างใดอย่างหนึ่ง (ห้ามชนกัน) */}
<div className="mu-search-tabs" role="tablist" aria-label="รูปแบบการค้นหา">
<button type="button" className="mu-search-tab" data-mode="code" role="tab" aria-selected="true">
<svg className="ic" aria-hidden="true"><use href="#ic-map-pin" /></svg>
<span data-i18n="stops.modeCode">ค้นหาด้วยรหัสป้าย</span>
</button>
<button type="button" className="mu-search-tab" data-mode="place" role="tab" aria-selected="false">
<svg className="ic" aria-hidden="true"><use href="#ic-landmark" /></svg>
<span data-i18n="stops.modePlace">ค้นหาด้วยชื่อสถานที่</span>
</button>
</div>
{/* โหมด 1: รหัสป้าย (5 ช่อง: 2 หน้า + 3 หลัง) */}
<div className="mu-search-mode" id="stops-code-wrap">
<div className="mu-code-boxes" id="stops-code-boxes" role="group" data-i18n-attr="aria-label:stops.codePh" aria-label="รหัสป้าย">
<input className="mu-code-cell" type="text" inputMode="numeric" maxLength={1} autoComplete="off" aria-label="หลักที่ 1" placeholder="0" />
<input className="mu-code-cell" type="text" inputMode="numeric" maxLength={1} autoComplete="off" aria-label="หลักที่ 2" placeholder="0" />
<span className="mu-code-plus" aria-hidden="true">+</span>
<input className="mu-code-cell" type="text" inputMode="numeric" maxLength={1} autoComplete="off" aria-label="หลักที่ 3" placeholder="0" />
<input className="mu-code-cell" type="text" inputMode="numeric" maxLength={1} autoComplete="off" aria-label="หลักที่ 4" placeholder="0" />
<input className="mu-code-cell" type="text" inputMode="numeric" maxLength={1} autoComplete="off" aria-label="หลักที่ 5" placeholder="0" />
</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>
<div className="mu-search-field">
<svg className="ic" aria-hidden="true"><use href="#ic-search" /></svg>
<input type="search" id="stops-place-input" autoComplete="off" placeholder="โรงพยาบาลอ่างทอง" data-i18n-attr="placeholder:stops.placePh,aria-label:stops.placePh" />
</div>
<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">
<svg className="ic" aria-hidden="true"><use href="#ic-map-pin" /></svg>
<span data-i18n="map.useMyLocation">ป้ายใกล้ฉัน</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>
</div>
</div>
</main>
</>
);
}