Skip to content
Snippets Groups Projects
Commit fb7356b1 authored by Kasper Seweryn's avatar Kasper Seweryn 🥞
Browse files

Fix navigation button in podcast card

parent efa36bc8
No related branches found
No related tags found
1 merge request!1Implement all components
Pipeline #23481 failed with stages
in 2 minutes and 56 seconds
<script setup lang="ts">
import { FwCard, FwPlayButton, FwOptionsButton } from '~/components'
import { FwCard, FwOptionsButton } from '~/components'
import { useTimeAgo } from '@vueuse/core'
import { useRouter } from 'vue-router'
interface Podcast {
id: number
name: string
artist: {
id: number
name: string
modification_date: '2022-09-11'
cover: {
......@@ -17,26 +17,19 @@ interface Podcast {
}
}
interface Events {
(e: 'play', podcast: Podcast): void
}
interface Props {
podcast: Podcast
}
const emit = defineEmits<Events>()
const props = defineProps<Props>()
const timeAgo = useTimeAgo(new Date(props.podcast.artist.modification_date))
let navigate = (to: 'artist' | 'podcast') => {}
let navigate = () => {}
if (import.meta.env.PROD) {
const router = useRouter()
navigate = (to: 'artist' | 'podcast') => to === 'podcast'
? router.push({ name: 'library.albums.detail', params: { id: props.podcast.id } })
: router.push({ name: 'library.channels.detail', params: { id: props.podcast.artist.id } })
navigate = () => router.push({ name: 'library.artists.detail', params: { id: props.podcast.artist.id } })
}
</script>
......@@ -44,11 +37,11 @@ if (import.meta.env.PROD) {
<fw-card
:title="podcast.name"
:image="podcast.artist.cover.urls.original"
@click="navigate('podcast')"
@click="navigate"
class="podcast-card"
>
<a
@click.stop="navigate('artist')"
@click.stop="navigate"
class="funkwhale link"
>
{{ podcast.artist.name }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment