practiced-songs
Matthew Huntington 11 months ago
parent 8abc6c24b1
commit 7d9f05a758

@ -7,8 +7,8 @@
import Timer from './components/timer.vue' import Timer from './components/timer.vue'
import Status from './components/status.vue' import Status from './components/status.vue'
const currentWorkingCategory = ref(null) import { currentWorkingCategory, currentWorkingInstrument } from './libs/state.js'
const currentWorkingInstrument = ref(null)
const timerRunning = ref(false) const timerRunning = ref(false)
const micThresholdExceeded = ref(false) const micThresholdExceeded = ref(false)
const summaryRef = ref(null) const summaryRef = ref(null)
@ -61,16 +61,14 @@
:categories="categories" :categories="categories"
v-model:timerRunning="timerRunning" v-model:timerRunning="timerRunning"
v-model:micThresholdExceeded="micThresholdExceeded" v-model:micThresholdExceeded="micThresholdExceeded"
v-model:currentWorkingInstrument="currentWorkingInstrument" />
v-model:currentWorkingCategory="currentWorkingCategory"/>
</section> </section>
<section id="summary"> <section id="summary">
<Summary <Summary
ref="summaryRef" ref="summaryRef"
:instruments="instruments" :instruments="instruments"
:categories="categories" :categories="categories"
v-model:currentWorkingInstrument="currentWorkingInstrument" />
v-model:currentWorkingCategory="currentWorkingCategory"/>
</section> </section>
<section id="category"> <section id="category">
<ShowCategory <ShowCategory
@ -78,8 +76,7 @@
ref="showCategoryRef" ref="showCategoryRef"
:instruments="instruments" :instruments="instruments"
:categories="categories" :categories="categories"
v-model:currentWorkingInstrument="currentWorkingInstrument" />
v-model:currentWorkingCategory="currentWorkingCategory"/>
</section> </section>
<section id="songs"> <section id="songs">
<Songs/> <Songs/>

@ -2,8 +2,7 @@
import { defineProps } from 'vue'; import { defineProps } from 'vue';
const props = defineProps(['instruments', 'categories']) const props = defineProps(['instruments', 'categories'])
const currentWorkingCategory = defineModel('currentWorkingCategory') import { currentWorkingCategory, currentWorkingInstrument } from '../libs/state.js'
const currentWorkingInstrument = defineModel('currentWorkingInstrument')
const selectFirstInstrumentOfCategory = () => { const selectFirstInstrumentOfCategory = () => {
currentWorkingCategory.value = props.categories.find(category => category.instrument === currentWorkingInstrument.value.name) currentWorkingCategory.value = props.categories.find(category => category.instrument === currentWorkingInstrument.value.name)

@ -2,10 +2,9 @@
import { formatSeconds } from '../libs/time.js' import { formatSeconds } from '../libs/time.js'
import CategoryChooser from './category_chooser.vue' import CategoryChooser from './category_chooser.vue'
import { onMounted, ref, watch, defineProps } from 'vue' import { onMounted, ref, watch, defineProps } from 'vue'
import { currentWorkingCategory, currentWorkingInstrument } from '../libs/state.js'
const props = defineProps(['categories', 'instruments']) const props = defineProps(['categories', 'instruments'])
const currentWorkingCategory = defineModel('currentWorkingCategory')
const currentWorkingInstrument = defineModel('currentWorkingInstrument')
const categorySessions = ref([]) const categorySessions = ref([])
@ -27,8 +26,6 @@
<template> <template>
<h2>Show Category</h2> <h2>Show Category</h2>
<CategoryChooser <CategoryChooser
v-model:currentWorkingCategory="currentWorkingCategory"
v-model:currentWorkingInstrument="currentWorkingInstrument"
:instruments="props.instruments" :instruments="props.instruments"
:categories="props.categories" /> :categories="props.categories" />
<table> <table>

@ -1,8 +1,7 @@
<script setup> <script setup>
import { onMounted, ref, defineExpose } from 'vue' import { onMounted, ref, defineExpose } from 'vue'
import { currentWorkingCategory, currentWorkingInstrument } from '../libs/state.js'
const props = defineProps(['instruments', 'categories']) const props = defineProps(['instruments', 'categories'])
const currentWorkingCategory = defineModel('currentWorkingCategory')
const currentWorkingInstrument = defineModel('currentWorkingInstrument')
const summary = ref([]) const summary = ref([])

@ -3,8 +3,6 @@
const micThresholdExceeded = defineModel('micThresholdExceeded') const micThresholdExceeded = defineModel('micThresholdExceeded')
const timerRunning = defineModel('timerRunning') const timerRunning = defineModel('timerRunning')
const currentWorkingCategory = defineModel('currentWorkingCategory')
const currentWorkingInstrument = defineModel('currentWorkingInstrument')
const props = defineProps(['categories', 'instruments']) const props = defineProps(['categories', 'instruments'])
@ -27,7 +25,7 @@
import CategoryChooser from './category_chooser.vue' import CategoryChooser from './category_chooser.vue'
import { getHours, getMinutes, createTimeObj, getAccumulatedSeconds, formatSeconds } from '../libs/time.js' import { getHours, getMinutes, createTimeObj, getAccumulatedSeconds, formatSeconds } from '../libs/time.js'
import { copiedSongs } from '../libs/state.js' import { copiedSongs, currentWorkingCategory, currentWorkingInstrument } from '../libs/state.js'
const description = ref('') const description = ref('')
@ -63,7 +61,7 @@
const reqBody = { const reqBody = {
description:description.value, description:description.value,
seconds: this.totalSeconds, seconds: this.totalSeconds,
practice_category_id: this.currentWorkingCategory.id practice_category_id: currentWorkingCategory.value.id
} }
if(reqBody.description && copiedSongs.value.length > 0){ if(reqBody.description && copiedSongs.value.length > 0){
@ -193,7 +191,7 @@
}, },
}, },
mounted() { mounted() {
this.practice_category_id = this.currentWorkingCategory.id this.practice_category_id = currentWorkingCategory.value.id
if(window.localStorage.getItem('lastTotalSeconds')){ if(window.localStorage.getItem('lastTotalSeconds')){
this.totalSeconds = parseInt(window.localStorage.getItem('lastTotalSeconds')) this.totalSeconds = parseInt(window.localStorage.getItem('lastTotalSeconds'))
} else { } else {
@ -231,8 +229,6 @@
<label>Practice Category</label> <label>Practice Category</label>
<CategoryChooser <CategoryChooser
v-model:currentWorkingCategory="currentWorkingCategory"
v-model:currentWorkingInstrument="currentWorkingInstrument"
:instruments="instruments" :instruments="instruments"
:categories="categories" /> :categories="categories" />
<input type="submit"/> <input type="submit"/>

@ -1,2 +1,4 @@
import { ref } from 'vue' import { ref } from 'vue'
export const copiedSongs = ref([]) export const copiedSongs = ref([])
export const currentWorkingCategory = ref(null)
export const currentWorkingInstrument = ref(null)

Loading…
Cancel
Save