mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-07-29 06:02:06 +00:00
use ternary op to send copyright text to songlist component
+ return a zeros if seconds is undefined in formatSeconds()
This commit is contained in:
parent
5f14fbf86d
commit
13f38c5a66
@ -22,7 +22,7 @@
|
|||||||
<div class="text">No tracks here</div>
|
<div class="text">No tracks here</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="copyright" v-if="copyright()">
|
<div class="copyright" v-if="copyright">
|
||||||
{{ copyright() }}
|
{{ copyright() }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -49,7 +49,7 @@ const props = defineProps<{
|
|||||||
playlistid?: string;
|
playlistid?: string;
|
||||||
on_album_page?: boolean;
|
on_album_page?: boolean;
|
||||||
disc?: string | number;
|
disc?: string | number;
|
||||||
copyright?: () => string;
|
copyright?: (() => string) | null;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -55,6 +55,10 @@ function isSameRoute(to: r, from: r) {
|
|||||||
* @param long Whether to provide the time in the long format
|
* @param long Whether to provide the time in the long format
|
||||||
*/
|
*/
|
||||||
function formatSeconds(seconds: number, long?: boolean) {
|
function formatSeconds(seconds: number, long?: boolean) {
|
||||||
|
if (seconds == undefined) {
|
||||||
|
return "00:00";
|
||||||
|
}
|
||||||
|
|
||||||
const date = new Date(seconds * 1000);
|
const date = new Date(seconds * 1000);
|
||||||
|
|
||||||
const hh = date.getUTCHours();
|
const hh = date.getUTCHours();
|
||||||
|
@ -43,7 +43,7 @@ const defaultTrack = <Track>{
|
|||||||
albumhash: " ",
|
albumhash: " ",
|
||||||
artists: ["Alice"],
|
artists: ["Alice"],
|
||||||
trackid: "",
|
trackid: "",
|
||||||
image: "",
|
image: "meh",
|
||||||
};
|
};
|
||||||
|
|
||||||
type From = fromFolder | fromAlbum | fromPlaylist | fromSearch;
|
type From = fromFolder | fromAlbum | fromPlaylist | fromSearch;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<SongList
|
<SongList
|
||||||
:tracks="FStore.tracks"
|
:tracks="FStore.tracks"
|
||||||
:path="FStore.path"
|
:path="FStore.path"
|
||||||
:copyright="() => null"
|
:copyright="null"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,13 +6,7 @@
|
|||||||
:tracks="disc"
|
:tracks="disc"
|
||||||
:on_album_page="true"
|
:on_album_page="true"
|
||||||
:disc="key"
|
:disc="key"
|
||||||
:copyright="
|
:copyright="isLastDisc(key) ? () => copyright : null"
|
||||||
() => {
|
|
||||||
if (isLastDisc(key)) {
|
|
||||||
return copyright;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user