import { useMyDashboard, useStructures } from '@/hooks/useMlm'; export default function MLMPage() { const { data: dashboard, isLoading } = useMyDashboard(); const { data: structures } = useStructures({ isActive: true }); if (isLoading) { return (
); } return (

MLM Dashboard

{/* Summary Cards */}
Total Downline
{dashboard?.totalDownline ?? 0}
Direct Referrals
{dashboard?.directReferrals ?? 0}
Group Volume
{(dashboard?.groupVolume ?? 0).toLocaleString()}
Total Earnings
${(dashboard?.totalEarnings ?? 0).toLocaleString()}
{/* Stats Grid */}
{/* Current Rank */}

Current Rank

{dashboard?.currentRank ? (
{dashboard.currentRank.level}

{dashboard.currentRank.name}

Level {dashboard.currentRank.level}

) : (

No rank assigned yet

)}
{/* Next Rank Progress */}

Next Rank Progress

{dashboard?.nextRank ? (
{dashboard.nextRank.name} Level {dashboard.nextRank.level}
{Object.entries(dashboard.nextRank.progress || {}).map(([key, value]) => (
{key.replace(/([A-Z])/g, ' $1').trim()} {Math.min(100, Math.round(Number(value)))}%
))}
) : (

You've reached the highest rank!

)}
{/* Volume Stats */}

Volume Summary

Personal Volume {(dashboard?.personalVolume ?? 0).toLocaleString()}
Group Volume {(dashboard?.groupVolume ?? 0).toLocaleString()}
Active Downline {dashboard?.activeDownline ?? 0}
{/* Active Structures */}

Active Structures

{structures?.map((structure) => (

{structure.name}

{structure.type}

Active
{structure.description && (

{structure.description}

)}
))} {(!structures || structures.length === 0) && (

No active structures

)}
{/* Quick Links */}

Quick Actions

My Network Structures Ranks My Earnings + Invite
); }