diff --git a/CHANGELOG.md b/CHANGELOG.md index e8e36eb..b9c22f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,8 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). removed along with its export from `@behindthemusictree/app-kit`. - **genre-tree**: `CriteriaDetailed` now includes `summary` (nullable string), matching the backend's detail genre response, and `GenreTreeView`'s `renderExtraDetails` now displays it - above the essential tracks list when present. + as a labeled "Summary" field above the essential tracks list, showing "—" when there is no + value, consistent with the always-visible core fields. ### Fixed diff --git a/packages/app-kit/src/genre-tree/GenreTreeView.test.tsx b/packages/app-kit/src/genre-tree/GenreTreeView.test.tsx index 86bce48..47502d5 100644 --- a/packages/app-kit/src/genre-tree/GenreTreeView.test.tsx +++ b/packages/app-kit/src/genre-tree/GenreTreeView.test.tsx @@ -839,7 +839,7 @@ describe("GenreTreeView", () => { expect(output).toBeNull(); }); - it("returns null when there is no summary, no essential tracks, and nothing archived", () => { + it("renders a blank summary placeholder when there is no summary, no essential tracks, and nothing archived", () => { useListFullGenrePlaylistsMock.mockReturnValue({ data: { results: [makePlaylist({ uuid: "gp1", criteria: { uuid: "c1", name: "Jazz" } })] }, isPending: false, @@ -867,8 +867,10 @@ describe("GenreTreeView", () => { const output = treeWheelPropsMock.mock.calls.at(-1)?.[0].renderExtraDetails({ id: "gp1", }); + render(<>{output}); - expect(output).toBeNull(); + expect(screen.getByText("Summary")).toBeInTheDocument(); + expect(screen.getByText("—")).toBeInTheDocument(); }); }); }); diff --git a/packages/app-kit/src/genre-tree/GenreTreeView.tsx b/packages/app-kit/src/genre-tree/GenreTreeView.tsx index 2017aaf..a029921 100644 --- a/packages/app-kit/src/genre-tree/GenreTreeView.tsx +++ b/packages/app-kit/src/genre-tree/GenreTreeView.tsx @@ -108,22 +108,26 @@ export function GenreTreeView({ } const { summary, essentialTracks, tracksArchivedCount } = selectedGenreDetail; - if (!summary && essentialTracks.length === 0 && tracksArchivedCount === 0) { - return null; - } return ( -
- {summary &&

{summary}

} + <> +
+ Summary +

{summary ?? "—"}

+
{tracksArchivedCount > 0 && ( -
- Archived tracks: - {tracksArchivedCount} +
+ + Archived tracks + +

{tracksArchivedCount}

)} {essentialTracks.length > 0 && ( -
-
Essential tracks
+
+ + Essential tracks +
    {essentialTracks.map((track) => (
  • {track.title}
  • @@ -131,7 +135,7 @@ export function GenreTreeView({
)} -
+ ); }, [