"use client"; import { albums } from "@/lib/list"; import { getSongLink } from "@/lib/songLinks"; import { getThemeColors } from "@/lib/themes"; import { faApple, faSpotify, faYoutube, faYoutubeSquare, IconDefinition } from "@fortawesome/free-brands-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ActionIcon, Anchor, Box, Divider, Grid, GridCol, Group, Modal, Stack, Text, Title, Tooltip, } from "@mantine/core"; import { useDisclosure, useHash } from "@mantine/hooks"; import Link from "next/link"; export default function TrackModal() { const [hash, setHash] = useHash(); console.log("🚀 ~ TrackModal.tsx:8 ~ TrackModal ~ hash:", hash); const close = () => { setHash(""); }; const album = albums.find((album) => { return album.id === hash.split("_")[1]; }); const track = album?.tracks.find((track) => { return track.id === `${hash.split("_")[1]}_${hash.split("_")[2]}`; }); const songLink = getSongLink(track?.id || ""); console.log("🚀 ~ TrackModal.tsx:25 ~ TrackModal ~ songLink:", songLink); const theme = getThemeColors(album?.id || ""); return ( {track?.label} Studio Version} /> 0 ? Object.keys(songLink).length : 4}> {songLink && Object.entries(songLink).map(([key, value]) => { let themeColor: { color: string; icon: IconDefinition; tooltip: string; }; switch (key) { case "spotify": themeColor = { color: "#1ED760", icon: faSpotify, tooltip: "Spotify", }; break; case "youtube": themeColor = { color: "#FF0000", icon: faYoutube, tooltip: "YouTube", }; break; case "youtubeMusic": themeColor = { color: "#FF0000", icon: faYoutubeSquare, tooltip: "YouTube Music", }; break; case "appleMusic": themeColor = { color: "#FF4E6B", icon: faApple, tooltip: "Apple Music", }; break; default: return null; } if (!themeColor) return null; return ( ); })} {Array.isArray(track?.emilyLive) && ( <> Fan Live Versions} /> {track.emilyLive.map((live, idx) => ( By: {live.author} {live.location} {new Date(live.date).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })} ))} )} {track?.lpLive && ( <> Linkin Park Live Versions} /> {new Date(track?.lpLive.date).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", })} {track?.lpLive.location} )} ); }