refactor: 重构奖池配置页面,移除冗余组件,优化加载体验与国际化支持

This commit is contained in:
2026-05-21 16:46:48 +08:00
parent 3ce84af39c
commit 26feed3c4f
29 changed files with 393 additions and 213 deletions

View File

@@ -53,7 +53,12 @@ function toDraft(p: AdminJackpotPoolRow): Draft {
};
}
export function JackpotPoolsConsole() {
type JackpotPoolsConsoleProps = {
/** 嵌入运营配置单页时去掉外层脚手架与重复标题 */
embedded?: boolean;
};
export function JackpotPoolsConsole({ embedded = false }: JackpotPoolsConsoleProps) {
const { t } = useTranslation(["jackpot", "common"]);
const [items, setItems] = useState<AdminJackpotPoolRow[]>([]);
const [drafts, setDrafts] = useState<Record<number, Draft>>({});
@@ -146,13 +151,14 @@ export function JackpotPoolsConsole() {
}
};
return (
<ModuleScaffold>
<Card>
const body = (
<Card className={embedded ? "border-border/60 shadow-none" : undefined}>
{!embedded ? (
<CardHeader>
<CardTitle className="text-base">{t("configTitle")}</CardTitle>
</CardHeader>
<CardContent className="space-y-8">
) : null}
<CardContent className="space-y-8">
{loading ? <p className="text-muted-foreground text-sm">{t("states.loading", { ns: "common" })}</p> : null}
{!loading && items.length === 0 ? (
<p className="text-muted-foreground text-sm">{t("noPoolData")}</p>
@@ -288,8 +294,13 @@ export function JackpotPoolsConsole() {
</div>
);
})}
</CardContent>
</Card>
</ModuleScaffold>
</CardContent>
</Card>
);
if (embedded) {
return body;
}
return <ModuleScaffold>{body}</ModuleScaffold>;
}