Skip to content

Commit ed4127c

Browse files
committed
feat: spotify link for each playlist
Signed-off-by: Matt Gleich <git@mattglei.ch>
1 parent 825acf2 commit ed4127c

File tree

4 files changed

+44
-7
lines changed

4 files changed

+44
-7
lines changed

src/lib/icons/spotify-icon.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
2+
><path
3+
d="M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z"
4+
fill="currentColor"
5+
/></svg
6+
>

src/lib/lcp/applemusic.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ export interface AppleMusicPlaylist {
2121
tracks: AppleMusicSong[];
2222
last_modified: Date;
2323
url: string;
24+
spotify_url: string;
2425
}

src/lib/view-button.svelte

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
of,
77
more,
88
icon: Icon,
9-
iconPaddingBottom = '3px'
9+
iconPaddingBottom = '3px',
10+
iconColor = 'inherit'
1011
}: {
1112
on?: string;
1213
more?: boolean;
1314
of?: string;
1415
icon?: Component;
1516
iconPaddingBottom?: string;
17+
iconColor?: string;
1618
} = $props();
1719
</script>
1820

@@ -28,7 +30,11 @@
2830
{/if}
2931

3032
{#if Icon}
31-
<div class="icon" style:--icon-padding-bottom={iconPaddingBottom}>
33+
<div
34+
class="icon"
35+
style:--icon-padding-bottom={iconPaddingBottom}
36+
style:--icon-color={iconColor}
37+
>
3238
<Icon />
3339
</div>
3440
{/if}
@@ -50,6 +56,7 @@
5056
margin-left: 7px;
5157
margin-right: 6px;
5258
margin-bottom: var(--icon-padding-bottom);
59+
color: var(--icon-color);
5360
}
5461
5562
@media (max-width: 500px) {

src/routes/music/playlist/[playlistID]/+page.svelte

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import ViewButton from '$lib/view-button.svelte';
77
import { DynamicHead, Error } from '@gleich/ui';
88
import type { PlaylistData } from './+page.server';
9+
import SpotifyIcon from '$lib/icons/spotify-icon.svelte';
910
1011
const { data }: { data: PlaylistData } = $props();
1112
</script>
@@ -36,9 +37,19 @@
3637
</p>
3738
</div>
3839
</div>
39-
<a class="view-on-apple-music" href={data.playlist.url} target="_blank">
40-
<ViewButton on="Apple Music" icon={AppleMusicIcon} iconPaddingBottom="1.5px" />
41-
</a>
40+
<div class="view-on-buttons">
41+
<a class="view-on-button" href={data.playlist.spotify_url} target="_blank">
42+
<ViewButton on="Spotify" icon={SpotifyIcon} iconPaddingBottom="1px" iconColor="#24db68" />
43+
</a>
44+
<a class="view-on-button" href={data.playlist.url} target="_blank">
45+
<ViewButton
46+
on="Apple Music"
47+
icon={AppleMusicIcon}
48+
iconPaddingBottom="0.5px"
49+
iconColor="#fb455d"
50+
/>
51+
</a>
52+
</div>
4253
</div>
4354
<div class="songs">
4455
{#each data.playlist.tracks as song (song)}
@@ -83,8 +94,15 @@
8394
width: 192px;
8495
}
8596
86-
.view-on-apple-music {
87-
margin-top: 20px;
97+
.view-on-buttons {
98+
display: flex;
99+
gap: 10px;
100+
margin-top: 30px;
101+
margin-bottom: 10px;
102+
}
103+
104+
.view-on-button {
105+
flex: 1;
88106
text-decoration: inherit;
89107
}
90108
@@ -102,5 +120,10 @@
102120
.stats {
103121
align-items: flex-start;
104122
}
123+
124+
.view-on-buttons {
125+
flex-direction: column;
126+
gap: 10px;
127+
}
105128
}
106129
</style>

0 commit comments

Comments
 (0)