- merge two routes into one page: detail opens as overlay on top of the list (list stays mounted, scroll preserved, no page refresh) - URL stays shareable via ?cinema=<slug> (pushState), browser back closes it - /cinema/:slug kept as client-side redirect for old links - mobile 6in: full-screen sheet, 44px touch targets, sticky bottom CTA, horizontal list cards, safe-area insets - tablet: 2-col grid, centered sheet (707x922), 4-col facilities - desktop: 3-col grid, sheet capped at 960px - extract Cinemalist-agnostic data layer (lib/cinemas.ts) + TH/EN i18n context - allow pinch-zoom (drop maximum-scale/user-scalable=no), html lang=th
22 lines
749 B
TypeScript
22 lines
749 B
TypeScript
import { Navigate, useParams } from "react-router";
|
|
|
|
/**
|
|
* เส้นทางเดิม /cinema/:slug → หน้าเดียว /?cinema=<slug>
|
|
* ------------------------------------------------------------
|
|
* ★ ใช้ <Navigate> (client-side) → ไม่รีเฟรชหน้า ไม่โหลดใหม่
|
|
* ★ เก็บไว้เพื่อให้ลิงก์เก่า/ลิงก์ที่แชร์ไว้แล้วยังใช้ได้
|
|
*/
|
|
export default function CinemaRedirect() {
|
|
const { slug } = useParams();
|
|
|
|
return (
|
|
<Navigate
|
|
to={{
|
|
pathname: "/",
|
|
search: slug ? `?cinema=${encodeURIComponent(slug)}` : "",
|
|
}}
|
|
replace
|
|
/>
|
|
);
|
|
}
|