2022-06-10 10:47:46 +00:00
|
|
|
<template>
|
|
|
|
<section class="recent">
|
|
|
|
<h1>
|
|
|
|
Recently Played
|
|
|
|
<Btn
|
|
|
|
data-testid="home-view-all-recently-played-btn"
|
|
|
|
@click.prevent="goToRecentlyPlayedScreen"
|
|
|
|
rounded
|
|
|
|
small
|
|
|
|
orange
|
|
|
|
>
|
|
|
|
View All
|
|
|
|
</Btn>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<ol v-if="songs.length" class="recent-song-list">
|
|
|
|
<li v-for="song in songs" :key="song.id">
|
|
|
|
<SongCard :song="song"/>
|
|
|
|
</li>
|
|
|
|
</ol>
|
|
|
|
|
|
|
|
<p v-show="!songs.length" class="text-secondary">
|
|
|
|
Your recently played songs will be displayed here.<br/>
|
|
|
|
Start listening!
|
|
|
|
</p>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2022-07-07 18:05:46 +00:00
|
|
|
import { toRef } from 'vue'
|
2022-06-10 10:47:46 +00:00
|
|
|
import router from '@/router'
|
|
|
|
import { recentlyPlayedStore } from '@/stores'
|
|
|
|
|
2022-07-07 07:52:54 +00:00
|
|
|
import Btn from '@/components/ui/Btn.vue'
|
2022-07-07 18:05:46 +00:00
|
|
|
import SongCard from '@/components/song/SongCard.vue'
|
2022-06-10 10:47:46 +00:00
|
|
|
|
|
|
|
const songs = toRef(recentlyPlayedStore.excerptState, 'songs')
|
|
|
|
|
|
|
|
const goToRecentlyPlayedScreen = () => router.go('recently-played')
|
|
|
|
</script>
|