import {
IconBrandFacebook,
IconBrandInstagram,
IconBrandLine,
IconCircleCheck,
IconExternalLink,
IconMail,
IconPhone,
IconTicket,
IconWorld,
} from "@tabler/icons-react";
import type { Cinema, ContactChannel } from "@/lib/cinemas";
import { resolveContact, type ContactKind } from "@/lib/contact-link";
import { COLORS } from "@/lib/design-tokens";
import { useI18n } from "@/lib/i18n";
import { translate } from "@/lib/i18n/messages";
/** ไอคอนตามชนิดช่องทาง (เดาจาก label ก่อน แล้วค่อยดูจาก kind/URL) */
function ChannelIcon({
label,
kind,
href,
}: {
label: string;
kind: ContactKind | null;
href: string | null;
}) {
const text = label.toLowerCase();
const url = (href ?? "").toLowerCase();
if (kind === "tel") return ;
if (kind === "mailto") return ;
if (url.includes("facebook") || text.includes("facebook")) {
return ;
}
if (url.includes("instagram") || text.includes("instagram")) {
return ;
}
if (url.includes("line.me") || text.includes("line")) {
return ;
}
if (
text.includes("จอง") ||
text.includes("book") ||
text.includes("ticket")
) {
return ;
}
return ;
}
function ContactRow({ channel }: { channel: ContactChannel }) {
const resolved = resolveContact(channel);
const value =
channel.value.trim() === "" ? (channel.href ?? "") : channel.value;
const body = (
<>