From 6bfcb241334b82b21c3c6cfbb1352e10e46dba63 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 29 Sep 2021 11:32:05 +0200 Subject: [PATCH] Client - add a workout + fix --- .../src/components/Common/CustomTextArea.vue | 5 + .../components/Dashboard/Timeline/index.vue | 20 +- fittrackee_client/src/components/NavBar.vue | 4 +- .../src/components/Workout/WorkoutEdition.vue | 370 +++++++++++++++--- .../src/locales/en/workouts.json | 11 +- .../src/locales/fr/workouts.json | 9 +- fittrackee_client/src/router/index.ts | 6 + fittrackee_client/src/scss/base.scss | 1 + .../src/store/modules/workouts/actions.ts | 84 +++- .../src/store/modules/workouts/enums.ts | 2 + .../src/store/modules/workouts/types.ts | 9 + fittrackee_client/src/types/workouts.ts | 6 +- fittrackee_client/src/views/AddWorkout.vue | 47 +++ fittrackee_client/src/views/EditWorkout.vue | 15 +- 14 files changed, 515 insertions(+), 74 deletions(-) create mode 100644 fittrackee_client/src/views/AddWorkout.vue diff --git a/fittrackee_client/src/components/Common/CustomTextArea.vue b/fittrackee_client/src/components/Common/CustomTextArea.vue index 458296f1..25d798b5 100644 --- a/fittrackee_client/src/components/Common/CustomTextArea.vue +++ b/fittrackee_client/src/components/Common/CustomTextArea.vue @@ -4,6 +4,7 @@ :id="name" :name="name" :maxLenght="charLimit" + :disabled="disabled" v-model="text" @input="updateText" /> @@ -24,6 +25,10 @@ type: Number, default: 500, }, + disabled: { + type: Boolean, + default: false, + }, input: { type: String, default: '', diff --git a/fittrackee_client/src/components/Dashboard/Timeline/index.vue b/fittrackee_client/src/components/Dashboard/Timeline/index.vue index 9cb577af..49d8fd07 100644 --- a/fittrackee_client/src/components/Dashboard/Timeline/index.vue +++ b/fittrackee_client/src/components/Dashboard/Timeline/index.vue @@ -2,15 +2,15 @@
{{ t('workouts.LATEST_WORKOUTS') }}
{{ t('workouts.NO_WORKOUTS') }} @@ -56,7 +56,7 @@ required: true, }, }, - setup(props) { + setup() { const store = useStore() const { t } = useI18n() @@ -64,9 +64,6 @@ const per_page = 5 onBeforeMount(() => loadWorkouts()) - const initWorkoutsCount = - props.user.nb_workouts >= per_page ? per_page : props.user.nb_workouts - const workouts: ComputedRef = computed( () => store.getters[WORKOUTS_STORE.GETTERS.USER_WORKOUTS] ) @@ -86,20 +83,13 @@ page.value += 1 loadWorkouts() } - function workoutsToDisplayCount() { - return workouts.value.length > initWorkoutsCount - ? workouts.value.length - : initWorkoutsCount - } return { - initWorkoutsCount, moreWorkoutsExist, per_page, workouts, t, loadMoreWorkouts, - workoutsToDisplayCount, } }, }) diff --git a/fittrackee_client/src/components/NavBar.vue b/fittrackee_client/src/components/NavBar.vue index f27d4b4a..43437075 100644 --- a/fittrackee_client/src/components/NavBar.vue +++ b/fittrackee_client/src/components/NavBar.vue @@ -28,7 +28,9 @@
- + + {{ t('workouts.ADD_WORKOUT') }} +
diff --git a/fittrackee_client/src/components/Workout/WorkoutEdition.vue b/fittrackee_client/src/components/Workout/WorkoutEdition.vue index a68eeb24..17b98490 100644 --- a/fittrackee_client/src/components/Workout/WorkoutEdition.vue +++ b/fittrackee_client/src/components/Workout/WorkoutEdition.vue @@ -1,14 +1,45 @@