feat(front): Load fallback image from album (feature was present in components/audio/artist/Card.vue)
This commit is contained in:
parent
2ea919cd81
commit
b2d36abd81
|
@ -1,5 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { useStore } from '~/store'
|
||||||
|
|
||||||
import type { Artist } from '~/types'
|
import type { Artist } from '~/types'
|
||||||
|
|
||||||
|
@ -20,26 +22,54 @@ if (import.meta.env.PROD) {
|
||||||
navigate = () =>
|
navigate = () =>
|
||||||
router.push({ name: 'library.artists.detail', params: { id: artist.id } })
|
router.push({ name: 'library.artists.detail', params: { id: artist.id } })
|
||||||
}
|
}
|
||||||
const image = artist.cover
|
|
||||||
? artist.cover.urls.original
|
const cover = computed(() => !props.artist.cover?.urls.original
|
||||||
|
? props.artist.albums.find(album => !!album.cover?.urls.original)?.cover
|
||||||
|
: props.artist.cover
|
||||||
|
)
|
||||||
|
|
||||||
|
const store = useStore()
|
||||||
|
const imageUrl = computed(() => cover.value?.urls.original
|
||||||
|
? store.getters['instance/absoluteUrl'](cover.value.urls.medium_square_crop)
|
||||||
: `${import.meta.env.BASE_URL}embed-default-cover.jpeg`
|
: `${import.meta.env.BASE_URL}embed-default-cover.jpeg`
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<span style="position:absolute; font-size:.7em">/front/src/components/artist/Card.vue</span>
|
<span style="position:absolute; font-size:.7em">/front/src/components/artist/Card.vue</span>
|
||||||
|
|
||||||
<fw-card
|
<fw-card
|
||||||
:title="artist.name"
|
:title="artist.name"
|
||||||
:image="image"
|
:image="imageUrl"
|
||||||
:tags="artist.tags"
|
:tags="artist.tags"
|
||||||
@click="navigate"
|
|
||||||
class="artist-card"
|
class="artist-card"
|
||||||
>
|
>
|
||||||
<fw-play-button @play="play(artist)" />
|
<fw-play-button @play="play(artist)" />
|
||||||
|
|
||||||
|
<tags-list
|
||||||
|
label-classes="tiny"
|
||||||
|
:truncate-size="20"
|
||||||
|
:limit="2"
|
||||||
|
:show-more="false"
|
||||||
|
:tags="artist.tags"
|
||||||
|
/>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
{{ $t("components.audio.artist.Card.meta.tracks", artist.tracks_count) }}
|
<span v-if="artist.content_category === 'music'">
|
||||||
<fw-options-button />
|
{{ $t('components.audio.artist.Card.meta.tracks', artist.tracks_count) }}
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
{{ $t('components.audio.artist.Card.meta.episodes', artist.tracks_count) }}
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<router-link
|
||||||
|
class="discrete link"
|
||||||
|
:to="{name: 'library.artists.detail', params: {id: artist.id}}"
|
||||||
|
>
|
||||||
|
Go to artist
|
||||||
|
</router-link>
|
||||||
|
|
||||||
</fw-card>
|
</fw-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import axios from 'axios'
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
|
|
||||||
import TagsSelector from '~/components/library/TagsSelector.vue'
|
import TagsSelector from '~/components/library/TagsSelector.vue'
|
||||||
// import ArtistCard from '~/components/audio/artist/Card.vue'
|
|
||||||
import Pagination from '~/components/vui/Pagination.vue'
|
import Pagination from '~/components/vui/Pagination.vue'
|
||||||
|
|
||||||
import useSharedLabels from '~/composables/locale/useSharedLabels'
|
import useSharedLabels from '~/composables/locale/useSharedLabels'
|
||||||
|
@ -227,7 +226,7 @@ const paginateOptions = computed(() => sortedUniq([12, 30, 50, paginateBy.value]
|
||||||
<div class="ui hidden divider" />
|
<div class="ui hidden divider" />
|
||||||
<div
|
<div
|
||||||
v-if="result && result.results.length > 0"
|
v-if="result && result.results.length > 0"
|
||||||
style = "display:flex; flex-wrap:wrap; gap: 32px;"
|
style="display:flex; flex-wrap:wrap; gap: 32px; margin-top:32px;"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="isLoading"
|
v-if="isLoading"
|
||||||
|
@ -235,11 +234,6 @@ const paginateOptions = computed(() => sortedUniq([12, 30, 50, paginateBy.value]
|
||||||
>
|
>
|
||||||
<div class="ui loader" />
|
<div class="ui loader" />
|
||||||
</div>
|
</div>
|
||||||
<ArtistCard
|
|
||||||
v-for="artist in result.results"
|
|
||||||
:key="artist.id"
|
|
||||||
:artist="artist"
|
|
||||||
/>
|
|
||||||
<artist-card
|
<artist-card
|
||||||
v-for="artist in result.results"
|
v-for="artist in result.results"
|
||||||
:key="artist.id"
|
:key="artist.id"
|
||||||
|
|
Loading…
Reference in New Issue