"use client"; import * as React from "react"; import { useInView } from "react-intersection-observer"; import type { Updater } from "use-immer"; import type { Team } from "@xcpcio/core"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import type { Resolver } from "@/lib/resolver"; import { cn } from "@/lib/utils"; export interface TeamUIProps { index: number; team: Team; resolver: Resolver; updateResolver: Updater; } const TeamUI: React.FC = (props) => { const { team, index, resolver } = props; const { ref, entry } = useInView(); const showTeamName = (team: Team) => { const left = team.organization; const right = team.name; if (right.length === 0) { return left; } if (left.length === 0) { return right; } return `${left} - ${right}`; }; return (
{entry?.isIntersecting && ( <>
{team.rank}
{showTeamName(team)}

{showTeamName(team)}

{team.problemStatistics.map((p, pIx) => { return (
{p.isAccepted && `${p.failedCount + Number(p.isAccepted)}/${Math.floor(p.lastSubmitTimestamp / 60)}`} {p.isWrongAnswer && `${p.failedCount}/${Math.floor(p.lastSubmitTimestamp / 60)}`} {p.isPending && `${p.failedCount} + ${p.pendingCount}`} {p.isUnSubmitted && p.problem.label}
); })}
{team.solvedProblemNum}
{team.penaltyToMinute}
)}
); }; export { TeamUI }; export default TeamUI;