Client - display only active sports in application in user preferences
+ fixes
This commit is contained in:
@ -38,10 +38,17 @@ const sortSports = (a: ITranslatedSport, b: ITranslatedSport): number => {
|
||||
export const translateSports = (
|
||||
sports: ISport[],
|
||||
t: CallableFunction,
|
||||
onlyActive = false
|
||||
onlyActive = false,
|
||||
userSports: number[] | null = null
|
||||
): ITranslatedSport[] =>
|
||||
sports
|
||||
.filter((sport) => (onlyActive ? sport.is_active_for_user : true))
|
||||
.filter((sport) =>
|
||||
onlyActive
|
||||
? userSports === null
|
||||
? sport.is_active_for_user
|
||||
: userSports.includes(sport.id) || sport.is_active
|
||||
: true
|
||||
)
|
||||
.map((sport) => ({
|
||||
...sport,
|
||||
translatedLabel: t(`sports.${sport.label}.LABEL`),
|
||||
|
Reference in New Issue
Block a user