API & Client - display only active sports when adding an activity

This commit is contained in:
Sam
2019-09-23 14:09:26 +02:00
parent a9cbe220ac
commit 8a4b114af8
13 changed files with 413 additions and 101 deletions

View File

@ -93,8 +93,9 @@ const sortSports = (a, b) => {
return sportALabel > sportBLabel ? 1 : sportALabel < sportBLabel ? -1 : 0
}
export const translateSports = (sports, t) =>
export const translateSports = (sports, t, onlyActive = false) =>
sports
.filter(sport => (onlyActive ? sport.is_active : true))
.map(sport => ({
...sport,
label: t(`sports:${sport.label}`),