refactor: update agent API schemas, standardize UI text styling, and enhance settlement credit ledger components

This commit is contained in:
2026-06-11 18:02:02 +08:00
parent 44ad51698f
commit 1eb6702c51
54 changed files with 1888 additions and 1103 deletions

View File

@@ -107,6 +107,17 @@ function unpaidMoneyClass(row: SettlementBillRow): string {
return "font-medium text-amber-800 dark:text-amber-300";
}
function paidMoneyClass(row: SettlementBillRow): string {
if ((row.paid_amount ?? 0) <= 0) {
return "text-muted-foreground";
}
if (row.unpaid_amount > 0) {
return "font-medium text-amber-800 dark:text-amber-300";
}
return "font-medium text-emerald-700";
}
function ownerPartyLabel(row: SettlementBillRow): string | null {
if (row.bill_type === "player") {
return row.player_username ?? row.owner_label ?? null;
@@ -118,18 +129,6 @@ function ownerPartyLabel(row: SettlementBillRow): string | null {
return row.owner_label ?? null;
}
function fundingModeHint(row: SettlementBillRow, t: (key: string, options?: Record<string, unknown>) => string) {
if (row.owner_funding_mode !== "credit") {
return null;
}
return (
<span className="rounded-full border border-border/70 bg-muted/30 px-1.5 py-0.5 text-[11px] font-normal leading-none text-muted-foreground">
{t("columns.creditMode", { defaultValue: "信用盘" })}
</span>
);
}
export function SettlementBillsTable({
rows,
loading,
@@ -211,10 +210,7 @@ export function SettlementBillsTable({
{playerView ? (
<>
<TableCell>
<div className="flex flex-wrap items-center gap-1.5">
<SettlementDashCell value={row.player_username ?? row.owner_label} />
{fundingModeHint(row, t)}
</div>
<SettlementDashCell value={row.player_username ?? row.owner_label} />
</TableCell>
<TableCell className="font-mono text-xs">
<SettlementDashCell
@@ -234,14 +230,7 @@ export function SettlementBillsTable({
) : null}
{mixedView ? (
<TableCell className="text-sm">
{isPlayerBill ? (
<div className="flex flex-wrap items-center gap-1.5">
<SettlementDashCell value={ownerPartyLabel(row)} />
{fundingModeHint(row, t)}
</div>
) : (
<SettlementDashCell value={ownerPartyLabel(row)} />
)}
<SettlementDashCell value={ownerPartyLabel(row)} />
</TableCell>
) : null}
<TableCell className="min-w-[10rem] text-sm">
@@ -275,7 +264,7 @@ export function SettlementBillsTable({
{formatDashboardMoneyMinor(direction.amount, currencyCode)}
</div>
</TableCell>
<TableCell className="text-right tabular-nums text-muted-foreground">
<TableCell className={cn("text-right tabular-nums", paidMoneyClass(row))}>
{formatDashboardMoneyMinor(row.paid_amount ?? 0, currencyCode)}
</TableCell>
<TableCell className={cn("text-right tabular-nums", unpaidMoneyClass(row))}>