From 228f71b04989a17bc1a47bbb19d71a14fdc16545 Mon Sep 17 00:00:00 2001 From: Aidan Date: Tue, 7 Jan 2025 19:38:46 -0500 Subject: [PATCH] bug fixes and optomizations to yield successful build --- app/components/Music.tsx | 24 ++++++++++++++++++++---- app/components/pages/About.tsx | 5 +++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/components/Music.tsx b/app/components/Music.tsx index 596dbfc..57f79ab 100644 --- a/app/components/Music.tsx +++ b/app/components/Music.tsx @@ -7,15 +7,31 @@ import { faPlay, faStepBackward, faStepForward, faArrowLeft, faArrowRight } from export default function Home() { const [timePeriod, setTimePeriod] = useState('2020s'); - const [songs, setSongs] = useState([]); + interface Song { + albumArt: string; + name: string; + artist: string; + duration: string; + link?: string; + } + const [songs, setSongs] = useState([]); const [currentIndex, setCurrentIndex] = useState(0); useEffect(() => { fetch('/data/music.json') .then(response => response.json()) .then(data => { - const selectedPeriod = data.find(period => period.timePeriod === timePeriod); - const songsList = selectedPeriod ? selectedPeriod.songs : []; + interface Song { + albumArt: string; + name: string; + artist: string; + duration: string; + } + interface Period { + timePeriod: string; + songs: Song[]; + } + const selectedPeriod = data.find((period: Period) => period.timePeriod === timePeriod); const songsList = selectedPeriod ? selectedPeriod.songs : []; setSongs(songsList); setCurrentIndex(Math.floor(Math.random() * songsList.length)); }); @@ -24,7 +40,7 @@ export default function Home() { useEffect(() => { const selectElement = document.getElementById('timePeriod'); if (selectElement) { - setTimePeriod(selectElement.value); + setTimePeriod((selectElement as HTMLSelectElement).value); } }, []); diff --git a/app/components/pages/About.tsx b/app/components/pages/About.tsx index 0822135..dc9c7ed 100644 --- a/app/components/pages/About.tsx +++ b/app/components/pages/About.tsx @@ -1,6 +1,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faUser } from '@fortawesome/free-solid-svg-icons' import GitHubFeatured from '../GitHubFeatured' +import Image from 'next/image' export default function About() { return ( @@ -29,8 +30,8 @@ export default function About() {

My GitHub Contributions

You can find me on GitHub as ihatenodejs.

- ihatenodejs's Stats - ihatenodejs's Top Languages + ihatenodejs's Stats + ihatenodejs's Top Languages