@behindthemusictree/app-kit-ui 31.0.0 → 32.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,9 +17,9 @@ type GenrePlaylistTracksSlots = {
17
17
  };
18
18
 
19
19
  type GenreDetailSlots<O extends CriteriaOverview> = {
20
- /** Replaces the default Summary section. */
20
+ /** Replaces the body of the default Summary section; the title and frame stay. */
21
21
  renderSummary?: (overview: O) => ReactNode;
22
- /** Replaces the default Essential section (e.g. "Essential songs"). */
22
+ /** Replaces the body of the default Essential section (e.g. "Essential songs"); the title and frame stay. */
23
23
  renderEssentialTracks?: (overview: O) => ReactNode;
24
24
  };
25
25
  type GenreDetailExtrasProps<O extends CriteriaOverview> = GenreDetailSlots<O> & GenrePlaylistTracksSlots & {
@@ -15,7 +15,7 @@ import {
15
15
  TrackListSidebar,
16
16
  TrackPositionPlayPause,
17
17
  useGenrePlaylistPlayback
18
- } from "../chunk-AQASG5KT.js";
18
+ } from "../chunk-QGGVPIXY.js";
19
19
  import "../chunk-DKQQLLMY.js";
20
20
  export {
21
21
  GenreDetailPanel,
package/dist/index.cjs CHANGED
@@ -1598,9 +1598,8 @@ function GenrePlaylistTracks({
1598
1598
  getNextPageParam: (lastPage) => lastPage.nextPage ?? void 0,
1599
1599
  enabled: scope !== "me" || sessionRestored && !!session?.accessToken
1600
1600
  });
1601
- const sentinelRef = (0, import_react11.useRef)(null);
1601
+ const [sentinel, setSentinel] = (0, import_react11.useState)(null);
1602
1602
  (0, import_react11.useEffect)(() => {
1603
- const sentinel = sentinelRef.current;
1604
1603
  if (!hasNextPage || isFetchingNextPage || !sentinel) return;
1605
1604
  const observer = new IntersectionObserver((entries) => {
1606
1605
  if (entries.some((entry) => entry.isIntersecting)) {
@@ -1609,7 +1608,7 @@ function GenrePlaylistTracks({
1609
1608
  });
1610
1609
  observer.observe(sentinel);
1611
1610
  return () => observer.disconnect();
1612
- }, [hasNextPage, isFetchingNextPage, fetchNextPage]);
1611
+ }, [hasNextPage, isFetchingNextPage, fetchNextPage, sentinel]);
1613
1612
  const pages = data?.pages ?? [];
1614
1613
  const tracks = pages.flatMap((page) => page.tracks);
1615
1614
  const total = pages[0]?.total ?? void 0;
@@ -1620,11 +1619,7 @@ function GenrePlaylistTracks({
1620
1619
  showPopup(/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(InternalErrorPopup, { errorCode: import_transport7.ErrorCode.CLIENT_UNKNOWN }));
1621
1620
  });
1622
1621
  };
1623
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "gtv-info-panel-children", children: [
1624
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "gtv-info-panel-children-title", children: [
1625
- (0, import_track_noun2.capitalize)(trackNoun.plural),
1626
- total !== void 0 && ` (${total})`
1627
- ] }),
1622
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ui7.PanelSection, { title: `${(0, import_track_noun2.capitalize)(trackNoun.plural)}${total !== void 0 ? ` (${total})` : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
1628
1623
  renderTracksToolbar?.(),
1629
1624
  isPending ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ui7.Skeleton, { className: "h-4 w-3/4", "aria-busy": "true" }) : isError && tracks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("p", { role: "alert", children: [
1630
1625
  "Couldn't load ",
@@ -1687,9 +1682,9 @@ function GenrePlaylistTracks({
1687
1682
  track.uuid
1688
1683
  );
1689
1684
  }),
1690
- hasNextPage && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { ref: sentinelRef, "aria-hidden": "true", className: "h-4" })
1685
+ hasNextPage && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { ref: setSentinel, "aria-hidden": "true", className: "h-4" })
1691
1686
  ] })
1692
- ] });
1687
+ ] }) });
1693
1688
  }
1694
1689
 
1695
1690
  // src/genre-tree/GenreDetailExtras.tsx
@@ -1720,10 +1715,7 @@ function GenreDetailExtras({
1720
1715
  );
1721
1716
  if (isPending) {
1722
1717
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
1723
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "gtv-info-panel-children", "aria-busy": "true", "data-testid": "genre-detail-extras-skeleton", children: [
1724
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "gtv-info-panel-children-title", children: "Summary" }),
1725
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui8.Skeleton, { className: "h-4 w-3/4" })
1726
- ] }),
1718
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui8.PanelSection, { title: "Summary", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "aria-busy": "true", "data-testid": "genre-detail-extras-skeleton", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui8.Skeleton, { className: "h-4 w-3/4" }) }) }),
1727
1719
  family
1728
1720
  ] });
1729
1721
  }
@@ -1731,50 +1723,38 @@ function GenreDetailExtras({
1731
1723
  const { summary, summarySourceUrl, essentialSongs } = overview;
1732
1724
  const wikidataUrl = wikidataId ? `https://www.wikidata.org/wiki/${encodeURIComponent(wikidataId)}` : null;
1733
1725
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
1734
- (summarySourceUrl || wikidataUrl) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "gtv-info-panel-children text-[0.8125rem] leading-[1.45] text-[var(--color-text)]", children: [
1735
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "gtv-info-panel-children-title", children: "Links" }),
1736
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs", children: [
1737
- summarySourceUrl && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1738
- "a",
1739
- {
1740
- href: summarySourceUrl,
1741
- target: "_blank",
1742
- rel: "noopener noreferrer",
1743
- className: "inline-flex items-center gap-1.5 text-[var(--color-text-muted)] hover:text-[var(--color-text)]",
1744
- children: [
1745
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_si2.SiWikipedia, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
1746
- "Wikipedia"
1747
- ]
1748
- }
1749
- ),
1750
- wikidataUrl && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1751
- "a",
1752
- {
1753
- href: wikidataUrl,
1754
- target: "_blank",
1755
- rel: "noopener noreferrer",
1756
- className: "inline-flex items-center gap-1.5 text-[var(--color-text-muted)] hover:text-[var(--color-text)]",
1757
- children: [
1758
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_si2.SiWikidata, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
1759
- "Wikidata"
1760
- ]
1761
- }
1762
- )
1763
- ] })
1764
- ] }),
1765
- renderSummary ? renderSummary(overview) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "gtv-info-panel-children text-[0.8125rem] leading-[1.45] text-[var(--color-text)]", children: [
1766
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "gtv-info-panel-children-title", children: "Summary" }),
1767
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ClampedText, { className: "mt-1", children: summary ?? "\u2014" }, genreUuid)
1768
- ] }),
1726
+ (summarySourceUrl || wikidataUrl) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui8.PanelSection, { title: "Links", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap gap-x-3 gap-y-1 text-xs text-[var(--color-text)]", children: [
1727
+ summarySourceUrl && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1728
+ "a",
1729
+ {
1730
+ href: summarySourceUrl,
1731
+ target: "_blank",
1732
+ rel: "noopener noreferrer",
1733
+ className: "inline-flex items-center gap-1.5 text-[var(--color-text-muted)] hover:text-[var(--color-text)]",
1734
+ children: [
1735
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_si2.SiWikipedia, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
1736
+ "Wikipedia"
1737
+ ]
1738
+ }
1739
+ ),
1740
+ wikidataUrl && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1741
+ "a",
1742
+ {
1743
+ href: wikidataUrl,
1744
+ target: "_blank",
1745
+ rel: "noopener noreferrer",
1746
+ className: "inline-flex items-center gap-1.5 text-[var(--color-text-muted)] hover:text-[var(--color-text)]",
1747
+ children: [
1748
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_si2.SiWikidata, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
1749
+ "Wikidata"
1750
+ ]
1751
+ }
1752
+ )
1753
+ ] }) }),
1754
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui8.PanelSection, { title: "Summary", children: renderSummary ? renderSummary(overview) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ClampedText, { className: "text-[0.8125rem] leading-[1.45] text-[var(--color-text)]", children: summary ?? "\u2014" }, genreUuid) }),
1769
1755
  family,
1770
1756
  renderGenreDetailExtras?.(overview),
1771
- renderEssentialTracks ? renderEssentialTracks(overview) : essentialSongs && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "gtv-info-panel-children text-[0.8125rem] leading-[1.45] text-[var(--color-text)]", children: [
1772
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "gtv-info-panel-children-title", children: [
1773
- "Essential ",
1774
- trackNoun.plural
1775
- ] }),
1776
- essentialSongs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { className: "mt-1 divide-y divide-[var(--color-border)]", children: essentialSongs.map((track) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { className: "py-1", children: track.title }, track.uuid)) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "mt-1", children: "\u2014" })
1777
- ] }),
1757
+ (renderEssentialTracks || essentialSongs) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui8.PanelSection, { title: `Essential ${trackNoun.plural}`, children: renderEssentialTracks ? renderEssentialTracks(overview) : essentialSongs && essentialSongs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { className: "text-[0.8125rem] leading-[1.45] text-[var(--color-text)]", children: essentialSongs.map((track) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { className: "py-1", children: track.title }, track.uuid)) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-[0.8125rem] leading-[1.45] text-[var(--color-text)]", children: "\u2014" }) }),
1778
1758
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1779
1759
  GenrePlaylistTracks,
1780
1760
  {