state now working wip for individual exercise

main
rYeti 2023-05-15 23:41:54 +02:00
parent 3a98ef751f
commit 8a6c959240
4 changed files with 11 additions and 49 deletions

File diff suppressed because one or more lines are too long

2
dist/index.html vendored
View File

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"><link rel="icon" href="./logo.ico"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Gym Tracker</title><script type="module" crossorigin src="./assets/index-0eaa6158.js"></script></head><body><div id="app"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="UTF-8"><link rel="icon" href="./logo.ico"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Gym Tracker</title><script type="module" crossorigin src="./assets/index-60b231bc.js"></script></head><body><div id="app"></div></body></html>

View File

View File

@ -1,19 +1,20 @@
import {defineStore} from 'pinia'
//https://vueuse.org/core/useStorage/
import {useStorage} from '@vueuse/core'
import { ref } from 'vue'
//see https://stephanlangeveld.medium.com/simple-local-storage-implementation-using-vue-3-vueuse-and-pinia-with-zero-extra-lines-of-code-cb9ed2cce42a
export const useWeightInputStore = defineStore({
id: 'weightInput',
state: () => ({
workingSets: [],
workingReps: [],
warmUpSets: [],
warmUpReps: [],
selectedExercise: [],
warmUpSetCount: 0,
workingSetCount: 0,
workingSets: useStorage('workingSets', []),
workingReps: useStorage('workingReps', []),
workingSetsWeight: useStorage('workingSetsWeight', []),
warmUpSets: useStorage('warmUpSets', []),
warmUpReps: useStorage('warmUpReps', []),
warmUpSetsWeight: useStorage('warmUpSetsWeight', []),
selectedExercise: useStorage('selectedExercise', []),
warmUpSetCount: useStorage('warmUpSetCount', 0),
workingSetCount: useStorage('workingSetCount', 0),
}),
getters: {
getAllWeights(state) {
@ -24,45 +25,6 @@ export const useWeightInputStore = defineStore({
addWeight(weight, reps) {
this.weight.push(weight);
this.reps.push(reps);
},/*
addWarmUp(){
const newWarmUpSet = {
id: this.warmUpSetCount++,
content: this.warmUpSetCount.toString().concat('. Set')
};
this.warmUpSets.push(newWarmUpSet.content);
},
addWorkingSet(){
const newWorkingSet = {
id: this.workingSetCount++,
content: this.workingSetCount.toString().concat('. Set')
};
this.workingSets.push(newWorkingSet.content);
}
*/
},
/*
const workingSets = ref([]);
const workingReps = ref([]);
const warmUpSets = ref([]);
const warmUpReps = ref([]);
const selectedExercise = ref([]);
function addWeightInput(workingSetWeight, workingRepsInput, warmUpSetsWeight, warmUpRepsInput, selectedExerciseInput) {
workingSets.value = workingSetWeight;
workingReps.value = workingRepsInput;
warmUpSets.value = warmUpSetsWeight;
warmUpReps.value = warmUpRepsInput;
selectedExercise.value = selectedExerciseInput;
}
return {
workingSets,
workingReps,
warmUpSets,
warmUpReps,
selectedExercise,
addWeightInput
}
*/
})