Client - replace sports PNG images with SVG

This commit is contained in:
Sam
2021-10-01 16:48:48 +02:00
parent ba0b94de45
commit 5856599377
28 changed files with 461 additions and 118 deletions

View File

@ -1,4 +1,4 @@
import { ISport } from '@/types/sports'
import { ITranslatedSport } from '@/types/sports'
import { IRecord, IRecordsBySports } from '@/types/workouts'
import { formatWorkoutDate, getDateWithTZ } from '@/utils/dates'
@ -35,19 +35,19 @@ export const formatRecord = (
export const getRecordsBySports = (
records: IRecord[],
sports: ISport[],
translatedSports: ITranslatedSport[],
tz: string
): IRecordsBySports =>
records.reduce((sportList: IRecordsBySports, record) => {
const sport = sports.find((s) => s.id === record.sport_id)
const sport = translatedSports.find((s) => s.id === record.sport_id)
if (sport && sport.label) {
if (sportList[sport.label] === void 0) {
sportList[sport.label] = {
img: sport.img,
if (sportList[sport.translatedLabel] === void 0) {
sportList[sport.translatedLabel] = {
label: sport.label,
records: [],
}
}
sportList[sport.label].records.push(formatRecord(record, tz))
sportList[sport.translatedLabel].records.push(formatRecord(record, tz))
}
return sportList
}, {})