- Introduced new CSS animations for jackpot effects to improve visual engagement. - Integrated CurrencySwitcher into PlayerPanel and HallScreen for better currency management. - Updated various components to utilize active player currency for consistent display. - Enhanced event handling for currency changes to ensure real-time updates across the application.
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import { cn } from "@/lib/utils";
|
|
|
|
export function ticketStatusDisplay(
|
|
status: string,
|
|
winMinor: number,
|
|
jackpotMinor: number,
|
|
t?: (key: string, options?: { defaultValue?: string; status?: string }) => string,
|
|
): { label: string; dotClass: string; ring?: boolean } {
|
|
const total = winMinor + jackpotMinor;
|
|
if (status === "success" || status === "pending_draw") {
|
|
return {
|
|
label: t?.(status === "pending_draw" ? "ticketStatus.pending_draw" : "ticketStatus.success") ?? status,
|
|
dotClass: "bg-sky-500",
|
|
};
|
|
}
|
|
if (status === "pending_payout") {
|
|
return { label: t?.("ticketStatus.pending_payout") ?? status, dotClass: "bg-amber-500" };
|
|
}
|
|
if (status === "settled_win" && total > 0) {
|
|
return { label: t?.("ticketStatus.settled_win") ?? status, dotClass: "bg-emerald-500" };
|
|
}
|
|
if (status === "settled_lose" || status === "settled_win") {
|
|
return {
|
|
label: t?.("ticketStatus.settled_lose") ?? status,
|
|
dotClass: "bg-background",
|
|
ring: true,
|
|
};
|
|
}
|
|
return {
|
|
label: t?.("ticketStatus.unknown", { status, defaultValue: status }) ?? status,
|
|
dotClass: "bg-red-500",
|
|
};
|
|
}
|
|
|
|
export function StatusDot({
|
|
label,
|
|
dotClass,
|
|
ring,
|
|
}: {
|
|
label: string;
|
|
dotClass: string;
|
|
ring?: boolean;
|
|
}) {
|
|
return (
|
|
<span className="inline-flex shrink-0 items-center gap-1.5 rounded-full border border-[#e5edf8] bg-[#f8fbff] px-2 py-1 text-xs font-bold text-slate-600">
|
|
<span
|
|
className={cn(
|
|
"inline-block size-2 shrink-0 rounded-full",
|
|
dotClass,
|
|
ring && "ring-1 ring-muted-foreground/50",
|
|
)}
|
|
aria-hidden
|
|
/>
|
|
<span>{label}</span>
|
|
</span>
|
|
);
|
|
}
|