feat(admin, settlement, dashboard): strengthen permission gating and billing workflows

This commit is contained in:
2026-06-09 13:44:19 +08:00
parent 7e65c53732
commit b7278e68a4
41 changed files with 900 additions and 199 deletions

View File

@@ -192,7 +192,7 @@ export function LoginForm() {
</div>
</CardHeader>
<form onSubmit={onSubmit}>
<CardContent className="flex flex-col gap-5 px-6 pt-6 sm:px-8">
<CardContent className="flex flex-col gap-5 px-6 py-6 sm:px-8">
<div className="flex flex-col gap-2">
<Label htmlFor="admin-account" className="text-sm font-medium">
{t("account")}

View File

@@ -4,9 +4,12 @@ import { useTranslation } from "react-i18next";
import { playerFundingModeLabel } from "@/lib/admin-player-display";
import { cn } from "@/lib/utils";
import type { AdminPlayerRow } from "@/types/api/admin-player";
type FundingRow = Pick<AdminPlayerRow, "funding_mode" | "uses_credit" | "auth_source">;
type FundingRow = {
funding_mode?: string | null;
uses_credit?: boolean;
auth_source?: string | null;
};
export function PlayerFundingModeBadge({
row,
@@ -41,25 +44,47 @@ export function PlayerLedgerSourceBadge({
className?: string;
}): React.ReactElement | null {
const { t } = useTranslation("wallet");
if (ledgerSource !== "credit_ledger" && ledgerSource !== "wallet_txn") {
if (
ledgerSource !== "credit_ledger" &&
ledgerSource !== "wallet_txn" &&
ledgerSource !== "payment_record" &&
ledgerSource !== "settlement_adjustment" &&
ledgerSource !== "share_ledger"
) {
return null;
}
const isCredit = ledgerSource === "credit_ledger";
const sourceClass =
ledgerSource === "wallet_txn"
? "border-sky-200 bg-sky-50 text-sky-900"
: ledgerSource === "payment_record"
? "border-emerald-200 bg-emerald-50 text-emerald-900"
: ledgerSource === "settlement_adjustment"
? "border-amber-200 bg-amber-50 text-amber-900"
: ledgerSource === "share_ledger"
? "border-indigo-200 bg-indigo-50 text-indigo-900"
: "border-violet-200 bg-violet-50 text-violet-900";
const label =
ledgerSource === "wallet_txn"
? t("ledgerWallet", { defaultValue: "钱包流水" })
: ledgerSource === "payment_record"
? t("ledgerPayment", { defaultValue: "收付记录" })
: ledgerSource === "settlement_adjustment"
? t("ledgerAdjustment", { defaultValue: "调账记录" })
: ledgerSource === "share_ledger"
? t("ledgerShare", { defaultValue: "分账" })
: t("ledgerCredit", { defaultValue: "信用流水" });
return (
<span
className={cn(
"inline-flex rounded-md border px-2 py-0.5 text-xs font-medium",
isCredit
? "border-violet-200 bg-violet-50 text-violet-900"
: "border-sky-200 bg-sky-50 text-sky-900",
sourceClass,
className,
)}
>
{isCredit
? t("ledgerCredit", { defaultValue: "信用流水" })
: t("ledgerWallet", { defaultValue: "钱包流水" })}
{label}
</span>
);
}