import { LeftOutlined } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; import TeamMatchBackground from '../../assets/teamMatchBackground.png'; import { routeLink } from '../../Router'; import PlayerCard, { PlayerCardProps } from '../PlayerCard'; export interface MatchProps { team1: PlayerCardProps[]; team2: PlayerCardProps[]; no: number; isSingle?: boolean; } const MatchHeaderComponent: React.FC = ({ team1, team2, no, isSingle = false }) => { const { t } = useTranslation(); const navigate = useNavigate(); const renderTeam = (team: PlayerCardProps[]) => (
{team.map((player, index) => ( ))}
); const calculateHandicapDifference = () => { const team1Hdc = team1.reduce((sum, player) => sum + player.hdcIndex, 0); const team2Hdc = team2.reduce((sum, player) => sum + player.hdcIndex, 0); return Math.abs(team1Hdc - team2Hdc); }; return (
navigate(routeLink.tournament)} style={{ cursor: 'pointer', fontSize: '16px', marginLeft: '5px', marginRight: '5px' }} />

{t('matchPage.matchNo')} {no}

{renderTeam(team1)}
VS
{isSingle &&
{t('matchPage.bet')} {calculateHandicapDifference()}
}
{renderTeam(team2)}
); }; export default MatchHeaderComponent;