Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.1 kB
1
Indexable
Never
import { getCurrentGoals } from '@/lib/helpers/getCurrentGoals';

export default function MatchStates2({ match }) {
  const liveStatus = [
    'INPLAY_1ST_HALF',
    'INPLAY_2ND_HALF',
    'HT',
    'INPLAY_ET',
    'INPLAY_ET_2ND_HALF',
    'BREAK',
    'PEN_BREAK',
    'EXTRA_TIME_BREAK',
    'INPLAY_PENALTIES',
  ];
  const finishedStatus = ['FT', 'AET', 'FT_PEN'];
  const upcomingStatus = [
    'TBA',
    'NS',
    'WO',
    'ABANDONED',
    'CANCELLED',
    'AWARDED',
    'INTERRUPTED',
    'POSTPONED',
  ];

  const matchState = match?.state?.state;
  const isLive = liveStatus.includes(matchState);
  const isUpcoming = upcomingStatus.includes(matchState);
  const { tOne, tTwo } = getCurrentGoals(match?.scores);

  return (
    <div>
      {!isLive && !isUpcoming && (
        <div className="my-auto text-gray-400 grid justify-items-center text-sm">
          <div className="pb-1">
            <h2>{tOne}</h2>
          </div>
          <div>
            <h2>{tTwo}</h2>
          </div>
        </div>
      )}
    </div>
  );
}
Leave a Comment