{
+ const user = UserStore.getUser(userId);
+ if (!user) return;
+
+ const guildId = SelectedGuildStore.getGuildId();
+ UserProfileActions.openUserProfileModal({
+ userId,
+ guildId,
+ channelId: SelectedChannelStore.getChannelId(),
+ analyticsLocation: {
+ page: guildId ? "Guild Channel" : "DM Channel",
+ section: "Profile Popout",
+ },
+ tabSection: "SONG_SPOTLIGHT",
+ });
+ }}
+ >
+
+
Song Spotlight
+
+ {previews && data
+ ? previews.map((song, i) => {
+ const render = renders.get(sid(song));
+ const extra = i === shownSongs - 1 && data.length > shownSongs;
+
+ return (
+
+ {render?.thumbnailUrl && (
+

+ )}
+ {extra && (
+
+ +{data.length - shownSongs}
+
+ )}
+
+ );
+ })
+ :
}
+
+
+
+ );
+}
diff --git a/src/equicordplugins/songSpotlight.desktop/ui/songs/ProfileSongs.tsx b/src/equicordplugins/songSpotlight.desktop/ui/songs/ProfileSongs.tsx
index 9bc46c95f..8137349c4 100644
--- a/src/equicordplugins/songSpotlight.desktop/ui/songs/ProfileSongs.tsx
+++ b/src/equicordplugins/songSpotlight.desktop/ui/songs/ProfileSongs.tsx
@@ -7,10 +7,12 @@
import { BaseText } from "@components/BaseText";
import { Flex } from "@components/Flex";
import { LinkIcon, PencilIcon } from "@components/Icons";
+import { Link } from "@components/Link";
import { listData } from "@equicordplugins/songSpotlight.desktop/lib/api";
import { useAuthorizationStore } from "@equicordplugins/songSpotlight.desktop/lib/stores/AuthorizationStore";
import { useSongStore } from "@equicordplugins/songSpotlight.desktop/lib/stores/SongStore";
import { cl } from "@equicordplugins/songSpotlight.desktop/lib/utils";
+import settings from "@equicordplugins/songSpotlight.desktop/settings";
import {
CardClasses,
MoreHorizontalIcon,
@@ -20,40 +22,75 @@ import {
import { openSettingsModal } from "@equicordplugins/songSpotlight.desktop/ui/settings";
import { sid } from "@song-spotlight/api/util";
import { copyWithToast } from "@utils/discord";
-import { classes } from "@utils/misc";
-import { ContextMenuApi, FluxDispatcher, Menu, React, Tooltip, useEffect, UserStore, useState } from "@webpack/common";
+import { classes } from "@utils/index";
+import {
+ ContextMenuApi,
+ FluxDispatcher,
+ Menu,
+ React,
+ Tooltip,
+ useEffect,
+ useMemo,
+ UserStore,
+ useState,
+} from "@webpack/common";
import Song from ".";
+import CollapsedProfileSongs from "./CollapsedProfileSongs";
-interface ProfileSongsProps {
+export interface ProfileSongsProps {
userId: string;
+ isSidebar: boolean;
}
-export default function ProfileSongs({ userId }: ProfileSongsProps) {
+export default function ProfileSongs({ userId, isSidebar }: ProfileSongsProps) {
const [failed, setFailed] = useState(false);
const { isAuthorized } = useAuthorizationStore();
const { users } = useSongStore();
+ const { profileSongsLimit, collapseSongList } = settings.use();
- const data = users[userId]?.data, at = users[userId]?.at;
+ const data = users[userId]?.data;
useEffect(() => {
if (isAuthorized() && !data) listData(userId).catch(() => setFailed(true));
}, [isAuthorized()]);
+ const [clamped, setClamped] = useState(true);
+ const clampedData = useMemo(() => data && (clamped ? data.slice(0, profileSongsLimit) : data), [
+ data,
+ clamped,
+ profileSongsLimit,
+ ]);
+
const owned = UserStore.getCurrentUser().id === userId;
- if (isAuthorized() && !data && !failed) {
+ const pending = isAuthorized() && !clampedData && !data && !failed;
+ if (!pending && !clampedData?.[0]) return null;
+
+ if (collapseSongList) {
+ return (
+