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

183 lines (182 loc) 6.03 kB
import { jsx as t, Fragment as d, jsxs as i } from "react/jsx-runtime"; import { SYNAPSE_STORAGE_LOCATION_ID as S } from "../../synapse-client/SynapseClient.js"; import "@sage-bionetworks/synapse-client/generated/models/ErrorResponseCode"; import "@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse"; import "@sage-bionetworks/synapse-client/util/SynapseClientError"; import "@sage-bionetworks/synapse-types"; import "../../utils/functions/EntityTypeUtils.js"; import { SAGE_OFFERINGS_HELP_URL as w } from "../../utils/SynapseConstants.js"; import "lodash-es"; import "@sage-bionetworks/synapse-client/util/synapseClientFetch"; import "@tanstack/react-query"; import "../../utils/PermissionLevelToAccessType.js"; import "react"; import { useSynapseContext as F } from "../../utils/context/SynapseContext.js"; import "use-deep-compare-effect"; import { Box as o, Typography as a, Tooltip as A } from "@mui/material"; import "../../utils/hooks/useCookiePreferences.js"; import "../../utils/hooks/useSourceAppConfigs.js"; import "universal-cookie"; import "../../utils/AppUtils/session/ApplicationSessionContext.js"; import "../../utils/context/FullContextProvider.js"; import "../../utils/context/DocumentMetadataContext.js"; import '../../style/components/_spinner.css';/* empty css */ import "@tanstack/query-core"; import "lodash-es/isEmpty"; import "lodash-es/isEqual"; import "lodash-es/xorWith"; import "react-router"; import "@sage-bionetworks/synapse-client"; import "../../utils/types/IsType.js"; import { useProjectStorageUsage as B } from "../../synapse-queries/entity/useProjectStorage.js"; import { spreadSx as D } from "../../theme/spreadSx.js"; import { calculateFriendlyFileSize as c } from "../../utils/functions/calculateFriendlyFileSize.js"; import { HelpPopover as P } from "../HelpPopover/HelpPopover.js"; const n = 142; function nt({ projectId: l, sx: x }) { const { isAuthenticated: f } = F(), { data: h } = B(l, { enabled: !!l && f }), p = h?.locations.filter( (y) => y.storageLocationId == S ), r = p?.length == 1 ? p[0] : void 0; if (!r) return /* @__PURE__ */ t(d, {}); const { sumFileBytes: s = 0, maxAllowedFileBytes: e = 0 } = r; if (e == 0) return /* @__PURE__ */ t(d, {}); const u = Math.min( Math.round(s / e * n), n ), g = c(s, 1), m = c( e, 1 ).replace(/\.0\s/, " "); return /* @__PURE__ */ i( o, { sx: D( { display: "flex", flexDirection: "column", width: "210px", fontFamily: "DM Sans", color: "white", px: "10px" }, x ), children: [ /* @__PURE__ */ i( o, { sx: { display: "flex", flexDirection: "row", gap: "5px" }, children: [ /* @__PURE__ */ i( a, { sx: { // match current styles in Project metadata fontWeight: 700, fontSize: "16px" }, children: [ "Data Availability", " " ] } ), " ", /* @__PURE__ */ t( P, { containerSx: { fontSize: "12px" }, markdownText: `Hosting Plan Options: - Basic Plan: Free, for sharing small datasets (<100GB) with self-service setup. No direct support. - Self-Managed Plan: Ideal for data longevity, FAIR principles, and NIH compliance. Includes consultation services and data access management tools. - Data Coordination Plan: For large, multi-institutional projects, with personalized consulting, data curation, and a custom data portal.`, helpUrl: w } ) ] } ), r.maxAllowedFileBytes && /* @__PURE__ */ t( A, { title: `Using ${g} out of ${m}`, children: /* @__PURE__ */ i( o, { sx: { display: "flex", flexDirection: "row", gap: "5px", alignItems: "center" }, children: [ /* @__PURE__ */ t( a, { variant: "body1", sx: { fontSize: "12px" }, children: "0" } ), /* @__PURE__ */ t( o, { sx: { width: `${n}px`, height: "4px", backgroundColor: "white", borderRadius: "50px" }, children: /* @__PURE__ */ t( o, { sx: { width: `${u}px`, height: "4px", backgroundColor: "#EDC766", borderRadius: "50px" } } ) } ), /* @__PURE__ */ t( a, { variant: "body1", sx: { fontSize: "12px", whiteSpace: "nowrap" }, children: m } ) ] } ) } ) ] } ); } export { nt as ProjectDataAvailability, nt as default }; //# sourceMappingURL=ProjectDataAvailability.js.map