From 09e3662a88c8ec37571eedc2e4939af70c4de791 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Sun, 17 Nov 2024 20:26:32 -0800 Subject: [PATCH] feat: music index --- src/pages/music/index.astro | 129 ++++++++++++++++++++++++++ src/styles/components/tab-buttons.css | 2 +- 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 src/pages/music/index.astro diff --git a/src/pages/music/index.astro b/src/pages/music/index.astro new file mode 100644 index 0000000..b063d80 --- /dev/null +++ b/src/pages/music/index.astro @@ -0,0 +1,129 @@ +--- +import Layout from "@layouts/Layout.astro"; +import Grid from "@components/media/Grid.astro"; +import Recent from "@components/media/music/Recent.astro"; +import Chart from "@components/media/music/Chart.astro"; +import NowPlaying from "@components/blocks/NowPlaying.jsx"; +import { + IconMicrophone2, + IconVinyl, + IconPlaylist, + IconCalendarTime, +} from "@tabler/icons-react"; +import { fetchGlobalData } from "@utils/data/global/index.js"; +import { fetchMusicData } from "@utils/data/music.js"; +import { fetchNowPlaying } from "@utils/data/nowPlaying.js"; +import { fetchAlbumReleases } from "@utils/data/albumReleases.js"; +import { mediaLinks } from "@utils/helpers/media.js"; + +export const prerender = true; + +const { globals } = await fetchGlobalData(Astro); +const music = await fetchMusicData(); +const albumReleases = await fetchAlbumReleases(); + +const title = "Music"; +const description = + "This is everything I've been listening to recently — it's collected in a database as I listen to it and displayed here."; + +let nowPlayingStaticContent = "Nothing playing."; + +if (import.meta.env.MODE === "development") { + const nowPlayingData = await fetchNowPlaying(); + nowPlayingStaticContent = nowPlayingData.content; +} +--- + + +

{title}

+

+ I've listened to{" "} + + {music.week.artists.length} artists + + ,{" "} + + {music.week.albums.length} albums + + , and{" "} + + {music.week.totalTracks} tracks + {" "} + this week. Most of that has been{" "} + +

+

+ Take a look at what I've listened to{" "} + this month or{" "} + check out the concerts I've been to. +

+

+ +

+
+

+ Artists +

+ +

+ Albums +

+ +

+ Tracks +

+
+ + + + +
+ +
+
+ +
+
+ { + albumReleases.upcoming.length > 0 && ( + <> +

+ Anticipated albums +

+ + + ) + } +
diff --git a/src/styles/components/tab-buttons.css b/src/styles/components/tab-buttons.css index ce05980..82c413e 100644 --- a/src/styles/components/tab-buttons.css +++ b/src/styles/components/tab-buttons.css @@ -16,7 +16,7 @@ input[id="tracks-chart"] ~ .tracks-chart { } [for="tracks-recent"] { - margin-right: var(--spacing-xs); + margin-right: var(--spacing-lg); } #tracks-recent:checked ~ [for="tracks-recent"],