Compare commits

...

3 commits

Author SHA1 Message Date
8a6d08d276
fix scrobblerrr 2026-02-17 07:05:29 -08:00
21ad28c980
new badge 2026-02-12 00:59:58 -08:00
f1e80ebb30
the scrobblerrr 2026-02-12 00:51:19 -08:00
5 changed files with 80 additions and 1 deletions

View file

@ -21,7 +21,6 @@ const { title } = Astro.props;
} }
.card { .card {
width: fit-content;
/* the golden rule i think */ /* the golden rule i think */
/* max-width: 800px is my everything */ /* max-width: 800px is my everything */
max-width: 800px; max-width: 800px;

View file

@ -0,0 +1,72 @@
---
---
<div class="lastfm">
<img class="cover" src="https://lastfm.freetls.fastly.net/i/u/300x300/c6f59c1e5e7240a4c0d427abd71f3dbb.jpg">
<div class="info">
<h3 class="title"><a target="_blank">loading...</a></h3>
on <span class="album"><strong>loading...</strong></span><br>
by <span class="artist"><strong>loading...</strong></span><br>
at <time class="time"><strong>loading...</strong></time>
</div>
</div>
<script>
// load bearing noelle
const json = await fetch("https://lastfm.nkko.workers.dev/?method=user.getRecentTracks&user=reidlab")
.then(res => res.json())
.catch(err => console.error("last.fm fail:", err));
console.log(json);
type LastFmResource<T> = { "#text": T }
const track = json.recenttracks.track[0] as {
"@attr"?: { nowplaying: boolean },
album: LastFmResource<string>,
artist: LastFmResource<string>,
date?: LastFmResource<string>,
image: LastFmResource<string>[],
name: string,
url: string,
};
// i think it's okay to have this be an anchor element
// the aria role is link if href is present, otherwise generic (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a#technical_summary)
// also briefly stated in the html spec (https://html.spec.whatwg.org/#the-a-element)
const title = document.querySelector(".title a") as HTMLAnchorElement;
const album = document.querySelector(".album strong") as HTMLElement;
const artist = document.querySelector(".artist strong") as HTMLElement;
const time = document.querySelector(".time strong") as HTMLTimeElement;
const cover = document.querySelector(".cover") as HTMLImageElement;
title.innerText = track.name;
title.href = track.url;
album.innerText = track.album["#text"];
artist.innerText = track.artist["#text"];
time.innerText = (track.date && new Date(track.date["#text"]).toLocaleString(undefined, {
dateStyle: "medium",
timeStyle: "short"
})) || (track["@attr"]?.nowplaying && "NOW!!!") || "epic error getting play time..";
// i chose a random thing from my library missing an album cover for this
// but apparently this goes for any missing track? cuz everyone else is doing it
// https://github.com/search?q=c6f59c1e5e7240a4c0d427abd71f3dbb&type=code
cover.src = track.image.at(-1)?.["#text"] ?? "https://lastfm.freetls.fastly.net/i/u/300x300/c6f59c1e5e7240a4c0d427abd71f3dbb.jpg";
cover.alt = track.name;
</script>
<style>
.lastfm {
display: flex;
gap: 1em;
}
.cover {
display: block;
width: 8em;
height: min-content;
float: left;
}
.info {
word-break: break-all;
}
.title {
size: 1.2em;
}
</style>

View file

@ -91,3 +91,7 @@
path: "./img/spax.gif" path: "./img/spax.gif"
alt: "spax dot zone" alt: "spax dot zone"
href: "https://spax.zone" href: "https://spax.zone"
- slug: "mini"
path: "./img/mini.png"
alt: "miniaturity"
href: "https://minipa.ws/"

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

View file

@ -3,6 +3,7 @@ import Layout from "../layouts/Layout.astro";
import Card from "../components/Card.astro"; import Card from "../components/Card.astro";
import Badges from "../components/Badges.astro"; import Badges from "../components/Badges.astro";
import LastFm from "../components/LastFm.astro";
--- ---
<Layout title="landing"> <Layout title="landing">
@ -11,6 +12,9 @@ import Badges from "../components/Badges.astro";
<p>this site was made as a dumping grounds for whatever i decide to put on here eventually, more coming soon, i promise!! the whole thing as a whole is still a work in progress</p> <p>this site was made as a dumping grounds for whatever i decide to put on here eventually, more coming soon, i promise!! the whole thing as a whole is still a work in progress</p>
<p>feel free to look around, and if you have any questions, feel free to ask me on my socials or contact me directly</p> <p>feel free to look around, and if you have any questions, feel free to ask me on my socials or contact me directly</p>
</Card> </Card>
<Card title="lastfm">
<LastFm/>
</Card>
<Card title="buttons"> <Card title="buttons">
<Badges/> <Badges/>
</Card> </Card>