feat(front): Updated time for playlist cards
This commit is contained in:
parent
cea69dc9b9
commit
48800e2eee
|
@ -3,10 +3,14 @@ import type { Playlist } from '~/types'
|
||||||
|
|
||||||
import PlayButton from '~/components/audio/PlayButton.vue'
|
import PlayButton from '~/components/audio/PlayButton.vue'
|
||||||
import defaultCover from '~/assets/audio/default-cover.png'
|
import defaultCover from '~/assets/audio/default-cover.png'
|
||||||
|
import { momentFormat } from '~/utils/filters'
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { useStore } from '~/store'
|
import { useStore } from '~/store'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
import moment from 'moment'
|
||||||
|
|
||||||
import Card from '~/components/ui/Card.vue'
|
import Card from '~/components/ui/Card.vue'
|
||||||
import ActorLink from '~/components/common/ActorLink.vue'
|
import ActorLink from '~/components/common/ActorLink.vue'
|
||||||
|
|
||||||
|
@ -52,6 +56,12 @@ const randomizedColors = computed(() => shuffleArray(bgcolors.value));
|
||||||
const goToPlaylist = () => {
|
const goToPlaylist = () => {
|
||||||
router.push({name: 'library.playlists.detail', params: {id: props.playlist.id}})
|
router.push({name: 'library.playlists.detail', params: {id: props.playlist.id}})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updatedTitle = computed(() => {
|
||||||
|
const date = momentFormat(new Date(props.playlist.modification_date ?? '1970-01-01'))
|
||||||
|
return t('components.audio.PlaylistCard.title', { date })
|
||||||
|
})
|
||||||
|
const updatedAgo = computed(() => moment(props.playlist.modification_date).fromNow())
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -92,15 +102,20 @@ const goToPlaylist = () => {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="playlist-action">
|
<time
|
||||||
<span>{{ t('components.playlists.Card.meta.tracks', playlist.tracks_count) }}</span>
|
:datetime="playlist.modification_date"
|
||||||
<PlayButton
|
:title="updatedTitle"
|
||||||
v-if="playlist.is_playable"
|
>
|
||||||
dropdown-only
|
{{ updatedAgo }}
|
||||||
:is-playable="playlist.is_playable"
|
</time>
|
||||||
:playlist="playlist"
|
<i class="bi bi-dot" />
|
||||||
/>
|
<span>{{ t('components.playlists.Card.meta.tracks', playlist.tracks_count) }}</span>
|
||||||
</div>
|
<PlayButton
|
||||||
|
v-if="playlist.is_playable"
|
||||||
|
dropdown-only
|
||||||
|
:is-playable="playlist.is_playable"
|
||||||
|
:playlist="playlist"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Card>
|
</Card>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue