2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2024-04-04 22:20:42 +00:00
|
|
|
<article>
|
|
|
|
<h3 class="text-2xl mb-3">Track Listing</h3>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li
|
|
|
|
v-for="(track, index) in tracks"
|
|
|
|
:key="index"
|
|
|
|
class="flex p-2 before:w-7 before:opacity-50"
|
2024-04-23 21:01:27 +00:00
|
|
|
data-testid="album-track-item"
|
2024-04-04 22:20:42 +00:00
|
|
|
>
|
2022-12-02 16:17:37 +00:00
|
|
|
<TrackListItem :album="album" :track="track" />
|
2022-07-08 14:53:04 +00:00
|
|
|
</li>
|
2022-04-15 14:24:30 +00:00
|
|
|
</ul>
|
2024-04-04 20:13:35 +00:00
|
|
|
</article>
|
2022-04-15 14:24:30 +00:00
|
|
|
</template>
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
<script lang="ts" setup>
|
2022-09-30 06:56:29 +00:00
|
|
|
import { onMounted, provide, ref, toRefs } from 'vue'
|
2022-06-10 10:47:46 +00:00
|
|
|
import { songStore } from '@/stores'
|
2024-05-19 05:49:42 +00:00
|
|
|
import { PlayablesKey } from '@/symbols'
|
2022-09-30 06:56:29 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
import TrackListItem from '@/components/album/AlbumTrackListItem.vue'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
const props = defineProps<{ album: Album, tracks: AlbumTrack[] }>()
|
|
|
|
const { album, tracks } = toRefs(props)
|
2022-06-10 10:47:46 +00:00
|
|
|
|
|
|
|
const songs = ref<Song[]>([])
|
|
|
|
|
2022-12-02 16:17:37 +00:00
|
|
|
// @ts-ignore
|
2024-05-19 05:49:42 +00:00
|
|
|
provide(PlayablesKey, songs)
|
2022-06-10 10:47:46 +00:00
|
|
|
|
|
|
|
onMounted(async () => songs.value = await songStore.fetchForAlbum(album.value))
|
2022-04-15 14:24:30 +00:00
|
|
|
</script>
|
2022-04-21 10:43:10 +00:00
|
|
|
|
2024-04-04 20:13:35 +00:00
|
|
|
<style lang="postcss" scoped>
|
2024-04-04 22:20:42 +00:00
|
|
|
ul {
|
|
|
|
counter-reset: trackCounter;
|
|
|
|
}
|
2022-07-08 14:53:04 +00:00
|
|
|
|
2024-04-04 22:20:42 +00:00
|
|
|
li {
|
|
|
|
counter-increment: trackCounter;
|
2022-04-21 10:43:10 +00:00
|
|
|
|
2024-04-04 22:20:42 +00:00
|
|
|
&::before {
|
|
|
|
content: counter(trackCounter);
|
|
|
|
}
|
2022-04-21 10:43:10 +00:00
|
|
|
|
2024-04-04 22:20:42 +00:00
|
|
|
&:nth-child(even) {
|
|
|
|
background: rgba(255, 255, 255, 0.05);
|
2022-04-21 10:43:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|