feat(api, i18n): add agent_node_id to various admin queries and enhance multi-language support

Introduced the agent_node_id field in AdminDrawListQuery, AdminPlayerListQuery, AdminSettlementBatchListQuery, TicketItemsListQuery, and TransferOrderListQuery to improve filtering capabilities. Updated the admin-breadcrumb and admin-sidebar components to include new translations for agent-related terms in English, Nepali, and Chinese, enhancing the overall user experience and multi-language support across the admin interface.
This commit is contained in:
2026-06-02 14:37:08 +08:00
parent a4e7a2d228
commit b15e377187
105 changed files with 5305 additions and 1596 deletions

View File

@@ -1,9 +1,11 @@
"use client";
import { Shield } from "lucide-react";
import { useCallback, useEffect, useMemo, useState } from "react";
import { useCallback, useMemo, useState } from "react";
import { useExportLabels } from "@/hooks/use-export-labels";
import { useTranslation } from "react-i18next";
import { useAsyncEffect } from "@/hooks/use-async-effect";
import { useTranslationRef } from "@/hooks/use-translation-ref";
import { getAdminDraws } from "@/api/admin-draws";
import { AdminListPaginationFooter } from "@/components/admin/admin-list-pagination-footer";
@@ -13,6 +15,7 @@ import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { AdminLoadingState, AdminLoadingInline, AdminTableLoadingRow } from "@/components/admin/admin-loading-state";
import {
Select,
SelectContent,
@@ -48,6 +51,7 @@ const DRAW_STATUS_OPTIONS: { value: string; label: string }[] = [
export function RiskIndexConsole() {
const { t } = useTranslation(["risk", "common"]);
const tRef = useTranslationRef(["risk", "common"]);
const exportLabels = useExportLabels("riskIndex");
const formatDt = useAdminDateTimeFormatter();
const [data, setData] = useState<AdminDrawListData | null>(null);
@@ -81,19 +85,17 @@ export function RiskIndexConsole() {
setData(d);
} catch (e) {
const msg =
e instanceof LotteryApiBizError ? e.message : t("loadDrawListFailed");
e instanceof LotteryApiBizError ? e.message : tRef.current("loadDrawListFailed");
setError(msg);
setData(null);
} finally {
setLoading(false);
}
}, [page, perPage, drawNoQuery, statusFilter, t]);
}, [page, perPage, drawNoQuery, statusFilter]);
useEffect(() => {
queueMicrotask(() => {
void load();
});
}, [load]);
useAsyncEffect(() => {
void load();
}, [page, perPage, drawNoQuery, statusFilter]);
function applySearch(): void {
setDrawNoQuery(drawNoInput.trim());
@@ -174,10 +176,7 @@ export function RiskIndexConsole() {
</CardHeader>
<CardContent className="admin-list-content">
{error ? <p className="text-sm text-destructive">{error}</p> : null}
{loading && (data?.items.length ?? 0) === 0 ? (
<p className="text-sm text-muted-foreground">{t("states.loading", { ns: "common" })}</p>
) : (
<div className="admin-table-shell">
<div className="admin-table-shell">
<Table id="risk-index-table">
<TableHeader>
<TableRow>
@@ -188,7 +187,9 @@ export function RiskIndexConsole() {
</TableRow>
</TableHeader>
<TableBody>
{(data?.items ?? []).length === 0 ? (
{loading && (data?.items.length ?? 0) === 0 ? (
<AdminTableLoadingRow colSpan={4} />
) : (data?.items ?? []).length === 0 ? (
<TableRow>
<TableCell colSpan={4} className="text-muted-foreground">
{t("states.noData", { ns: "common" })}
@@ -222,7 +223,6 @@ export function RiskIndexConsole() {
</TableBody>
</Table>
</div>
)}
<AdminListPaginationFooter
selectId="risk-index-draws-per-page"
total={total}