state now working wip for individual exercise
parent
3a98ef751f
commit
8a6c959240
File diff suppressed because one or more lines are too long
|
|
@ -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>
|
||||||
|
|
@ -1,19 +1,20 @@
|
||||||
import {defineStore} from 'pinia'
|
import {defineStore} from 'pinia'
|
||||||
//https://vueuse.org/core/useStorage/
|
//https://vueuse.org/core/useStorage/
|
||||||
import {useStorage} from '@vueuse/core'
|
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
|
//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({
|
export const useWeightInputStore = defineStore({
|
||||||
id: 'weightInput',
|
id: 'weightInput',
|
||||||
state: () => ({
|
state: () => ({
|
||||||
workingSets: [],
|
workingSets: useStorage('workingSets', []),
|
||||||
workingReps: [],
|
workingReps: useStorage('workingReps', []),
|
||||||
warmUpSets: [],
|
workingSetsWeight: useStorage('workingSetsWeight', []),
|
||||||
warmUpReps: [],
|
warmUpSets: useStorage('warmUpSets', []),
|
||||||
selectedExercise: [],
|
warmUpReps: useStorage('warmUpReps', []),
|
||||||
warmUpSetCount: 0,
|
warmUpSetsWeight: useStorage('warmUpSetsWeight', []),
|
||||||
workingSetCount: 0,
|
selectedExercise: useStorage('selectedExercise', []),
|
||||||
|
warmUpSetCount: useStorage('warmUpSetCount', 0),
|
||||||
|
workingSetCount: useStorage('workingSetCount', 0),
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getAllWeights(state) {
|
getAllWeights(state) {
|
||||||
|
|
@ -24,45 +25,6 @@ export const useWeightInputStore = defineStore({
|
||||||
addWeight(weight, reps) {
|
addWeight(weight, reps) {
|
||||||
this.weight.push(weight);
|
this.weight.push(weight);
|
||||||
this.reps.push(reps);
|
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
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
})
|
})
|
||||||
Loading…
Reference in New Issue