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
+51 -13
+51 -13
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,16 +48,30 @@ const { isPlaying, play, pause, next, prev, shuffle, repeat } = usePlayer()
</div> </div>
</div> </div>
<div class="controls"> <div class="controls">
<Icon name="lucide:shuffle" @click="shuffle()" /> <div class="btns">
<Icon name="lucide:skip-back" @click="prev()" /> <Icon name="lucide:shuffle" @click="shuffle()" />
<Icon name="lucide:pause" v-if="isPlaying" @click="pause()" /> <Icon name="lucide:skip-back" @click="prev()" />
<Icon name="lucide:play" v-else @click="play()" /> <Icon
<Icon name="lucide:skip-forward" @click="next()" /> name="lucide:pause"
<Icon v-if="isPlaying"
name="lucide:repeat" @click="pause()"
:class="{ repeating: repeat }" />
@click="repeat = !repeat" <Icon name="lucide:play" v-else @click="play()" />
/> <Icon name="lucide:skip-forward" @click="next()" />
<Icon
name="lucide:repeat"
:class="{ repeating: repeat }"
@click="repeat = !repeat"
/>
</div>
<div class="slider">
<RangeSlider
:model-value="secondsPlayed"
@update:model-value="(v) => (secondsPlayed = v ?? 0)"
:max="duration"
dont-update-immediately
/>
</div>
</div> </div>
<div class="misc-btns"></div> <div class="misc-btns"></div>
</template> </template>
@@ -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;
gap: 1rem; align-items: flex-start;
.btns,
.slider {
display: flex;
justify-content: center;
width: 100%;
}
.btns {
gap: 1rem;
}
span { span {
font-size: 24px; font-size: 24px;