78 lines
2.8 KiB
TypeScript
78 lines
2.8 KiB
TypeScript
import {
|
|
IconBook,
|
|
IconBriefcase,
|
|
IconCoffee,
|
|
IconPlant2,
|
|
IconShoppingBag,
|
|
IconSofa,
|
|
IconTicket,
|
|
IconToolsKitchen2,
|
|
type Icon as TablerIcon,
|
|
} from "@tabler/icons-react";
|
|
|
|
import { LocationPanel } from "@/components/cinema/LocationPanel";
|
|
import { cinemaFacilities, type Cinema } from "@/lib/cinemas";
|
|
import { useI18n } from "@/lib/i18n";
|
|
import type { FacilityKey } from "@/lib/i18n/messages";
|
|
import { COLORS } from "@/lib/design-tokens";
|
|
|
|
const FACILITY_ICONS: Record<FacilityKey, TablerIcon> = {
|
|
seating: IconSofa,
|
|
ticket: IconTicket,
|
|
restaurant: IconToolsKitchen2,
|
|
cafe: IconCoffee,
|
|
garden: IconPlant2,
|
|
bookstore: IconBook,
|
|
colearning: IconBriefcase,
|
|
other: IconShoppingBag,
|
|
};
|
|
|
|
/** สิ่งอำนวยความสะดวก (ซ้าย) + ที่ตั้ง (ขวา) ตาม layout ใน Figma */
|
|
export function FacilitiesSection({ cinema }: { cinema: Cinema }) {
|
|
const { locale, messages } = useI18n();
|
|
const facilities = cinemaFacilities(cinema);
|
|
|
|
return (
|
|
<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]">
|
|
{messages.detail.facilities}
|
|
</h2>
|
|
{facilities.length > 0 ? (
|
|
<div className="grid grid-cols-2 gap-x-4 gap-y-10 sm:grid-cols-4">
|
|
{facilities.map((key) => {
|
|
const Icon = FACILITY_ICONS[key];
|
|
const base = messages.facilities[key];
|
|
const custom = cinema.facility_details?.[key];
|
|
const title = custom?.label?.trim() || base.title;
|
|
// คำอธิบายแสดงเฉพาะที่กรอกไว้รายโรง (ค่าเริ่มต้นใช้เป็น placeholder ในหลังบ้าน)
|
|
const sub =
|
|
(locale === "en" ? custom?.sub_en : custom?.sub_th)?.trim() ?? "";
|
|
return (
|
|
<div key={key} className="flex flex-col items-center gap-3">
|
|
<div
|
|
className="flex size-[72px] items-center justify-center rounded-full"
|
|
style={{ background: COLORS.glowSoft }}
|
|
>
|
|
<Icon size={40} stroke={1.5} />
|
|
</div>
|
|
<div className="text-center">
|
|
<div className="font-medium">{title}</div>
|
|
{sub ? (
|
|
<div className="mt-1 text-sm text-[#B3B3B3]">{sub}</div>
|
|
) : null}
|
|
</div>
|
|
</div>
|
|
);
|
|
})}
|
|
</div>
|
|
) : (
|
|
<p className="text-sm text-[#777]">{messages.detail.noData}</p>
|
|
)}
|
|
</div>
|
|
|
|
<LocationPanel cinema={cinema} />
|
|
</section>
|
|
);
|
|
}
|