All files / optimized-app/src/components HeavyRevenueChart.tsx

100% Statements 4/4
100% Branches 0/0
100% Functions 3/3
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34                  2x   2x                   6x                        
import { useMemo } from "react";
import type { PortfolioRow } from "../../../benchmark/src/data";
import { buildRevenueChartSeries, formatCurrency } from "../../../benchmark/src/data";
 
interface HeavyRevenueChartProps {
  rows: readonly PortfolioRow[];
}
 
export default function HeavyRevenueChart({ rows }: HeavyRevenueChartProps) {
  const series = useMemo(() => buildRevenueChartSeries(rows), [rows]);
 
  return (
    <section className="panel chart-panel" data-testid="optimized-heavy-chart" aria-labelledby="optimized-chart-title">
      <div className="panel-header">
        <div>
          <p className="eyebrow">Lazy module</p>
          <h2 id="optimized-chart-title">Revenue concentration</h2>
        </div>
      </div>
      <ul className="bar-chart" aria-label="Revenue by account health">
        {series.map((bucket) => (
          <li className="bar-row" key={bucket.label}>
            <span>{bucket.label}</span>
            <div className="bar-track">
              <div className="bar-fill" style={{ width: `${bucket.percent}%`, background: bucket.color }} />
            </div>
            <strong>{formatCurrency(bucket.value)}</strong>
          </li>
        ))}
      </ul>
    </section>
  );
}