"use client";
import { cn } from "@/lib/utils";
import { useEffect, useState } from "react";
type Item = {
id: string;
text: string;
emoji: string;
soundCategory: string;
gridIndex: number;
};
type Props = {
item: Item | null;
index: number;
marked: boolean;
markCount: number;
markedBy: string[];
gridSize: number;
onMark: (itemId: string) => void;
disabled?: boolean;
isFreeSpace?: boolean;
};
function getSoundEmoji(cat: string) {
switch (cat) {
case "horn": return "🎺";
case "alarm": return "🚨";
case "flood": return "🌊";
case "explosion": return "💥";
case "monster": return "👹";
case "death": return "💀";
case "chaos": return "🔥";
default: return "🔔";
}
}
export function BingoCell({ item, index, marked, markCount, markedBy, gridSize, onMark, disabled, isFreeSpace }: Props) {
const [shake, setShake] = useState(false);
const [glow, setGlow] = useState(false);
useEffect(() => {
if (marked) {
setShake(true);
setGlow(true);
const t1 = setTimeout(() => setShake(false), 300);
const t2 = setTimeout(() => setGlow(false), 2000);
return () => { clearTimeout(t1); clearTimeout(t2); };
}
}, [marked]);
if (!item) {
return (
5 ? "p-1" : "p-2"
)}>
✖
);
}
const isFree = isFreeSpace || item.text.startsWith("FREE SPACE");
return (
);
}