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,7 +1,9 @@
"use client";
import { useCallback, useEffect, useState } from "react";
import { useCallback, useState } from "react";
import { useTranslation } from "react-i18next";
import { useAsyncEffect } from "@/hooks/use-async-effect";
import { useTranslationRef } from "@/hooks/use-translation-ref";
import { toast } from "sonner";
import { Download, RefreshCw } from "lucide-react";
@@ -10,6 +12,7 @@ import { AdminRowActionsMenu } from "@/components/admin/admin-row-actions-menu";
import { AdminStatusBadge } from "@/components/admin/admin-status-badge";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { AdminLoadingState, AdminLoadingInline, AdminTableLoadingRow } from "@/components/admin/admin-loading-state";
import {
Table,
TableBody,
@@ -40,6 +43,7 @@ type ReportJobsPanelProps = {
export function ReportJobsPanel({ canExport, refreshToken = 0 }: ReportJobsPanelProps) {
const { t } = useTranslation(["reports", "common"]);
const tRef = useTranslationRef(["reports", "common"]);
const formatTs = useAdminDateTimeFormatter();
const [jobs, setJobs] = useState<AdminReportJobRow[]>([]);
const [loading, setLoading] = useState(true);
@@ -51,18 +55,16 @@ export function ReportJobsPanel({ canExport, refreshToken = 0 }: ReportJobsPanel
const data = await getAdminReportJobs({ page: 1, per_page: 10 });
setJobs(data.items);
} catch (e) {
toast.error(e instanceof LotteryApiBizError ? e.message : t("tasks.loadFailed"));
toast.error(e instanceof LotteryApiBizError ? e.message : tRef.current("tasks.loadFailed"));
setJobs([]);
} finally {
setLoading(false);
}
}, [t]);
}, []);
useEffect(() => {
queueMicrotask(() => {
void loadJobs();
});
}, [loadJobs, refreshToken]);
useAsyncEffect(() => {
void loadJobs();
}, [refreshToken]);
async function handleDownload(job: AdminReportJobRow): Promise<void> {
if (!canExport || job.status !== "completed") {
@@ -111,11 +113,7 @@ export function ReportJobsPanel({ canExport, refreshToken = 0 }: ReportJobsPanel
</TableHeader>
<TableBody>
{loading ? (
<TableRow>
<TableCell colSpan={6} className="text-muted-foreground">
{t("states.loading", { ns: "common" })}
</TableCell>
</TableRow>
<AdminTableLoadingRow colSpan={6} />
) : jobs.length === 0 ? (
<TableRow>
<TableCell colSpan={6} className="text-muted-foreground">