feat(app): single-page UX — detail sheet, mobile/tablet responsive
- 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
This commit is contained in:
1 parent
92a2adad6a
commit
44823a5b90
10 files changed
+1129
-308
No files matched your search
@@ -0,0 +1,71 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
import { useLang } from "@/lib/i18n";
|
||||
|
||||
interface AboutDialogProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* ป๊อปอัป "เกี่ยวกับเรา" — ใช้ native <dialog> (โฟกัส trap + Esc ให้เอง)
|
||||
* ★ มือถือ: กว้าง 92vw, ปุ่มเต็มความกว้าง, เผื่อ safe-area ล่าง (มือถือมีแถบ gesture)
|
||||
* ★ แท็บเล็ต: กว้างสูงสุด 420px
|
||||
*/
|
||||
export function AboutDialog({ open, onClose }: AboutDialogProps) {
|
||||
const dialogRef = useRef<HTMLDialogElement>(null);
|
||||
const { t } = useLang();
|
||||
|
||||
useEffect(() => {
|
||||
const el = dialogRef.current;
|
||||
if (!el) return;
|
||||
|
||||
if (open && !el.open) {
|
||||
el.showModal();
|
||||
} else if (!open && el.open) {
|
||||
el.close();
|
||||
}
|
||||
}, [open]);
|
||||
|
||||
useEffect(() => {
|
||||
const el = dialogRef.current;
|
||||
if (!el) return;
|
||||
|
||||
// ปิดด้วย Esc → บอก parent ให้ sync state
|
||||
const handleClose = () => onClose();
|
||||
el.addEventListener("close", handleClose);
|
||||
return () => el.removeEventListener("close", handleClose);
|
||||
}, [onClose]);
|
||||
|
||||
return (
|
||||
<dialog
|
||||
ref={dialogRef}
|
||||
aria-labelledby="about-title"
|
||||
className="m-auto w-[92vw] max-w-[420px] rounded-2xl border-2 border-[#ff1f1f] bg-[#0a0a0a] p-0 text-white backdrop:bg-black/75"
|
||||
onClick={(event) => {
|
||||
// คลิกฉากหลัง (นอกกล่องเนื้อหา) = ปิด
|
||||
if (event.target === dialogRef.current) onClose();
|
||||
}}
|
||||
>
|
||||
<div className="flex flex-col gap-3 p-5 pb-[max(1.25rem,env(safe-area-inset-bottom))] sm:p-6">
|
||||
<h2 id="about-title" className="text-lg font-bold text-[#ff1f1f] sm:text-xl">
|
||||
{t("about.title")}
|
||||
</h2>
|
||||
<p className="text-sm leading-relaxed text-[#9ca3af]">{t("about.body")}</p>
|
||||
|
||||
<div className="border-t border-white/10 pt-3 text-xs text-white/80">
|
||||
<span className="font-semibold text-[#ff1f1f]">{t("about.dev")}:</span>{" "}
|
||||
AlterFlixHub Team · v1.0.0
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="mt-1 flex min-h-11 w-full items-center justify-center rounded-lg bg-gradient-to-br from-[#ff1f1f] via-[#e00000] to-[#7a0000] px-4 text-sm font-bold text-white transition-transform active:scale-[0.98] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
|
||||
>
|
||||
{t("about.close")}
|
||||
</button>
|
||||
</div>
|
||||
</dialog>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import { IconStar } from "@tabler/icons-react";
|
||||
import type { MouseEvent } from "react";
|
||||
|
||||
import type { Cinema } from "@/lib/cinemas";
|
||||
import { useLang } from "@/lib/i18n";
|
||||
|
||||
interface CinemaCardProps {
|
||||
cinema: Cinema;
|
||||
/**
|
||||
* เปิดรายละเอียดบนหน้าเดิม (ไม่เปลี่ยน route)
|
||||
* ★ ถ้าไม่ส่งมา จะเป็นการนำทางปกติไป /?cinema=<slug>
|
||||
*/
|
||||
onSelect?: (slug: string) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* การ์ดโรงภาพยนตร์
|
||||
* ★ มือถือ (<640px): การ์ดแนวนอน ปกซ้าย 112px → สแกน list ได้เร็ว กินพื้นที่น้อย
|
||||
* ★ แท็บเล็ต/เดสก์ท็อป: การ์ดแนวตั้ง ปก 16:9
|
||||
* ★ ใช้ <a href="/?cinema=..."> จริง (กดกลาง/เปิดแท็บใหม่ได้, crawler อ่านได้)
|
||||
* แต่คลิกปกติ = preventDefault แล้วเรียก onSelect → ไม่รีเฟรชหน้า
|
||||
*/
|
||||
export function CinemaCard({ cinema, onSelect }: CinemaCardProps) {
|
||||
const { t } = useLang();
|
||||
const isOpen = cinema.status === "open";
|
||||
const href = `/?cinema=${cinema.slug}`;
|
||||
|
||||
const handleClick = (event: MouseEvent<HTMLAnchorElement>) => {
|
||||
// ปล่อยให้เบราว์เซอร์จัดการถ้าผู้ใช้เปิดแท็บใหม่ / กด modifier
|
||||
if (!onSelect) return;
|
||||
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
||||
if (event.button !== 0) return;
|
||||
|
||||
event.preventDefault();
|
||||
onSelect(cinema.slug);
|
||||
};
|
||||
|
||||
return (
|
||||
<a
|
||||
href={href}
|
||||
onClick={handleClick}
|
||||
className="group flex overflow-hidden rounded-xl border border-white/10 bg-[#141414] transition-colors duration-150 hover:border-[#ff1f1f] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ff1f1f] active:bg-[#1c1c1c] sm:block"
|
||||
>
|
||||
{/* ปก */}
|
||||
<div
|
||||
className="relative aspect-square w-28 shrink-0 sm:aspect-[16/9] sm:w-full"
|
||||
style={{ background: cinema.cover }}
|
||||
>
|
||||
<span
|
||||
className={`absolute left-2 top-2 rounded-full border px-2 py-0.5 text-[10px] font-bold leading-tight sm:left-3 sm:top-3 sm:px-2.5 sm:text-[11px] ${
|
||||
isOpen
|
||||
? "border-[#ff1f1f] bg-[#e00000]/85 text-white"
|
||||
: "border-white/20 bg-black/55 text-white"
|
||||
}`}
|
||||
>
|
||||
{isOpen ? t("status.open") : t("status.closed")}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* เนื้อหา */}
|
||||
<div className="flex min-w-0 flex-1 flex-col justify-center gap-1 px-3 py-2.5 sm:gap-1.5 sm:px-4 sm:py-3.5">
|
||||
<h3 className="truncate text-[15px] font-bold leading-tight sm:text-base">
|
||||
{cinema.name}
|
||||
</h3>
|
||||
<p className="truncate text-xs text-[#9ca3af] sm:text-[13px]">{cinema.area}</p>
|
||||
|
||||
<div className="mt-0.5 flex items-center gap-2.5 text-xs sm:text-[13px]">
|
||||
<span className="inline-flex items-center gap-1 font-bold text-[#ff1f1f]">
|
||||
<IconStar size={14} stroke={2} className="shrink-0" aria-hidden="true" />
|
||||
{cinema.rating.toFixed(1)}
|
||||
</span>
|
||||
<span className="text-[#6b7280]">·</span>
|
||||
<span className={isOpen ? "font-medium text-[#22c55e]" : "text-[#9ca3af]"}>
|
||||
{isOpen ? t("status.open") : t("status.closed")}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* แท็ก — ซ่อนบนมือถือเพื่อไม่ให้แน่น */}
|
||||
{cinema.tags.length > 0 && (
|
||||
<div className="mt-1 hidden flex-wrap gap-1.5 sm:flex">
|
||||
{cinema.tags.map((tag) => (
|
||||
<span
|
||||
key={tag}
|
||||
className="rounded-full border border-[#A92626] px-2.5 py-0.5 text-[11px] text-[#D47272]"
|
||||
>
|
||||
{tag}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,363 @@
|
||||
import {
|
||||
IconBook,
|
||||
IconBriefcase,
|
||||
IconBus,
|
||||
IconCar,
|
||||
IconChevronLeft,
|
||||
IconChevronRight,
|
||||
IconCircleCheck,
|
||||
IconCoffee,
|
||||
IconExternalLink,
|
||||
IconMap,
|
||||
IconMapPin,
|
||||
IconPlant2,
|
||||
IconShoppingBag,
|
||||
IconSofa,
|
||||
IconTicket,
|
||||
IconToolsKitchen2,
|
||||
IconTrain,
|
||||
IconX,
|
||||
} from "@tabler/icons-react";
|
||||
import { useEffect, useRef, type ComponentType } from "react";
|
||||
|
||||
import { CinemaCard } from "./CinemaCard";
|
||||
import { getCinema, getOtherCinemas } from "@/lib/cinemas";
|
||||
import { useLang, type MessageKey } from "@/lib/i18n";
|
||||
|
||||
const BORDER = "#332B2B";
|
||||
|
||||
type IconType = ComponentType<{ size?: number; stroke?: number; className?: string }>;
|
||||
|
||||
const TRANSPORT: { icon: IconType; labelKey: MessageKey; valueKey: MessageKey }[] = [
|
||||
{ icon: IconCar, labelKey: "transport.car", valueKey: "transport.carValue" },
|
||||
{ icon: IconTrain, labelKey: "transport.train", valueKey: "transport.trainValue" },
|
||||
{ icon: IconBus, labelKey: "transport.bus", valueKey: "transport.busValue" },
|
||||
];
|
||||
|
||||
const FACILITIES: { icon: IconType; titleKey: MessageKey; subKey: MessageKey }[] = [
|
||||
{ icon: IconSofa, titleKey: "facility.lounge", subKey: "facility.loungeSub" },
|
||||
{ icon: IconTicket, titleKey: "facility.ticket", subKey: "facility.ticketSub" },
|
||||
{ icon: IconToolsKitchen2, titleKey: "facility.food", subKey: "facility.foodSub" },
|
||||
{ icon: IconCoffee, titleKey: "facility.cafe", subKey: "facility.cafeSub" },
|
||||
{ icon: IconPlant2, titleKey: "facility.garden", subKey: "facility.gardenSub" },
|
||||
{ icon: IconBook, titleKey: "facility.book", subKey: "facility.bookSub" },
|
||||
{ icon: IconBriefcase, titleKey: "facility.colearn", subKey: "facility.colearnSub" },
|
||||
{ icon: IconShoppingBag, titleKey: "facility.other", subKey: "facility.otherSub" },
|
||||
];
|
||||
|
||||
const CONTACTS = [
|
||||
{ label: "Website", value: "alterflixhub.com" },
|
||||
{ label: "Mobile Application", value: "AlterFlixHub" },
|
||||
{ label: "Facebook", value: "AlterFlixHub" },
|
||||
{ label: "Call", value: "098-869-0997" },
|
||||
];
|
||||
|
||||
interface CinemaDetailSheetProps {
|
||||
/** slug ที่กำลังเปิด — null = ปิด */
|
||||
slug: string | null;
|
||||
onClose: () => void;
|
||||
/** เปลี่ยนโรงโดยไม่ปิด sheet (แทนการนำทาง) */
|
||||
onSelectCinema: (slug: string) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* รายละเอียดโรงภาพยนตร์ — เปิดเป็น overlay บนหน้าเดิม (single page)
|
||||
* ------------------------------------------------------------
|
||||
* ★ ไม่เปลี่ยน route → รายการด้านหลังไม่ unmount, scroll ไม่หาย, ไม่รีเฟรช
|
||||
* ★ URL ยังเปลี่ยน (?cinema=slug) → แชร์ลิงก์ได้, back ได้
|
||||
* ★ มือถือ 6": full-screen sheet + ปุ่มปิด 44px + CTA ติดขอบล่าง (thumb zone)
|
||||
* ★ แท็บเล็ต/เดสก์ท็อป: การ์ดกลางจอ สูงสุด 90dvh, เลื่อนในกล่อง
|
||||
* ★ ใช้ native <dialog> → focus trap + Esc + backdrop ให้เอง
|
||||
*/
|
||||
export function CinemaDetailSheet({ slug, onClose, onSelectCinema }: CinemaDetailSheetProps) {
|
||||
const dialogRef = useRef<HTMLDialogElement>(null);
|
||||
const { t } = useLang();
|
||||
const cinema = getCinema(slug ?? undefined);
|
||||
|
||||
/* เปิด/ปิด dialog ตาม slug */
|
||||
useEffect(() => {
|
||||
const el = dialogRef.current;
|
||||
if (!el) return;
|
||||
|
||||
if (slug && !el.open) {
|
||||
el.showModal();
|
||||
} else if (!slug && el.open) {
|
||||
el.close();
|
||||
}
|
||||
}, [slug]);
|
||||
|
||||
/* Esc / ปิดจากเบราว์เซอร์ → sync state */
|
||||
useEffect(() => {
|
||||
const el = dialogRef.current;
|
||||
if (!el) return;
|
||||
|
||||
const handleClose = () => onClose();
|
||||
el.addEventListener("close", handleClose);
|
||||
return () => el.removeEventListener("close", handleClose);
|
||||
}, [onClose]);
|
||||
|
||||
/* เปลี่ยน slug = เลื่อนกลับขึ้นบนสุดของ sheet */
|
||||
useEffect(() => {
|
||||
if (slug) dialogRef.current?.scrollTo({ top: 0 });
|
||||
}, [slug]);
|
||||
|
||||
const isOpen = cinema?.status === "open";
|
||||
const others = cinema ? getOtherCinemas(cinema.slug, 3) : [];
|
||||
const mapHref = cinema
|
||||
? `https://maps.google.com/?q=${encodeURIComponent(cinema.mapQuery)}`
|
||||
: "#";
|
||||
|
||||
return (
|
||||
<dialog
|
||||
ref={dialogRef}
|
||||
aria-label={cinema ? cinema.name : undefined}
|
||||
className="m-0 h-[100dvh] max-h-none w-full max-w-none overflow-y-auto overscroll-contain border-0 bg-[#0D0D0D] p-0 text-white backdrop:bg-black/80 sm:m-auto sm:h-auto sm:max-h-[90dvh] sm:w-[92vw] sm:max-w-[960px] sm:rounded-2xl sm:border sm:border-[#332B2B]"
|
||||
>
|
||||
{cinema && (
|
||||
<div className="flex min-h-full flex-col">
|
||||
{/* ---------- แถบปิด (ติดบน) ---------- */}
|
||||
<div className="sticky top-0 z-20 flex items-center gap-3 border-b border-white/10 bg-[#0D0D0D]/95 px-4 py-2.5 backdrop-blur-md sm:px-5">
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="truncate text-sm font-bold sm:text-base">{cinema.name}</p>
|
||||
<p className="truncate text-[11px] text-[#9ca3af] sm:text-xs">
|
||||
{cinema.area} · ★ {cinema.rating.toFixed(1)}
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
aria-label={t("about.close")}
|
||||
className="flex size-11 shrink-0 items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/20 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ff1f1f]"
|
||||
>
|
||||
<IconX size={20} aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* ---------- เนื้อหา (เลื่อน) ---------- */}
|
||||
<div className="flex-1 px-4 pb-4 pt-3 sm:px-5 sm:pb-6">
|
||||
{/* แกลเลอรี */}
|
||||
<section aria-label="ภาพโรงภาพยนตร์">
|
||||
<div
|
||||
className="relative aspect-[4/3] w-full overflow-hidden rounded-xl sm:aspect-[16/9]"
|
||||
style={{ background: cinema.cover }}
|
||||
>
|
||||
<div className="absolute inset-0 bg-black/15" />
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
<span className="px-6 text-center text-lg font-semibold text-white/70 sm:text-xl">
|
||||
{cinema.name}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="ภาพก่อนหน้า"
|
||||
className="absolute left-2 top-1/2 flex size-11 -translate-y-1/2 items-center justify-center rounded-full bg-black/50 text-white hover:bg-black/70"
|
||||
>
|
||||
<IconChevronLeft size={22} aria-hidden="true" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="ภาพถัดไป"
|
||||
className="absolute right-2 top-1/2 flex size-11 -translate-y-1/2 items-center justify-center rounded-full bg-black/50 text-white hover:bg-black/70"
|
||||
>
|
||||
<IconChevronRight size={22} aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* หัวเรื่อง */}
|
||||
<section className="mt-4 flex flex-col gap-3">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{cinema.tags.map((tag) => (
|
||||
<span
|
||||
key={tag}
|
||||
className="rounded-full border border-[#A92626] px-3 py-1 text-xs text-[#D47272]"
|
||||
style={{
|
||||
background:
|
||||
"linear-gradient(180deg, rgba(143,8,8,0.3) 0%, rgba(27,27,27,0) 100%)",
|
||||
}}
|
||||
>
|
||||
{tag}
|
||||
</span>
|
||||
))}
|
||||
<span
|
||||
className={`rounded-full px-3 py-1 text-xs font-semibold ${
|
||||
isOpen ? "bg-[#e00000]/85 text-white" : "bg-white/10 text-[#9ca3af]"
|
||||
}`}
|
||||
>
|
||||
{isOpen ? t("status.open") : t("status.closed")}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<h2 className="text-[24px] font-bold leading-tight tracking-tight sm:text-[30px]">
|
||||
{cinema.name}
|
||||
</h2>
|
||||
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex items-center gap-2 text-sm sm:text-base">
|
||||
<IconMapPin size={18} className="shrink-0" aria-hidden="true" />
|
||||
<span>{cinema.area}</span>
|
||||
</div>
|
||||
<a
|
||||
href={mapHref}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="flex min-h-11 w-full items-center justify-center gap-2 rounded-lg border border-white px-4 text-sm font-medium hover:border-[#ff1f1f] hover:text-[#ff1f1f] active:bg-white/5 sm:w-auto"
|
||||
>
|
||||
{t("detail.map")}
|
||||
<IconMap size={17} aria-hidden="true" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p className="text-sm leading-relaxed text-white/90 sm:text-base">
|
||||
{cinema.description}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
{/* การเดินทาง */}
|
||||
<section className="mt-5">
|
||||
<h3 className="mb-1 text-[11px] font-semibold uppercase tracking-wide text-[#9ca3af]">
|
||||
{t("detail.transport")}
|
||||
</h3>
|
||||
{TRANSPORT.map((row, index) => {
|
||||
const Icon = row.icon;
|
||||
return (
|
||||
<div
|
||||
key={row.labelKey}
|
||||
className="flex flex-col justify-between gap-0.5 py-2.5 text-sm sm:flex-row sm:items-center sm:gap-4"
|
||||
style={{
|
||||
borderBottom:
|
||||
index < TRANSPORT.length - 1 ? `1px solid ${BORDER}` : undefined,
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center gap-2 font-medium">
|
||||
<Icon size={18} stroke={1.75} aria-hidden="true" />
|
||||
{t(row.labelKey)}
|
||||
</div>
|
||||
<div className="pl-7 text-[#9ca3af] sm:pl-0 sm:text-right sm:text-white/90">
|
||||
{t(row.valueKey)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</section>
|
||||
|
||||
{/* ติดต่อ + ชำระเงิน */}
|
||||
<section
|
||||
className="mt-5 flex flex-col gap-4 rounded-xl p-4"
|
||||
style={{ border: `1px solid ${BORDER}` }}
|
||||
>
|
||||
<h3 className="text-base font-semibold sm:text-lg">{t("detail.contactTitle")}</h3>
|
||||
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
{CONTACTS.map((contact) => (
|
||||
<div key={contact.label} className="flex min-w-0 flex-col gap-0.5">
|
||||
<span className="text-[11px] text-[#999]">{contact.label}</span>
|
||||
<span className="flex items-center gap-1.5 truncate text-xs sm:text-sm">
|
||||
<span className="truncate">{contact.value}</span>
|
||||
<IconExternalLink
|
||||
size={13}
|
||||
className="shrink-0 text-[#9ca3af]"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<span className="text-[11px] text-[#999]">{t("detail.payment")}</span>
|
||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-1.5">
|
||||
{["เงินสด", "บัตรเครดิต", "สแกนจ่าย"].map((payment) => (
|
||||
<span key={payment} className="flex items-center gap-1.5 text-xs">
|
||||
<IconCircleCheck size={14} className="text-[#22c55e]" aria-hidden="true" />
|
||||
{payment}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* สิ่งอำนวยความสะดวก */}
|
||||
<section className="mt-5">
|
||||
<h3 className="mb-3 text-base font-semibold sm:text-lg">
|
||||
{t("detail.facilities")}
|
||||
</h3>
|
||||
<div className="grid grid-cols-2 gap-x-3 gap-y-5 sm:grid-cols-4 sm:gap-y-6">
|
||||
{FACILITIES.map((facility) => {
|
||||
const Icon = facility.icon;
|
||||
return (
|
||||
<div
|
||||
key={facility.titleKey}
|
||||
className="flex flex-col items-center gap-2 text-center"
|
||||
>
|
||||
<div
|
||||
className="flex size-12 items-center justify-center rounded-full sm:size-14"
|
||||
style={{ background: "rgba(143,8,8,0.4)" }}
|
||||
>
|
||||
<Icon size={24} stroke={1.5} aria-hidden="true" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-xs font-medium leading-snug sm:text-sm">
|
||||
{t(facility.titleKey)}
|
||||
</div>
|
||||
<div className="mt-0.5 text-[10px] text-[#B3B3B3] sm:text-xs">
|
||||
{t(facility.subKey)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* ที่ตั้ง */}
|
||||
<section
|
||||
className="mt-5 flex flex-col gap-3 rounded-xl p-4"
|
||||
style={{ border: `1px solid ${BORDER}` }}
|
||||
>
|
||||
<h3 className="text-base font-semibold sm:text-lg">{t("detail.location")}</h3>
|
||||
<a
|
||||
href={mapHref}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="flex h-28 items-center justify-center rounded-xl bg-[#E8E8E8] text-xs font-medium text-[#333] hover:opacity-90 sm:h-40 sm:text-sm"
|
||||
>
|
||||
<span className="flex items-center gap-1.5">
|
||||
<IconMapPin size={16} aria-hidden="true" />
|
||||
{t("detail.map")}
|
||||
</span>
|
||||
</a>
|
||||
<p className="text-xs leading-relaxed text-[#999] sm:text-sm">{cinema.address}</p>
|
||||
</section>
|
||||
|
||||
{/* โรงอื่น ๆ — เปลี่ยนใน sheet ทันที ไม่รีโหลด */}
|
||||
<section className="mt-6">
|
||||
<h3 className="mb-3 text-base font-semibold sm:text-lg">
|
||||
{t("detail.otherCinemas")}
|
||||
</h3>
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-3">
|
||||
{others.map((other) => (
|
||||
<CinemaCard
|
||||
key={other.slug}
|
||||
cinema={other}
|
||||
onSelect={() => onSelectCinema(other.slug)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
{/* ---------- CTA ติดขอบล่าง (thumb zone) ---------- */}
|
||||
<div className="sticky bottom-0 z-20 border-t border-white/10 bg-[#0D0D0D]/95 px-4 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] backdrop-blur-md">
|
||||
<button
|
||||
type="button"
|
||||
className="flex min-h-12 w-full items-center justify-center rounded-lg bg-gradient-to-br from-[#ff1f1f] via-[#e00000] to-[#7a0000] text-sm font-bold text-white transition-transform active:scale-[0.99] sm:mx-auto sm:max-w-[320px]"
|
||||
>
|
||||
{t("detail.book")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</dialog>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
import {
|
||||
IconBrandFacebook,
|
||||
IconBrandInstagram,
|
||||
IconBrandLinkedin,
|
||||
IconBrandTelegram,
|
||||
IconBrandYoutube,
|
||||
} from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import { Link, useLocation } from "react-router";
|
||||
|
||||
import { AboutDialog } from "./AboutDialog";
|
||||
import { useLang } from "@/lib/i18n";
|
||||
|
||||
/** โซเชียลใน footer — เพิ่ม/ลบที่นี่ที่เดียว */
|
||||
const SOCIALS = [
|
||||
{ label: "Facebook", href: "https://facebook.com", icon: IconBrandFacebook },
|
||||
{ label: "Instagram", href: "https://instagram.com", icon: IconBrandInstagram },
|
||||
{ label: "LinkedIn", href: "https://linkedin.com", icon: IconBrandLinkedin },
|
||||
{ label: "YouTube", href: "https://youtube.com", icon: IconBrandYoutube },
|
||||
{ label: "Telegram", href: "https://telegram.org", icon: IconBrandTelegram },
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Header กลาง — ใช้ทั้งหน้าแรกและหน้ารายละเอียด
|
||||
* ★ มือถือ 6": ความสูง 56px, แบรนด์เล็กลง, ปุ่ม lang กระชับ — ไม่ล้นที่ 360px
|
||||
* ★ แตะง่าย: ทุกปุ่มขั้นต่ำ 40px, ปุ่มหลัก 44px
|
||||
* ★ sticky + พื้นหลังเบลอ เพื่อไม่ให้เนื้อหาทะลุตอนเลื่อน
|
||||
*/
|
||||
export function SiteHeader() {
|
||||
const { t, lang, setLang } = useLang();
|
||||
const [aboutOpen, setAboutOpen] = useState(false);
|
||||
const { pathname } = useLocation();
|
||||
|
||||
const isHome = pathname === "/";
|
||||
|
||||
return (
|
||||
<>
|
||||
<header className="sticky top-0 z-40 border-b border-white/10 bg-[#0a0a0a]/85 backdrop-blur-md">
|
||||
<div className="mx-auto flex h-14 w-full max-w-[1160px] items-center gap-2 px-3 sm:h-16 sm:gap-3 sm:px-5">
|
||||
{/* แบรนด์ */}
|
||||
<Link
|
||||
to="/"
|
||||
className="flex min-w-0 items-center gap-2 rounded-lg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ff1f1f]"
|
||||
aria-label="AlterFlixHub"
|
||||
>
|
||||
<span
|
||||
className="flex size-7 shrink-0 items-center justify-center rounded-lg text-sm font-black text-white sm:size-8"
|
||||
style={{ background: "linear-gradient(135deg,#ff1f1f 0%,#e00000 45%,#7a0000 100%)" }}
|
||||
aria-hidden="true"
|
||||
>
|
||||
A
|
||||
</span>
|
||||
<span className="truncate text-[15px] font-extrabold tracking-tight text-white sm:text-lg">
|
||||
Alter<span className="text-[#ff1f1f]">Flix</span>Hub
|
||||
</span>
|
||||
</Link>
|
||||
|
||||
<div className="ml-auto flex shrink-0 items-center gap-1.5 sm:gap-2">
|
||||
{/* กลับหน้าแรก — แสดงเฉพาะเมื่อไม่ใช่หน้าแรก */}
|
||||
{!isHome && (
|
||||
<Link
|
||||
to="/"
|
||||
className="hidden min-h-10 items-center rounded-lg border border-white/15 px-3 text-xs font-semibold text-white transition-colors hover:border-[#ff1f1f] hover:text-[#ff1f1f] sm:inline-flex"
|
||||
>
|
||||
{t("nav.allCinemas")}
|
||||
</Link>
|
||||
)}
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setAboutOpen(true)}
|
||||
className="flex min-h-10 items-center rounded-lg border border-white/15 px-2.5 text-xs font-semibold text-white transition-colors hover:border-[#ff1f1f] hover:text-[#ff1f1f] active:bg-white/5 sm:px-3.5 sm:text-[13px]"
|
||||
>
|
||||
{t("nav.about")}
|
||||
</button>
|
||||
|
||||
{/* สลับภาษา */}
|
||||
<div
|
||||
className="flex overflow-hidden rounded-lg border border-white/15"
|
||||
role="group"
|
||||
aria-label={t("lang.label")}
|
||||
>
|
||||
{(["th", "en"] as const).map((code) => (
|
||||
<button
|
||||
key={code}
|
||||
type="button"
|
||||
onClick={() => setLang(code)}
|
||||
aria-pressed={lang === code}
|
||||
className={`min-h-10 px-2.5 text-[11px] font-bold transition-colors sm:px-3 sm:text-xs ${
|
||||
lang === code
|
||||
? "bg-[#e00000] text-white"
|
||||
: "bg-transparent text-[#9ca3af] hover:text-white"
|
||||
}`}
|
||||
>
|
||||
{code === "th" ? "ไทย" : "EN"}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<AboutDialog open={aboutOpen} onClose={() => setAboutOpen(false)} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** Footer กลาง — กระชับบนมือถือ */
|
||||
export function SiteFooter() {
|
||||
const { t } = useLang();
|
||||
|
||||
return (
|
||||
<footer className="border-t border-white/10 px-4 py-6 pb-[max(1.5rem,env(safe-area-inset-bottom))] text-center sm:py-8">
|
||||
{/* โซเชียล — เล็กลงบนมือถือเพื่อไม่กินพื้นที่ */}
|
||||
<div className="mb-5 flex items-center justify-center gap-5 text-white/70 sm:mb-6 sm:gap-8">
|
||||
{SOCIALS.map((social) => {
|
||||
const Icon = social.icon;
|
||||
return (
|
||||
<a
|
||||
key={social.label}
|
||||
href={social.href}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
aria-label={social.label}
|
||||
className="flex size-10 items-center justify-center rounded-lg transition-colors hover:text-[#ff1f1f] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ff1f1f]"
|
||||
>
|
||||
<Icon size={22} stroke={1.5} aria-hidden="true" />
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<p className="text-xs text-[#9ca3af] sm:text-sm">
|
||||
© 2026 AlterFlixHub · {t("footer.rights")}
|
||||
</p>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import { HeaderActionsProvider } from "@agent-native/toolkit/app-shell";
|
||||
|
||||
import { LangProvider } from "@/lib/i18n";
|
||||
|
||||
interface LayoutProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
@@ -18,11 +20,14 @@ interface LayoutProps {
|
||||
export function Layout({ children }: LayoutProps) {
|
||||
return (
|
||||
<HeaderActionsProvider>
|
||||
<div className="flex h-screen w-full flex-col overflow-hidden bg-background text-foreground">
|
||||
<main className="agent-native-app-main min-w-0 flex-1 overflow-y-auto overscroll-contain">
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
{/* LangProvider ครอบทั้งแอป — header/footer/ทุกหน้าอ่านภาษาจากที่เดียว */}
|
||||
<LangProvider>
|
||||
<div className="flex h-screen w-full flex-col overflow-hidden bg-background text-foreground">
|
||||
<main className="agent-native-app-main min-w-0 flex-1 overflow-y-auto overscroll-contain">
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
</LangProvider>
|
||||
</HeaderActionsProvider>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* ข้อมูลโรงภาพยนตร์ — แหล่งเดียวสำหรับหน้าแรกและหน้ารายละเอียด
|
||||
* ★ เพิ่มโรงใหม่ = เพิ่ม object ที่นี่ (ทั้ง 2 หน้าอ่านจากที่เดียว)
|
||||
*/
|
||||
|
||||
export type CinemaStatus = "open" | "closed";
|
||||
|
||||
export interface Cinema {
|
||||
/** ใช้ใน URL: /cinema/<slug> */
|
||||
slug: string;
|
||||
name: string;
|
||||
/** ย่อสถานที่ เช่น "ชั้น 4 เซ็นทรัลเวิลด์" */
|
||||
area: string;
|
||||
rating: number;
|
||||
status: CinemaStatus;
|
||||
tags: string[];
|
||||
description: string;
|
||||
address: string;
|
||||
/** query สำหรับ Google Maps */
|
||||
mapQuery: string;
|
||||
/** ไล่ระดับสีปกการ์ด (ดำ-แดง ตามธีม) */
|
||||
cover: string;
|
||||
}
|
||||
|
||||
/** ไล่ระดับสีปก — ใช้ซ้ำทั้งการ์ดหน้าแรกและหน้ารายละเอียด */
|
||||
export const COVER_GRADIENTS = [
|
||||
"linear-gradient(135deg,#7a0000,#e00000)",
|
||||
"linear-gradient(135deg,#3a0d0d,#a00000)",
|
||||
"linear-gradient(135deg,#1a0a0a,#c00000)",
|
||||
"linear-gradient(135deg,#5c0505,#ff1f1f)",
|
||||
"linear-gradient(135deg,#2b0a0a,#b00000)",
|
||||
"linear-gradient(135deg,#4d0707,#e00000)",
|
||||
] as const;
|
||||
|
||||
export const CINEMAS: Cinema[] = [
|
||||
{
|
||||
slug: "alterflix-major",
|
||||
name: "AlterFlix Major",
|
||||
area: "ชั้น 4 เซ็นทรัลเวิลด์",
|
||||
rating: 4.8,
|
||||
status: "open",
|
||||
tags: ["อาร์ตเฮาส์", "หนังนอกกระแส"],
|
||||
description:
|
||||
"โรงภาพยนตร์สำหรับคนที่อยากค้นพบหนังหลากหลาย เน้นภาพยนตร์นอกกระแสและเรื่องที่ไม่ได้เข้าฉายในวงกว้าง พร้อมเรื่องราวและมุมมองที่แตกต่างสำหรับคนรักหนัง",
|
||||
address: "ชั้น 4 เซ็นทรัลเวิลด์ 999/9 ถนนพระราม 1 เขตปทุมวัน กรุงเทพฯ 10330",
|
||||
mapQuery: "Central World Bangkok",
|
||||
cover: COVER_GRADIENTS[0],
|
||||
},
|
||||
{
|
||||
slug: "alterflix-imax",
|
||||
name: "AlterFlix IMAX",
|
||||
area: "ชั้น 5 สยามพารากอน",
|
||||
rating: 4.9,
|
||||
status: "open",
|
||||
tags: ["IMAX", "จอใหญ่"],
|
||||
description:
|
||||
"จอ IMAX ขนาดใหญ่พร้อมระบบเสียงรอบทิศทาง เหมาะกับหนังบล็อกบัสเตอร์ที่ต้องการความสมจริงที่สุด",
|
||||
address: "ชั้น 5 สยามพารากอน 991/1 ถนนพระราม 1 เขตปทุมวัน กรุงเทพฯ 10330",
|
||||
mapQuery: "Siam Paragon Bangkok",
|
||||
cover: COVER_GRADIENTS[1],
|
||||
},
|
||||
{
|
||||
slug: "alterflix-plus",
|
||||
name: "AlterFlix Plus",
|
||||
area: "ชั้น 3 เอ็มควอเทียร์",
|
||||
rating: 4.7,
|
||||
status: "open",
|
||||
tags: ["ที่นั่งกว้าง", "ครอบครัว"],
|
||||
description:
|
||||
"โรงภาพยนตร์ที่นั่งกว้างเป็นพิเศษ เดินทางสะดวกด้วยรถไฟฟ้า เหมาะกับครอบครัวและกลุ่มเพื่อน",
|
||||
address: "ชั้น 3 เอ็มควอเทียร์ 689 ถนนสุขุมวิท เขตวัฒนา กรุงเทพฯ 10110",
|
||||
mapQuery: "EmQuartier Bangkok",
|
||||
cover: COVER_GRADIENTS[2],
|
||||
},
|
||||
{
|
||||
slug: "alterflix-mini",
|
||||
name: "AlterFlix Mini",
|
||||
area: "ชั้น 2 เดอะมอลล์บางกะปิ",
|
||||
rating: 4.5,
|
||||
status: "closed",
|
||||
tags: ["โรงเล็ก", "ราคาย่อมเยา"],
|
||||
description:
|
||||
"โรงขนาดเล็กบรรยากาศอบอุ่น ราคาย่อมเยา ปัจจุบันปิดปรับปรุงเพื่อเปลี่ยนระบบภาพและเสียงใหม่",
|
||||
address: "ชั้น 2 เดอะมอลล์บางกะปิ 3522 ถนนลาดพร้าว เขตบางกะปิ กรุงเทพฯ 10240",
|
||||
mapQuery: "The Mall Bangkapi",
|
||||
cover: COVER_GRADIENTS[3],
|
||||
},
|
||||
{
|
||||
slug: "alterflix-vip",
|
||||
name: "AlterFlix VIP",
|
||||
area: "ชั้น 6 ไอคอนสยาม",
|
||||
rating: 4.9,
|
||||
status: "open",
|
||||
tags: ["VIP", "เสิร์ฟถึงที่นั่ง"],
|
||||
description:
|
||||
"โรงภาพยนตร์ระดับพรีเมียม ที่นั่ง recliner พร้อมบริการเสิร์ฟอาหารและเครื่องดื่มถึงที่นั่ง",
|
||||
address: "ชั้น 6 ไอคอนสยาม 299 ถนนเจริญนคร เขตคลองสาน กรุงเทพฯ 10600",
|
||||
mapQuery: "ICONSIAM Bangkok",
|
||||
cover: COVER_GRADIENTS[4],
|
||||
},
|
||||
{
|
||||
slug: "alterflix-classic",
|
||||
name: "AlterFlix Classic",
|
||||
area: "ชั้น 3 ฟิวเจอร์พาร์ค",
|
||||
rating: 4.4,
|
||||
status: "open",
|
||||
tags: ["หนังคลาสสิก", "ราคาย่อมเยา"],
|
||||
description:
|
||||
"โรงภาพยนตร์ที่ฉายหนังคลาสสิกและหนังไทย restored เป็นรอบพิเศษ เหมาะกับคนที่ชอบบรรยากาศโรงหนังแบบเดิม",
|
||||
address: "ชั้น 3 ฟิวเจอร์พาร์ค รังสิต 94 ถนนพหลโยธิน ต.คูคต อ.ลำลูกกา ปทุมธานี 12130",
|
||||
mapQuery: "Future Park Rangsit",
|
||||
cover: COVER_GRADIENTS[5],
|
||||
},
|
||||
];
|
||||
|
||||
export function getCinema(slug: string | undefined): Cinema | undefined {
|
||||
if (!slug) return undefined;
|
||||
return CINEMAS.find((c) => c.slug === slug);
|
||||
}
|
||||
|
||||
/** โรงอื่น ๆ ที่ไม่ใช่ slug ที่ระบุ — ใช้แสดง "โรงหนังอิสระอื่นๆ" */
|
||||
export function getOtherCinemas(slug: string, limit = 3): Cinema[] {
|
||||
return CINEMAS.filter((c) => c.slug !== slug).slice(0, limit);
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
/**
|
||||
* i18n แบบเบา — TH/EN สำหรับ chrome (nav, hero, ปุ่ม, footer)
|
||||
* ★ ข้อความไทยเป็นค่าเริ่มต้น · เก็บภาษาที่เลือกใน localStorage
|
||||
* ★ เพิ่มข้อความใหม่ = เพิ่มทั้ง th และ en (คีย์ต้องตรงกัน)
|
||||
*/
|
||||
import {
|
||||
createContext,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useState,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
|
||||
export type Lang = "th" | "en";
|
||||
|
||||
const STORAGE_KEY = "alterflixhub:lang";
|
||||
|
||||
const DICT = {
|
||||
th: {
|
||||
"brand.partA": "Alter",
|
||||
"brand.partB": "Flix",
|
||||
"brand.partC": "Hub",
|
||||
"nav.about": "เกี่ยวกับเรา",
|
||||
"nav.home": "หน้าแรก",
|
||||
"nav.allCinemas": "โรงภาพยนตร์ทั้งหมด",
|
||||
"lang.label": "ภาษา",
|
||||
|
||||
"home.hero1": "ค้นพบโรงภาพยนตร์",
|
||||
"home.hero2": "รอบตัวคุณ",
|
||||
"home.lead": "เลือกโรงภาพยนตร์ที่ใช่ ดูรอบฉายและรายละเอียดได้ในที่เดียว",
|
||||
"home.sectionTitle": "โรงภาพยนตร์ทั้งหมด",
|
||||
"home.count": "{n} แห่ง",
|
||||
|
||||
"status.open": "เปิดบริการ",
|
||||
"status.closed": "ปิดปรับปรุง",
|
||||
|
||||
"detail.back": "ย้อนกลับ",
|
||||
"detail.breadcrumb": "หน้าแรก / รายละเอียดโรงภาพยนตร์",
|
||||
"detail.map": "เปิด Google map",
|
||||
"detail.contactTitle": "สอบถามข้อมูลและจองตั๋ว",
|
||||
"detail.book": "ดูรอบฉาย",
|
||||
"detail.payment": "ชำระเงิน",
|
||||
"detail.facilities": "สิ่งอำนวยความสะดวก",
|
||||
"detail.location": "ที่ตั้ง",
|
||||
"detail.otherCinemas": "โรงหนังอิสระอื่นๆ",
|
||||
"detail.transport": "การเดินทาง",
|
||||
|
||||
"transport.car": "รถยนต์ส่วนตัว",
|
||||
"transport.carValue": "ที่จอดรถภายในศูนย์การค้า",
|
||||
"transport.train": "รถไฟฟ้า",
|
||||
"transport.trainValue": "MRT / BTS สถานีใกล้เคียง",
|
||||
"transport.bus": "รถประจำทาง",
|
||||
"transport.busValue": "29, 34, 36, 40, 47, 50",
|
||||
|
||||
"facility.lounge": "โซนนั่งรอ",
|
||||
"facility.loungeSub": "บริเวณโถงโรงภาพยนตร์",
|
||||
"facility.ticket": "จุดจำหน่ายตั๋ว",
|
||||
"facility.ticketSub": "Box Office",
|
||||
"facility.food": "ร้านอาหาร",
|
||||
"facility.foodSub": "ภายในศูนย์การค้า",
|
||||
"facility.cafe": "ร้านคาเฟ่",
|
||||
"facility.cafeSub": "บริเวณโถงโรงภาพยนตร์",
|
||||
"facility.garden": "สวนหย่อม",
|
||||
"facility.gardenSub": "ลานกลางแจ้ง",
|
||||
"facility.book": "ร้านหนังสือ",
|
||||
"facility.bookSub": "ภายในศูนย์การค้า",
|
||||
"facility.colearn": "Co-Learning Space",
|
||||
"facility.colearnSub": "บริเวณโถงโรงภาพยนตร์",
|
||||
"facility.other": "อื่นๆ",
|
||||
"facility.otherSub": "ร้านทำผม ร้านทำเล็บ",
|
||||
|
||||
"about.title": "เกี่ยวกับเรา",
|
||||
"about.body":
|
||||
"AlterFlixHub — ศูนย์รวมข้อมูลโรงภาพยนตร์ ดูรอบฉาย เปรียบเทียบ และค้นพบประสบการณ์ชมภาพยนตร์ที่ดีที่สุด",
|
||||
"about.dev": "ผู้พัฒนา",
|
||||
"about.close": "ปิด",
|
||||
|
||||
"footer.rights": "สงวนลิขสิทธิ์",
|
||||
"notFound.title": "ไม่พบโรงภาพยนตร์นี้",
|
||||
"notFound.body": "ลิงก์อาจเปลี่ยนไปแล้ว หรือโรงภาพยนตร์ถูกนำออกจากระบบ",
|
||||
"notFound.cta": "ดูโรงภาพยนตร์ทั้งหมด",
|
||||
},
|
||||
en: {
|
||||
"brand.partA": "Alter",
|
||||
"brand.partB": "Flix",
|
||||
"brand.partC": "Hub",
|
||||
"nav.about": "About us",
|
||||
"nav.home": "Home",
|
||||
"nav.allCinemas": "All cinemas",
|
||||
"lang.label": "Language",
|
||||
|
||||
"home.hero1": "Discover cinemas",
|
||||
"home.hero2": "around you",
|
||||
"home.lead": "Pick the right cinema, check showtimes and details in one place.",
|
||||
"home.sectionTitle": "All cinemas",
|
||||
"home.count": "{n} venues",
|
||||
|
||||
"status.open": "Now open",
|
||||
"status.closed": "Temporarily closed",
|
||||
|
||||
"detail.back": "Back",
|
||||
"detail.breadcrumb": "Home / Cinema details",
|
||||
"detail.map": "Open Google map",
|
||||
"detail.contactTitle": "Contact & booking",
|
||||
"detail.book": "Showtimes",
|
||||
"detail.payment": "Payment",
|
||||
"detail.facilities": "Facilities",
|
||||
"detail.location": "Location",
|
||||
"detail.otherCinemas": "Other indie cinemas",
|
||||
"detail.transport": "Getting here",
|
||||
|
||||
"transport.car": "By car",
|
||||
"transport.carValue": "Parking inside the mall",
|
||||
"transport.train": "By rail",
|
||||
"transport.trainValue": "Nearby MRT / BTS station",
|
||||
"transport.bus": "By bus",
|
||||
"transport.busValue": "29, 34, 36, 40, 47, 50",
|
||||
|
||||
"facility.lounge": "Waiting lounge",
|
||||
"facility.loungeSub": "Cinema lobby",
|
||||
"facility.ticket": "Ticket counter",
|
||||
"facility.ticketSub": "Box office",
|
||||
"facility.food": "Restaurants",
|
||||
"facility.foodSub": "Inside the mall",
|
||||
"facility.cafe": "Cafés",
|
||||
"facility.cafeSub": "Cinema lobby",
|
||||
"facility.garden": "Garden",
|
||||
"facility.gardenSub": "Outdoor plaza",
|
||||
"facility.book": "Bookstore",
|
||||
"facility.bookSub": "Inside the mall",
|
||||
"facility.colearn": "Co-Learning Space",
|
||||
"facility.colearnSub": "Cinema lobby",
|
||||
"facility.other": "Others",
|
||||
"facility.otherSub": "Hair & nail salon",
|
||||
|
||||
"about.title": "About us",
|
||||
"about.body":
|
||||
"AlterFlixHub — your hub for cinema info, showtimes and the best movie-going experience.",
|
||||
"about.dev": "Developer",
|
||||
"about.close": "Close",
|
||||
|
||||
"footer.rights": "All rights reserved",
|
||||
"notFound.title": "Cinema not found",
|
||||
"notFound.body": "The link may have changed, or this cinema was removed.",
|
||||
"notFound.cta": "Browse all cinemas",
|
||||
},
|
||||
} as const;
|
||||
|
||||
export type MessageKey = keyof (typeof DICT)["th"];
|
||||
|
||||
interface LangContextValue {
|
||||
lang: Lang;
|
||||
setLang: (next: Lang) => void;
|
||||
/** แปลคีย์ → ข้อความ · รองรับ {n} */
|
||||
t: (key: MessageKey, vars?: Record<string, string | number>) => string;
|
||||
}
|
||||
|
||||
const LangContext = createContext<LangContextValue | null>(null);
|
||||
|
||||
function readInitialLang(): Lang {
|
||||
if (typeof window === "undefined") return "th";
|
||||
try {
|
||||
const saved = window.localStorage.getItem(STORAGE_KEY);
|
||||
if (saved === "th" || saved === "en") return saved;
|
||||
} catch {
|
||||
/* localStorage ถูกปิด */
|
||||
}
|
||||
return "th";
|
||||
}
|
||||
|
||||
export function LangProvider({ children }: { children: ReactNode }) {
|
||||
const [lang, setLangState] = useState<Lang>(readInitialLang);
|
||||
|
||||
const setLang = useCallback((next: Lang) => {
|
||||
setLangState(next);
|
||||
try {
|
||||
window.localStorage.setItem(STORAGE_KEY, next);
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}, []);
|
||||
|
||||
// sync <html lang> เพื่อ a11y + ให้เบราว์เซอร์เลือกฟอนต์ถูก
|
||||
useEffect(() => {
|
||||
document.documentElement.lang = lang;
|
||||
}, [lang]);
|
||||
|
||||
const value = useMemo<LangContextValue>(() => {
|
||||
const dict = DICT[lang] as Record<string, string>;
|
||||
const fallback = DICT.th as Record<string, string>;
|
||||
|
||||
const t = (key: MessageKey, vars?: Record<string, string | number>) => {
|
||||
let text = dict[key] ?? fallback[key] ?? key;
|
||||
if (vars) {
|
||||
for (const [k, v] of Object.entries(vars)) {
|
||||
text = text.split(`{${k}}`).join(String(v));
|
||||
}
|
||||
}
|
||||
return text;
|
||||
};
|
||||
|
||||
return { lang, setLang, t };
|
||||
}, [lang, setLang]);
|
||||
|
||||
return <LangContext.Provider value={value}>{children}</LangContext.Provider>;
|
||||
}
|
||||
|
||||
export function useLang(): LangContextValue {
|
||||
const ctx = useContext(LangContext);
|
||||
if (!ctx) throw new Error("useLang ต้องอยู่ใต้ <LangProvider>");
|
||||
return ctx;
|
||||
}
|
||||
+4
-2
@@ -32,12 +32,14 @@ const THEME_INIT_SCRIPT = getThemeInitScript();
|
||||
|
||||
export function Layout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<html lang="th" suppressHydrationWarning>
|
||||
<head>
|
||||
<meta charSet="utf-8" />
|
||||
{/* ★ ห้ามใส่ maximum-scale / user-scalable=no — บล็อก pinch-zoom (a11y)
|
||||
viewport-fit=cover เปิดให้ env(safe-area-inset-*) ทำงานบนมือถือขอบโค้ง */}
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
|
||||
content="width=device-width, initial-scale=1, viewport-fit=cover"
|
||||
/>
|
||||
<script
|
||||
suppressHydrationWarning
|
||||
|
||||
+90
-301
@@ -1,326 +1,115 @@
|
||||
import {
|
||||
IconArrowBackUp,
|
||||
IconBrandFacebook,
|
||||
IconBrandInstagram,
|
||||
IconBrandLinkedin,
|
||||
IconBrandTelegram,
|
||||
IconBrandYoutube,
|
||||
IconBus,
|
||||
IconChevronDown,
|
||||
IconChevronLeft,
|
||||
IconChevronRight,
|
||||
IconCircleCheck,
|
||||
IconCoffee,
|
||||
IconBook,
|
||||
IconBriefcase,
|
||||
IconMap,
|
||||
IconMapPin,
|
||||
IconShoppingBag,
|
||||
IconSofa,
|
||||
IconExternalLink,
|
||||
IconTicket,
|
||||
IconToolsKitchen2,
|
||||
IconTrain,
|
||||
IconPlant2,
|
||||
} from "@tabler/icons-react";
|
||||
import type { ComponentType } from "react";
|
||||
import { APP_TITLE } from "@/lib/app-config";
|
||||
import { useEffect } from "react";
|
||||
import { useSearchParams } from "react-router";
|
||||
|
||||
import { CINEMAS, getCinema } from "@/lib/cinemas";
|
||||
import { useLang } from "@/lib/i18n";
|
||||
import { CinemaCard } from "@/components/cinema/CinemaCard";
|
||||
import { CinemaDetailSheet } from "@/components/cinema/CinemaDetailSheet";
|
||||
import { SiteFooter, SiteHeader } from "@/components/cinema/SiteHeader";
|
||||
|
||||
export function meta() {
|
||||
return [
|
||||
{ title: "House Cinema Samyan" },
|
||||
{ name: "description", content: `${APP_TITLE} cinema details` },
|
||||
{ title: "AlterFlixHub — โรงภาพยนตร์" },
|
||||
{
|
||||
name: "description",
|
||||
content: "เลือกโรงภาพยนตร์ที่ใช่ ดูรอบฉายและรายละเอียดได้ในที่เดียว",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
const BRAND = "#8F0808";
|
||||
const BORDER = "#332B2B";
|
||||
|
||||
const tags = ["หนังนอกกระแส", "อาร์ตเฮาส์"];
|
||||
|
||||
const transport: {
|
||||
icon: ComponentType<{ size?: number }> | null;
|
||||
label: string;
|
||||
value: string;
|
||||
}[] = [
|
||||
{ icon: null, label: "รถยนต์ส่วนตัว", value: "ที่จอดรถภายในศูนย์การค้าสามย่านมิตรทาวน์" },
|
||||
{ icon: IconTrain, label: "รถไฟฟ้า", value: "MRT สถานีสามย่าน" },
|
||||
{ icon: IconBus, label: "รถประจำทาง", value: "29, 34, 36, 40, 47, 50" },
|
||||
];
|
||||
|
||||
const contacts = [
|
||||
{ label: "Website", value: "www.housesamyan.com" },
|
||||
{ label: "Mobile Application", value: "House Cinema" },
|
||||
{ label: "Facebook", value: "House Samyan" },
|
||||
{ label: "Call", value: "098-869-0997" },
|
||||
];
|
||||
|
||||
const payments = ["เงินสด", "บัตรเครดิต", "สแกนจ่าย"];
|
||||
|
||||
const facilities: {
|
||||
icon: ComponentType<{ size?: number; stroke?: number }>;
|
||||
title: string;
|
||||
sub: string;
|
||||
}[] = [
|
||||
{ icon: IconSofa, title: "โซนนั่งรอ", sub: "บริเวณโถงโรงภาพยนตร์" },
|
||||
{ icon: IconTicket, title: "จุดจำหน่ายตั๋ว", sub: "Box Office ชั้น 5" },
|
||||
{ icon: IconToolsKitchen2, title: "ร้านอาหาร", sub: "ภายในศูนย์การค้า" },
|
||||
{ icon: IconCoffee, title: "ร้านคาเฟ่", sub: "บริเวณโถงโรงภาพยนตร์" },
|
||||
{ icon: IconPlant2, title: "สวนหย่อม", sub: "ลานกลางแจ้ง" },
|
||||
{ icon: IconBook, title: "ร้านหนังสือ", sub: "ภายในศูนย์การค้า" },
|
||||
{ icon: IconBriefcase, title: "Co-Learning Space", sub: "บริเวณโถงโรงภาพยนตร์" },
|
||||
{ icon: IconShoppingBag, title: "อื่นๆ", sub: "ร้านทำผม ร้านทำเล็บ" },
|
||||
];
|
||||
|
||||
const socials = [
|
||||
IconBrandFacebook,
|
||||
IconBrandInstagram,
|
||||
IconBrandLinkedin,
|
||||
IconBrandYoutube,
|
||||
IconBrandTelegram,
|
||||
];
|
||||
|
||||
function Logo() {
|
||||
return (
|
||||
<span
|
||||
className="text-4xl leading-none"
|
||||
style={{ fontFamily: "'Jersey 15', sans-serif", color: BRAND }}
|
||||
>
|
||||
AlterFlixHub
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* หน้าแรก (Home) — รายการโรงภาพยนตร์ + รายละเอียดในหน้าเดียวกัน
|
||||
* ------------------------------------------------------------
|
||||
* ★ เว็บหน้าเดียว: การ์ด → เปิด sheet ทับ ไม่เปลี่ยน route, ไม่รีเฟรช
|
||||
* รายการด้านหลังไม่ unmount → scroll ที่เลื่อนไว้ยังอยู่
|
||||
* ★ URL = /?cinema=<slug> (pushState) → แชร์ลิงก์ได้, back ปิด sheet
|
||||
* ★ มือถือ 6" (360–430px): การ์ด 1 คอลัมน์แนวนอน, sheet เต็มจอ
|
||||
* ★ แท็บเล็ต (640–1023px): 2 คอลัมน์
|
||||
* ★ เดสก์ท็อป (≥1024px): 3 คอลัมน์, sheet กลางจอ
|
||||
*/
|
||||
export default function HomeRoute() {
|
||||
const { t } = useLang();
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const activeSlug = searchParams.get("cinema");
|
||||
const activeCinema = getCinema(activeSlug ?? undefined);
|
||||
|
||||
/** เปิดรายละเอียด — push history entry (ปุ่ม back ของเบราว์เซอร์จะปิด sheet) */
|
||||
const openCinema = (slug: string) => {
|
||||
setSearchParams({ cinema: slug });
|
||||
};
|
||||
|
||||
/** ปิด — replace เพื่อไม่ให้ history บวมด้วย entry ของ state "ปิด" */
|
||||
const closeCinema = () => {
|
||||
setSearchParams({}, { replace: true });
|
||||
};
|
||||
|
||||
/* title เปลี่ยนตามโรงที่เปิด — ลิงก์ที่แชร์จะได้ชื่อถูก */
|
||||
useEffect(() => {
|
||||
document.title = activeCinema
|
||||
? `${activeCinema.name} — AlterFlixHub`
|
||||
: "AlterFlixHub — โรงภาพยนตร์";
|
||||
}, [activeCinema]);
|
||||
|
||||
return (
|
||||
<div className="relative min-h-screen overflow-hidden bg-[#0D0D0D] text-white">
|
||||
<div className="relative min-h-full bg-gradient-to-b from-[#0a0a0a] via-[#160505] to-[#0a0a0a] text-white">
|
||||
{/* แสงแดงเรือง ๆ หลัง hero — decorative */}
|
||||
<div
|
||||
className="pointer-events-none absolute left-1/2 top-[649px] size-[382px] -translate-x-1/2 rounded-full opacity-[0.66] blur-[237px]"
|
||||
className="pointer-events-none absolute left-1/2 top-20 h-56 w-56 -translate-x-1/2 rounded-full opacity-50 blur-[110px] sm:top-28 sm:h-80 sm:w-80 sm:blur-[140px]"
|
||||
style={{ background: "#4C0404" }}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
|
||||
<header className="relative flex items-center justify-between px-4 py-4 md:px-[108px]">
|
||||
<Logo />
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="h-4 w-[21px] overflow-hidden">
|
||||
<div className="h-[2.75px] bg-[#A51931]" />
|
||||
<div className="mt-[2.67px] h-[5.33px] bg-[#2D2A4A]" />
|
||||
<div className="mt-[2.66px] h-[2.67px] bg-[#A51931]" />
|
||||
</div>
|
||||
<span className="text-lg font-medium">TH</span>
|
||||
<IconChevronDown size={16} />
|
||||
</div>
|
||||
</header>
|
||||
<SiteHeader />
|
||||
|
||||
<main className="relative mx-auto flex w-full max-w-[1440px] flex-col gap-10 px-4 pb-16 pt-4 md:px-[108px] md:pt-6">
|
||||
<a
|
||||
href="/"
|
||||
className="inline-flex w-fit items-center gap-2 text-xl font-medium"
|
||||
>
|
||||
<IconArrowBackUp size={24} />
|
||||
ย้อนกลับ
|
||||
</a>
|
||||
|
||||
<section className="grid gap-6 lg:grid-cols-[minmax(0,807px)_minmax(0,387px)]">
|
||||
<div className="relative aspect-[269/202] w-full overflow-hidden rounded-xl bg-neutral-400 lg:aspect-auto lg:h-[606px]">
|
||||
<div className="absolute inset-0 bg-black/20" />
|
||||
<button
|
||||
aria-label="Previous"
|
||||
className="absolute left-6 top-1/2 flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/50"
|
||||
<main className="relative mx-auto w-full max-w-[1160px] px-4 pb-10 sm:px-5 sm:pb-14">
|
||||
{/* ---------- Hero ---------- */}
|
||||
<section className="py-8 text-center sm:py-12 lg:py-16">
|
||||
<h1 className="mx-auto max-w-[22ch] text-[28px] font-black leading-[1.2] tracking-tight sm:text-[38px] lg:text-[48px]">
|
||||
<span
|
||||
className="bg-clip-text text-transparent"
|
||||
style={{
|
||||
backgroundImage:
|
||||
"linear-gradient(135deg,#ff1f1f 0%,#e00000 45%,#7a0000 100%)",
|
||||
}}
|
||||
>
|
||||
<IconChevronLeft size={24} />
|
||||
</button>
|
||||
<button
|
||||
aria-label="Next"
|
||||
className="absolute right-6 top-1/2 flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/50"
|
||||
>
|
||||
<IconChevronRight size={24} />
|
||||
</button>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-6 lg:grid-cols-1 lg:grid-rows-2">
|
||||
<div className="aspect-[387/290] rounded-xl bg-neutral-400" />
|
||||
<div className="relative aspect-[387/290] overflow-hidden rounded-xl bg-neutral-400">
|
||||
<div className="absolute inset-0 bg-black/20" />
|
||||
<div className="absolute bottom-2.5 right-2.5 flex size-[60px] items-center justify-center rounded-lg bg-black/80 text-lg font-medium">
|
||||
5+
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{t("home.hero1")}
|
||||
</span>
|
||||
<br />
|
||||
{t("home.hero2")}
|
||||
</h1>
|
||||
<p className="mx-auto mt-3 max-w-[40ch] text-sm leading-relaxed text-[#9ca3af] sm:mt-4 sm:max-w-[52ch] sm:text-base">
|
||||
{t("home.lead")}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section className="grid gap-10 lg:grid-cols-[minmax(0,749px)_minmax(0,384px)] lg:justify-between">
|
||||
<div className="flex flex-col gap-12">
|
||||
<div className="flex flex-col gap-6">
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{tags.map((t) => (
|
||||
<span
|
||||
key={t}
|
||||
className="rounded-[18px] border border-[#A92626] px-4 py-2 text-sm text-[#D47272]"
|
||||
style={{
|
||||
background:
|
||||
"linear-gradient(180deg, rgba(143,8,8,0.3) 0%, rgba(27,27,27,0) 100%)",
|
||||
}}
|
||||
>
|
||||
{t}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<h1 className="text-[40px] font-bold leading-[1.3]">
|
||||
HOUSE CINEMA SAMYAN
|
||||
</h1>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center justify-between gap-4">
|
||||
<div className="flex items-center gap-2 text-lg">
|
||||
<IconMapPin size={24} className="shrink-0" />
|
||||
ชั้น 5 สามย่านมิตรทาวน์ กรุงเทพฯ
|
||||
</div>
|
||||
<a
|
||||
href="https://maps.google.com/?q=House+Samyan"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="flex w-[200px] items-center justify-center gap-2 rounded-lg border border-white px-4 py-2 text-lg font-medium"
|
||||
>
|
||||
เปิด Google map
|
||||
<IconMap size={24} />
|
||||
</a>
|
||||
</div>
|
||||
<p className="text-xl leading-[1.3]">
|
||||
โรงภาพยนตร์สำหรับคนที่อยากค้นพบหนังหลากหลาย
|
||||
เน้นภาพยนตร์นอกกระแสและเรื่องที่ไม่ได้
|
||||
เข้าฉายในวงกว้าง พร้อมเรื่องราวและมุมมองที่แตกต่างสำหรับคนรักหนัง
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col">
|
||||
{transport.map((r, i) => (
|
||||
<div
|
||||
key={r.label}
|
||||
className="flex flex-col justify-between gap-1 py-2.5 sm:min-h-10 sm:flex-row sm:gap-4"
|
||||
style={{
|
||||
borderBottom: i < 2 ? `1px solid ${BORDER}` : undefined,
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center gap-2 font-medium">
|
||||
{r.icon ? (
|
||||
<r.icon size={20} />
|
||||
) : (
|
||||
<img
|
||||
src="https://api.builder.io/api/v1/image/assets/TEMP/7f9d444f475087649cf684a31d477823ae1ccd5a?width=40"
|
||||
alt=""
|
||||
className="size-5"
|
||||
/>
|
||||
)}
|
||||
{r.label}
|
||||
</div>
|
||||
<div className="sm:text-right">{r.value}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside
|
||||
className="flex flex-col justify-between gap-6 rounded-xl p-6"
|
||||
style={{ border: `1px solid ${BORDER}` }}
|
||||
>
|
||||
<div className="flex flex-col gap-4">
|
||||
<h2 className="text-2xl font-semibold leading-[1.3]">
|
||||
สอบถามข้อมูลและจองตั๋ว
|
||||
</h2>
|
||||
{contacts.map((c) => (
|
||||
<div key={c.label} className="flex flex-col gap-2">
|
||||
<span className="text-sm text-[#999]">{c.label}</span>
|
||||
<div className="flex items-center justify-between">
|
||||
<span>{c.value}</span>
|
||||
<IconExternalLink size={16} />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<div className="flex flex-col gap-3">
|
||||
<span className="text-sm text-[#999]">Payment</span>
|
||||
<div className="flex flex-wrap items-center gap-6">
|
||||
{payments.map((p) => (
|
||||
<span key={p} className="flex items-center gap-1 text-sm">
|
||||
<IconCircleCheck size={16} />
|
||||
{p}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
className="flex h-12 items-center justify-center gap-2 rounded-lg px-4"
|
||||
style={{ background: BRAND, border: `1px solid ${BRAND}` }}
|
||||
>
|
||||
ดูรอบฉาย
|
||||
</button>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
<section className="grid gap-10 lg:grid-cols-[minmax(0,749px)_minmax(0,384px)] lg:justify-between">
|
||||
<div className="flex flex-col gap-8">
|
||||
<h2 className="text-2xl font-semibold leading-[1.3]">
|
||||
สิ่งอำนวยความสะดวก
|
||||
{/* ---------- รายการโรงภาพยนตร์ ---------- */}
|
||||
<section aria-labelledby="cinemas-heading">
|
||||
<div className="mb-3 flex items-baseline gap-2 sm:mb-4">
|
||||
<h2 id="cinemas-heading" className="text-lg font-extrabold sm:text-xl">
|
||||
{t("home.sectionTitle")}
|
||||
</h2>
|
||||
<div className="grid grid-cols-2 gap-x-4 gap-y-10 sm:grid-cols-4">
|
||||
{facilities.map((f) => (
|
||||
<div key={f.title} className="flex flex-col items-center gap-3">
|
||||
<div
|
||||
className="flex size-[72px] items-center justify-center rounded-full"
|
||||
style={{ background: "rgba(143,8,8,0.4)" }}
|
||||
>
|
||||
<f.icon size={40} stroke={1.5} />
|
||||
</div>
|
||||
<div className="text-center">
|
||||
<div className="font-medium">{f.title}</div>
|
||||
<div className="mt-1 text-sm text-[#B3B3B3]">{f.sub}</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<span className="text-xs text-[#9ca3af] sm:text-sm">
|
||||
{t("home.count", { n: CINEMAS.length })}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<aside
|
||||
className="flex flex-col gap-6 self-start rounded-xl p-6"
|
||||
style={{ border: `1px solid ${BORDER}` }}
|
||||
>
|
||||
<div className="flex flex-col gap-4">
|
||||
<h2 className="text-2xl font-semibold leading-[1.3]">ที่ตั้ง</h2>
|
||||
<div className="h-[183px] rounded-xl bg-[#E8E8E8]" />
|
||||
</div>
|
||||
<p className="text-sm leading-[1.3] text-[#999]">
|
||||
ชั้น 5 ศูนย์การค้าสามย่านมิตรทาวน์
|
||||
<br />
|
||||
944/1 ถนนพระราม 4 แขวงวังใหม่ เขตปทุมวัน กรุงเทพฯ 10330
|
||||
housesamyan.com
|
||||
</p>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
<section className="flex flex-col gap-8">
|
||||
<h2 className="text-2xl font-semibold leading-[1.3]">
|
||||
โรงหนังอิสระอื่นๆ
|
||||
</h2>
|
||||
<img
|
||||
src="https://api.builder.io/api/v1/image/assets/TEMP/576da98b280302b92da72afe31f5bf53689a401e?width=2448"
|
||||
alt="Cards"
|
||||
className="w-full"
|
||||
/>
|
||||
{/* มือถือ = 1 คอลัมน์ · แท็บเล็ต = 2 · เดสก์ท็อป = 3 */}
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4 lg:grid-cols-3">
|
||||
{CINEMAS.map((cinema) => (
|
||||
<CinemaCard key={cinema.slug} cinema={cinema} onSelect={openCinema} />
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer className="relative flex flex-col items-center gap-10 px-4 py-10 md:px-[108px]">
|
||||
<Logo />
|
||||
<div className="flex gap-8">
|
||||
{socials.map((I, i) => (
|
||||
<I key={i} size={42} stroke={1.25} />
|
||||
))}
|
||||
</div>
|
||||
<div className="flex w-full max-w-[1218px] flex-col items-center gap-8">
|
||||
<div className="h-px w-full bg-white/20" />
|
||||
<p className="text-sm">Copyright © AlterFlixHub</p>
|
||||
</div>
|
||||
</footer>
|
||||
<SiteFooter />
|
||||
|
||||
{/* ---------- รายละเอียด (overlay บนหน้าเดิม) ---------- */}
|
||||
<CinemaDetailSheet
|
||||
slug={activeCinema ? activeCinema.slug : null}
|
||||
onClose={closeCinema}
|
||||
onSelectCinema={openCinema}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user