synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
46 lines (45 loc) • 1.57 kB
JavaScript
import { jsxs as m, Fragment as p, jsx as e } from "react/jsx-runtime";
import { useGetUserProjectsInfinite as j } from "../../synapse-queries/user/useGetUserProjects.js";
import { PRODUCTION_ENDPOINT_CONFIG as N } from "../../utils/functions/getEndpoint.js";
import { useEffect as u } from "react";
import { useErrorHandler as w } from "react-error-boundary";
import { useInView as x } from "react-intersection-observer";
import { SkeletonTable as I } from "../Skeleton/SkeletonTable.js";
function $({ userId: d }) {
const i = w(), { ref: h, inView: a } = x(), g = {}, {
data: P,
status: f,
isFetching: t,
isLoading: E,
hasNextPage: l,
fetchNextPage: s,
isError: c,
error: o
} = j(d, g);
u(() => {
c && o && i(o);
}, [c, o, i]), u(() => {
f === "success" && !t && l && s && a && s();
}, [f, t, l, s, a]);
const n = P?.pages.flatMap((r) => r.results) ?? [];
return /* @__PURE__ */ m(p, { children: [
n.length > 0 && /* @__PURE__ */ m(p, { children: [
n.map((r) => r ? /* @__PURE__ */ e("p", { children: /* @__PURE__ */ e(
"a",
{
target: "_self",
rel: "noopener noreferrer",
href: `${N.PORTAL}Synapse:${r.id}`,
children: r.name
}
) }, `user-project-list-item-${r.id}`) : !1),
/* @__PURE__ */ e("div", { ref: h })
] }),
!t && n.length == 0 && /* @__PURE__ */ e("div", { children: "Empty" }),
E && /* @__PURE__ */ e(I, { numRows: 5, numCols: 1 })
] });
}
export {
$ as default
};
//# sourceMappingURL=UserProjects.js.map