93 lines
2.0 KiB
Vue
93 lines
2.0 KiB
Vue
<script setup lang="ts">
|
|
import { useRouter } from 'vue-router'
|
|
|
|
import type { Album } from '~/types'
|
|
|
|
const play = defineEmit<[album: Album]>()
|
|
|
|
interface Props {
|
|
album: Album;
|
|
}
|
|
|
|
const props = defineProps<Props>()
|
|
|
|
const { album } = props
|
|
|
|
let navigate = (to: 'artist' | 'album') => {}
|
|
|
|
if (import.meta.env.PROD) {
|
|
const router = useRouter()
|
|
navigate = (to: 'artist' | 'album') => to === 'album'
|
|
? router.push({ name: 'library.albums.detail', params: { id: album.value.id } })
|
|
: router.push({ name: 'library.artists.detail', params: { id: album.value.artist.id } })
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<fw-card
|
|
:title="album.title"
|
|
:image="album.cover?.urls.original"
|
|
class="album-card"
|
|
>
|
|
<fw-play-button @play="play(album)" />
|
|
|
|
<a
|
|
v-for="ac in album.artist_credit"
|
|
:key="ac.artist.id"
|
|
class="funkwhale link"
|
|
@click.stop="navigate('artist')"
|
|
>
|
|
{{ ac.credit ?? $t('components.Queue.meta.unknownArtist') }}
|
|
{{ ac.joinphrase }}
|
|
</a>
|
|
|
|
<tags-list
|
|
label-classes="tiny"
|
|
:truncate-size="20"
|
|
:limit="2"
|
|
:show-more="false"
|
|
:tags="album.tags"
|
|
/>
|
|
|
|
<router-link
|
|
class="discrete link"
|
|
:to="{name: 'library.albums.detail', params: {id: album.id}}"
|
|
>
|
|
Go to album
|
|
</router-link>
|
|
|
|
<template #footer>
|
|
{{ $t('components.audio.album.Card.meta.tracks', album.tracks?.length || 0) }}
|
|
<fw-options-button />
|
|
</template>
|
|
</fw-card>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.funkwhale {
|
|
&.card.album-card {
|
|
--fw-border-radius: 12px;
|
|
--fw-card-width: 208px;
|
|
--fw-card-image-width: var(--fw-card-width);
|
|
--fw-card-padding: 16px;
|
|
|
|
> .card-image {
|
|
border-radius: 0 !important;
|
|
width: var(--fw-card-image-width);
|
|
margin: calc(-1 * var(--fw-card-padding)) calc(-1 * var(--fw-card-padding)) 0;
|
|
}
|
|
|
|
> .card-title {
|
|
font-size: 1rem;
|
|
text-align: left !important;
|
|
padding-top: 16px !important;
|
|
}
|
|
|
|
> .card-content {
|
|
padding-top: 0 !important;
|
|
text-align: left !important;
|
|
}
|
|
}
|
|
}
|
|
</style>
|