UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

58 lines (57 loc) 2.07 kB
import { jsx as o, Fragment as l, jsxs as f } from "react/jsx-runtime"; import { useGetDownloadListStatistics as u } from "../../synapse-queries/download/useDownloadList.js"; import { useSynapseContext as h } from "../../utils/context/SynapseContext.js"; import { Link as w, Tooltip as k } from "@mui/material"; import { Suspense as S, useEffect as E } from "react"; import { ErrorBoundary as L, useErrorHandler as x } from "react-error-boundary"; import { Link as y } from "react-router"; import D from "../IconSvg/IconSvg.js"; import { TOOLTIP_DELAY_SHOW as b } from "../SynapseTable/SynapseTableConstants.js"; import { SkeletonInlineBlock as C } from "../Skeleton/SkeletonInlineBlock.js"; import "@mui/material/Skeleton"; import "lodash-es"; import { EmptyFallbackComponent as N } from "../error/ErrorBanner.js"; function F({ to: r, className: s = "" }) { const { isAuthenticated: t } = h(), e = x(), m = "Click to view items in your download list.", { data: c, isLoading: p, isError: i, error: n } = u(); if (E(() => { i && n && t && e(n); }, [i, n, e, t]), !t || p) return /* @__PURE__ */ o(l, {}); const a = c?.totalNumberOfFiles ?? 0; if (a === 0) return /* @__PURE__ */ o(l, {}); const d = /* @__PURE__ */ o( k, { title: m, placement: "bottom", enterNextDelay: b, children: /* @__PURE__ */ f("span", { children: [ /* @__PURE__ */ o("span", { className: "SRC-primary-text-color", children: /* @__PURE__ */ o(D, { icon: "download" }) }), /* @__PURE__ */ o("span", { className: "download-cart-size", children: a }) ] }) } ); return /* @__PURE__ */ o( w, { to: r, component: y, className: `Download-Link v2 ${s}`, children: d } ); } function G(r) { return /* @__PURE__ */ o(L, { FallbackComponent: N, children: /* @__PURE__ */ o(S, { fallback: /* @__PURE__ */ o(C, { width: 100 }), children: /* @__PURE__ */ o(F, { ...r }) }) }); } export { G as ShowDownloadV2, G as default }; //# sourceMappingURL=ShowDownloadV2.js.map