// components/ClientProfile.tsx import React, { useEffect, useState } from "react"; import { getClientList, ClientData } from "../../index"; import { ClientProfileProps } from "../../types"; import { Leaderboard } from "../Leaderboard"; /** * The ClientProfile component. * Renders a detailed profile view for the given client and provides options for customization. * @param {string} client - The client ID to fetch client data. Required. * @param {string} [containerClassName] - CSS class for the main container. Optional. * @param {string} [bannerClassName] - CSS class for the banner. Optional. * @param {string} [avatarClassName] - CSS class for the avatar. Optional. * @param {string} [leaderboardClassName] - CSS class for the leaderboard container. Optional. * @returns A React component that renders a detailed client profile including a leaderboard. */ export const ClientProfile: React.FC = ({ client, containerClassName, bannerClassName, avatarClassName, leaderboardClassName, }) => { const [clientData, setClientData] = useState(null); useEffect(() => { getClientList().then((response) => { if ("data" in response) { const foundClient = response.data.find((c) => c.client === client); setClientData(foundClient || null); } }); }, [client]); if (!clientData) return
Loading...
; return (
{`${clientData.client}
); };