feat(admin, i18n): enhance reports, draws, config, and player workflows
This commit is contained in:
@@ -817,6 +817,11 @@ export function HotUsageBars({
|
||||
}): ReactElement {
|
||||
const { t } = useTranslation("dashboard");
|
||||
const chartConfig = useMemo(() => buildUsageBarConfig(t("riskCapUsage")), [t]);
|
||||
const shortenPoolLabel = (value: string): string => {
|
||||
const normalized = value.trim();
|
||||
const trimmedMeta = normalized.replace(/\s*\(.+\)$/, "");
|
||||
return trimmedMeta.length > 10 ? `${trimmedMeta.slice(0, 10)}…` : trimmedMeta;
|
||||
};
|
||||
|
||||
const chartData = useMemo(
|
||||
() =>
|
||||
@@ -824,6 +829,7 @@ export function HotUsageBars({
|
||||
const pct = Math.min(100, Math.max(0, (row.usage_ratio ?? 0) * 100));
|
||||
return {
|
||||
number: row.normalized_number.trim(),
|
||||
displayNumber: shortenPoolLabel(row.normalized_number),
|
||||
usage: pct,
|
||||
fill: usageBarFill(pct),
|
||||
};
|
||||
@@ -855,15 +861,23 @@ export function HotUsageBars({
|
||||
<YAxis
|
||||
type="category"
|
||||
dataKey="number"
|
||||
width={72}
|
||||
width={compact ? 92 : 112}
|
||||
tickLine={false}
|
||||
axisLine={false}
|
||||
tickFormatter={(value) => {
|
||||
const row = chartData.find((item) => item.number === value);
|
||||
return row?.displayNumber ?? value;
|
||||
}}
|
||||
tick={{ fontSize: 11, fontFamily: "var(--font-mono)" }}
|
||||
/>
|
||||
<ChartTooltip
|
||||
content={
|
||||
<ChartTooltipContent
|
||||
formatter={(value) => `${Number(value).toFixed(1)}%`}
|
||||
formatter={(value, _name, item) => {
|
||||
const payload = item?.payload as { number?: string } | undefined;
|
||||
const number = payload?.number ? `${payload.number} · ` : "";
|
||||
return `${number}${Number(value).toFixed(1)}%`;
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user