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