Author SHA1 Message Date
lucast 7cbc087049 Added album slider 2026-04-05 12:02:22 +02:00
lucast 5c9b82265d Test data cleanup 2026-04-05 11:57:21 +02:00
lucast 307f467f94 Added track title to slider 2026-04-05 11:55:45 +02:00
lucast cb481ad983 Added track slider for artist page 2026-04-05 11:55:17 +02:00
lucast e8d2173f17 Created tracks page for artists 2026-03-08 12:06:17 +01:00
lucast 427437bb3b Moved artist page 2026-03-08 12:06:05 +01:00
lucast fceddf641a Added track image row component 2026-03-08 12:05:53 +01:00
lucast af3b9669dc Fixed player hiding the bottom of the page and elements behind the player being visible 2026-03-08 11:30:17 +01:00
lucast 4eb7c6d5a9 Added groups to dropdown menu 2026-03-08 11:24:46 +01:00
lucast aa93320215 Add cursor pointer style to dropdown icon 2026-03-08 11:12:42 +01:00
lucast 6c1dda9622 Fixed small bug with checkbox not having initial value 2026-03-07 19:49:45 +01:00
lucast b48db8bb37 Merge branch 'feat/player-fullscreen' 2026-03-07 19:49:18 +01:00
lucast d5482a9ea4 Added non synced text 2026-03-07 19:49:06 +01:00
lucast ab22cd6eb9 Implemented scrolling 2026-03-07 19:37:59 +01:00
lucast b6e854b1dd Add onMounted hook to refresh session token if needed 2026-03-07 19:28:59 +01:00
lucast fd27fee6c7 Updated synced lyrics system to be more smooth 2026-03-07 15:42:34 +01:00
lucast 22d6150290 Got synced lyrics working 2026-03-07 15:32:20 +01:00
lucast ddef57b802 Merge branch 'master' into feat/player-fullscreen 2026-03-07 14:45:58 +01:00
lucast ae79952ddc Update fullscreen player to show/hide close buttons 2026-02-27 14:53:31 +01:00
lucast 76c57c1ba0 Made cursor hide when no movement is detected 2026-02-27 14:51:45 +01:00
lucast 4475b95aed Implement mouse movement detection for fullscreen player and update layout structure 2026-02-27 14:48:53 +01:00
lucast 2561bd0e62 Add TrackDisplay component for fullscreen player with controls and styling 2026-02-27 14:48:45 +01:00
lucast ed53c41a87 Add monochrome slider support with styling adjustments 2026-02-27 14:48:27 +01:00
lucast 78c4a6cb8e Added fullscreen composable and background for fullscreen 2026-02-25 17:21:31 +01:00
18 changed files with 1021 additions and 20 deletions

No files matched your search

