diff --git a/src/components/ExerciseList.vue b/src/components/ExerciseList.vue
index a2a83f1..517b7f4 100644
--- a/src/components/ExerciseList.vue
+++ b/src/components/ExerciseList.vue
@@ -7,11 +7,11 @@
-
+
-
+
@@ -23,7 +23,7 @@
import WeightsInput from "@/views/weight/WeightsInput.vue";
import { useWeightInputStore } from '@/stores/storeInput';
- const muscle = defineProps({
+ const props = defineProps({
muscle: String,
})
@@ -34,7 +34,7 @@
onMounted(async () => {
await json.fetchMuscleExercise()
- switch (muscle.muscle) {
+ switch (props.muscle) {
case "Legs":
exercises.value = json.exerciseList.muscle[0].exercises
break;
@@ -65,12 +65,17 @@
});
};
+ function isActiveExercise(exercise){
+ //TODO: Implement (exercise in weightInput.exercises) to show which exercise are edited, or put them in a proper seperate list
+ return { 'exercise-list-button': selectedExercise.value !== exercise, 'exercise-list-button-active': selectedExercise.value === exercise};
+ };
+
const exerciseClick = (exercise) => {
- selectedExercise.value = exercise;
+ selectedExercise.value = exercise.name;
};
const initSetInput = () => {
- weightInput.initSetsInputs(selectedExercise.value);
+ weightInput.initSetsInputs(props.muscle, selectedExercise.value);
};
@@ -85,6 +90,14 @@
margin-top: 0.5rem;
}
+.exercise-list-button {
+ @apply bg-secondary-button hover:bg-accent text-white font-bold py-2 px-2 rounded;
+}
+
+.exercise-list-button-active {
+ @apply bg-accent text-white font-bold py-2 px-2 rounded;
+}
+
.search{
width: auto;
height: 2rem;
@@ -112,4 +125,4 @@
color: white;
}
-
\ No newline at end of file
+
diff --git a/src/stores/storeInput.js b/src/stores/storeInput.js
index 2481e6c..ecb687a 100644
--- a/src/stores/storeInput.js
+++ b/src/stores/storeInput.js
@@ -6,79 +6,86 @@ export const useWeightInputStore = defineStore('weightInput', () => {
// localStorage https://vueuse.org/core/useLocalStorage/
const exercises = useLocalStorage('exercises', {});
- function addWorkingSet(selectedExercise) {
- if (!exercises.value[selectedExercise]) {
+ function addWorkingSet(muscle, selectedExercise) {
+ if (!exercises.value[muscle][selectedExercise]) {
return;
}
- exercises.value[selectedExercise].workingSet.push({
+ exercises.value[muscle][selectedExercise].workingSet.push({
workingSetReps: [],
workingSetWeight: [],
});
- console.log('Added working set:', exercises.value[selectedExercise]);
+ console.log('Added working set:', exercises.value[muscle][selectedExercise]);
}
- function addWarmUpSet(selectedExercise) {
- if (!exercises.value[selectedExercise]) {
+ function addWarmUpSet(muscle, selectedExercise) {
+ if (!exercises.value[muscle][selectedExercise]) {
return;
}
- exercises.value[selectedExercise].warmUpSet.push({
+ exercises.value[muscle][selectedExercise].warmUpSet.push({
warmSetReps: [],
warmSetWeight: [],
});
}
- function removeWorkingSet(selectedExercise) {
- if(!exercises.value[selectedExercise]) {
+ function removeWorkingSet(muscle, selectedExercise) {
+ if(!exercises.value[muscle][selectedExercise]) {
return
}
- exercises.value[selectedExercise].workingSet.pop({
+ exercises.value[muscle][selectedExercise].workingSet.pop({
workingSetReps: [],
workingSetsWeight: [],
})
}
- function removeWarmUpSet(selectedExercise) {
- if(!exercises.value[selectedExercise]) {
+ function removeWarmUpSet(muscle, selectedExercise) {
+ if(!exercises.value[muscle][selectedExercise]) {
return;
}
- exercises.value[selectedExercise].warmUpSet.pop({
+ exercises.value[muscle][selectedExercise].warmUpSet.pop({
warmUpSetReps: [],
warmUpSetsWeight: [],
})
}
- function getWorkingSetCount(selectedExercise) {
- if (exercises.value[selectedExercise]) {
- return exercises.value[selectedExercise].workingSet.length;
+ function getWorkingSetCount(muscle, selectedExercise) {
+ if (exercises.value[muscle][selectedExercise]) {
+ return exercises.value[muscle][selectedExercise].workingSet.length;
}
return 1;
}
- function getWarmUpSetCount(selectedExercise) {
- if (exercises.value[selectedExercise]) {
- return exercises.value[selectedExercise].warmUpSet.length;
+ function getWarmUpSetCount(muscle, selectedExercise) {
+ if (exercises.value[muscle][selectedExercise]) {
+ return exercises.value[muscle][selectedExercise].warmUpSet.length;
}
return 1;
}
- function initSetsInputs(selectedExercise) {
- if(!exercises.value[selectedExercise]) {
- exercises.value[selectedExercise] = {
- workingSet: [],
- warmUpSet: [],
- };
- exercises.value[selectedExercise].workingSet.push({
+ function initSetsInputs(muscle, selectedExercise) {
+ if (!exercises.value[muscle]) {
+ exercises.value[muscle] = {};
+ }
+
+ if (!exercises.value[muscle][selectedExercise]) {
+ exercises.value[muscle][selectedExercise] = {
+ workingSet: [],
+ warmUpSet: [],
+ };
+
+ exercises.value[muscle][selectedExercise].workingSet.push({
workingSetReps: [],
workingSetWeight: [],
});
- exercises.value[selectedExercise].warmUpSet.push({
+
+ exercises.value[muscle][selectedExercise].warmUpSet.push({
warmSetReps: [],
warmSetWeight: [],
});
}
- console.log('Init sets inputs:', exercises.value[selectedExercise], selectedExercise);
- }
+
+ console.log('Init sets inputs:', exercises.value[muscle][selectedExercise], selectedExercise);
+ }
return {
exercises,
@@ -91,4 +98,4 @@ export const useWeightInputStore = defineStore('weightInput', () => {
initSetsInputs }
}
-)
\ No newline at end of file
+)
diff --git a/src/views/weight/WeightsInput.vue b/src/views/weight/WeightsInput.vue
index ca4471a..f125676 100644
--- a/src/views/weight/WeightsInput.vue
+++ b/src/views/weight/WeightsInput.vue
@@ -3,18 +3,18 @@
-
-
-
@@ -38,18 +38,18 @@
-
-