@fluid-app/portal-sdk 0.1.227 → 0.1.228
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.
- package/dist/{ShareablesScreen-AMlPuFFk.cjs → ShareablesScreen-D6zYE_qj.cjs} +38 -18
- package/dist/ShareablesScreen-D6zYE_qj.cjs.map +1 -0
- package/dist/{ShareablesScreen-CNARhXTE.mjs → ShareablesScreen-DaOvfu8L.mjs} +38 -18
- package/dist/ShareablesScreen-DaOvfu8L.mjs.map +1 -0
- package/dist/{ShareablesScreen-DyGQ-Yo_.cjs → ShareablesScreen-ujMMFRgM.cjs} +1 -1
- package/dist/index.cjs +16 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +16 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/dist/ShareablesScreen-AMlPuFFk.cjs.map +0 -1
- package/dist/ShareablesScreen-CNARhXTE.mjs.map +0 -1
|
@@ -1617,6 +1617,37 @@ function ProductDetailScreen({ productId, countryCode, fetchProduct: fetchPortal
|
|
|
1617
1617
|
});
|
|
1618
1618
|
}
|
|
1619
1619
|
//#endregion
|
|
1620
|
+
//#region ../../shareables/ui/src/hooks/use-infinite-list-sentinel.ts
|
|
1621
|
+
/**
|
|
1622
|
+
* Wires a sentinel `<div>` to TanStack Query infinite-pagination state.
|
|
1623
|
+
*
|
|
1624
|
+
* Returns a ref the caller attaches to a 1px sentinel element rendered below
|
|
1625
|
+
* the list. When the sentinel scrolls into view (with a 200px root margin)
|
|
1626
|
+
* and the query has a next page, isn't already fetching, and hasn't errored,
|
|
1627
|
+
* `fetchNextPage()` is invoked.
|
|
1628
|
+
*/
|
|
1629
|
+
function useInfiniteListSentinel({ hasNextPage, isFetchingNextPage, fetchNextPage, error }) {
|
|
1630
|
+
const sentinelRef = (0, react.useRef)(null);
|
|
1631
|
+
(0, react.useEffect)(() => {
|
|
1632
|
+
const target = sentinelRef.current;
|
|
1633
|
+
if (!target) return;
|
|
1634
|
+
const observer = new IntersectionObserver((entries) => {
|
|
1635
|
+
if (entries[0]?.isIntersecting && hasNextPage && !isFetchingNextPage && !error) fetchNextPage();
|
|
1636
|
+
}, {
|
|
1637
|
+
threshold: 0,
|
|
1638
|
+
rootMargin: "200px"
|
|
1639
|
+
});
|
|
1640
|
+
observer.observe(target);
|
|
1641
|
+
return () => observer.disconnect();
|
|
1642
|
+
}, [
|
|
1643
|
+
fetchNextPage,
|
|
1644
|
+
hasNextPage,
|
|
1645
|
+
isFetchingNextPage,
|
|
1646
|
+
error
|
|
1647
|
+
]);
|
|
1648
|
+
return sentinelRef;
|
|
1649
|
+
}
|
|
1650
|
+
//#endregion
|
|
1620
1651
|
//#region ../../shareables/ui/src/components/OwnerFilterTabs.tsx
|
|
1621
1652
|
function getFilteredEmptyMessage({ searchTerm, ownerFilter, hasOtherFilters = false, entityName = "items", defaultMessage = "Nothing available at the moment." }) {
|
|
1622
1653
|
const isFiltered = ownerFilter !== "all" || hasOtherFilters;
|
|
@@ -1711,7 +1742,6 @@ function MediaListingScreen(_props) {
|
|
|
1711
1742
|
}, 300);
|
|
1712
1743
|
return () => clearTimeout(timer);
|
|
1713
1744
|
}, [searchTerm]);
|
|
1714
|
-
const observerTarget = (0, react.useRef)(null);
|
|
1715
1745
|
const { mutate: deleteMedia, isPending: isDeleting } = (0, _tanstack_react_query.useMutation)({
|
|
1716
1746
|
mutationFn: (id) => api.media.deleteMedia(id),
|
|
1717
1747
|
onSuccess: () => {
|
|
@@ -1757,22 +1787,12 @@ function MediaListingScreen(_props) {
|
|
|
1757
1787
|
});
|
|
1758
1788
|
const allItems = (0, react.useMemo)(() => data?.pages.flatMap((p) => p.media) ?? [], [data?.pages]);
|
|
1759
1789
|
const filteredItems = ownerFilter === "all" ? allItems : ownerFilter === "my" ? allItems.filter((item) => item.owner_type === "user") : allItems.filter((item) => item.owner_type === "company");
|
|
1760
|
-
|
|
1761
|
-
const target = observerTarget.current;
|
|
1762
|
-
if (!target) return;
|
|
1763
|
-
const observer = new IntersectionObserver((entries) => {
|
|
1764
|
-
if (entries[0]?.isIntersecting && hasNextPage && !isFetchingNextPage) fetchNextPage();
|
|
1765
|
-
}, {
|
|
1766
|
-
threshold: 0,
|
|
1767
|
-
rootMargin: "200px"
|
|
1768
|
-
});
|
|
1769
|
-
observer.observe(target);
|
|
1770
|
-
return () => observer.disconnect();
|
|
1771
|
-
}, [
|
|
1772
|
-
fetchNextPage,
|
|
1790
|
+
const sentinelRef = useInfiniteListSentinel({
|
|
1773
1791
|
hasNextPage,
|
|
1774
|
-
isFetchingNextPage
|
|
1775
|
-
|
|
1792
|
+
isFetchingNextPage,
|
|
1793
|
+
fetchNextPage,
|
|
1794
|
+
error
|
|
1795
|
+
});
|
|
1776
1796
|
const filterBar = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1777
1797
|
className: "flex items-center gap-3",
|
|
1778
1798
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OwnerFilterTabs, {
|
|
@@ -1869,7 +1889,7 @@ function MediaListingScreen(_props) {
|
|
|
1869
1889
|
}),
|
|
1870
1890
|
filters: filterBar,
|
|
1871
1891
|
footer,
|
|
1872
|
-
sentinelRef
|
|
1892
|
+
sentinelRef,
|
|
1873
1893
|
loadingFilterShape: "search-view",
|
|
1874
1894
|
children: viewMode === "grid" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1875
1895
|
className: SHAREABLE_GRID_CLASS,
|
|
@@ -12511,4 +12531,4 @@ Object.defineProperty(exports, "shareablesScreenPropertySchema", {
|
|
|
12511
12531
|
}
|
|
12512
12532
|
});
|
|
12513
12533
|
|
|
12514
|
-
//# sourceMappingURL=ShareablesScreen-
|
|
12534
|
+
//# sourceMappingURL=ShareablesScreen-D6zYE_qj.cjs.map
|