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= */ onSelect?: (slug: string) => void; } /** * การ์ดโรงภาพยนตร์ * ★ มือถือ (<640px): การ์ดแนวนอน ปกซ้าย 112px → สแกน list ได้เร็ว กินพื้นที่น้อย * ★ แท็บเล็ต/เดสก์ท็อป: การ์ดแนวตั้ง ปก 16:9 * ★ ใช้ จริง (กดกลาง/เปิดแท็บใหม่ได้, 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) => { // ปล่อยให้เบราว์เซอร์จัดการถ้าผู้ใช้เปิดแท็บใหม่ / กด 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 ( {/* ปก */}
{isOpen ? t("status.open") : t("status.closed")}
{/* เนื้อหา */}

{cinema.name}

{cinema.area}

· {isOpen ? t("status.open") : t("status.closed")}
{/* แท็ก — ซ่อนบนมือถือเพื่อไม่ให้แน่น */} {cinema.tags.length > 0 && (
{cinema.tags.map((tag) => ( {tag} ))}
)}
); }