import React from 'react'; import CardBox from '../CardBox'; import ImageField from '../ImageField'; import dataFormatter from '../../helpers/dataFormatter'; import { saveFile } from '../../helpers/fileSaver'; import ListActionsPopover from '../ListActionsPopover'; import { useAppSelector } from '../../stores/hooks'; import { Pagination } from '../Pagination'; import LoadingSpinner from '../LoadingSpinner'; import Link from 'next/link'; import { hasPermission } from '../../helpers/userPermissions'; type Props = { games: any[]; loading: boolean; onDelete: (id: string) => void; currentPage: number; numPages: number; onPageChange: (page: number) => void; }; const ListGames = ({ games, loading, onDelete, currentPage, numPages, onPageChange, }: Props) => { const currentUser = useAppSelector((state) => state.auth.currentUser); const hasUpdatePermission = hasPermission(currentUser, 'UPDATE_GAMES'); const corners = useAppSelector((state) => state.style.corners); const bgColor = useAppSelector((state) => state.style.cardsColor); return ( <>
{loading && } {!loading && games.map((item) => (
dark:divide-dark-700 overflow-x-auto' } >

GameDate

{dataFormatter.dateTimeFormatter(item.date)}

League

{dataFormatter.leaguesOneListFormatter(item.league)}

Team

{dataFormatter.teamsOneListFormatter(item.team)}

TeamScore

{item.team_score}

OpponentScore

{item.opponent_score}

Season

{dataFormatter.seasonsOneListFormatter(item.season)}

))} {!loading && games.length === 0 && (

No data to display

)}
); }; export default ListGames;