feat(admin, players): enhance player management and admin interfaces
Some checks failed
lotteryadmin CI / build (push) Has been cancelled
Some checks failed
lotteryadmin CI / build (push) Has been cancelled
Updated the player management components to improve error handling and display for various operations, including ticket loading and transaction retrieval. Introduced new status badges for better visual representation of player statuses. Enhanced localization support for error messages and improved the overall user experience in the admin console. Refactored components for better maintainability and clarity.
This commit is contained in:
@@ -262,12 +262,18 @@ export function DashboardConsole(): ReactElement {
|
||||
const platformLocked = coerceAdminMinor(platformRisk?.locked_amount);
|
||||
const platformCap = coerceAdminMinor(platformRisk?.cap_amount);
|
||||
const rawPlatformUsagePct = platformRisk?.usage_percent;
|
||||
const platformUsagePct =
|
||||
typeof rawPlatformUsagePct === "number" && Number.isFinite(rawPlatformUsagePct)
|
||||
? Math.min(100, Math.max(0, rawPlatformUsagePct))
|
||||
: platformCap > 0
|
||||
? (platformLocked / platformCap) * 100
|
||||
: 0;
|
||||
const useCurrentDrawRisk = drawId != null;
|
||||
const capUsageLocked = useCurrentDrawRisk ? riskLocked : platformLocked;
|
||||
const capUsageCap = useCurrentDrawRisk ? riskCap : platformCap;
|
||||
const capUsagePct =
|
||||
capUsageCap > 0
|
||||
? (capUsageLocked / capUsageCap) * 100
|
||||
: typeof rawPlatformUsagePct === "number" && Number.isFinite(rawPlatformUsagePct)
|
||||
? Math.min(100, Math.max(0, rawPlatformUsagePct))
|
||||
: platformCap > 0
|
||||
? (platformLocked / platformCap) * 100
|
||||
: 0;
|
||||
const showCapUsageCard = useCurrentDrawRisk || platformRisk != null;
|
||||
|
||||
const hotRows = useMemo(() => topPoolsForTab(hotPoolSample, hotTab), [hotPoolSample, hotTab]);
|
||||
|
||||
@@ -403,25 +409,25 @@ export function DashboardConsole(): ReactElement {
|
||||
</DashboardPanelCard>
|
||||
|
||||
<DashboardPanelCard
|
||||
href="/admin/risk"
|
||||
href={drawScopedHref(drawId, "/risk/pools")}
|
||||
title={t("riskCapUsage")}
|
||||
value={`${platformUsagePct.toFixed(1)}%`}
|
||||
value={`${capUsagePct.toFixed(1)}%`}
|
||||
actionLabel={t("occupancyDetails")}
|
||||
icon={<Shield className="size-5" aria-hidden />}
|
||||
accent={
|
||||
platformUsagePct >= 90
|
||||
capUsagePct >= 90
|
||||
? "destructive"
|
||||
: platformUsagePct >= 70
|
||||
: capUsagePct >= 70
|
||||
? "primary"
|
||||
: "muted"
|
||||
}
|
||||
loading={loading}
|
||||
>
|
||||
{platformRisk != null ? (
|
||||
{showCapUsageCard ? (
|
||||
<CapUsageBar
|
||||
locked={platformLocked}
|
||||
cap={platformCap}
|
||||
usagePct={platformUsagePct}
|
||||
locked={capUsageLocked}
|
||||
cap={capUsageCap}
|
||||
usagePct={capUsagePct}
|
||||
formatMoney={formatMoneyMinor}
|
||||
currency={currency}
|
||||
compact
|
||||
|
||||
Reference in New Issue
Block a user