feat(agents, config, dashboard, i18n): add agent line provision wizard, site deletion, and site dashboard with multi-language support
Added agent line provision wizard page with permission gating, replacing redirect placeholder. Introduced site deletion API and UI with confirmation dialog in integration sites management. Added new site-scoped dashboard panel showing bet metrics, P/L trends, active players, and quick links. Enhanced chart tooltip to support custom formatters and fix indicator color
This commit is contained in:
53
src/lib/admin-signed-money.tsx
Normal file
53
src/lib/admin-signed-money.tsx
Normal file
@@ -0,0 +1,53 @@
|
||||
"use client";
|
||||
|
||||
import type { ReactElement, ReactNode } from "react";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/** 盈亏 / 输赢:负红、正绿、零灰 */
|
||||
export function signedMoneyClass(amount: number, emphasize = false): string {
|
||||
if (amount < 0) {
|
||||
return cn("text-destructive", emphasize && "font-semibold");
|
||||
}
|
||||
if (amount > 0) {
|
||||
return cn("text-emerald-600 dark:text-emerald-400", emphasize && "font-semibold");
|
||||
}
|
||||
|
||||
return cn("text-muted-foreground", emphasize && "font-medium");
|
||||
}
|
||||
|
||||
export function SignedMoney({
|
||||
amount,
|
||||
children,
|
||||
emphasize,
|
||||
className,
|
||||
}: {
|
||||
amount: number;
|
||||
children: ReactNode;
|
||||
emphasize?: boolean;
|
||||
className?: string;
|
||||
}): ReactElement {
|
||||
return (
|
||||
<span className={cn(signedMoneyClass(amount, emphasize), "tabular-nums", className)}>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** 报表 / 结算字段是否应按正负着色 */
|
||||
export function isSignedMoneyField(key: string): boolean {
|
||||
return (
|
||||
key === "approx_house_gross_minor" ||
|
||||
key === "net_win_loss_minor" ||
|
||||
key === "gross_win_loss" ||
|
||||
key === "game_win_loss" ||
|
||||
key === "profit_loss_minor" ||
|
||||
key === "today_profit_minor" ||
|
||||
key === "seven_day_profit_minor" ||
|
||||
key === "platform_profit" ||
|
||||
key === "platform_profit_minor" ||
|
||||
key === "share_profit" ||
|
||||
key === "share_profit_meta" ||
|
||||
key.endsWith("_profit_minor")
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user