wip
parent
054da6633e
commit
e9a696dcaa
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="exerciseList">
|
<div class="exerciseList">
|
||||||
<ul class="exerciseItem" v-for="exercise in filterExercises()" :key="exercise.name">
|
<ul class="exerciseItem" v-for="exercise in filterExercises()" :key="exercise.name">
|
||||||
<button @click="exerciseClick(exercise)" class="btn bg-secondary-button hover:bg-accent text-white font-bold py-2 px-2 rounded" >{{ exercise.name }}</button>
|
<button @click="exerciseClick(exercise); addSets()" class="btn bg-secondary-button hover:bg-accent text-white font-bold py-2 px-2 rounded" >{{ exercise.name }}</button>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="selectedExercise">
|
<div v-if="selectedExercise">
|
||||||
|
|
@ -21,12 +21,14 @@
|
||||||
import { useExerciseStore } from '@/stores/storeExercise.js';
|
import { useExerciseStore } from '@/stores/storeExercise.js';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import WeightsInput from "@/views/weight/WeightsInput.vue";
|
import WeightsInput from "@/views/weight/WeightsInput.vue";
|
||||||
|
import { useWeightInputStore } from '@/stores/storeInput';
|
||||||
|
|
||||||
const muscle = defineProps({
|
const muscle = defineProps({
|
||||||
muscle: String,
|
muscle: String,
|
||||||
})
|
})
|
||||||
|
|
||||||
const json = useExerciseStore()
|
const json = useExerciseStore()
|
||||||
|
const weightInput = useWeightInputStore()
|
||||||
const exercises = ref([])
|
const exercises = ref([])
|
||||||
const selectedExercise = ref(null)
|
const selectedExercise = ref(null)
|
||||||
|
|
||||||
|
|
@ -67,6 +69,10 @@
|
||||||
selectedExercise.value = exercise;
|
selectedExercise.value = exercise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const addSets = () => {
|
||||||
|
weightInput.initInputs(selectedExercise.value);
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
|
|
||||||
export const useWeightInputStore = defineStore(('weightInput'),{
|
export const useWeightInputStore = defineStore(('weightInput'), {
|
||||||
state: () => reactive ({
|
state: () => reactive ({
|
||||||
workingSets: [
|
workingSets: [
|
||||||
{
|
{
|
||||||
|
selectedExercise: '',
|
||||||
|
workingReps: [],
|
||||||
|
workingSetsWeight: [],
|
||||||
|
workingSetCount: 0,
|
||||||
|
/*
|
||||||
selectedExercise: '',
|
selectedExercise: '',
|
||||||
workingSet: [
|
workingSet: [
|
||||||
{
|
{
|
||||||
|
|
@ -12,19 +17,29 @@ export const useWeightInputStore = defineStore(('weightInput'),{
|
||||||
workingSetsWeight: []
|
workingSetsWeight: []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
workingSetReps: [],
|
||||||
|
workingSetWeight: [],
|
||||||
workingSetCount: 0,
|
workingSetCount: 0,
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
warmUpSets: [
|
warmUpSets: [
|
||||||
{
|
{
|
||||||
|
selectedExercise: '',
|
||||||
|
warmUpReps: [],
|
||||||
|
warmUpSetsWeight: [],
|
||||||
|
warmUpSetCount: 0,
|
||||||
|
/*
|
||||||
selectedExercise: '',
|
selectedExercise: '',
|
||||||
warmUpSet: [
|
warmUpSet: [
|
||||||
{
|
{
|
||||||
warmUpReps: [],
|
warmUpReps: [0,],
|
||||||
warmUpSetsWeight: [],
|
warmUpSetsWeight: [0,],
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
warmUpSetCount: 0,
|
warmUpSetReps: [],
|
||||||
|
warmUpSetWeight: [],
|
||||||
|
warmUpSetCount: 0,*/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|
@ -35,18 +50,42 @@ export const useWeightInputStore = defineStore(('weightInput'),{
|
||||||
removeWorkingSet(selectedExercise) {
|
removeWorkingSet(selectedExercise) {
|
||||||
this.sets = this.sets.filter(e => {return e.selectedExercise !== selectedExercise})
|
this.sets = this.sets.filter(e => {return e.selectedExercise !== selectedExercise})
|
||||||
},
|
},
|
||||||
addWorkingSet(selectedExercise, workingSetCount, workingReps, workingSetsWeight){
|
addWorkingSet(selectedExercise) {
|
||||||
const neWworkingSet = {
|
const targetExercise = this.state.find(set => set.selectedExercise.name === selectedExercise);
|
||||||
}
|
if(targetExercise) {
|
||||||
|
targetExercise.warmUpReps.push([]);
|
||||||
|
targetExercise.warmUpSetsWeight.push([]);
|
||||||
|
targetExercise.warmUpSetCount++;
|
||||||
|
} else {
|
||||||
|
this.workingSets.push({
|
||||||
|
selectedExercise,
|
||||||
|
workingReps: [],
|
||||||
|
workingSetsWeight: [],
|
||||||
|
workingSetCount: 1,
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
addWarmUpSet(selectedExercise) {
|
addWarmUpSet(selectedExercise) {
|
||||||
this.warmUpSets.push({
|
this.warmUpSets.push({
|
||||||
selectedExercise: selectedExercise,
|
|
||||||
warmUpSets: [],
|
warmUpSets: [],
|
||||||
warmUpReps: [],
|
warmUpReps: [],
|
||||||
warmUpSetsWeight: [],
|
warmUpSetsWeight: [],
|
||||||
warmUpSetCount: warmUpSetCount++,
|
warmUpSetCount: warmUpSetCount++,
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
initInputs(selectedExercise) {
|
||||||
|
this.workingSets.push({
|
||||||
|
selectedExercise: selectedExercise,
|
||||||
|
workingSetReps: [],
|
||||||
|
workingSetsWeight: [],
|
||||||
|
workingSetCount: 1,
|
||||||
|
})
|
||||||
|
this.warmUpSets.push({
|
||||||
|
selectedExercise: selectedExercise,
|
||||||
|
warmUpReps: [],
|
||||||
|
warmUpSetsWeight: [],
|
||||||
|
warmUpSetCount: 1,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
<div class="working-set mt-5">
|
<div class="working-set mt-5">
|
||||||
<label>Working Sets</label>
|
<label>Working Sets</label>
|
||||||
<button @click="workingAddSet()"
|
<button @click="addWorkingSet()"
|
||||||
class="bg-accent hover:bg-primary-button text-white font-bold py-2 px-2 rounded ml-7">
|
class="bg-accent hover:bg-primary-button text-white font-bold py-2 px-2 rounded ml-7">
|
||||||
Add
|
Add
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -47,11 +47,11 @@
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div v-for="(workingset, workingSetCount) in weightInput.workingSets.workingSets" :key="workingSetCount" class="item flex justify-smart mt-1">
|
<div v-for="(workingset, workingSetCount) in weightInput.workingSets" :key="workingSetCount" class="item flex justify-smart mt-1">
|
||||||
{{ workingset }}
|
{{ workingset.content }}
|
||||||
<div class="ml-3">
|
<div class="ml-3">
|
||||||
<input
|
<input
|
||||||
v-model="weightInput.workingSets.workingSetsWeight.workingSetsWeight[workingSetCount]"
|
v-model="weightInput.workingSets.workingSetsWeight[workingSetCount]"
|
||||||
type="number"
|
type="number"
|
||||||
class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none block rounded-md sm:text-sm "
|
class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none block rounded-md sm:text-sm "
|
||||||
placeholder="Weight (Kg)"
|
placeholder="Weight (Kg)"
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
</div>
|
</div>
|
||||||
<label class="ml-3 mt-2">Reps</label>
|
<label class="ml-3 mt-2">Reps</label>
|
||||||
<div class="ml-3">
|
<div class="ml-3">
|
||||||
<input v-model="weightInput.workingSets.workingSets.workingReps[workingSetCount]"
|
<input v-model="weightInput.workingSets.workingReps[workingSetCount]"
|
||||||
type="number"
|
type="number"
|
||||||
class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none block rounded-md sm:text-sm "
|
class="mt-1 px-3 py-2 bg-black border shadow-sm border-slate-300 placeholder-slate-400 focus:outline-none block rounded-md sm:text-sm "
|
||||||
placeholder="Reps"
|
placeholder="Reps"
|
||||||
|
|
@ -82,7 +82,10 @@ const selectedExercise = defineProps({
|
||||||
|
|
||||||
const weightInput = useWeightInputStore();
|
const weightInput = useWeightInputStore();
|
||||||
weightInput.selectedExercise = ref(selectedExercise.selectedExercise);
|
weightInput.selectedExercise = ref(selectedExercise.selectedExercise);
|
||||||
let workingSetCount = ref(0);
|
|
||||||
|
const addWorkingSet = () => {
|
||||||
|
weightInput.addWorkingSet(selectedExercise.selectedExercise);
|
||||||
|
}
|
||||||
|
|
||||||
const warmUpAddSet = () => {
|
const warmUpAddSet = () => {
|
||||||
const newWarmUpSet = {
|
const newWarmUpSet = {
|
||||||
|
|
@ -90,11 +93,7 @@ const warmUpAddSet = () => {
|
||||||
content:weightInput.warmUpSets.warmUpSetCount.toString().concat('. Set'),
|
content:weightInput.warmUpSets.warmUpSetCount.toString().concat('. Set'),
|
||||||
|
|
||||||
};
|
};
|
||||||
weightInput.warmUpSets.push(newWarmUpSet.content);
|
weightInput.workingSetCount;
|
||||||
};
|
|
||||||
|
|
||||||
const workingAddSet = () => {
|
|
||||||
weightInput.workingSets.workingSetCount = ++workingSetCount;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeWarmUpSet = () => {
|
const removeWarmUpSet = () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue