From 9a81be6655c5a7a8e9bc85d251efdf997bb1170b Mon Sep 17 00:00:00 2001 From: Andrew B Date: Sun, 16 Apr 2023 15:39:35 -0400 Subject: [PATCH] chore: move now playing to intro file --- src/lib/components/Intro.svelte | 9 ++++++++- src/lib/components/NowPlaying.svelte | 14 -------------- src/routes/api/spotify/np/+server.ts | 14 +++++++------- 3 files changed, 15 insertions(+), 22 deletions(-) delete mode 100644 src/lib/components/NowPlaying.svelte diff --git a/src/lib/components/Intro.svelte b/src/lib/components/Intro.svelte index 583d2ef..e46bb46 100644 --- a/src/lib/components/Intro.svelte +++ b/src/lib/components/Intro.svelte @@ -30,7 +30,14 @@ {/each}
- + {#if data.song.isPlaying} + + + Now Playing: + {data.song.artist} - {data.song.title} + + + {/if}
diff --git a/src/lib/components/NowPlaying.svelte b/src/lib/components/NowPlaying.svelte deleted file mode 100644 index 1ee3619..0000000 --- a/src/lib/components/NowPlaying.svelte +++ /dev/null @@ -1,14 +0,0 @@ - - -{#if song.isPlaying} - - - Now Playing: - {song.artist} - {song.title} - - -{/if} diff --git a/src/routes/api/spotify/np/+server.ts b/src/routes/api/spotify/np/+server.ts index 368f574..ab2a041 100644 --- a/src/routes/api/spotify/np/+server.ts +++ b/src/routes/api/spotify/np/+server.ts @@ -27,13 +27,13 @@ export async function GET() { let artist = song.item.artists.map((_artist: Artist) => _artist.name).join(', '); const songUrl = song.item.external_urls.spotify; - // trim artist and song names - if (artist.length > 15) { - artist = artist.substring(0, 15) + '...'; - } - if (title.length > 25) { - title = title.substring(0, 25) + '...'; - } + // trim artist and song names + if (artist.length > 15) { + artist = artist.substring(0, 15) + '...'; + } + if (title.length > 25) { + title = title.substring(0, 25) + '...'; + } return new Response( JSON.stringify({ -- 2.51.2