// src/components/Leaderboard.tsx import React from 'react'; import { useLeaderboardQuery } from '../hooks/queries/useLeaderboardQuery'; import { Award, Crown, ShieldAlert } from 'lucide-react'; /** * Leaderboard component displaying top users by points. * * Refactored to use TanStack Query (ADR-0005 Phase 8). */ export const Leaderboard: React.FC = () => { const { data: leaderboard = [], isLoading, error } = useLeaderboardQuery(10); const getRankIcon = (rank: string) => { switch (rank) { case '1': return ; case '2': return ; case '3': return ; default: return {rank}; } }; if (isLoading) { return
Loading Leaderboard...
; } if (error) { return (

Error: {error.message}

); } return (

Top Users

{leaderboard.length === 0 ? (

The leaderboard is currently empty. Be the first to earn points!

) : (
    {leaderboard.map((user) => (
  1. {getRankIcon(user.rank)}
    {user.full_name

    {user.full_name || 'Anonymous User'}

    {user.points} pts
  2. ))}
)}
); }; export default Leaderboard;