import React from 'react'; import { Modal, ModalOverlay, ModalContent, ModalHeader, ModalFooter, ModalBody, ModalCloseButton, Button, Box, Text, VStack, HStack, Badge, Flex, useColorModeValue, } from '@chakra-ui/react'; import { useTranslation } from 'react-i18next'; import { TeamLogo } from '../common/TeamLogo'; interface ClubModalProps { isOpen: boolean; onClose: () => void; club: { team: string; team_id?: string; team_logo_url?: string; rank?: string | number; played?: string | number; wins?: string | number; draws?: string | number; losses?: string | number; score?: string; points?: string | number; // Additional fields from FACR goals_scored?: string | number; goals_conceded?: string | number; goal_difference?: string | number; form?: string; // Last 5 matches form (e.g., "WWDWL") position_change?: number; // +/- change in position } | null; clubType?: 'football' | 'futsal'; } const ClubModal: React.FC = ({ isOpen, onClose, club, clubType = 'football' }) => { const { t } = useTranslation(); if (!club) return null; // Theme-aware colors const cardBg = useColorModeValue('white', 'gray.800'); const borderColor = useColorModeValue('gray.200', 'whiteAlpha.300'); const fallbackBg = useColorModeValue('gray.100', 'gray.700'); const fallbackText = useColorModeValue('gray.600', 'gray.300'); return ( {club.team.substring(0, 2).toUpperCase()} } /> {club.team} {club.rank && ( {t('table.position_place', { position: club.rank })} )} {/* Statistics */} {t('club_modal.statistics')} {t('club_modal.matches_played')}: {club.played || 0} {t('club_modal.wins')}: {club.wins || 0} {t('club_modal.draws')}: {club.draws || 0} {t('club_modal.losses')}: {club.losses || 0} {t('club_modal.score')}: {club.score || '0:0'} {(club.goals_scored !== undefined || club.goals_conceded !== undefined) && ( <> {t('club_modal.goals_scored')}: {club.goals_scored || 0} {t('club_modal.goals_conceded')}: {club.goals_conceded || 0} )} {club.goal_difference !== undefined && ( {t('club_modal.goal_difference')}: = 0 ? 'green.600' : 'red.600'}> {Number(club.goal_difference) > 0 ? '+' : ''}{club.goal_difference} )} {t('club_modal.points')}: {club.points || 0} {/* Form (Last 5 matches) */} {club.form && ( {t('club_modal.form_last_5')} {club.form.split('').map((result, idx) => ( {result === 'W' ? 'V' : result === 'D' ? 'R' : 'P'} ))} )} ); }; export default ClubModal;