'use client'; import React, { useState } from 'react'; import type { Locale } from '@/lib/locale'; import { pickLocaleText } from '@/lib/locale'; interface TopUpModalProps { open: boolean; onClose: () => void; onConfirm: (amount: number) => void; amounts?: number[]; isDark: boolean; locale: Locale; } const DEFAULT_AMOUNTS = [50, 100, 500, 1000]; export default function TopUpModal({ open, onClose, onConfirm, amounts, isDark, locale }: TopUpModalProps) { const amountOptions = amounts ?? DEFAULT_AMOUNTS; const [selected, setSelected] = useState(null); if (!open) return null; const handleConfirm = () => { if (selected !== null) { onConfirm(selected); } }; return (
{/* Header */}

{pickLocaleText(locale, '选择充值金额', 'Select Amount')}

{/* Amount grid */}
{amountOptions.map((amount) => { const isSelected = selected === amount; return ( ); })}
{/* Confirm button */}
); }