2025-10-25 01:03:11 +00:00
|
|
|
"use client";
|
|
|
|
|
import { getSongLink } from "@/lib/songLinks";
|
2025-10-25 01:26:25 +00:00
|
|
|
import type { AlbumTheme } from "@/lib/themes";
|
|
|
|
|
import type { Track } from "@/lib/ListTypes";
|
2025-10-25 01:03:11 +00:00
|
|
|
import {
|
2025-10-25 01:26:25 +00:00
|
|
|
faApple,
|
|
|
|
|
faSpotify,
|
|
|
|
|
faYoutube,
|
|
|
|
|
faYoutubeSquare,
|
|
|
|
|
type IconDefinition,
|
|
|
|
|
} from "@fortawesome/free-brands-svg-icons";
|
|
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
|
import { ActionIcon, Box, Divider, Grid, GridCol, Group, Modal, Stack, Text, Title, Tooltip } from "@mantine/core";
|
2025-10-25 01:03:11 +00:00
|
|
|
import Link from "next/link";
|
|
|
|
|
|
2025-10-25 01:26:25 +00:00
|
|
|
interface TrackModalProps {
|
|
|
|
|
opened: boolean;
|
|
|
|
|
onClose: () => void;
|
|
|
|
|
track: Track;
|
|
|
|
|
theme: AlbumTheme;
|
|
|
|
|
}
|
2025-10-25 01:03:11 +00:00
|
|
|
|
2025-10-25 01:26:25 +00:00
|
|
|
export default function TrackModal({ opened, onClose, track, theme }: TrackModalProps) {
|
|
|
|
|
const songLink = getSongLink(track.id);
|
2025-10-25 01:03:11 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Modal
|
2025-10-25 01:26:25 +00:00
|
|
|
centered
|
|
|
|
|
opened={opened}
|
|
|
|
|
onClose={onClose}
|
2025-10-25 01:03:11 +00:00
|
|
|
withCloseButton={false}
|
2025-10-25 01:26:25 +00:00
|
|
|
transitionProps={{ duration: 150, transition: "fade" }}
|
2025-10-25 01:03:11 +00:00
|
|
|
styles={{
|
|
|
|
|
body: {
|
|
|
|
|
background: theme.background.gradient,
|
|
|
|
|
boxShadow: "none",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Stack>
|
2025-10-25 01:26:25 +00:00
|
|
|
<Title order={1}>{track.label}</Title>
|
|
|
|
|
<Divider
|
|
|
|
|
color={theme.accent.DEFAULT}
|
|
|
|
|
size={"lg"}
|
|
|
|
|
label={
|
|
|
|
|
<Title c={theme.accent.DEFAULT} order={3}>
|
|
|
|
|
Studio Version
|
|
|
|
|
</Title>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-10-25 01:03:11 +00:00
|
|
|
<Grid columns={songLink && Object.keys(songLink).length > 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 (
|
|
|
|
|
<GridCol
|
|
|
|
|
span={1}
|
2025-10-25 01:26:25 +00:00
|
|
|
key={`${track.id}_${key}`}
|
2025-10-25 01:03:11 +00:00
|
|
|
style={{ display: "flex", alignItems: "center", justifyContent: "center" }}
|
|
|
|
|
>
|
|
|
|
|
<Tooltip label={themeColor.tooltip}>
|
|
|
|
|
<ActionIcon
|
2025-10-25 01:26:25 +00:00
|
|
|
tabIndex={-1}
|
2025-10-25 01:03:11 +00:00
|
|
|
variant="filled"
|
|
|
|
|
color={themeColor.color}
|
|
|
|
|
size="lg"
|
|
|
|
|
component={Link}
|
|
|
|
|
href={value}
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
>
|
|
|
|
|
<FontAwesomeIcon icon={themeColor.icon} />
|
|
|
|
|
</ActionIcon>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</GridCol>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Grid>
|
2025-10-25 01:26:25 +00:00
|
|
|
{Array.isArray(track.emilyLive) && (
|
2025-10-25 01:03:11 +00:00
|
|
|
<>
|
2025-10-25 01:26:25 +00:00
|
|
|
<Divider
|
|
|
|
|
color={theme.accent.DEFAULT}
|
|
|
|
|
size={"lg"}
|
|
|
|
|
label={
|
|
|
|
|
<Title c={theme.accent.DEFAULT} order={3}>
|
|
|
|
|
Fan Live Versions
|
|
|
|
|
</Title>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-10-25 01:03:11 +00:00
|
|
|
<Stack>
|
2025-10-25 01:26:25 +00:00
|
|
|
{track.emilyLive.map((live) => (
|
2025-10-25 01:03:11 +00:00
|
|
|
<Box style={{ width: "100%" }} key={`emilyLive_${live.url}`}>
|
|
|
|
|
<Group justify="space-between" align="center">
|
|
|
|
|
<Box style={{ display: "flex", flexDirection: "column", gap: "4px" }}>
|
|
|
|
|
<Text>By: {live.author}</Text>
|
|
|
|
|
<Text>{live.location}</Text>
|
|
|
|
|
<Text>
|
|
|
|
|
{new Date(live.date).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })}
|
|
|
|
|
</Text>
|
|
|
|
|
</Box>
|
|
|
|
|
<ActionIcon
|
2025-10-25 01:26:25 +00:00
|
|
|
tabIndex={-1}
|
2025-10-25 01:03:11 +00:00
|
|
|
variant="filled"
|
|
|
|
|
color={"#FF0000"}
|
|
|
|
|
size="lg"
|
|
|
|
|
component={Link}
|
|
|
|
|
href={live.url}
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
>
|
|
|
|
|
<FontAwesomeIcon icon={faYoutube} />
|
|
|
|
|
</ActionIcon>
|
|
|
|
|
</Group>
|
|
|
|
|
</Box>
|
|
|
|
|
))}
|
|
|
|
|
</Stack>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
|
2025-10-25 01:26:25 +00:00
|
|
|
{track.lpLive && (
|
2025-10-25 01:03:11 +00:00
|
|
|
<>
|
2025-10-25 01:26:25 +00:00
|
|
|
<Divider
|
|
|
|
|
color={theme.accent.DEFAULT}
|
|
|
|
|
size={"lg"}
|
|
|
|
|
label={
|
|
|
|
|
<Title c={theme.accent.DEFAULT} order={3}>
|
|
|
|
|
Linkin Park Live Versions
|
|
|
|
|
</Title>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-10-25 01:03:11 +00:00
|
|
|
<Group justify="space-between" align="center">
|
|
|
|
|
<Box style={{ display: "flex", flexDirection: "column", gap: "4px" }}>
|
|
|
|
|
<Text>
|
2025-10-25 01:26:25 +00:00
|
|
|
{new Date(track.lpLive.date).toLocaleDateString("en-US", {
|
2025-10-25 01:03:11 +00:00
|
|
|
year: "numeric",
|
|
|
|
|
month: "long",
|
|
|
|
|
day: "numeric",
|
|
|
|
|
})}
|
|
|
|
|
</Text>
|
2025-10-25 01:26:25 +00:00
|
|
|
<Text>{track.lpLive.location}</Text>
|
2025-10-25 01:03:11 +00:00
|
|
|
</Box>
|
|
|
|
|
<ActionIcon
|
2025-10-25 01:26:25 +00:00
|
|
|
tabIndex={-1}
|
2025-10-25 01:03:11 +00:00
|
|
|
variant="filled"
|
|
|
|
|
color={"#FF0000"}
|
|
|
|
|
size="lg"
|
|
|
|
|
component={Link}
|
2025-10-25 01:26:25 +00:00
|
|
|
href={track.lpLive.url}
|
2025-10-25 01:03:11 +00:00
|
|
|
target="_blank"
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
>
|
|
|
|
|
<FontAwesomeIcon icon={faYoutube} />
|
|
|
|
|
</ActionIcon>
|
|
|
|
|
</Group>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</Stack>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
}
|