diff --git a/frontend/src/components/pages/CCPMetricsPage.js b/frontend/src/components/pages/CCPMetricsPage.js index dd630a0..f0de15f 100644 --- a/frontend/src/components/pages/CCPMetricsPage.js +++ b/frontend/src/components/pages/CCPMetricsPage.js @@ -100,55 +100,55 @@ function StatsBar({ stats, onNonCompliantClick, ncExpanded }) { // --------------------------------------------------------------------------- // Metric Breakdown Panel (shown when Non-Compliant is clicked) // --------------------------------------------------------------------------- -function MetricBreakdownPanel({ metrics, onSelectMetric }) { +function MetricBreakdownPanel({ metrics }) { + const [showAll, setShowAll] = useState(false); + if (!metrics || metrics.length === 0) return null; // Only show metrics with non_compliant > 0 const ncMetrics = metrics.filter(m => m.non_compliant > 0); if (ncMetrics.length === 0) return null; + const TOP_COUNT = 8; + const displayMetrics = showAll ? ncMetrics : ncMetrics.slice(0, TOP_COUNT); + const hasMore = ncMetrics.length > TOP_COUNT; + return (
-
- Non-Compliant by Metric +
+
+ Non-Compliant by Metric +
+ {hasMore && ( + + )}
-
- {ncMetrics.map(m => { +
+ {displayMetrics.map(m => { const pct = m.total > 0 ? (m.compliant / m.total) : 0; const target = Number(m.target || 0); const color = pct >= target ? '#10B981' : pct >= target * 0.85 ? '#F59E0B' : '#EF4444'; return ( - +
{m.non_compliant.toLocaleString()}
+
); })}
@@ -801,7 +801,6 @@ function DataManagementPanel({ onClose, onDataChanged }) {

Manage Data

{/* ⚠️ CONVENTION: Use lucide-react icon instead of raw Unicode character */} - {/* ⚠️ CONVENTION: Use lucide-react icon instead of raw Unicode character */}
@@ -1052,14 +1051,7 @@ export default function CCPMetricsPage() { {/* Metric breakdown (revealed when Non-Compliant is clicked) */} {showMetricBreakdown && ( - { - // Find the first vertical that has this metric with non-compliant > 0 - // and navigate to it - setShowMetricBreakdown(false); - }} - /> + )} {/* Charts row */}