import { type TeamStats } from '../../lib/hooks/use-team'; import { type TeamsFieldsFragment } from '../../lib/hooks/__generated__/Teams'; import { TeamAvatar, getFallbackAvatar } from './team-avatar'; import { FavoriteGame, Stat } from './team-stats'; import { useT } from '../../lib/use-t'; import { formatNumberRounded } from '@vegaprotocol/utils'; import BigNumber from 'bignumber.js'; import { Box } from './box'; import { Intent, Tooltip, TradingAnchorButton } from '@vegaprotocol/ui-toolkit'; import { Links } from '../../lib/links'; import orderBy from 'lodash/orderBy'; import { take } from 'lodash'; import { DispatchMetricLabels } from '@vegaprotocol/types'; import classNames from 'classnames'; import { UpdateTeamButton } from '../../client-pages/competitions/update-team-button'; import { type TeamGame } from '../../lib/hooks/use-games'; export const TeamCard = ({ rank, team, stats, games, }: { rank: number; team: TeamsFieldsFragment; stats?: TeamStats; games?: TeamGame[]; }) => { const t = useT(); const lastGames = take( orderBy( games?.map((g) => ({ rank: g.team.rank, metric: g.team.rewardMetric, epoch: g.epoch, })), (i) => i.epoch, 'desc' ), 5 ); return (
{/** Card */}

{team.name}

{games && } {t('Profile')}
{/** Tiles */}
{t('Last {{games}} games result', { replace: { games: lastGames.length || '' }, })}
{lastGames.length === 0 && t('None available')} {lastGames.map((game, i) => ( ))}
); }; /** * Sets the english ordinal for given rank only if the current language is set * to english. */ const RankLabel = ({ rank }: { rank: number }) => { const t = useT(); return t('place', { count: rank, ordinal: true }); };