import EditOutlined from "@mui/icons-material/EditOutlined"; import RefreshOutlined from "@mui/icons-material/RefreshOutlined"; import { AdminActionIconButton } from "@/shared/ui/AdminListLayout.jsx"; import { Button } from "@/shared/ui/Button.jsx"; import { formatMillis } from "@/shared/utils/time.js"; import { atmosphereLevelOptions, controlStrengthOptions, jackpotStrategyOptions, luckyGiftConfigScopeLabel, noviceStrengthOptions, optionLabel, payoutStyleOptions, poolModeOptions, } from "@/features/lucky-gift/constants.js"; import { formFromConfig } from "@/features/lucky-gift/configModel.js"; import styles from "@/features/lucky-gift/lucky-gift.module.css"; export function LuckyGiftConfigSummary({ canUpdate, config, configLoading, onEdit, onRefresh }) { const form = formFromConfig(config); return (
幸运礼物配置 {luckyGiftConfigScopeLabel}
{formatPercent(config?.targetRTPPPM)} {optionLabel(controlStrengthOptions, form.controlStrength)} {optionLabel(poolModeOptions, form.poolMode)} {optionLabel(noviceStrengthOptions, form.noviceStrength)} {optionLabel(payoutStyleOptions, form.payoutStyle)} {optionLabel(jackpotStrategyOptions, form.jackpotStrategy)} {optionLabel(atmosphereLevelOptions, form.atmosphereLevel)} {config?.updatedAtMs ? formatMillis(config.updatedAtMs) : configLoading ? "加载中" : "-"}
); } function SummaryItem({ children, label }) { return (
{label} {children}
); } function ConfigStatus({ config, loading }) { return ( {config?.enabled ? "已开启" : loading ? "加载中" : "已关闭"} ); } function formatPercent(ppm) { const value = Number(ppm || 0) / 10_000; return `${value.toFixed(2).replace(/\.?0+$/, "")}%`; }