refactor: 更新风险监控页面标题为国际化支持,优化风险池控制台的标题处理
This commit is contained in:
@@ -37,6 +37,7 @@ import { useExportLabels } from "@/hooks/use-export-labels";
|
||||
import { formatAdminMinorUnits } from "@/lib/money";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { LotteryApiBizError } from "@/types/api/errors";
|
||||
import type { RiskPoolsPageTitleKey } from "@/modules/risk/risk-display";
|
||||
import type { AdminRiskPoolListData, AdminRiskPoolRow } from "@/types/api/admin-risk";
|
||||
|
||||
const SORT_OPTIONS: { value: "usage_desc" | "locked_desc" | "remaining_asc" | "number_asc"; label: string }[] =
|
||||
@@ -59,7 +60,9 @@ type RiskFilter = "all" | "sold_out" | "high_risk";
|
||||
|
||||
type RiskPoolsConsoleProps = {
|
||||
drawId: number;
|
||||
title: string;
|
||||
/** @deprecated 优先使用 titleKey */
|
||||
title?: string;
|
||||
titleKey?: RiskPoolsPageTitleKey;
|
||||
soldOutOnly: boolean;
|
||||
defaultSort: "usage_desc" | "locked_desc" | "remaining_asc" | "number_asc";
|
||||
allowSortChange?: boolean;
|
||||
@@ -68,11 +71,13 @@ type RiskPoolsConsoleProps = {
|
||||
export function RiskPoolsConsole({
|
||||
drawId,
|
||||
title,
|
||||
titleKey,
|
||||
soldOutOnly,
|
||||
defaultSort,
|
||||
allowSortChange = false,
|
||||
}: RiskPoolsConsoleProps) {
|
||||
const { t } = useTranslation(["risk", "common"]);
|
||||
const pageTitle = titleKey ? t(titleKey) : (title ?? t("poolsTitle"));
|
||||
const exportLabels = useExportLabels("riskPools");
|
||||
useAdminCurrencyCatalog();
|
||||
const [sort, setSort] = useState(defaultSort);
|
||||
@@ -145,7 +150,7 @@ export function RiskPoolsConsole({
|
||||
return (
|
||||
<Card className="admin-list-card">
|
||||
<CardHeader className="admin-list-header space-y-3">
|
||||
<CardTitle className="admin-list-title">{title}</CardTitle>
|
||||
<CardTitle className="admin-list-title">{pageTitle}</CardTitle>
|
||||
<div className="admin-list-toolbar">
|
||||
<div className="admin-list-field">
|
||||
<Label htmlFor="risk-pool-number" className="sm:w-16 sm:shrink-0">
|
||||
@@ -216,7 +221,7 @@ export function RiskPoolsConsole({
|
||||
<div className="admin-list-actions">
|
||||
<AdminTableExportButton
|
||||
tableId={`risk-pools-table-${drawId}`}
|
||||
filename={title ?? exportLabels.filename}
|
||||
filename={pageTitle ?? exportLabels.filename}
|
||||
sheetName={exportLabels.sheetName}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user