refactor(risk, navigation): update risk management redirects and enhance loading states

Changed default redirects in risk management pages to point to the new risk pools section. Removed unused risk lock log components and streamlined the admin reports page with a loading state for better user experience. Added a new DocFigure component for improved documentation visuals and updated localization files to include new figure descriptions.
This commit is contained in:
2026-06-16 13:50:58 +08:00
parent b774e22352
commit a4454a54a4
57 changed files with 981 additions and 1161 deletions

View File

@@ -5,6 +5,7 @@ import { useCallback, useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { AdminNoResourceState, AdminTableNoResourceRow } from "@/components/admin/admin-no-resource-state";
import { AdminLoadingInline } from "@/components/admin/admin-loading-state";
import { Input } from "@/components/ui/input";
import { cn } from "@/lib/utils";
import { formatAdminCreditMajorDecimal } from "@/lib/money";
@@ -55,15 +56,6 @@ function pruneTreeForSearch(
return out;
}
function collectExpandableIds(nodes: AgentNodeRow[], into: Set<number>): void {
for (const node of nodes) {
if ((node.children?.length ?? 0) > 0) {
into.add(node.id);
collectExpandableIds(node.children ?? [], into);
}
}
}
export type AgentLineSidebarProps = {
siteLabel: string | null;
/** API 返回的嵌套树(含 children */
@@ -72,6 +64,7 @@ export type AgentLineSidebarProps = {
selectedId: number | null;
keyword: string;
agentCount: number;
loading?: boolean;
onKeywordChange: (value: string) => void;
onSelect: (node: AgentNodeRow) => void;
};
@@ -167,6 +160,7 @@ export function AgentLineSidebar({
selectedId,
keyword,
agentCount,
loading = false,
onKeywordChange,
onSelect,
}: AgentLineSidebarProps): React.ReactElement {
@@ -180,9 +174,20 @@ export function AgentLineSidebar({
}, [normalizedKeyword, parentNameMap, tree]);
useEffect(() => {
const next = new Set<number>();
collectExpandableIds(tree, next);
setExpandedIds(next);
if (tree.length === 0) {
setExpandedIds(new Set());
return;
}
setExpandedIds((prev) => {
const next = new Set(prev);
for (const node of tree) {
if ((node.children?.length ?? 0) > 0) {
next.add(node.id);
}
}
return next;
});
}, [tree]);
useEffect(() => {
@@ -258,7 +263,9 @@ export function AgentLineSidebar({
</div>
<div className="min-h-0 flex-1 overflow-y-auto px-2 py-2">
{!hasAnyAgent ? (
{loading ? (
<AdminLoadingInline className="py-10" />
) : !hasAnyAgent ? (
<AdminNoResourceState className="px-2 py-8 text-center text-sm text-muted-foreground" />
) : (
<ul className="space-y-0.5" role="listbox" aria-label={t("listTitle", { defaultValue: "代理列表" })}>