"use client"; import { ArrowDownLeft, ArrowUpRight } from "lucide-react"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { TransferInPanel, TransferOutPanel, } from "@/features/wallet/wallet-transfer-forms"; import { cn } from "@/lib/utils"; type BaseProps = { currency: string; onSuccess: () => Promise; /** 避免同页多实例 input id 冲突 */ idPrefix?: string; }; export function TransferInDialog({ currency, lotteryMinor, onSuccess, idPrefix = "", triggerClassName, triggerVariant = "wallet", triggerLabel, }: BaseProps & { lotteryMinor: number; triggerClassName?: string; triggerVariant?: "wallet" | "hall"; triggerLabel?: string; }) { const [open, setOpen] = useState(false); const { t } = useTranslation("player"); const resolvedTriggerLabel = triggerLabel ?? t("wallet.transferIn"); return ( {t("wallet.transferInTitle")} {t("wallet.dialogInDescription", { currency })}
setOpen(false)} onSuccess={async () => { await onSuccess(); setOpen(false); }} />
); } export function TransferOutDialog({ currency, availableMinor, onSuccess, idPrefix = "", triggerClassName, triggerVariant = "wallet", triggerLabel, }: BaseProps & { availableMinor: number; triggerClassName?: string; triggerVariant?: "wallet" | "hall"; triggerLabel?: string; }) { const [open, setOpen] = useState(false); const { t } = useTranslation("player"); const resolvedTriggerLabel = triggerLabel ?? t("wallet.transferOut"); return ( {t("wallet.transferOutTitle")} {t("wallet.dialogOutDescription")}
setOpen(false)} onSuccess={async () => { await onSuccess(); setOpen(false); }} />
); }