+1
View File
@@ -129,6 +129,7 @@ watch(
<Checkbox
v-else-if="field.type == 'checkbox'"
:label="field.label || field.key"
:model-value="localItem[field.key]"
@change="(v) => (localItem[field.key] = v)"
/>
<Input
+138
View File
@@ -0,0 +1,138 @@
<script setup lang="ts">
import LyricsDisplay from "./Fullscreen/LyricsDisplay.vue"
const fullscreen = useFullscreen()
const song = useSong()
const mouseMovedRecently = ref(true)
onMounted(() => {
let timeoutId: NodeJS.Timeout
const handleMouseMove = () => {
mouseMovedRecently.value = true
clearTimeout(timeoutId)
timeoutId = setTimeout(() => {
mouseMovedRecently.value = false
}, 2000)
}
window.addEventListener("mousemove", handleMouseMove)
onUnmounted(() => {
window.removeEventListener("mousemove", handleMouseMove)
})
})
</script>
<template>
<section
class="fullscreen"
:class="{ showCursor: mouseMovedRecently }"
v-show="fullscreen"
>
<template v-if="song">
<NuxtImg
:src="GET_FILE(song.album.file)"
:alt="song.name"
width="500"
height="500"
class="background"
/>
</template>
<section class="screen-container">
<Icon
name="lucide:x"
class="close-btn"
:class="{ show: mouseMovedRecently }"
@click="fullscreen = false"
/>
<div class="content-container">
<PlayerFullscreenTrackDisplay
:show-buttons="mouseMovedRecently"
/>
<LyricsDisplay
:animation-duration="0.2"
:offset="150"
:show-scroll-bar="mouseMovedRecently"
/>
</div>
</section>
</section>
</template>
<style lang="scss" scoped>
.fullscreen {
position: fixed;
top: 0;
left: 0;
width: 200vw;
height: 200vh;
z-index: 150;
cursor: none;
&.showCursor {
cursor: auto;
}
}
.background {
position: absolute;
top: -25%;
left: -25%;
width: 100%;
height: 100%;
object-fit: cover;
filter: blur(40px);
}
.screen-container {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.45);
}
.close-btn {
position: absolute;
top: 1rem;
right: 1rem;
cursor: pointer;
font-size: 24px;
transition: opacity 0.2s ease;
opacity: 0;
&.show {
opacity: 1;
}
}
.content-container {
/* TODO: A lot of magic numbers... should be variables */
max-width: 1280px;
width: 100%;
height: 100%;
margin: 0 auto;
display: grid;
grid-template-columns: 500px 1fr;
gap: 110px;
align-items: center;
& > * {
max-height: 675px;
}
}
</style>
@@ -0,0 +1,226 @@
<script setup lang="ts">
const { animationDuration, offset, showScrollBar } = defineProps<{
animationDuration: number
offset: number
showScrollBar: boolean
}>()
const song = useSong()
const { secondsPlayed } = usePlayer()
const parsedLyrics = computed(() => {
if (!song.value || !song.value.lyrics.synced) return
if (song.value.lyrics.synced) return parseLyrics(song.value.lyrics.text)
})
const lyricsRefs = useTemplateRef("lyrics")
const activeIndex = computed(() => {
if (!parsedLyrics.value) return -1
const time = secondsPlayed.value
return parsedLyrics.value.findIndex(
(lyric, i) =>
lyric.time <= time &&
(!parsedLyrics.value![i + 1] ||
parsedLyrics.value![i + 1]!.time > time),
)
})
const scrollActiveIndex = computed(() => {
if (!parsedLyrics.value) return -1
const time = secondsPlayed.value + animationDuration
let index = parsedLyrics.value.findIndex(
(lyric, i) =>
lyric.time <= time &&
(!parsedLyrics.value![i + 1] ||
parsedLyrics.value![i + 1]!.time > time),
)
if (index >= parsedLyrics.value.length - 1)
index = parsedLyrics.value.length - 2
return index
})
const height = ref(0)
watch(song, () => {
const trackDisplay = document.querySelector(".track-display")
if (!trackDisplay) return
const resizeObserver = new ResizeObserver((entries) => {
height.value = entries[0]!.target.clientHeight
})
resizeObserver.observe(trackDisplay)
})
const transformY = computed(() => {
if (activeIndex.value < 0) return 0
let accumulatedHeight = 0
if (!lyricsRefs.value) return 0
for (let i = 0; i < scrollActiveIndex.value; i++) {
const el = lyricsRefs.value[i]
if (el) accumulatedHeight += el.getBoundingClientRect().height
}
return -accumulatedHeight
})
const containerRef = useTemplateRef("container-ref")
const outerRef = useTemplateRef("outer-ref")
const manualOffset = ref(0)
const isScrolling = ref(false)
let scrollingTimeout: any = null
const onWheel = (event: WheelEvent) => {
if (!containerRef.value || !outerRef.value) return
isScrolling.value = true
clearTimeout(scrollingTimeout)
const delta = event.deltaY
manualOffset.value -= delta
const maxTranslate = offset
const minTranslate =
-containerRef.value.scrollHeight + outerRef.value.offsetHeight
manualOffset.value = Math.min(
maxTranslate,
Math.max(minTranslate, manualOffset.value),
)
scrollingTimeout = setTimeout(() => (isScrolling.value = false), 3000)
}
const finalTransform = computed(() => {
if (isScrolling.value) return manualOffset.value
return transformY.value + offset
})
</script>
<template>
<div
ref="outer-ref"
v-if="song && song.lyrics.synced"
class="synced-lyrics-container"
:style="{
height: `${height}px`,
}"
@wheel.prevent="onWheel"
>
<div
ref="container-ref"
class="synced-lyrics"
:style="{
transform: `translateY(${finalTransform}px)`,
transition: `transform ${animationDuration}s ease`,
}"
>
<p
v-for="(lyric, i) in parsedLyrics"
:key="lyric.time"
:class="{ active: i == activeIndex }"
ref="lyrics"
@click="() => (secondsPlayed = lyric.time)"
>
{{ lyric.text }}
</p>
</div>
</div>
<div
v-else-if="song"
class="lyrics"
:style="{
height: `${height}px`,
}"
:class="{ show: showScrollBar }"
>
<p>{{ song.lyrics.text }}</p>
</div>
</template>
<style lang="scss" scoped>
@use "@/styles/util" as *;
@use "@/styles/variables" as *;
.synced-lyrics-container {
position: relative;
overflow: hidden;
mask-image: linear-gradient(
transparent 0%,
#000 15%,
#000,
#000,
95%,
transparent 100%
);
}
.synced-lyrics {
position: absolute;
scrollbar-width: none;
will-change: transform;
top: 0;
& > p {
@include fontSize(40px);
font-weight: 600;
color: white;
opacity: 0.4;
padding: 10px 0;
transition:
opacity 0.1s ease,
filter 0.1s ease;
filter: blur(1.5px);
&.active {
opacity: 1;
filter: initial;
}
&:hover {
cursor: pointer;
opacity: 1;
filter: initial;
}
}
}
.lyrics {
overflow: hidden;
& > p {
height: 100%;
overflow-y: scroll;
white-space: pre-wrap;
&::-webkit-scrollbar {
width: 10px;
}
&::-webkit-scrollbar-thumb {
background-color: transparent;
border-radius: 5px;
}
}
&.show > p::-webkit-scrollbar-thumb {
background-color: $color-secondary-background;
}
}
</style>
@@ -0,0 +1,144 @@
<script setup lang="ts">
const { showButtons } = defineProps<{ showButtons: boolean }>()
const song = useSong()
const {
isPlaying,
play,
pause,
next,
prev,
shuffle,
repeat,
secondsPlayed,
duration,
} = usePlayer()
const secondsPlayedFormatted = computed(() =>
new Date(secondsPlayed.value * 1000).toISOString().slice(14, 19),
)
const durationFormatted = computed(() =>
new Date((duration.value - secondsPlayed.value) * 1000)
.toISOString()
.slice(14, 19),
)
</script>
<template>
<article class="track-display" v-if="song">
<NuxtImg
class="cover"
:src="GET_FILE(song.album.file)"
:alt="song.name"
width="512"
height="512"
/>
<div class="track">
<p class="name">{{ song.name }}</p>
<ArtistName :artists="song.artists" />
</div>
<div class="slider">
<RangeSlider
:model-value="secondsPlayed"
@update:model-value="(v) => (secondsPlayed = v ?? 0)"
:max="duration"
dont-update-immediately
monochrome
/>
<div class="time">
<p>{{ secondsPlayedFormatted }}</p>
<p>{{ durationFormatted }}</p>
</div>
</div>
<div class="btns" :class="{ hidden: !showButtons }">
<Icon name="lucide:shuffle" @click="shuffle()" />
<Icon name="lucide:skip-back" @click="prev()" />
<Icon name="lucide:pause" v-if="isPlaying" @click="pause()" />
<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>
</article>
</template>
<style lang="scss" scoped>
@use "@/styles/util" as *;
@use "@/styles/variables" as *;
.track-display {
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}
.cover {
width: 100%;
aspect-ratio: 1;
object-fit: cover;
border-radius: $border-radius-standard;
}
.track {
@include fontSize(16px);
width: 100%;
line-height: 1.3;
.name {
@include fontSize(17px);
font-weight: bold;
}
}
.slider {
display: flex;
flex-direction: column;
width: 100%;
gap: 4px;
.time {
width: 100%;
display: flex;
justify-content: space-between;
opacity: 0.5;
& p {
@include fontSize(15px);
}
}
}
.btns {
cursor: pointer;
font-size: 30px;
display: flex;
justify-content: center;
width: 100%;
gap: 1rem;
overflow: hidden;
max-height: 30px;
transition: max-height 0.2s ease-in-out;
&.hidden {
max-height: 0;
}
& > * {
transition: color 0.2s ease;
}
.repeating {
color: $color-accent;
}
}
</style>
+5 -4
View File
@@ -39,6 +39,7 @@ const durationFormatted = computed(() =>
)
const toast = useToast()
const fullscreen = useFullscreen()
</script>
<template>
@@ -106,13 +107,11 @@ const toast = useToast()
name="lucide:list"
@click="toast.show('Not yet implemented')"
/>
<Icon
name="lucide:expand"
@click="toast.show('Not yet implemented')"
/>
<Icon name="lucide:expand" @click="fullscreen = true" />
</div>
</template>
</article>
<PlayerFullscreen />
</template>
<style lang="scss" scoped>
@@ -132,6 +131,8 @@ const toast = useToast()
border-radius: $border-radius-lg;
border: 1px solid $color-border;
background-color: $color-background;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
+25 -6
View File
@@ -1,22 +1,39 @@
<script setup lang="ts">
interface SliderProps {
title?: string
scrollWidth?: () => number
sliderClass?: string
}
const props = defineProps<SliderProps>()
const slider = ref<HTMLDivElement>()
const slider = useTemplateRef<HTMLDivElement>("slider")
const scrollLeft = (num: number) => {
if (slider.value) slider.value.scrollLeft += num
if (!slider.value) return
const maxScroll = slider.value.scrollWidth - slider.value.clientWidth
slider.value.scrollLeft = Math.max(
0,
Math.min(slider.value?.scrollLeft + num, maxScroll),
)
}
const left = () => {
if (slider.value) scrollLeft(-slider.value.offsetWidth)
if (slider.value)
scrollLeft(
props.scrollWidth
? -props.scrollWidth()
: -slider.value.offsetWidth,
)
}
const right = () => {
if (slider.value) scrollLeft(slider.value.offsetWidth)
if (slider.value)
scrollLeft(
props.scrollWidth ? props.scrollWidth() : slider.value.offsetWidth,
)
}
const doesScroll = ref<boolean>(false)
@@ -48,7 +65,9 @@ onMounted(() => {
class="left"
name="material-symbols:chevron-left-rounded"
/>
<section class="slider" ref="slider"><slot /></section>
<section class="slider" :class="[props.sliderClass]" ref="slider">
<slot />
</section>
<Icon
v-if="doesScroll"
@click="right"
@@ -85,7 +104,7 @@ onMounted(() => {
& > * {
flex: 0 0 auto;
scroll-snap-align: center;
scroll-snap-align: start;
}
}
+141
View File
@@ -0,0 +1,141 @@
<script setup lang="ts">
import type { DropdownMenuItem } from "~/ui/DropdownMenu.vue"
interface TrackRowProps {
track: Track
}
const { track } = defineProps<TrackRowProps>()
const emit = defineEmits<{ (e: "playAlbumAtIndex"): void }>()
const hovering = ref(false)
const toast = useToast()
const dropdownMenuItems: DropdownMenuItem[][] = [
[
{
label: "Play only this",
icon: "lucide:play",
onSelect() {},
},
{
label: "Play next",
icon: "lucide:list-start",
onSelect() {
toast.show("Playing next")
},
},
{
label: "Add to queue",
icon: "lucide:list-end",
onSelect() {
toast.show("Added to queue")
},
},
],
]
</script>
<template>
<article
class="track"
@mouseover="hovering = true"
@mouseleave="hovering = false"
>
<div
class="index"
:class="{ hovering }"
@click="emit('playAlbumAtIndex')"
>
<Icon name="lucide:play" />
<NuxtImg
:src="GET_FILE(track.album.file)"
width="50"
height="50"
placeholder
/>
</div>
<div>
<p>{{ track.name }}</p>
<ArtistName :artists="track.artists" class="artists" />
</div>
<DropdownMenu :items="dropdownMenuItems">
<Icon name="lucide:ellipsis" class="dropdown-icon" />
</DropdownMenu>
</article>
</template>
<style lang="scss" scoped>
@use "@/styles/variables" as *;
@use "@/styles/util" as *;
@use "sass:color";
.track {
display: grid;
grid-template-columns: 40px 1fr 30px;
gap: 0.5rem;
align-items: center;
padding: 0.6rem 1rem;
border-radius: $border-radius-standard;
background-color: $color-background;
line-height: 1;
width: 100%;
p {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.index {
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
position: relative;
cursor: pointer;
img {
border-radius: $border-radius-standard;
}
span {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
opacity: 0;
}
img,
span {
transition: opacity 0.15s ease;
}
&.hovering {
img {
opacity: 0.4;
}
span {
opacity: 1;
}
}
}
.artists {
@include fontSize(14px);
}
.dropdown-icon {
font-size: 20px;
cursor: pointer;
}
</style>
+4 -1
View File
@@ -14,7 +14,8 @@ const hovering = ref(false)
const toast = useToast()
const dropdownMenuItems: DropdownMenuItem[] = [
const dropdownMenuItems: DropdownMenuItem[][] = [
[
{
label: "Play only this",
icon: "lucide:play",
@@ -34,6 +35,7 @@ const dropdownMenuItems: DropdownMenuItem[] = [
toast.show("Added to queue")
},
},
],
]
const durationFormatted = computed(() =>
@@ -120,5 +122,6 @@ const durationFormatted = computed(() =>
.dropdown-icon {
font-size: 20px;
cursor: pointer;
}
</style>
+4
View File
@@ -131,6 +131,10 @@ export const useAuth = () => {
return refreshPromise
}
onMounted(() => {
if (refreshToken.value && !sessionToken.value) refreshSessionToken()
})
return {
refreshToken,
sessionToken,
+1
View File
@@ -0,0 +1 @@
export const useFullscreen = () => useState<boolean>("fullscreen", () => false)
+150 -1
View File
@@ -1 +1,150 @@
<template></template>
<script setup lang="ts">
const route = useRoute()
const id = computed(() => route.params.id)
const { data: artistData } = await useApiFetch<Album>(`/artists/${id.value}`)
const { data: albumsData } = await useApiFetch<Album[]>(
`/artists/${id.value}/albums`,
)
const { data: tracksData } = await useApiFetch<Track[]>(
`/artists/${id.value}/tracks`,
)
const chunkedTracks = computed(() => {
const SIZE = 3
const chunks = []
for (let i = 0; i < tracksData.value.length; i += SIZE) {
chunks.push(tracksData.value.slice(i, i + SIZE))
}
return chunks
})
const slider = useTemplateRef("slider")
const scrollWidth = () => {
if (!slider.value) return 0
const el = Array.isArray(slider.value) ? slider.value[0] : slider.value
if (!el) return 0
return el.offsetWidth
}
const { playAlbum, playShuffledAlbum, playAlbumAtIndex } = usePlayer()
</script>
<template>
<section class="info" v-if="artistData">
<NuxtImg
:src="GET_FILE(artistData.file)"
width="300"
height="300"
placeholder
/>
<div class="details">
<h1>{{ artistData.name }}</h1>
<div class="buttons">
<Button
icon-name="lucide:play"
@click="() => playAlbum(tracksData)"
>Play</Button
>
<Button
icon-name="lucide:shuffle"
@click="() => playShuffledAlbum(tracksData)"
>Shuffle</Button
>
</div>
</div>
</section>
<Slider slider-class="slider" :scroll-width="scrollWidth" title="Tracks">
<section
class="tracks"
v-for="(chunk, pI) in chunkedTracks"
:key="`chunk-${pI}`"
ref="slider"
>
<TrackRow
v-for="(track, i) in chunk"
:key="`track-${track._id}`"
:track="track"
:index="i + pI * 3"
@play-album-at-index="
() => playAlbumAtIndex(tracksData, i + pI * 3)
"
/>
</section>
</Slider>
<Slider title="Albums">
<AlbumCard
v-for="album in albumsData"
:key="album._id"
:name="album.name"
:file="`${BACKEND_SERVE}${album.file}`"
:artists="album.artists"
:_id="album._id"
/>
</Slider>
</template>
<style lang="scss" scoped>
@use "@/styles/variables" as *;
@use "@/styles/util";
.info {
display: flex;
gap: 1rem;
margin-bottom: 2rem;
& img {
border-radius: $border-radius-standard;
}
.details {
padding-top: 3.5rem;
display: flex;
flex-direction: column;
gap: 0.2rem;
& h1 {
@include util.fontSize(32px);
font-weight: 700;
line-height: 2.4rem;
}
.artist {
@include util.fontSize(18px);
}
.buttons {
margin-top: auto;
display: flex;
gap: 1rem;
}
}
}
$gap: 12px;
:deep(.slider) {
gap: $gap;
}
.tracks {
display: grid;
grid-template-rows: repeat(3, 1fr);
gap: 0.4rem;
flex: 0 0 calc((100% - 3 * $gap) / 4);
}
</style>
+108
View File
@@ -0,0 +1,108 @@
<script setup lang="ts">
const route = useRoute()
const id = computed(() => route.params.id)
const { data: artistData } = await useApiFetch<Artist>(`/artists/${id.value}`)
const { data: tracksData } = await useApiFetch<Track[]>(
`/artists/${id.value}/tracks`,
)
const { playAlbum, playAlbumAtIndex } = usePlayer()
</script>
<template>
<section class="info" v-if="artistData">
<NuxtImg
:src="GET_FILE(artistData.file)"
width="300"
height="300"
placeholder
/>
<div class="details">
<h1>{{ artistData.name }}</h1>
<div class="buttons">
<Button
icon-name="lucide:play"
@click="() => playAlbum(tracksData)"
>Play</Button
>
</div>
</div>
</section>
<section class="tracks-container">
<NuxtLink :to="`/artist/${id}/tracks`">
Tracks
<Icon name="lucide:chevron-right" />
</NuxtLink>
<Slider>
<div class="tracks">
<template v-for="j in 25">
<TrackImageRow
v-for="(track, i) in tracksData"
:key="track._id"
:track="track"
:index="i"
@play-album-at-index="
() => playAlbumAtIndex(tracksData, i)
"
/>
</template>
</div>
</Slider>
</section>
<section class="albums"></section>
</template>
<style lang="scss" scoped>
@use "@/styles/variables" as *;
@use "@/styles/util";
.info {
display: flex;
gap: 1rem;
margin-bottom: 2rem;
img {
border-radius: $border-radius-standard;
}
.details {
padding-top: 3.5rem;
display: flex;
flex-direction: column;
& h1 {
@include util.fontSize(32px);
font-weight: 700;
line-height: 2.4rem;
}
.buttons {
margin-top: auto;
}
}
}
.tracks-container {
a {
display: inline-flex;
align-items: center;
@include util.fontSize(24px);
font-weight: 600;
}
.tracks {
display: grid;
grid-template-rows: repeat(3, 1fr);
grid-template-columns: repeat(auto-fit, minmax(300px, 350px));
grid-auto-flow: column;
}
}
</style>
+3
View File
@@ -0,0 +1,3 @@
<template>
<h1>Tracks!</h1>
</template>
+2
View File
@@ -7,7 +7,9 @@ $color-border: rgba(255, 255, 255, 0.16);
$color-button: rgba(255, 255, 255, 0.08);
$color-button-hover: rgba(255, 255, 255, 0.16);
$color-attention: #fc8181;
$color-slider-monochrome: white;
$border-radius-sm: 0.15rem;
$border-radius-standard: 0.3rem;
$border-radius-lg: 0.6rem;
+30 -6
View File
@@ -6,7 +6,7 @@ export interface DropdownMenuItem {
}
interface DropdownMenuProps {
items: DropdownMenuItem[]
items: DropdownMenuItem[][]
}
const props = defineProps<DropdownMenuProps>()
@@ -85,9 +85,14 @@ onBeforeMount(() => {
<Transition name="dropdown">
<div v-show="open" class="menu" :class="placement">
<div
v-for="(group, i) in items"
:key="`group-${i}`"
class="group"
>
<button
v-for="(item, i) in items"
:key="i"
v-for="(item, i) in group"
:key="`item-${i}`"
class="item"
@click="
() => {
@@ -100,6 +105,7 @@ onBeforeMount(() => {
<span>{{ item.label }}</span>
</button>
</div>
</div>
</Transition>
</div>
</template>
@@ -113,11 +119,10 @@ onBeforeMount(() => {
.menu {
position: absolute;
right: 0;
min-width: 180px;
padding: 0.5rem;
min-width: 180px;
background-color: $color-secondary-background;
border-radius: $border-radius-standard;
@@ -125,7 +130,6 @@ onBeforeMount(() => {
display: flex;
flex-direction: column;
gap: 2px;
z-index: 1000;
@@ -140,6 +144,26 @@ onBeforeMount(() => {
}
}
.group {
width: 100%;
display: flex;
flex-direction: column;
gap: 4px;
padding: 0.4rem 0;
border-bottom: 1px solid $color-border;
&:first-child {
padding-top: 0;
}
&:last-child {
border-bottom: none;
padding-bottom: 0;
}
}
.item {
display: flex;
align-items: center;
+11 -1
View File
@@ -4,6 +4,7 @@ interface SliderProps {
max?: number
step?: number
dontUpdateImmediately?: boolean
monochrome?: boolean
}
const props = withDefaults(defineProps<SliderProps>(), {
@@ -11,6 +12,7 @@ const props = withDefaults(defineProps<SliderProps>(), {
max: 100,
step: 1,
dontUpdateImmediately: false,
monochrome: false,
})
const value = defineModel<number>()
@@ -67,7 +69,11 @@ const onMouseDown = (event: MouseEvent) => {
<template>
<div ref="slider-ref" class="slider" @mousedown="onMouseDown">
<div class="track">
<div class="fill" :style="{ width: percentage + '%' }" />
<div
class="fill"
:class="{ monochrome }"
:style="{ width: percentage + '%' }"
/>
</div>
</div>
</template>
@@ -98,4 +104,8 @@ const onMouseDown = (event: MouseEvent) => {
background: $color-accent;
border-radius: 999px;
}
.slider .monochrome {
background-color: $color-slider-monochrome;
}
</style>
+1 -1
View File
@@ -38,7 +38,7 @@
width: 100%;
height: 100%;
overflow-y: auto;
padding: 2rem 3rem;
padding: 2rem 3rem calc(2rem + $player-height);
}
}
</style>
+27
View File
@@ -0,0 +1,27 @@
export const parseLyrics = (lrc: string) => {
const regex = /^\[(\d{2}:\d{2}(.\d{2,3})?)\](.*)/
const lines = lrc.split("\n")
const output: { time: number; text: any }[] = []
const parseTime = (time: any) => {
const minsec = time.split(":")
const min = parseInt(minsec[0]) * 60
const sec = parseFloat(minsec[1])
return min + sec
}
lines.forEach((line: any) => {
const match = line.match(regex)
if (match == null) return
const time = match[1]
const text = match[3]
output.push({
time: parseTime(time),
text: text.trim(),
})
})
return output
}