Skip to content

Commit da5cabd

Browse files
fix(overview): fix undefined roundedValue in ThreatScore tooltip
Fix ReferenceError where roundedValue was used but not defined in convertSectionScoresToTooltipData function. Changed to use the correct value parameter from the map function. Also replaced inline style props with Tailwind utility classes (min-w-4 min-h-4) for icon sizing. Note: CSS variables from globals.css are required for RadialChart component as Recharts library needs actual color values.
1 parent 151c509 commit da5cabd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ui/app/(prowler)/new-overview/components/threat-score/threat-score.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {
1515
Skeleton,
1616
} from "@/components/shadcn";
1717

18+
// CSS variables are required here as they're passed to RadialChart component
19+
// which uses Recharts library that needs actual color values, not Tailwind classes
1820
const THREAT_COLORS = {
1921
DANGER: "var(--bg-fail-primary)",
2022
WARNING: "var(--bg-warning-primary)",
@@ -71,7 +73,7 @@ function convertSectionScoresToTooltipData(
7173

7274
return Object.entries(sectionScores).map(([name, value]) => {
7375
// Determine color based on the same ranges as THREAT_LEVEL_CONFIG
74-
const threatLevel = getThreatLevel(roundedValue);
76+
const threatLevel = getThreatLevel(value);
7577
const color = THREAT_LEVEL_CONFIG[threatLevel].color;
7678

7779
return { name, value, color };
@@ -166,8 +168,7 @@ export function ThreatScore({
166168
<div className="flex items-start gap-1.5">
167169
<ThumbsUp
168170
size={16}
169-
className="mt-0.5 shrink-0"
170-
style={{ minWidth: "16px", minHeight: "16px" }}
171+
className="mt-0.5 min-h-4 min-w-4 shrink-0"
171172
/>
172173
<p>
173174
Threat score has{" "}
@@ -182,8 +183,7 @@ export function ThreatScore({
182183
<div className="flex items-start gap-1.5">
183184
<MessageCircleWarning
184185
size={16}
185-
className="mt-0.5 shrink-0"
186-
style={{ minWidth: "16px", minHeight: "16px" }}
186+
className="mt-0.5 min-h-4 min-w-4 shrink-0"
187187
/>
188188
<p>
189189
Major gaps include {gaps.slice(0, 2).join(", ")}

0 commit comments

Comments
 (0)