mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-29 15:14:35 +02:00
Add: Sleep Timer set to end of chapter #24, Change: Scroll to current chapter in modal
This commit is contained in:
parent
3b462b27b5
commit
082c303caf
9 changed files with 134 additions and 41 deletions
|
@ -10,15 +10,21 @@
|
|||
<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>
|
||||
<ul v-if="!sleepTimerRunning" class="h-full w-full" role="listbox" aria-labelledby="listbox-label">
|
||||
<template v-for="timeout in timeouts">
|
||||
<li :key="timeout" class="text-gray-50 select-none relative py-4 pr-9 cursor-pointer hover:bg-black-400" role="option" @click="clickedOption(timeout)">
|
||||
<li :key="timeout" class="text-gray-50 select-none relative py-4 cursor-pointer hover:bg-black-400" role="option" @click="clickedOption(timeout)">
|
||||
<div class="flex items-center justify-center">
|
||||
<span class="font-normal ml-3 block truncate text-lg">{{ timeout }} min</span>
|
||||
<span class="font-normal block truncate text-lg">{{ timeout }} min</span>
|
||||
</div>
|
||||
</li>
|
||||
</template>
|
||||
<li v-if="currentEndOfChapterTime" class="text-gray-50 select-none relative py-4 cursor-pointer hover:bg-black-400" role="option" @click="clickedChapterOption(timeout)">
|
||||
<div class="flex items-center justify-center">
|
||||
<span class="font-normal block truncate text-lg text-center">End of Chapter</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div v-else class="px-2 py-4">
|
||||
<p class="mb-4 text-2xl font-mono text-center">{{ timeRemainingPretty }}</p>
|
||||
<p v-if="endOfChapterTimeSet" class="mb-4 text-2xl font-mono text-center">EOC: {{ endOfChapterTimePretty }}</p>
|
||||
<p v-else class="mb-4 text-2xl font-mono text-center">{{ timeRemainingPretty }}</p>
|
||||
<ui-btn @click="cancelSleepTimer" class="w-full">Cancel Timer</ui-btn>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -31,7 +37,9 @@ export default {
|
|||
props: {
|
||||
value: Boolean,
|
||||
currentTime: Number,
|
||||
sleepTimerRunning: Boolean
|
||||
sleepTimerRunning: Boolean,
|
||||
currentEndOfChapterTime: Boolean,
|
||||
endOfChapterTimeSet: Number
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
|
@ -50,13 +58,20 @@ export default {
|
|||
},
|
||||
timeRemainingPretty() {
|
||||
return this.$secondsToTimestamp(this.currentTime / 1000)
|
||||
},
|
||||
endOfChapterTimePretty() {
|
||||
return this.$secondsToTimestamp(this.endOfChapterTimeSet / 1000)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickedChapterOption() {
|
||||
this.show = false
|
||||
this.$nextTick(() => this.$emit('change', { time: this.currentEndOfChapterTime * 1000, isChapterTime: true }))
|
||||
},
|
||||
clickedOption(timeoutMin) {
|
||||
var timeout = timeoutMin * 1000 * 60
|
||||
this.show = false
|
||||
this.$nextTick(() => this.$emit('change', timeout))
|
||||
this.$nextTick(() => this.$emit('change', { time: timeout, isChapterTime: false }))
|
||||
},
|
||||
cancelSleepTimer() {
|
||||
this.$emit('cancel')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue