feat(api, agents, i18n): enhance settlement features and multi-language support

Added new types and API functions for settlement period summaries and credit ledgers, improving the management of agent settlements. Updated the admin console to reflect these changes, enhancing user experience with better navigation and data presentation. Additionally, expanded multi-language support by incorporating new translations in English, Nepali, and Chinese for settlement-related terms, ensuring consistency across the platform.
This commit is contained in:
2026-06-05 18:00:59 +08:00
parent 65eaeecf8c
commit af982bb9f7
73 changed files with 4307 additions and 2494 deletions

View File

@@ -7,7 +7,7 @@ import { adminHasAnyPermission } from "@/lib/admin-permissions";
import { PRD_SETTLEMENT_AGENT_ACCESS_ANY } from "@/lib/admin-prd";
import { useAdminProfile } from "@/stores/admin-session";
/** 钱包模块仅服务主站钱包玩家;信用盘流水在结算中心。 */
/** 钱包模块仅服务主站钱包玩家;信用盘结账在结算中心。 */
export function WalletScopeHint(): React.ReactElement {
const { t } = useTranslation("wallet");
const profile = useAdminProfile();
@@ -23,11 +23,11 @@ export function WalletScopeHint(): React.ReactElement {
})}
{canSettlement ? (
<Link href="/admin/settlement-center" className="mx-1 text-primary underline">
{t("scopeHintSettlementLink", { defaultValue: "结算中心 → 信用流水" })}
{t("scopeHintSettlementLink", { defaultValue: "结算中心" })}
</Link>
) : (
<span className="mx-1 font-medium text-foreground">
{t("scopeHintSettlement", { defaultValue: "结算中心 → 信用流水" })}
{t("scopeHintSettlement", { defaultValue: "结算中心" })}
</span>
)}

View File

@@ -1,11 +1,10 @@
"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useTranslation } from "react-i18next";
import { AdminSubnav, AdminSubnavLink } from "@/components/admin/admin-subnav";
import { adminHasAnyPermission } from "@/lib/admin-permissions";
import { cn } from "@/lib/utils";
import { useAdminProfile } from "@/stores/admin-session";
const RECONCILE_PERMS = [
@@ -26,44 +25,23 @@ export function WalletSubnav(): React.ReactElement {
const perms = profile?.permissions;
return (
<nav
aria-label={t("subnavLabel")}
className="flex w-full flex-wrap items-end gap-1 border-b border-border/60 px-1"
>
<AdminSubnav aria-label={t("subnavLabel")}>
{tabs.map((tab) => {
const allowed = adminHasAnyPermission(perms, [...tab.requiredAny]);
const active = pathname === tab.href || pathname.startsWith(`${tab.href}/`);
if (!allowed) {
return (
<span
key={tab.href}
className={cn(
"border-b-2 border-transparent px-4 py-3 text-sm font-medium text-muted-foreground/45",
"cursor-not-allowed",
)}
title={t("noPermission")}
>
{t(tab.label)}
</span>
);
}
return (
<Link
<AdminSubnavLink
key={tab.href}
href={tab.href}
className={cn(
"border-b-2 px-4 py-3 text-sm font-medium transition-colors",
active
? "border-primary text-primary"
: "border-transparent text-muted-foreground hover:border-border/80 hover:text-foreground",
)}
active={active}
disabled={!allowed}
disabledTitle={t("noPermission")}
>
{t(tab.label)}
</Link>
</AdminSubnavLink>
);
})}
</nav>
</AdminSubnav>
);
}