refactor(front): channel card
This commit is contained in:
parent
159042669a
commit
c7139b92ad
|
@ -10,7 +10,8 @@ import { useRouter } from 'vue-router'
|
|||
import moment from 'moment'
|
||||
|
||||
import PlayButton from '~/components/audio/PlayButton.vue'
|
||||
import TagsList from '~/components/tags/List.vue'
|
||||
import Card from '~/components/ui/Card.vue'
|
||||
import Spacer from '~/components/ui/Spacer.vue'
|
||||
|
||||
interface Props {
|
||||
object: Channel
|
||||
|
@ -21,7 +22,7 @@ const store = useStore()
|
|||
const router = useRouter()
|
||||
|
||||
const imageUrl = computed(() => props.object.artist?.cover
|
||||
? store.getters['instance/absoluteUrl'](props.object.artist.cover.urls.medium_square_crop)
|
||||
? store.getters['instance/absoluteUrl'](props.object.artist.cover.urls.large_square_crop)
|
||||
: null
|
||||
)
|
||||
|
||||
|
@ -43,64 +44,39 @@ const updatedAgo = computed(() => moment(props.object.artist?.modification_date)
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="card app-card">
|
||||
<div
|
||||
v-lazy:background-image="imageUrl"
|
||||
:class="['ui', 'head-image', {'circular': object.artist?.content_category != 'podcast'}, {'padded': object.artist?.content_category === 'podcast'}, 'image', {'default-cover': !object.artist?.cover}]"
|
||||
@click="router.push({name: 'channels.detail', params: {id: urlId}})"
|
||||
>
|
||||
<play-button
|
||||
:icon-only="true"
|
||||
:is-playable="true"
|
||||
:button-classes="['ui', 'circular', 'large', 'vibrant', 'icon', 'button']"
|
||||
:artist="object.artist"
|
||||
/>
|
||||
</div>
|
||||
<Card
|
||||
:title="object.artist?.name"
|
||||
:image="imageUrl"
|
||||
:tags="object.artist?.tags ?? []"
|
||||
:to="{name: 'channels.detail', params: {id: urlId}}"
|
||||
>
|
||||
<div class="content">
|
||||
<strong>
|
||||
<router-link
|
||||
class="discrete link"
|
||||
:to="{name: 'channels.detail', params: {id: urlId}}"
|
||||
>
|
||||
{{ object.artist?.name }}
|
||||
</router-link>
|
||||
</strong>
|
||||
<div class="description">
|
||||
<span
|
||||
v-if="object.artist?.content_category === 'podcast'"
|
||||
class="meta ellipsis"
|
||||
>
|
||||
{{ t('components.audio.ChannelCard.meta.episodes', object.artist.tracks_count) }}
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ t('components.audio.ChannelCard.meta.tracks', object.artist?.tracks_count ?? 0) }}
|
||||
</span>
|
||||
<TagsList
|
||||
label-classes="tiny"
|
||||
:truncate-size="20"
|
||||
:limit="2"
|
||||
:show-more="false"
|
||||
:tags="object.artist?.tags ?? []"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
v-if="object.artist?.content_category === 'podcast'"
|
||||
>
|
||||
<i class="bi bi-music-note-list" />
|
||||
{{ t('components.audio.ChannelCard.meta.episodes', object.artist.tracks_count) }}
|
||||
</span>
|
||||
<span v-else>
|
||||
<i class="bi bi-music-note-list" />
|
||||
{{ t('components.audio.ChannelCard.meta.tracks', object.artist?.tracks_count ?? 0) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="extra content">
|
||||
<template #action>
|
||||
<time
|
||||
class="meta ellipsis"
|
||||
:datetime="object.artist?.modification_date"
|
||||
:title="updatedTitle"
|
||||
>
|
||||
{{ updatedAgo }}
|
||||
</time>
|
||||
<play-button
|
||||
class="right floated basic icon"
|
||||
<Spacer h grow />
|
||||
<PlayButton
|
||||
:dropdown-only="true"
|
||||
:is-playable="true"
|
||||
:dropdown-icon-classes="['ellipsis', 'horizontal', 'large really discrete']"
|
||||
:artist="object.artist"
|
||||
:channel="object"
|
||||
:account="object.attributed_to"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</Card>
|
||||
</template>
|
||||
|
|
|
@ -24,6 +24,10 @@ const props = defineProps<{
|
|||
& WidthProps
|
||||
>()
|
||||
|
||||
const tags = computed(() => {
|
||||
return props.tags?.slice(0, 2)
|
||||
})
|
||||
|
||||
const image = typeof props.image === 'string' ? { src: props.image } : props.image
|
||||
|
||||
const isExternalLink = computed(() => {
|
||||
|
@ -82,7 +86,13 @@ const attributes = computed(() =>
|
|||
</Alert>
|
||||
|
||||
<Layout flex gap-4 v-if="tags" :class="$style.tags">
|
||||
<Pill v-for="tag in tags" :key="tag">
|
||||
<Pill
|
||||
solid
|
||||
raised
|
||||
secondary
|
||||
v-for="tag in tags"
|
||||
:key="tag"
|
||||
>
|
||||
#{{ tag }}
|
||||
</Pill>
|
||||
</Layout>
|
||||
|
@ -206,6 +216,7 @@ const attributes = computed(() =>
|
|||
>.tags {
|
||||
padding: 0 var(--fw-card-padding);
|
||||
margin-top: 8px;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
>.content {
|
||||
|
|
Loading…
Reference in New Issue