mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-30 07:07:22 +02:00
Update chapters modal to always show both start and duration, add sticky header
This commit is contained in:
@@ -99,7 +99,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<modals-chapters-modal v-model="showChapterModal" :current-chapter="currentChapter" :chapters="chapters" :playback-rate="currentPlaybackRate" :use-chapter-duration="playerSettings.useChapterDuration" @select="selectChapter" />
|
<modals-chapters-modal v-model="showChapterModal" :current-chapter="currentChapter" :chapters="chapters" :playback-rate="currentPlaybackRate" @select="selectChapter" />
|
||||||
<modals-dialog v-model="showMoreMenuDialog" :items="menuItems" width="80vw" @action="clickMenuAction" />
|
<modals-dialog v-model="showMoreMenuDialog" :items="menuItems" width="80vw" @action="clickMenuAction" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -146,7 +146,6 @@ export default {
|
|||||||
useChapterTrack: false,
|
useChapterTrack: false,
|
||||||
useTotalTrack: true,
|
useTotalTrack: true,
|
||||||
scaleElapsedTimeBySpeed: true,
|
scaleElapsedTimeBySpeed: true,
|
||||||
useChapterDuration: false,
|
|
||||||
lockUi: false
|
lockUi: false
|
||||||
},
|
},
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
@@ -207,11 +206,6 @@ export default {
|
|||||||
value: 'scale_elapsed_time',
|
value: 'scale_elapsed_time',
|
||||||
icon: this.playerSettings.scaleElapsedTimeBySpeed ? 'check_box' : 'check_box_outline_blank'
|
icon: this.playerSettings.scaleElapsedTimeBySpeed ? 'check_box' : 'check_box_outline_blank'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
text: this.$strings.LabelUseChapterDuration,
|
|
||||||
value: 'use_chapter_duration',
|
|
||||||
icon: this.playerSettings.useChapterDuration ? 'check_box' : 'check_box_outline_blank'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
text: this.playerSettings.lockUi ? this.$strings.LabelUnlockPlayer : this.$strings.LabelLockPlayer,
|
text: this.playerSettings.lockUi ? this.$strings.LabelUnlockPlayer : this.$strings.LabelLockPlayer,
|
||||||
value: 'lock',
|
value: 'lock',
|
||||||
@@ -738,9 +732,6 @@ export default {
|
|||||||
this.playerSettings.scaleElapsedTimeBySpeed = !this.playerSettings.scaleElapsedTimeBySpeed
|
this.playerSettings.scaleElapsedTimeBySpeed = !this.playerSettings.scaleElapsedTimeBySpeed
|
||||||
this.updateTimestamp()
|
this.updateTimestamp()
|
||||||
this.savePlayerSettings()
|
this.savePlayerSettings()
|
||||||
} else if (action === 'use_chapter_duration') {
|
|
||||||
this.playerSettings.useChapterDuration = !this.playerSettings.useChapterDuration
|
|
||||||
this.savePlayerSettings()
|
|
||||||
} else if (action === 'lock') {
|
} else if (action === 'lock') {
|
||||||
this.playerSettings.lockUi = !this.playerSettings.lockUi
|
this.playerSettings.lockUi = !this.playerSettings.lockUi
|
||||||
this.savePlayerSettings()
|
this.savePlayerSettings()
|
||||||
@@ -808,7 +799,6 @@ export default {
|
|||||||
this.playerSettings.useTotalTrack = !!savedPlayerSettings.useTotalTrack
|
this.playerSettings.useTotalTrack = !!savedPlayerSettings.useTotalTrack
|
||||||
this.playerSettings.lockUi = !!savedPlayerSettings.lockUi
|
this.playerSettings.lockUi = !!savedPlayerSettings.lockUi
|
||||||
this.playerSettings.scaleElapsedTimeBySpeed = !!savedPlayerSettings.scaleElapsedTimeBySpeed
|
this.playerSettings.scaleElapsedTimeBySpeed = !!savedPlayerSettings.scaleElapsedTimeBySpeed
|
||||||
this.playerSettings.useChapterDuration = !!savedPlayerSettings.useChapterDuration
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
savePlayerSettings() {
|
savePlayerSettings() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<modals-modal v-model="show" :width="400" height="100%">
|
<modals-modal v-model="show" :width="400" max-width="95%" height="100%">
|
||||||
<template #outer>
|
<template #outer>
|
||||||
<div v-if="currentChapter" class="absolute top-10 left-4 z-40 pt-1" style="max-width: 80%">
|
<div v-if="currentChapter" class="absolute top-10 left-4 z-40 pt-1" style="max-width: 80%">
|
||||||
<p class="text-white text-lg truncate">{{ chapters.length }} {{ $strings.LabelChapters }}</p>
|
<p class="text-white text-lg truncate">{{ chapters.length }} {{ $strings.LabelChapters }}</p>
|
||||||
@@ -8,19 +8,31 @@
|
|||||||
|
|
||||||
<div class="w-full h-full overflow-hidden absolute top-0 left-0 flex items-center justify-center" @click="show = false">
|
<div class="w-full h-full overflow-hidden absolute top-0 left-0 flex items-center justify-center" @click="show = false">
|
||||||
<div ref="container" class="w-full overflow-x-hidden overflow-y-auto bg-secondary rounded-lg border border-fg/20" style="max-height: 75%" @click.stop>
|
<div ref="container" class="w-full overflow-x-hidden overflow-y-auto bg-secondary rounded-lg border border-fg/20" style="max-height: 75%" @click.stop>
|
||||||
|
<div class="sticky top-0 z-10 bg-secondary grid grid-cols-[1fr_auto_auto] gap-2 px-3 py-2 border-b border-fg/10 transition-shadow" :class="{ 'shadow-md': isScrolled }">
|
||||||
|
<div>
|
||||||
|
<p class="text-fg-muted text-sm">{{ $strings.LabelChapters }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="text-right" style="min-width: 60px">
|
||||||
|
<p class="text-fg-muted text-sm" style="letter-spacing: -0.5px">{{ $strings.LabelStart }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="text-right" style="min-width: 60px">
|
||||||
|
<p class="text-fg-muted text-sm" style="letter-spacing: -0.5px">{{ $strings.LabelDuration }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<ul class="h-full w-full" role="listbox" aria-labelledby="listbox-label">
|
<ul class="h-full w-full" role="listbox" aria-labelledby="listbox-label">
|
||||||
<template v-for="chapter in chapters">
|
<li v-for="chapter in chapters" :key="chapter.id" :id="`chapter-row-${chapter.id}`" class="text-fg select-none relative cursor-pointer" :class="currentChapterId === chapter.id ? 'bg-primary bg-opacity-80' : ''" role="option" @click="clickedOption(chapter)">
|
||||||
<li :key="chapter.id" :id="`chapter-row-${chapter.id}`" class="text-fg select-none relative py-4 cursor-pointer" :class="currentChapterId === chapter.id ? 'bg-primary bg-opacity-80' : ''" role="option" @click="clickedOption(chapter)">
|
<div class="grid grid-cols-[1fr_auto_auto] gap-2 px-3 py-3 items-start">
|
||||||
<div class="relative flex items-center pl-3 pr-20">
|
<p class="font-normal line-clamp-2 text-sm text-fg/80">{{ chapter.title }}</p>
|
||||||
<p class="font-normal block truncate text-sm text-fg/80">{{ chapter.title }}</p>
|
<div class="text-right" style="min-width: 60px">
|
||||||
<div class="absolute top-0 right-3 -mt-0.5">
|
<span class="font-mono text-fg-muted text-sm" style="letter-spacing: -0.5px">{{ $secondsToTimestamp(chapter.start / _playbackRate) }}</span>
|
||||||
<span class="font-mono text-fg-muted leading-3 text-sm" style="letter-spacing: -0.5px">{{ $secondsToTimestamp(((useChapterDuration ? Math.max(0, chapter.end - chapter.start) : chapter.start) / _playbackRate)) }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-right" style="min-width: 60px">
|
||||||
|
<span class="font-mono text-fg-muted text-sm" style="letter-spacing: -0.5px">{{ $secondsToTimestamp(Math.max(0, chapter.end - chapter.start) / _playbackRate) }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-show="chapter.id === currentChapterId" class="w-0.5 h-full absolute top-0 left-0 bg-yellow-400" />
|
<div v-show="chapter.id === currentChapterId" class="w-0.5 h-full absolute top-0 left-0 bg-yellow-400" />
|
||||||
</li>
|
</li>
|
||||||
</template>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -39,11 +51,12 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: () => null
|
default: () => null
|
||||||
},
|
},
|
||||||
playbackRate: Number,
|
playbackRate: Number
|
||||||
useChapterDuration: Boolean
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
isScrolled: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value(newVal) {
|
value(newVal) {
|
||||||
@@ -88,8 +101,25 @@ export default {
|
|||||||
container.scrollTo({ top: offsetTop - containerHeight / 2 })
|
container.scrollTo({ top: offsetTop - containerHeight / 2 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
handleScroll() {
|
||||||
|
const container = this.$refs.container
|
||||||
|
if (container) {
|
||||||
|
this.isScrolled = container.scrollTop > 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {}
|
mounted() {
|
||||||
|
const container = this.$refs.container
|
||||||
|
if (container) {
|
||||||
|
container.addEventListener('scroll', this.handleScroll)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
const container = this.$refs.container
|
||||||
|
if (container) {
|
||||||
|
container.removeEventListener('scroll', this.handleScroll)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -272,7 +272,6 @@
|
|||||||
"LabelUnknown": "Unknown",
|
"LabelUnknown": "Unknown",
|
||||||
"LabelUnlockPlayer": "Unlock Player",
|
"LabelUnlockPlayer": "Unlock Player",
|
||||||
"LabelUseBookshelfView": "Use bookshelf view",
|
"LabelUseBookshelfView": "Use bookshelf view",
|
||||||
"LabelUseChapterDuration": "Use chapter duration",
|
|
||||||
"LabelUser": "User",
|
"LabelUser": "User",
|
||||||
"LabelUsername": "Username",
|
"LabelUsername": "Username",
|
||||||
"LabelVeryHigh": "Very High",
|
"LabelVeryHigh": "Very High",
|
||||||
|
|||||||
Reference in New Issue
Block a user