diff --git a/src/lib/components/media/mediaCard.svelte b/src/lib/components/media/mediaCard.svelte
index 7c7b0bd..af76632 100644
--- a/src/lib/components/media/mediaCard.svelte
+++ b/src/lib/components/media/mediaCard.svelte
@@ -3,15 +3,9 @@
import IconButton from '$lib/components/util/iconButton.svelte'
import { goto } from '$app/navigation'
- import { currentlyPlaying } from '$lib/stores'
+ import { queue } from '$lib/stores'
let image: HTMLImageElement, captionText: HTMLDivElement
-
- const setCurrentlyPlaying = () => {
- if (mediaItem.type === 'song') {
- $currentlyPlaying = mediaItem
- }
- }
@@ -31,7 +25,12 @@
{/if}
-
+ {
+ if (mediaItem.type === 'song') $queue.push(mediaItem)
+ }}
+ >
diff --git a/src/lib/components/media/mediaPlayer.svelte b/src/lib/components/media/mediaPlayer.svelte
index 8a3c2a3..658d12e 100644
--- a/src/lib/components/media/mediaPlayer.svelte
+++ b/src/lib/components/media/mediaPlayer.svelte
@@ -1,10 +1,13 @@
-{#if $currentlyPlaying}
+{#if currentlyPlaying}
- {#key $currentlyPlaying}
-
+ {#key currentlyPlaying}
+
{/key}
- {$currentlyPlaying.name}
- {$currentlyPlaying.artists?.map((artist) => artist.name).join(', ') || $currentlyPlaying.createdBy?.name}
+ {currentlyPlaying.name}
+ {currentlyPlaying.artists?.map((artist) => artist.name).join(', ') || currentlyPlaying.createdBy?.name}
@@ -105,11 +108,11 @@
-
-
{/if}
diff --git a/src/lib/stores.ts b/src/lib/stores.ts
index e8c32c4..7961b87 100644
--- a/src/lib/stores.ts
+++ b/src/lib/stores.ts
@@ -5,7 +5,7 @@ export const pageWidth: Writable = writable()
export const newestAlert: Writable<[AlertType, string]> = writable()
-export const currentlyPlaying: Writable = writable()
+export const queue: Writable = writable()
const youtubeMusicBackground: string = 'https://www.gstatic.com/youtube/media/ytm/images/sbg/wsbg@4000x2250.png' // Default Youtube music background
export const backgroundImage: Writable = writable(youtubeMusicBackground)
diff --git a/src/routes/(app)/search/+page.svelte b/src/routes/(app)/search/+page.svelte
index e0da77f..7e2a4f8 100644
--- a/src/routes/(app)/search/+page.svelte
+++ b/src/routes/(app)/search/+page.svelte
@@ -1,8 +1,17 @@
{#if data.searchResults}
@@ -13,7 +22,7 @@
{
- if (searchResult.type === 'song') $currentlyPlaying = searchResult
+ if (searchResult.type === 'song') $queue.push(searchResult)
}}
class="grid aspect-square h-full place-items-center bg-cover bg-center bg-no-repeat"
style="--thumbnail: url('/api/remoteImage?url={searchResult.thumbnail}')"
@@ -28,6 +37,9 @@
{searchResult.createdBy?.name}
{/if}
+ {#if 'duration' in searchResult && searchResult.duration}
+ {formatTime(searchResult.duration)}
+ {/if}
{/each}