feat(dashboard, i18n): enhance agent dashboard and localization support

Updated the agent dashboard to include new metrics for today's bets and payouts, improving visibility for users. Enhanced localization files with additional hints and labels for better user experience across English, Nepali, and Chinese. Introduced new functions for formatting business dates and improved the handling of analytics permissions in the dashboard components.
This commit is contained in:
2026-06-16 14:18:58 +08:00
parent a4454a54a4
commit d4cf4ff436
17 changed files with 534 additions and 415 deletions

View File

@@ -16,6 +16,28 @@ export function signedMoneyClass(amount: number, emphasize = false): string {
return cn("text-muted-foreground", emphasize && "font-medium");
}
/** 环比趋势色:升/降何者为「好」因指标而异 */
export function signedTrendClassName(
series: number[],
mode: "higherBetter" | "lowerBetter" | "signed",
): string {
if (series.length < 2) {
return "text-muted-foreground";
}
const last = series[series.length - 1] ?? 0;
const prev = series[series.length - 2] ?? 0;
if (mode === "signed") {
return signedMoneyClass(last - prev, false);
}
const improved = mode === "higherBetter" ? last > prev : last < prev;
if (last === prev) {
return "text-muted-foreground";
}
return improved
? "text-emerald-600 dark:text-emerald-400"
: "text-destructive";
}
export function SignedMoney({
amount,
children,