tangled
alpha
login
or
join now
vielle.dev
/
site
0
fork
atom
Personal Site
0
fork
atom
overview
issues
pulls
pipelines
prettier formatted smthn m8 idk what to say
vielle.dev
7 months ago
0eaa9554
0e725cfe
verified
This commit was signed with the committer's
known signature
.
vielle.dev
SSH Key Fingerprint:
SHA256:/4bvxqoEh9iMdjAPgcgAgXKZZQTROL3ULiPt6nH9RSs=
+14
-10
1 changed file
expand all
collapse all
unified
split
src
components
playing
NowPlaying.astro
+14
-10
src/components/playing/NowPlaying.astro
···
57
57
</div>
58
58
</section>
59
59
60
60
-
{track instanceof SpotifyError && <script set:html={`console.error("Failed to load nowPlaying:", ${JSON.stringify(track)})`}></script>}
60
60
+
{
61
61
+
track instanceof SpotifyError && (
62
62
+
<script
63
63
+
set:html={`console.error("Failed to load nowPlaying:", ${JSON.stringify(track)})`}
64
64
+
/>
65
65
+
)
66
66
+
}
61
67
62
68
<style>
63
69
@keyframes spin {
···
184
190
</style>
185
191
186
192
<script>
187
187
-
import {
188
188
-
type nowPlaying,
189
189
-
isNowPlaying,
190
190
-
} from "./spotify/client";
193
193
+
import { type nowPlaying, isNowPlaying } from "./spotify/client";
191
194
192
195
const nowPlayingEl = document.getElementById("now-playing");
193
196
if (!nowPlayingEl) throw new Error("Could not find #now-playing");
194
194
-
const art = nowPlayingEl.querySelector(".art")
195
195
-
if (!art || !(art instanceof HTMLImageElement)) throw new Error("Could not find #now-playing img.art");
197
197
+
const art = nowPlayingEl.querySelector(".art");
198
198
+
if (!art || !(art instanceof HTMLImageElement))
199
199
+
throw new Error("Could not find #now-playing img.art");
196
200
197
201
const renderNowPlaying = (playing: Exclude<nowPlaying, null>) => {
198
198
-
art.src = playing.album.images[0].url
202
202
+
art.src = playing.album.images[0].url;
199
203
};
200
204
201
205
const renderSilent = () => {
202
202
-
art.src = "https://undefined/"
206
206
+
art.src = "https://undefined/";
203
207
};
204
208
205
209
const events = new EventSource("/now-playing-sse");
···
214
218
return renderNowPlaying(playing);
215
219
216
220
// server sent strange/error response
217
217
-
console.error("Unexpected value sent from server:", playing)
221
221
+
console.error("Unexpected value sent from server:", playing);
218
222
// continue as normal as the previous value WAS ok
219
223
});
220
224
</script>