From dd47006eaf5546866ae1669dc67b271d46b64b59 Mon Sep 17 00:00:00 2001 From: Owolabenjade Date: Thu, 27 Aug 2026 18:40:45 +0100 Subject: [PATCH] fix(web): fix #1055 health score formula explanation and grade thresholds --- apps/web/components/HealthScore.tsx | 51 ++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/apps/web/components/HealthScore.tsx b/apps/web/components/HealthScore.tsx index 9fb2075..2f4713c 100644 --- a/apps/web/components/HealthScore.tsx +++ b/apps/web/components/HealthScore.tsx @@ -1,3 +1,7 @@ +'use client'; + +import { useState } from 'react'; + export function HealthScore({ collateral, required, @@ -7,6 +11,8 @@ export function HealthScore({ required: bigint; reserve: bigint; }) { + const [showInfo, setShowInfo] = useState(false); + const coverageRatio = required === 0n ? 100 : Number((collateral * 100n) / required); const reserveRatio = collateral === 0n ? 0 : Number((reserve * 100n) / collateral); @@ -34,7 +40,50 @@ export function HealthScore({ return (
-

Account Health Score

+
+

Account Health Score

+ +
+ + {showInfo && ( +
+

How Health Score is Calculated

+

+ The score (0–100) is a weighted combination of your collateral ratios: +

+
    +
  • + 70% Coverage Ratio: Collateral ÷ Required (capped at 100%) +
  • +
  • + 30% Reserve Ratio: Reserve ÷ Collateral (capped at 100%) +
  • +
+

Grade Thresholds

+
    +
  • + Excellent: 80–100 +
  • +
  • + Good: 60–79 +
  • +
  • + Fair: 40–59 +
  • +
  • + Poor: < 40 +
  • +
+
+ )} +

{healthScore}