feat(style): person icon as fallback for artists and channels. fix channel detail layout.

This commit is contained in:
ArneBo 2025-02-23 01:28:24 +01:00
parent e2ad54ab83
commit 08fae09a6d
3 changed files with 68 additions and 110 deletions

View File

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { type operations } from '~/generated/types.ts'
import PlayButton from '~/components/audio/PlayButton.vue' import PlayButton from '~/components/audio/PlayButton.vue'
import Card from '~/components/ui/Card.vue' import Card from '~/components/ui/Card.vue'
@ -21,29 +22,6 @@ const props = defineProps<Props>()
const { artist } = props const { artist } = props
const cover = computed(() => {
const artistCover = artist.cover ?? undefined
const albumCover = albums.value?.find(
(album: Album) => album.cover?.urls
)?.cover
const trackCover = tracks.value?.find(
(track: Track) => track.cover?.urls
)?.cover
const fallback: Cover = {
uuid: '',
urls: {
original: `${import.meta.env.BASE_URL}embed-default-cover.jpeg`,
medium_square_crop: `${import.meta.env.BASE_URL}embed-default-cover.jpeg`,
large_square_crop: `${import.meta.env.BASE_URL}embed-default-cover.jpeg`
}
}
return artistCover || albumCover || trackCover || fallback
})
</script> </script>
<template> <template>
@ -53,6 +31,7 @@ const cover = computed(() => {
:tags="artist.tags" :tags="artist.tags"
:to="{name: 'library.artists.detail', params: {id: artist.id}}" :to="{name: 'library.artists.detail', params: {id: artist.id}}"
small small
style="align-self: flex-start;"
> >
<template #topright> <template #topright>
<PlayButton <PlayButton
@ -64,10 +43,16 @@ const cover = computed(() => {
<template #image> <template #image>
<img <img
v-lazy="cover.urls.medium_square_crop" v-if="artist.cover"
v-lazy="artist.cover.urls.medium_square_crop"
:alt="artist.name" :alt="artist.name"
class="channel-image" class="channel-image"
> />
<i
v-else
class="bi bi-person-circle"
style="font-size: 167px; margin: 16px;"
/>
</template> </template>
<template #footer> <template #footer>
@ -85,6 +70,7 @@ const cover = computed(() => {
discrete discrete
/> />
</template> </template>
</Card> </Card>
</template> </template>

View File

@ -55,7 +55,6 @@ const updatedAgo = computed(() => moment(props.object.artist?.modification_date)
<template #topright> <template #topright>
<PlayButton <PlayButton
icon-only icon-only
:is-playable="object.artist?.is_playable"
:artist="object.artist" :artist="object.artist"
/> />
</template> </template>
@ -66,11 +65,16 @@ const updatedAgo = computed(() => moment(props.object.artist?.modification_date)
v-lazy="imageUrl" v-lazy="imageUrl"
:alt="object.artist?.name" :alt="object.artist?.name"
class="channel-image" class="channel-image"
> />
<i
v-else
class="bi bi-person-circle"
style="font-size: 167px; margin: 16px;"
/>
</template> </template>
<template #default> <template #default>
<Spacer :size="8" /> <Spacer :size="8"/>
</template> </template>
<template #footer> <template #footer>
@ -89,10 +93,7 @@ const updatedAgo = computed(() => moment(props.object.artist?.modification_date)
<span v-else> <span v-else>
{{ t('components.audio.ChannelCard.meta.tracks', object.artist?.tracks_count ?? 0) }} {{ t('components.audio.ChannelCard.meta.tracks', object.artist?.tracks_count ?? 0) }}
</span> </span>
<Spacer <Spacer h grow />
h
grow
/>
<PlayButton <PlayButton
:dropdown-only="true" :dropdown-only="true"
:is-playable="true" :is-playable="true"

View File

@ -150,10 +150,8 @@ const updateSubscriptionCount = (delta: number) => {
</script> </script>
<template> <template>
<Layout <Layout stack main
v-title="labels.title" v-title="labels.title"
stack
main
> >
<Loader v-if="isLoading" /> <Loader v-if="isLoading" />
<template v-if="object && !isLoading"> <template v-if="object && !isLoading">
@ -166,32 +164,18 @@ const updateSubscriptionCount = (delta: number) => {
alt="" alt=""
class="huge channel-image" class="huge channel-image"
:src="store.getters['instance/absoluteUrl'](object.artist.cover.urls.large_square_crop)" :src="store.getters['instance/absoluteUrl'](object.artist.cover.urls.large_square_crop)"
> />
<i <i
v-else v-else
class="huge circular inverted bi bi-person-circle-fill violet" class="bi bi-person-circle"
style="font-size: 300px; margin-top: -32px;"
/> />
<Layout <Layout stack style="flex: 1; gap: 16px;">
stack <h1 style="margin-top: 64px; margin-bottom: 8px;">
no-gap
style="flex: 1;"
>
<h1>
<div
:title="object.artist?.name"
>
{{ object.artist?.name }} {{ object.artist?.name }}
</div>
</h1> </h1>
<Layout <Layout stack class="meta" style="gap: 8px;">
stack <Layout flex noGap>
class="meta"
style="gap: 0;"
>
<Layout
flex
no-gap
>
<template v-if="totalTracks > 0"> <template v-if="totalTracks > 0">
<span <span
v-if="object.artist?.content_category === 'podcast'" v-if="object.artist?.content_category === 'podcast'"
@ -219,13 +203,9 @@ const updateSubscriptionCount = (delta: number) => {
/> />
</div> </div>
</Layout> </Layout>
<Layout <Layout flex noGap>
flex <template v-if="object.artist?.content_category === 'podcast'">
no-gap <span>
>
<span
v-if="object.artist?.content_category === 'podcast'"
>
{{ t('views.channels.DetailBase.header.podcastChannel') }} {{ t('views.channels.DetailBase.header.podcastChannel') }}
</span> </span>
<span <span
@ -241,19 +221,17 @@ const updateSubscriptionCount = (delta: number) => {
{{ t('views.channels.DetailBase.link.mirrored', {domain: externalDomain}) }} {{ t('views.channels.DetailBase.link.mirrored', {domain: externalDomain}) }}
</a> </a>
</span> </span>
<span </template>
v-else <template v-else>
> <span>
{{ t('views.channels.DetailBase.header.artistChannel') }} {{ t('views.channels.DetailBase.header.artistChannel') }}
</span> </span>
</template>
<span v-if="object.actor"> <span v-if="object.actor">
<i class="bi bi-dot" /> <i class="bi bi-dot" />
{{ t('views.library.LibraryBase.link.owner') }} {{ t('views.library.LibraryBase.link.owner') }}
</span> </span>
<Spacer <Spacer h :size="4" />
h
:size="4"
/>
<ActorLink <ActorLink
v-if="object.actor" v-if="object.actor"
discrete discrete
@ -269,10 +247,7 @@ const updateSubscriptionCount = (delta: number) => {
:can-update="false" :can-update="false"
@updated="object = $event" @updated="object = $event"
/> />
<Layout <Layout flex class="header-buttons">
flex
class="header-buttons"
>
<Link <Link
v-if="isOwner" v-if="isOwner"
solid solid
@ -320,8 +295,8 @@ const updateSubscriptionCount = (delta: number) => {
<hr> <hr>
<PopoverItem <PopoverItem
v-for="obj in getReportableObjects({account: object.attributed_to, channel: object})" v-for="obj in getReportableObjects({account: object.attributed_to, channel: object})"
:key="obj.target.type + obj.target.id"
icon="bi-share" icon="bi-share"
:key="obj.target.type + obj.target.id"
@click.stop.prevent="report(obj)" @click.stop.prevent="report(obj)"
> >
{{ obj.label }} {{ obj.label }}
@ -342,8 +317,7 @@ const updateSubscriptionCount = (delta: number) => {
:is-loading="isLoading" :is-loading="isLoading"
icon="bi-trash" icon="bi-trash"
@confirm="remove()" @confirm="remove()"
> > {{ t('views.channels.DetailBase.button.confirm') }}
{{ t('views.channels.DetailBase.button.confirm') }}
<template #modal-content> <template #modal-content>
{{ t('views.channels.DetailBase.modal.delete.content.warning') }} {{ t('views.channels.DetailBase.modal.delete.content.warning') }}
</template> </template>
@ -365,10 +339,7 @@ const updateSubscriptionCount = (delta: number) => {
</template> </template>
</template> </template>
</Popover> </Popover>
<Spacer <Spacer h grow />
h
grow
/>
<subscribe-button <subscribe-button
:channel="object" :channel="object"
@subscribed="updateSubscriptionCount(1)" @subscribed="updateSubscriptionCount(1)"
@ -376,9 +347,9 @@ const updateSubscriptionCount = (delta: number) => {
/> />
<Modal <Modal
:title="t('views.channels.DetailBase.modal.embed.header')"
v-if="totalTracks > 0" v-if="totalTracks > 0"
v-model="showEmbedModal" v-model="showEmbedModal"
:title="t('views.channels.DetailBase.modal.embed.header')"
:cancel="t('views.channels.DetailBase.button.cancel')" :cancel="t('views.channels.DetailBase.button.cancel')"
> >
<div class="scrolling content"> <div class="scrolling content">
@ -396,11 +367,11 @@ const updateSubscriptionCount = (delta: number) => {
</template> </template>
</Modal> </Modal>
<Modal <Modal
v-if="isOwner"
v-model="showEditModal"
:title="t(`views.channels.DetailBase.header.${ :title="t(`views.channels.DetailBase.header.${
object.artist?.content_category === 'podcast' ? 'podcastChannel' : 'artistChannel' object.artist?.content_category === 'podcast' ? 'podcastChannel' : 'artistChannel'
}`)" }`)"
v-if="isOwner"
v-model="showEditModal"
> >
<div class="scrolling content"> <div class="scrolling content">
<channel-form <channel-form
@ -416,7 +387,7 @@ const updateSubscriptionCount = (delta: number) => {
<Button <Button
primary primary
autofocus autofocus
:is-loading="edit.loading" :isLoading="edit.loading"
:disabled="!edit.submittable" :disabled="!edit.submittable"
@click.stop="editForm?.submit" @click.stop="editForm?.submit"
> >
@ -430,8 +401,8 @@ const updateSubscriptionCount = (delta: number) => {
@click.stop.prevent="showSubscribeModal = true" @click.stop.prevent="showSubscribeModal = true"
/> />
<Modal <Modal
v-model:show="showSubscribeModal"
:title="t('views.channels.DetailBase.modal.subscribe.header')" :title="t('views.channels.DetailBase.modal.subscribe.header')"
v-model:show="showSubscribeModal"
class="tiny" class="tiny"
:cancel="t('views.channels.DetailBase.button.cancel')" :cancel="t('views.channels.DetailBase.button.cancel')"
> >
@ -482,7 +453,7 @@ const updateSubscriptionCount = (delta: number) => {
v-if="object.artist?.tags && object.artist?.tags.length > 0" v-if="object.artist?.tags && object.artist?.tags.length > 0"
:tags="object.artist.tags" :tags="object.artist.tags"
:limit="5" :limit="5"
show-more="true" showMore="true"
/> />
<Tabs> <Tabs>
<Tab <Tab