From 3d4a9913c5c094c3e82ec0960e4d6a1cfab323b8 Mon Sep 17 00:00:00 2001 From: Christian Carlsson Date: Thu, 21 Nov 2024 21:45:09 +0000 Subject: [PATCH] refact: update style for exercise forms (#59) --- .../src/views/Exercises/CreateExercise.vue | 33 +---- .../src/views/Exercises/UpdateExercise.vue | 129 +++++++----------- 2 files changed, 48 insertions(+), 114 deletions(-) diff --git a/apps/web/src/views/Exercises/CreateExercise.vue b/apps/web/src/views/Exercises/CreateExercise.vue index 820c3d96..939c64d1 100644 --- a/apps/web/src/views/Exercises/CreateExercise.vue +++ b/apps/web/src/views/Exercises/CreateExercise.vue @@ -11,19 +11,6 @@ const resError = ref('') const resOK = ref(false) const rest = ref(0) -const restOptions = [ - { value: 30, label: '30 seconds' }, - { value: 60, label: '1 minute' }, - { value: 90, label: '1 minute 30 seconds' }, - { value: 120, label: '2 minutes' }, - { value: 150, label: '2 minutes 30 seconds' }, - { value: 180, label: '3 minutes' }, - { value: 210, label: '3 minutes 30 seconds' }, - { value: 240, label: '4 minutes' }, - { value: 270, label: '4 minutes 30 seconds' }, - { value: 300, label: '5 minutes' }, -] - async function createExercise() { const request = new CreateExerciseRequest({ name: name.value, @@ -88,30 +75,12 @@ async function createExercise() { v-model="label" id="label" type="text" + placeholder="Optional" class="block w-full rounded-md border-0 bg-white px-3 py-3 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm/6" /> -
-
- -
-
- -
-
Save Exercise diff --git a/apps/web/src/views/Exercises/UpdateExercise.vue b/apps/web/src/views/Exercises/UpdateExercise.vue index d76afff8..fe5b490e 100644 --- a/apps/web/src/views/Exercises/UpdateExercise.vue +++ b/apps/web/src/views/Exercises/UpdateExercise.vue @@ -11,24 +11,9 @@ const name = ref('') const label = ref('') const resError = ref('') const resOK = ref(false) -const rest = ref(0) const route = useRoute() -console.log(route.params.id) -const restOptions = [ - { value: 30, label: '30 seconds' }, - { value: 60, label: '1 minute' }, - { value: 90, label: '1 minute 30 seconds' }, - { value: 120, label: '2 minutes' }, - { value: 150, label: '2 minutes 30 seconds' }, - { value: 180, label: '3 minutes' }, - { value: 210, label: '3 minutes 30 seconds' }, - { value: 240, label: '4 minutes' }, - { value: 270, label: '4 minutes 30 seconds' }, - { value: 300, label: '5 minutes' }, -] - async function loadExercise() { const request = new GetExerciseRequest({ id: route.params.id as string, @@ -57,11 +42,11 @@ onMounted(() => { async function updateExercise() { const request = new UpdateExerciseRequest({ exercise: new Exercise({ - id: route.params.id[0], + id: route.params.id as string, name: name.value, label: label.value, }), - updateMask: new FieldMask({ paths: ['name', 'label', 'rest_between_sets'] }), + updateMask: new FieldMask({ paths: ['name', 'label'] }), }) try { await ExerciseClient.update(request) @@ -79,75 +64,55 @@ async function updateExercise() {