diff --git a/web/src/app/discover/discover-client.tsx b/web/src/app/discover/discover-client.tsx index cc7886b..cbc2dcc 100644 --- a/web/src/app/discover/discover-client.tsx +++ b/web/src/app/discover/discover-client.tsx @@ -15,11 +15,22 @@ type Suggestion = { artistName: string; rgMbid: string | null; album: string | null; + primaryType: string | null; + secondaryTypes: string[]; score: number; seedCount: number; sources: string[]; }; +type Tab = "Artists" | "Albums"; + +/** Only full-length albums belong in Suggested albums — hide singles/EPs and + * secondary-type releases (live/comp). New sweeps already filter server-side + * (discover.albumsOnly); this also sweeps any pre-filter rows still in the DB. */ +function isFullAlbum(s: Suggestion): boolean { + return (s.primaryType ?? "Album") === "Album" && (s.secondaryTypes?.length ?? 0) === 0; +} + /** "just now" / "3h ago" / "2d ago" — timeAgo has no suffix, so add one (except "just now"). */ function agoLabel(value: string): string { const a = timeAgo(value, Date.now()); @@ -43,6 +54,9 @@ export function DiscoverClient() { const [followedSimilar, setFollowedSimilar] = useState>(new Set()); const [artistModal, setArtistModal] = useState<{ mbid: string; name: string } | null>(null); const [albumModal, setAlbumModal] = useState(null); + const [tab, setTab] = useState("Artists"); + + const albums = feed.albums.filter(isFullAlbum); const loadFeed = useCallback(async () => { setFeed(await (await fetch("/api/discover")).json()); @@ -172,8 +186,19 @@ export function DiscoverClient() { ) : null} - - {feed.artists.length === 0 ? ( +
+ + +
+ + {tab === "Artists" ? ( + feed.artists.length === 0 ? (

No suggestions yet — run Discover, or follow a few artists to seed it.

) : (
    @@ -204,14 +229,12 @@ export function DiscoverClient() { ))}
- )} - - - {feed.albums.length === 0 ? ( + ) + ) : albums.length === 0 ? (

No album suggestions yet.

) : (
    - {feed.albums.map((s) => ( + {albums.map((s) => (