diff --git a/bun.lockb b/bun.lockb deleted file mode 100644 index 3cc22d8..0000000 Binary files a/bun.lockb and /dev/null differ diff --git a/next.config.mjs b/next.config.mjs index 8bb82c7..1f3270d 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -11,6 +11,10 @@ const nextConfig = { protocol: "https", hostname: "cdn.discordapp.com", }, + { + protocol: "https", + hostname: "i.scdn.co", + }, { protocol: "https", hostname: "bonfire.wtf", diff --git a/package.json b/package.json index 325b1c6..59a34e8 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "framer-motion": "^11.3.30", "lucide-react": "^0.436.0", "moment": "^2.30.1", - "next": "14.2.3", + "next": "^14.2.7", "next-themes": "^0.3.0", "react": "^18", "react-dom": "^18", diff --git a/src/app/(pages)/page.tsx b/src/app/(pages)/page.tsx index 7a021af..4596037 100644 --- a/src/app/(pages)/page.tsx +++ b/src/app/(pages)/page.tsx @@ -19,7 +19,7 @@ const LandingPage = (): ReactElement => ( - + diff --git a/src/components/landing/discord-status.tsx b/src/components/landing/discord-status.tsx index 6359788..1e89592 100644 --- a/src/components/landing/discord-status.tsx +++ b/src/components/landing/discord-status.tsx @@ -1,11 +1,19 @@ "use client"; import { ReactElement, useEffect, useState } from "react"; -import { Data, DiscordUser, useLanyardWS } from "use-lanyard"; +import { + Activity, + Data, + DiscordUser, + Spotify, + useLanyardWS, +} from "use-lanyard"; import DCDNUser from "@/types/dcdn"; import axios from "axios"; import Image from "next/image"; import { cn } from "@/lib/utils"; +import moment from "moment"; +import { PuzzlePieceIcon } from "@heroicons/react/24/outline"; const statusColors = { online: "bg-green-500", @@ -57,7 +65,7 @@ const DiscordStatus = (): ReactElement | undefined => { } return ( -
+
{ />
-
+
{dcdnUser.bio && }
+ + {/* Activity */} + {discordData.activities.length > 0 && ( +
+ {discordData.activities[0].name !== + "Spotify" ? ( + + ) : ( + discordData.spotify && ( + + ) + )} +
+ )}
@@ -88,9 +114,9 @@ const BannerAvatar = ({ discordUser: DiscordUser; dcdnUser: DCDNUser; }): ReactElement => ( -
+
{`${discordUser.username}'s ( -
- {dcdnUser.bio} -
+
{dcdnUser.bio}
); const Badges = ({ dcdnUser }: { dcdnUser: DCDNUser }): ReactElement => ( @@ -149,4 +173,84 @@ const Username = ({
); +const SpotifyActivity = ({ spotify }: { spotify: Spotify }): ReactElement => { + const startTimestamp: number = spotify.timestamps.start; // Example start timestamp + const endTimestamp: number = spotify.timestamps.end; // Example end timestamp + const [songProgress, setSongProgress] = useState(); + const songDuration: string = moment(endTimestamp - startTimestamp).format( + "m:ss" + ); + + // Update the song progress every second + useEffect(() => { + const interval = setInterval(() => { + const songProgress: string = moment( + Date.now() - startTimestamp + ).format("m:ss"); + setSongProgress(songProgress); + }, 1000); + return () => clearInterval(interval); + }, [startTimestamp]); + + return ( +
+
+ {/* Artwork */} + {`Track + + {/* Track Info */} +
+

{spotify.song}

+

{spotify.artist}

+

+ {songProgress} / {songDuration} +

+
+
+ + {/* Spotify Logo */} + Spotify Logo +
+ ); +}; + +const GameActivity = ({ activity }: { activity: Activity }): ReactElement => ( +
+
+ {/* Artwork */} + {`Game + + {/* Activity Info */} +
+

{activity.name}

+

{activity.details}

+

+ {activity.state} +

+
+
+ + {/* Activity Logo */} + +
+); + export default DiscordStatus;