my website https://bigspeed.me

chore: move now playing to intro file

+15 -22
+8 -1
src/lib/components/Intro.svelte
··· 30 30 {/each} 31 31 </div> 32 32 <div class="bottom-8"> 33 - <NowPlaying song={data.song} /> 33 + {#if data.song.isPlaying} 34 + <a href={data.song.songUrl} target="_blank"> 35 + <span class="text-xl opacity-50 hover:opacity-75 transition"> 36 + Now Playing: 37 + <strong>{data.song.artist} - {data.song.title}</strong> 38 + </span> 39 + </a> 40 + {/if} 34 41 </div> 35 42 </div> 36 43 </div>
-14
src/lib/components/NowPlaying.svelte
··· 1 - <script lang="ts"> 2 - import type { Song } from '$lib/types'; 3 - 4 - export let song: Song; 5 - </script> 6 - 7 - {#if song.isPlaying} 8 - <a href={song.songUrl} target="_blank"> 9 - <span class="text-xl opacity-50 hover:opacity-75 transition"> 10 - Now Playing: 11 - <strong>{song.artist} - {song.title}</strong> 12 - </span> 13 - </a> 14 - {/if}
+7 -7
src/routes/api/spotify/np/+server.ts
··· 27 27 let artist = song.item.artists.map((_artist: Artist) => _artist.name).join(', '); 28 28 const songUrl = song.item.external_urls.spotify; 29 29 30 - // trim artist and song names 31 - if (artist.length > 15) { 32 - artist = artist.substring(0, 15) + '...'; 33 - } 34 - if (title.length > 25) { 35 - title = title.substring(0, 25) + '...'; 36 - } 30 + // trim artist and song names 31 + if (artist.length > 15) { 32 + artist = artist.substring(0, 15) + '...'; 33 + } 34 + if (title.length > 25) { 35 + title = title.substring(0, 25) + '...'; 36 + } 37 37 38 38 return new Response( 39 39 JSON.stringify({