You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
939 B
51 lines
939 B
import map from 'lodash/map'
|
|
|
|
import format from 'date-fns/format'
|
|
|
|
import type { Match } from 'requests'
|
|
|
|
import { getSportLexic } from 'helpers'
|
|
import { parseDate } from 'helpers/parseDate'
|
|
|
|
import { getMatchAccess } from './getMatchClickAction'
|
|
|
|
const prepareMatch = (match: Match) => {
|
|
const {
|
|
calc,
|
|
country_id,
|
|
date: matchDate,
|
|
has_video,
|
|
id,
|
|
live,
|
|
preview,
|
|
sport,
|
|
storage,
|
|
team1,
|
|
team2,
|
|
tournament,
|
|
} = match
|
|
const date = parseDate(matchDate)
|
|
return {
|
|
access: getMatchAccess(match),
|
|
calc,
|
|
countryId: country_id,
|
|
date,
|
|
formattedDate: format(date, 'dd.MM.yy'),
|
|
hasVideo: has_video,
|
|
id,
|
|
live,
|
|
preview,
|
|
sportName: getSportLexic(sport),
|
|
sportType: sport,
|
|
storage,
|
|
team1,
|
|
team2,
|
|
time: format(date, 'HH:mm'),
|
|
tournament,
|
|
}
|
|
}
|
|
|
|
export const prepareMatches = (matches: Array<Match>) => map(
|
|
matches,
|
|
prepareMatch,
|
|
)
|
|
|