diff --git a/src/app/(pages)/page.tsx b/src/app/(pages)/page.tsx index 4596037..5da5026 100644 --- a/src/app/(pages)/page.tsx +++ b/src/app/(pages)/page.tsx @@ -3,7 +3,6 @@ import Navbar from "@/components/landing/navbar"; import { ReactElement } from "react"; import Navigation from "@/components/landing/navigation"; import BlurFade from "@/components/ui/blur-fade"; -import DiscordStatus from "@/components/landing/discord-status"; const LandingPage = (): ReactElement => (
@@ -19,9 +18,6 @@ const LandingPage = (): ReactElement => ( - - -
); diff --git a/src/components/landing/discord-status.tsx b/src/components/landing/discord-status.tsx index 1e89592..1f98dfd 100644 --- a/src/components/landing/discord-status.tsx +++ b/src/components/landing/discord-status.tsx @@ -11,9 +11,10 @@ import { import DCDNUser from "@/types/dcdn"; import axios from "axios"; import Image from "next/image"; -import { cn } from "@/lib/utils"; +import { cn, truncateText } from "@/lib/utils"; import moment from "moment"; import { PuzzlePieceIcon } from "@heroicons/react/24/outline"; +import SimpleTooltip from "@/components/ui/simple-tooltip"; const statusColors = { online: "bg-green-500", @@ -25,15 +26,26 @@ const statusColors = { const userBadges = { // Nitro "https://cdn.discordapp.com/badge-icons/2ba85e8026a8614b640c2837bcdfe21b.png": - (dcdnUser: DCDNUser) => dcdnUser.premiumType, + { + name: "Nitro Subscriber", + predicate: (dcdnUser: DCDNUser) => dcdnUser.premiumType, + }, // Early Supporter "https://cdn.discordapp.com/badge-icons/7060786766c9c840eb3019e725d2b358.png": - (dcdnUser: DCDNUser) => (dcdnUser.flags & (1 << 9)) === 1 << 9, + { + name: "Early Supporter", + predicate: (dcdnUser: DCDNUser) => + (dcdnUser.flags & (1 << 9)) === 1 << 9, + }, // Active Developer "https://cdn.discordapp.com/badge-icons/6bdc42827a38498929a4920da12695d9.png": - (dcdnUser: DCDNUser) => (dcdnUser.flags & (1 << 22)) === 1 << 22, + { + name: "Active Developer", + predicate: (dcdnUser: DCDNUser) => + (dcdnUser.flags & (1 << 22)) === 1 << 22, + }, }; const DiscordStatus = (): ReactElement | undefined => { @@ -141,21 +153,24 @@ const BannerAvatar = ({ ); const Bio = ({ dcdnUser }: { dcdnUser: DCDNUser }): ReactElement => ( -
{dcdnUser.bio}
+
+ {truncateText(dcdnUser.bio, 15)} +
); const Badges = ({ dcdnUser }: { dcdnUser: DCDNUser }): ReactElement => (
{Object.entries(userBadges) - .filter(([_, predicate]) => predicate(dcdnUser)) - .map(([badge], index) => ( - Discord Profile Badge + .filter(([_, badge]) => badge.predicate(dcdnUser)) + .map(([badgeIcon, badge], index) => ( + + Discord Profile Badge + ))}
); @@ -177,17 +192,16 @@ 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" - ); + const songDuration: number = endTimestamp - startTimestamp; // Update the song progress every second useEffect(() => { const interval = setInterval(() => { - const songProgress: string = moment( - Date.now() - startTimestamp - ).format("m:ss"); - setSongProgress(songProgress); + const songProgress = Date.now() - startTimestamp; + if (songProgress > songDuration) { + return; + } + setSongProgress(moment(songProgress).format("m:ss")); }, 1000); return () => clearInterval(interval); }, [startTimestamp]); @@ -206,10 +220,14 @@ const SpotifyActivity = ({ spotify }: { spotify: Spotify }): ReactElement => { {/* Track Info */}
-

{spotify.song}

-

{spotify.artist}

+

+ {truncateText(spotify.song, 24)} +

+

+ {truncateText(spotify.artist.replace(";", ","), 26)} +

- {songProgress} / {songDuration} + {songProgress} / {moment(songDuration).format("m:ss")}

diff --git a/src/components/landing/nav-content/my-work.tsx b/src/components/landing/nav-content/my-work.tsx index 7aa98e1..0082278 100644 --- a/src/components/landing/nav-content/my-work.tsx +++ b/src/components/landing/nav-content/my-work.tsx @@ -9,6 +9,7 @@ import { ReactElement } from "react"; import Project from "@/types/project"; import { ScrollArea } from "@/components/ui/scroll-area"; import Image from "next/image"; +import { truncateText } from "@/lib/utils"; const projects: Project[] = [ { @@ -111,8 +112,8 @@ const MyWork = (): ReactElement => { {/* Description */} -

- {project.description} +

+ {truncateText(project.description, 136)}

diff --git a/src/components/landing/navbar.tsx b/src/components/landing/navbar.tsx index 4fff87a..c293a96 100644 --- a/src/components/landing/navbar.tsx +++ b/src/components/landing/navbar.tsx @@ -23,7 +23,7 @@ import BlurFade from "@/components/ui/blur-fade"; const Navbar = (): ReactElement => ( -