Added RangeSlider for secondsPlayed

This commit is contained in:
lucast committed 2026-02-19 15:26:58 +01:00
1 parent 4ca422e25a
commit 2d7fc08a3e
1 file changed
+41 -3
+41 -3
View File
@@ -17,7 +17,17 @@ onMounted(() => {
}) })
const song = useSong() const song = useSong()
const { isPlaying, play, pause, next, prev, shuffle, repeat } = usePlayer() const {
isPlaying,
play,
pause,
next,
prev,
shuffle,
repeat,
secondsPlayed,
duration,
} = usePlayer()
</script> </script>
<template> <template>
@@ -38,9 +48,14 @@ const { isPlaying, play, pause, next, prev, shuffle, repeat } = usePlayer()
</div> </div>
</div> </div>
<div class="controls"> <div class="controls">
<div class="btns">
<Icon name="lucide:shuffle" @click="shuffle()" /> <Icon name="lucide:shuffle" @click="shuffle()" />
<Icon name="lucide:skip-back" @click="prev()" /> <Icon name="lucide:skip-back" @click="prev()" />
<Icon name="lucide:pause" v-if="isPlaying" @click="pause()" /> <Icon
name="lucide:pause"
v-if="isPlaying"
@click="pause()"
/>
<Icon name="lucide:play" v-else @click="play()" /> <Icon name="lucide:play" v-else @click="play()" />
<Icon name="lucide:skip-forward" @click="next()" /> <Icon name="lucide:skip-forward" @click="next()" />
<Icon <Icon
@@ -49,6 +64,15 @@ const { isPlaying, play, pause, next, prev, shuffle, repeat } = usePlayer()
@click="repeat = !repeat" @click="repeat = !repeat"
/> />
</div> </div>
<div class="slider">
<RangeSlider
:model-value="secondsPlayed"
@update:model-value="(v) => (secondsPlayed = v ?? 0)"
:max="duration"
dont-update-immediately
/>
</div>
</div>
<div class="misc-btns"></div> <div class="misc-btns"></div>
</template> </template>
</article> </article>
@@ -86,7 +110,8 @@ const { isPlaying, play, pause, next, prev, shuffle, repeat } = usePlayer()
.track, .track,
.controls, .controls,
.misc-btns { .misc-btns,
.controls {
display: flex; display: flex;
width: 100%; width: 100%;
gap: 0.5rem; gap: 0.5rem;
@@ -111,8 +136,21 @@ const { isPlaying, play, pause, next, prev, shuffle, repeat } = usePlayer()
} }
.controls { .controls {
flex-direction: column;
gap: 0.8rem;
justify-content: center; justify-content: center;
align-items: flex-start;
.btns,
.slider {
display: flex;
justify-content: center;
width: 100%;
}
.btns {
gap: 1rem; gap: 1rem;
}
span { span {
font-size: 24px; font-size: 24px;