refactor: 更新管理端页面元数据,统一国际化支持,移除冗余代码
This commit is contained in:
37
src/hooks/use-export-labels.ts
Normal file
37
src/hooks/use-export-labels.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
/** 与 `common.export.*` 键一致 */
|
||||
export type ExportLabelKey =
|
||||
| "drawsList"
|
||||
| "drawFinance"
|
||||
| "adminRoles"
|
||||
| "adminUsers"
|
||||
| "players"
|
||||
| "walletTransferOrders"
|
||||
| "walletTransactions"
|
||||
| "playerWallets"
|
||||
| "tickets"
|
||||
| "settlementBatches"
|
||||
| "jackpotPayouts"
|
||||
| "jackpotContributions"
|
||||
| "riskLockLogs"
|
||||
| "riskPools"
|
||||
| "riskIndex"
|
||||
| "riskPoolDetail"
|
||||
| "auditLogs"
|
||||
| "currencies";
|
||||
|
||||
export function useExportLabels(key: ExportLabelKey, params?: Record<string, string>) {
|
||||
const { t } = useTranslation("common");
|
||||
|
||||
return useMemo(
|
||||
() => ({
|
||||
filename: t(`export.${key}.filename`, params),
|
||||
sheetName: t(`export.${key}.sheetName`, params),
|
||||
}),
|
||||
[key, params, t],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user