2023-01-29 13:19:06 -06:00
|
|
|
<template>
|
|
|
|
<modals-modal v-model="show" :width="200" height="100%">
|
|
|
|
<template #outer>
|
2023-02-26 14:41:18 -06:00
|
|
|
<div class="absolute top-8 left-4 z-40">
|
2023-12-03 17:37:01 -06:00
|
|
|
<p class="text-white text-2xl truncate">{{ $strings.HeaderSleepTimer }}</p>
|
2023-01-29 13:19:06 -06:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<div
|
|
|
|
class="w-full h-full overflow-hidden absolute top-0 left-0 flex items-center justify-center"
|
|
|
|
@click="
|
|
|
|
show = false
|
|
|
|
manualTimerModal = false
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<div class="w-full overflow-x-hidden overflow-y-auto bg-primary rounded-lg border border-white border-opacity-20" style="max-height: 75%" @click.stop>
|
|
|
|
<div v-if="manualTimerModal" class="p-4">
|
|
|
|
<div class="flex mb-4" @click="manualTimerModal = false">
|
|
|
|
<span class="material-icons text-3xl">arrow_back</span>
|
|
|
|
</div>
|
|
|
|
<div class="flex my-2 justify-between">
|
|
|
|
<ui-btn @click="decreaseManualTimeout" class="w-9 h-9" :padding-x="0" small style="max-width: 36px"><span class="material-icons">remove</span></ui-btn>
|
|
|
|
<p class="text-2xl font-mono text-center">{{ manualTimeoutMin }} min</p>
|
|
|
|
<ui-btn @click="increaseManualTimeout" class="w-9 h-9" :padding-x="0" small style="max-width: 36px"><span class="material-icons">add</span></ui-btn>
|
|
|
|
</div>
|
2023-12-03 17:37:01 -06:00
|
|
|
<ui-btn @click="clickedOption(manualTimeoutMin)" class="w-full">{{ $strings.ButtonSetTimer }}</ui-btn>
|
2023-01-29 13:19:06 -06:00
|
|
|
</div>
|
|
|
|
<ul v-else class="h-full w-full" role="listbox" aria-labelledby="listbox-label">
|
|
|
|
<template v-for="timeout in timeouts">
|
2023-12-10 17:53:27 -06:00
|
|
|
<li :key="timeout" class="text-fg select-none relative py-4" role="option" @click="clickedOption(timeout)">
|
2023-01-29 13:19:06 -06:00
|
|
|
<div class="flex items-center justify-center">
|
|
|
|
<span class="font-normal block truncate text-lg">{{ timeout }} min</span>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</template>
|
2023-12-10 17:53:27 -06:00
|
|
|
<li class="text-fg select-none relative py-4" role="option" @click="clickedChapterOption">
|
2023-01-29 13:19:06 -06:00
|
|
|
<div class="flex items-center justify-center">
|
2023-12-03 17:37:01 -06:00
|
|
|
<span class="font-normal block truncate text-lg text-center">{{ $strings.LabelEndOfChapter }}</span>
|
2023-01-29 13:19:06 -06:00
|
|
|
</div>
|
|
|
|
</li>
|
2023-12-10 17:53:27 -06:00
|
|
|
<li class="text-fg select-none relative py-4" role="option" @click="manualTimerModal = true">
|
2023-01-29 13:19:06 -06:00
|
|
|
<div class="flex items-center justify-center">
|
2023-12-03 17:37:01 -06:00
|
|
|
<span class="font-normal block truncate text-lg text-center">{{ $strings.LabelCustomTime }}</span>
|
2023-01-29 13:19:06 -06:00
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</modals-modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
value: Boolean
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
manualTimerModal: null,
|
|
|
|
manualTimeoutMin: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
show: {
|
|
|
|
get() {
|
|
|
|
return this.value
|
|
|
|
},
|
|
|
|
set(val) {
|
|
|
|
this.$emit('input', val)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
timeouts() {
|
|
|
|
return [5, 10, 15, 30, 45, 60, 90]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async clickedChapterOption() {
|
|
|
|
await this.$hapticsImpact()
|
|
|
|
this.show = false
|
|
|
|
this.$nextTick(() => this.$emit('change', 0))
|
|
|
|
},
|
|
|
|
async clickedOption(timeoutMin) {
|
|
|
|
await this.$hapticsImpact()
|
|
|
|
const timeout = timeoutMin * 1000 * 60
|
|
|
|
this.show = false
|
|
|
|
this.manualTimerModal = false
|
|
|
|
this.$nextTick(() => this.$emit('change', timeout))
|
|
|
|
},
|
|
|
|
async increaseManualTimeout() {
|
|
|
|
await this.$hapticsImpact()
|
|
|
|
this.manualTimeoutMin++
|
|
|
|
},
|
|
|
|
async decreaseManualTimeout() {
|
|
|
|
await this.$hapticsImpact()
|
|
|
|
if (this.manualTimeoutMin > 1) this.manualTimeoutMin--
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {}
|
|
|
|
}
|
|
|
|
</script>
|