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