From 19147516493b3f725d7c6b61762b97a52157d92c Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Wed, 4 Sep 2024 15:50:20 -0400 Subject: [PATCH] Add more tooltips to the Spotify activity card --- src/components/landing/discord-status.tsx | 43 +++++++++++++---------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/components/landing/discord-status.tsx b/src/components/landing/discord-status.tsx index e35a47a..4fd972e 100644 --- a/src/components/landing/discord-status.tsx +++ b/src/components/landing/discord-status.tsx @@ -88,7 +88,7 @@ const DiscordStatus = (): ReactElement | undefined => {
- {dcdnUser.bio && } + {dcdnUser.bio && }
@@ -153,10 +153,12 @@ const BannerAvatar = ({
); -const Bio = ({ dcdnUser }: { dcdnUser: DCDNUser }): ReactElement => ( -
- {truncateText(dcdnUser.bio, 15)} -
+const Bio = ({ bio }: { bio: string }): ReactElement => ( + +
+ {truncateText(bio, 15)} +
+
); const Badges = ({ dcdnUser }: { dcdnUser: DCDNUser }): ReactElement => ( @@ -192,19 +194,20 @@ const Username = ({ const SpotifyActivity = ({ spotify }: { spotify: Spotify }): ReactElement => { const trackUrl: string = `https://open.spotify.com/track/${spotify.track_id}`; + const trackArtist: string = spotify.artist.replace(";", ","); const startTimestamp: number = spotify.timestamps.start; const endTimestamp: number = spotify.timestamps.end; - const [songProgress, setSongProgress] = useState(); - const songDuration: number = endTimestamp - startTimestamp; + const [trackProgress, setTrackProgress] = useState(); + const trackDuration: number = endTimestamp - startTimestamp; - // Update the song progress every second + // Update the track progress every second useEffect(() => { const interval = setInterval(() => { - const songProgress = Date.now() - startTimestamp; - if (songProgress > songDuration) { + const trackProgress = Date.now() - startTimestamp; + if (trackProgress > trackDuration) { return; } - setSongProgress(moment(songProgress).format("m:ss")); + setTrackProgress(moment(trackProgress).format("m:ss")); }, 1000); return () => clearInterval(interval); }, [startTimestamp]); @@ -226,15 +229,19 @@ const SpotifyActivity = ({ spotify }: { spotify: Spotify }): ReactElement => { {/* Track Info */}
-

- {truncateText(spotify.song, 22)} -

-

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

+ +

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

+
+ +

+ {truncateText(trackArtist, 26)} +

+

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