Untitled

 avatar
unknown
plain_text
a year ago
1.1 kB
4
Indexable
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>
  );
}
Editor is loading...
Leave a Comment