'use client';
/**
* Income Groups Page — Standalone page for the Income Groups analytics detail view.
*
* Renders the IncomeTab content from the analytics detail page as its own route.
* Accessible via sidebar navigation under Analítica > Income Groups.
*/
import { useState, useMemo } from 'react';
import { clientPortal } from '@/lib/mock-data';
import { useCompactCurrencyFormatter } from '@/lib/hooks/useCurrencyFormatter';
import { chartColorArray } from '@/lib/constants/theme';
import type { PortalIncomeGroupDetail } from '@/lib/mock-data/types';
import PieChartWidget from '@/components/charts/PieChartWidget';
// ─── Helper Components ───────────────────────────────────────────────────────
function ChevronIcon({ expanded }: { expanded: boolean }) {
return (
);
}
function PercentageBadge({ value }: { value: number }) {
const isPositive = value >= 0;
return (
{isPositive ? '+' : ''}{value.toFixed(1)}%
);
}
function TotalEarningsCard({ total, trend }: { total: number; trend: number }) {
const fmtMoney = useCompactCurrencyFormatter();
return (