diff --git a/.stignore b/.stignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.stignore @@ -0,0 +1 @@ +node_modules diff --git a/app/apple-icon.tsx b/app/apple-icon.tsx index 9b251a9..be613e1 100644 --- a/app/apple-icon.tsx +++ b/app/apple-icon.tsx @@ -10,7 +10,6 @@ export default function AppleIcon() { const dataUrl = `data:image/svg+xml;base64,${svg.toString("base64")}`; return new ImageResponse( - // eslint-disable-next-line @next/next/no-img-element , { ...size } ); diff --git a/app/components/GitHubActivity.tsx b/app/components/GitHubActivity.tsx index ffff228..a737f8e 100644 --- a/app/components/GitHubActivity.tsx +++ b/app/components/GitHubActivity.tsx @@ -4,7 +4,6 @@ import { useEffect, useState } from "react"; import { createPortal } from "react-dom"; type Day = { date: string; count: number }; -type LastCommit = { message: string; repo: string; sha: string; url: string; timeAgo: string }; const MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; const CELL = 16; @@ -42,7 +41,6 @@ function formatDate(dateStr: string): string { export default function GitHubActivity() { const [weeks, setWeeks] = useState([]); const [total, setTotal] = useState(0); - const [lastCommit, setLastCommit] = useState(null); const [hoveredInfo, setHoveredInfo] = useState<{ date: string; count: number; rect: DOMRect } | null>(null); useEffect(() => { @@ -58,10 +56,9 @@ export default function GitHubActivity() { useEffect(() => { fetch("/api/github/contributions") .then((r) => r.json()) - .then((data: { weeks?: Day[][]; totalContributions?: number; lastCommit?: LastCommit }) => { + .then((data: { weeks?: Day[][]; totalContributions?: number }) => { if (data.weeks) setWeeks(data.weeks); if (data.totalContributions) setTotal(data.totalContributions); - if (data.lastCommit) setLastCommit(data.lastCommit); }) .catch(() => {}); }, []); diff --git a/app/hooks/use-now-playing.ts b/app/hooks/use-now-playing.ts index 3dbe189..459c752 100644 --- a/app/hooks/use-now-playing.ts +++ b/app/hooks/use-now-playing.ts @@ -21,12 +21,12 @@ export function useNowPlaying(): UseNowPlayingReturn { const [data, setData] = useState(null); const [displayItem, setDisplayItem] = useState(null); const [slideClass, setSlideClass] = useState(""); - const prevUrlRef = useRef(null); + const prevItemKeyRef = useRef(null); const slideTimers = useRef[]>([]); useEffect(() => { const poll = () => { - fetch("/api/lastfm/now-playing") + fetch("/api/lastfm/now-playing", { cache: "no-store" }) .then((r) => r.json()) .then((d: NowPlayingResult) => setData(d)) .catch(() => setData({ isPlaying: false })); @@ -39,22 +39,27 @@ export function useNowPlaying(): UseNowPlayingReturn { useEffect(() => { if (!data) return; + let cancelled = false; queueMicrotask(() => { + if (cancelled) return; + const nextItem: DisplayItem = data.isPlaying ? { title: data.title, artist: data.artist, songUrl: data.songUrl, albumArt: data.albumArt } : (data.recentTrack ?? null); if (!nextItem) { setDisplayItem(null); - prevUrlRef.current = null; + prevItemKeyRef.current = null; return; } - if (prevUrlRef.current === nextItem.songUrl) return; + const nextItemKey = `${data.isPlaying ? "playing" : "recent"}|${nextItem.songUrl}|${nextItem.title}|${nextItem.artist}`; + + if (prevItemKeyRef.current === nextItemKey) return; - const hadContent = prevUrlRef.current !== null; - prevUrlRef.current = nextItem.songUrl; + const hadContent = prevItemKeyRef.current !== null; + prevItemKeyRef.current = nextItemKey; if (!hadContent) { setDisplayItem(nextItem); @@ -72,8 +77,19 @@ export function useNowPlaying(): UseNowPlayingReturn { }, 200) ); }); + + return () => { + cancelled = true; + }; }, [data]); + useEffect(() => { + return () => { + slideTimers.current.forEach(clearTimeout); + slideTimers.current = []; + }; + }, []); + const dotPlaying = Boolean(data?.isPlaying); return { data, displayItem, dotPlaying, slideClass }; diff --git a/app/page.tsx b/app/page.tsx index 5110c4b..61f7dcf 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -51,23 +51,27 @@ export default async function Home() { {/* Values */}
-

Curious about everything, committed to a few things.

-

Pledged to give 10% of my lifetime income — because some decisions are worth making early.

+

Welcome to my personal space at a corner of human made internet :D

+

I am a believer of Longtermism and Effective Altruism.

+

Currently, I'm investigating what I believe when it comes to faith and religion, and what role they play in people's lives.

+

And I'm also trying to build a consistant lifestyle lol.

{/* Personality / side */}
-

Up before the city. Barely.

-

Currently reading Thinking, Fast and Slow and pretending I understand it.

+

I study Maths and I'm always awed by the beauty of deep abstract structures. I love the outline of analysis proofs and I'm mostly obsessed with algebra(but algebra is really hard lol).

+

I really love building things and I dream of building something that can help people / make people happy with a fantastic user experience.

+

+

Currently reading What's Your Dream?: Find Your Passion. Love Your Work. Build a Richer Life. and trying to ask myself questions in the book to question myself.

{/* Social links — icon row, pinned to bottom */}
diff --git a/public/avatar.jpg b/public/avatar.jpg index 3e45ba4..d31cca6 100644 Binary files a/public/avatar.jpg and b/public/avatar.jpg differ