From 13f38c5a662e986d1ab16dc1d837fb6510e80ecb Mon Sep 17 00:00:00 2001 From: geoffrey45 Date: Thu, 4 Aug 2022 14:56:46 +0300 Subject: [PATCH] use ternary op to send copyright text to songlist component + return a zeros if seconds is undefined in formatSeconds() --- src/components/FolderView/SongList.vue | 4 ++-- src/composables/perks.ts | 4 ++++ src/stores/queue.ts | 2 +- src/views/FolderView.vue | 2 +- src/views/album/Content.vue | 8 +------- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/components/FolderView/SongList.vue b/src/components/FolderView/SongList.vue index a6d48c8..c7b2d51 100644 --- a/src/components/FolderView/SongList.vue +++ b/src/components/FolderView/SongList.vue @@ -22,7 +22,7 @@
No tracks here
- @@ -49,7 +49,7 @@ const props = defineProps<{ playlistid?: string; on_album_page?: boolean; disc?: string | number; - copyright?: () => string; + copyright?: (() => string) | null; }>(); const route = useRoute(); diff --git a/src/composables/perks.ts b/src/composables/perks.ts index 8d32c97..53d9cbc 100644 --- a/src/composables/perks.ts +++ b/src/composables/perks.ts @@ -55,6 +55,10 @@ function isSameRoute(to: r, from: r) { * @param long Whether to provide the time in the long format */ function formatSeconds(seconds: number, long?: boolean) { + if (seconds == undefined) { + return "00:00"; + } + const date = new Date(seconds * 1000); const hh = date.getUTCHours(); diff --git a/src/stores/queue.ts b/src/stores/queue.ts index 7ca7ffc..a0591fc 100644 --- a/src/stores/queue.ts +++ b/src/stores/queue.ts @@ -43,7 +43,7 @@ const defaultTrack = { albumhash: " ", artists: ["Alice"], trackid: "", - image: "", + image: "meh", }; type From = fromFolder | fromAlbum | fromPlaylist | fromSearch; diff --git a/src/views/FolderView.vue b/src/views/FolderView.vue index 1fef586..c6029ce 100644 --- a/src/views/FolderView.vue +++ b/src/views/FolderView.vue @@ -15,7 +15,7 @@ diff --git a/src/views/album/Content.vue b/src/views/album/Content.vue index 7847baf..993641f 100644 --- a/src/views/album/Content.vue +++ b/src/views/album/Content.vue @@ -6,13 +6,7 @@ :tracks="disc" :on_album_page="true" :disc="key" - :copyright=" - () => { - if (isLastDisc(key)) { - return copyright; - } - } - " + :copyright="isLastDisc(key) ? () => copyright : null" />