feat(admin, i18n): enhance reports, draws, config, and player workflows

This commit is contained in:
2026-06-08 17:41:55 +08:00
parent af982bb9f7
commit 7e65c53732
55 changed files with 1986 additions and 804 deletions

View File

@@ -59,6 +59,7 @@ export type AgentLineDetailPanelProps = {
canViewPlayersTab: boolean;
canManageNode: boolean;
canCreateChild: boolean;
canCreateChildAgent: boolean;
canDeleteChild: (node: AgentNodeRow) => boolean;
onEditChild: (node: AgentNodeRow) => void;
onDeleteChild: (node: AgentNodeRow) => void;
@@ -88,6 +89,7 @@ export function AgentLineDetailPanel({
canViewPlayersTab,
canManageNode,
canCreateChild,
canCreateChildAgent,
canDeleteChild,
onEditChild,
onDeleteChild,
@@ -155,6 +157,17 @@ export function AgentLineDetailPanel({
siteLabel && siteCode.trim() !== ""
? `${siteLabel} (${siteCode})`
: siteLabel ?? siteCode;
const codeText = typeof node.code === "string" ? node.code.trim() : "";
const usernameText = typeof node.username === "string" ? node.username.trim() : "";
const childActionHint = canCreateChild
? null
: canCreateChildAgent
? t("lineUi.addChildUnavailableHint", {
defaultValue: "当前代理未开启“允许创建下级代理”,如需新增请先调整该代理配置。",
})
: t("lineUi.addChildNoPermissionHint", {
defaultValue: "当前账号没有为该节点创建下级代理的权限。",
});
return (
<div className="flex min-h-[28rem] min-w-0 flex-1 flex-col bg-background">
@@ -171,21 +184,25 @@ export function AgentLineDetailPanel({
: t("common:status.disabled", { defaultValue: "停用" })}
</AdminStatusBadge>
</div>
<p className="mt-1.5 text-sm text-muted-foreground">
<span className="font-mono text-xs text-foreground/80">{node.code}</span>
{node.username ? (
<>
<span className="mx-1.5 text-border">·</span>
{node.username}
</>
) : null}
{parentName ? (
<>
<span className="mx-1.5 text-border">·</span>
{t("parentAgent", { defaultValue: "上级代理" })} {parentName}
</>
) : null}
</p>
{(codeText !== "" || usernameText !== "" || parentName) ? (
<div className="mt-2 flex flex-wrap items-center gap-2 text-sm text-muted-foreground">
{codeText !== "" ? (
<span className="rounded-md bg-muted/50 px-2 py-1 font-mono text-xs text-foreground/80">
{t("lineUi.agentCode", { defaultValue: "编码" })} {codeText}
</span>
) : null}
{usernameText !== "" ? (
<span className="rounded-md bg-muted/50 px-2 py-1 text-xs">
{t("lineUi.agentUsername", { defaultValue: "账号" })} {usernameText}
</span>
) : null}
{parentName ? (
<span className="rounded-md bg-muted/50 px-2 py-1 text-xs">
{t("parentAgent", { defaultValue: "上级代理" })} {parentName}
</span>
) : null}
</div>
) : null}
</div>
<div className="flex shrink-0 flex-col items-end gap-2 sm:flex-row sm:items-center">
@@ -202,16 +219,23 @@ export function AgentLineDetailPanel({
</div>
) : null}
{canManageNode ? (
<div className="flex flex-wrap justify-end gap-2">
<Button type="button" size="sm" variant="outline" onClick={onEditCurrent}>
<Pencil className="mr-1.5 size-3.5" />
{t("lineUi.editAccount", { defaultValue: "账号与状态" })}
</Button>
{canCreateChild ? (
<Button type="button" size="sm" onClick={onAddChild}>
<Plus className="mr-1.5 size-3.5" />
{t("createChild", { defaultValue: "添加下级代理" })}
<div className="flex max-w-[28rem] flex-col items-end gap-2">
<div className="flex flex-wrap justify-end gap-2">
<Button type="button" size="sm" variant="outline" onClick={onEditCurrent}>
<Pencil className="mr-1.5 size-3.5" />
{t("lineUi.editAgent", { defaultValue: "编辑代理" })}
</Button>
{canCreateChild ? (
<Button type="button" size="sm" onClick={onAddChild}>
<Plus className="mr-1.5 size-3.5" />
{t("createChild", { defaultValue: "添加下级代理" })}
</Button>
) : null}
</div>
{childActionHint ? (
<p className="text-right text-xs leading-5 text-muted-foreground">
{childActionHint}
</p>
) : null}
</div>
) : null}
@@ -267,7 +291,7 @@ export function AgentLineDetailPanel({
})
: t("lineUi.profileTabHint", {
defaultValue:
"占成、授信、回水与风控标签在此维护;登录名密码请用「账号与状态」。",
"占成、授信、回水与风控标签在此维护;登录名密码与启停状态请用「编辑代理」。",
})}
</p>
</CardHeader>
@@ -426,7 +450,7 @@ function OverviewTab({
defaultValue: "{{count}} 个,可在对应 Tab 管理下级代理。",
count: childCount,
})}
actionLabel={t("lineUi.viewAll", { defaultValue: "查看全部" })}
actionLabel={t("lineUi.viewDownline", { defaultValue: "查看直属下级" })}
onAction={onGoToDownline}
/>
) : null}
@@ -437,7 +461,7 @@ function OverviewTab({
description={t("lineUi.overviewPlayersHint", {
defaultValue: "直属玩家请在「直属玩家」Tab 维护。",
})}
actionLabel={t("lineUi.viewAll", { defaultValue: "查看全部" })}
actionLabel={t("lineUi.viewPlayers", { defaultValue: "查看直属玩家" })}
onAction={onGoToPlayers}
/>
) : null}
@@ -509,6 +533,9 @@ function DownlineTable({
onAddChild: () => void;
}): React.ReactElement {
const { t } = useTranslation(["agents", "common"]);
const createChildLabel = t("lineUi.createDownline", { defaultValue: "创建下级代理" });
const editChildLabel = t("lineUi.editDownline", { defaultValue: "编辑代理" });
const deleteChildLabel = t("lineUi.deleteDownline", { defaultValue: "删除代理" });
if (childAgents.length === 0) {
return (
@@ -517,7 +544,7 @@ function DownlineTable({
{canManageNode && canCreateChild ? (
<Button type="button" className="mt-2" onClick={onAddChild}>
<Plus className="mr-1.5 size-4" />
{t("createChild", { defaultValue: "添加下级代理" })}
{createChildLabel}
</Button>
) : null}
</AdminNoResourceState>
@@ -604,13 +631,13 @@ function DownlineTable({
actions={[
{
key: "edit",
label: t("editNode", { defaultValue: "编辑代理" }),
label: editChildLabel,
icon: Pencil,
onClick: () => onEditChild(child),
},
{
key: "delete",
label: t("deleteNode", { defaultValue: "删除代理" }),
label: deleteChildLabel,
icon: Trash2,
destructive: true,
disabled: !canDeleteChild(child),