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

222 lines (221 loc) 6.18 kB
import { jsxs as S, jsx as e } from "react/jsx-runtime"; import b from "../../synapse-queries/entity/useGetQueryResultBundle.js"; import "../../utils/PermissionLevelToAccessType.js"; import { BUNDLE_MASK_QUERY_SELECT_COLUMNS as R, BUNDLE_MASK_QUERY_RESULTS as w } from "../../utils/SynapseConstants.js"; import "react"; import "../../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 { parseEntityIdFromSqlStatement as E } from "../../utils/functions/SqlFunctions.js"; import "../../utils/functions/EntityTypeUtils.js"; import "lodash-es"; import "@sage-bionetworks/synapse-client/util/synapseClientFetch"; import "../../utils/context/SynapseContext.js"; import "use-deep-compare-effect"; import "@tanstack/react-query"; import "@tanstack/query-core"; import "lodash-es/isEmpty"; import "lodash-es/isEqual"; import "lodash-es/xorWith"; import { Box as p, Typography as y, Skeleton as L, Link as N, CardMedia as _ } from "@mui/material"; import "@sage-bionetworks/synapse-client"; import "@sage-bionetworks/synapse-types"; 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 "react-router"; import "../../utils/types/IsType.js"; import { getFieldIndex as g } from "../../utils/functions/queryUtils.js"; import { useImageUrl as A } from "../../utils/hooks/useImageUrlUtils.js"; import B from "../PortalSectionHeader/PortalSectionHeader.js"; const u = 101, f = 156, U = ({ website: t, children: o }) => { const r = { display: "flex", alignItems: "center", justifyContent: "center" }; return t ? /* @__PURE__ */ e( N, { href: t, target: "_blank", sx: { ...r, textDecoration: "none !important" }, children: o } ) : /* @__PURE__ */ e(p, { sx: r, children: o }); }, j = ({ partner: t, imageColIndex: o, organizationNameColIndex: r, websiteColIndex: l, entityId: s, isLoading: m }) => { const i = t.values[o] ?? "", d = t.values[r], c = t.values[l], a = A(i, s); if (!a && !d) return null; if (m) return /* @__PURE__ */ e( L, { variant: "rectangular", height: u, width: f } ); const x = a ? /* @__PURE__ */ e( _, { component: "img", image: a, "aria-hidden": "true", sx: { width: `${f}px`, height: `${u}px`, objectFit: "contain", borderRadius: "10px" } } ) : /* @__PURE__ */ e( p, { sx: { display: "flex", width: "165px", padding: "3px", flexDirection: "column", gap: "10px", border: "2px solid", borderColor: "grey.900", backgroundColor: "#FFF", textAlign: "center" }, children: /* @__PURE__ */ e( p, { sx: { display: "flex", padding: "10px", justifyContent: "center", alignItems: "center", gap: "10px", border: "1px solid", borderColor: "grey.900" }, children: /* @__PURE__ */ e( y, { variant: "headline3", sx: { fontSize: "14px", fontWeight: 400, lineHeight: "130%", color: "grey.900" }, children: d } ) } ) } ); return /* @__PURE__ */ e(U, { website: c, children: x }); }, ge = ({ sql: t, titleText: o = "Our Partners", variation: r = "default", sx: l }) => { const s = E(t), m = { partMask: R | w, concreteType: "org.sagebionetworks.repo.model.table.QueryBundleRequest", entityId: s, query: { sql: t } }, { data: i, isLoading: d } = b(m), c = i?.queryResult.queryResults.rows ?? []; let a; ((n) => { n.CARDLOGO = "cardLogo", n.ORGANIZATION_NAME = "organizationName", n.WEBSITE = "website"; })(a || (a = {})); const x = g( "cardLogo", i ), h = g( "organizationName", i ), I = g( "website", i ); return /* @__PURE__ */ S( p, { sx: { display: "grid", padding: { xs: "40px", lg: "20px 80px" }, gridTemplateColumns: r === "centered" ? { xs: "1fr" } : { xs: "1fr", md: "1fr 3fr" }, gap: "50px", textAlign: r === "centered" ? "center" : "left", ...l }, children: [ r === "default" ? /* @__PURE__ */ e( B, { title: o, sx: { h2: { fontSize: "24px", paddingTop: "26px", width: "100%" } } } ) : /* @__PURE__ */ e( y, { variant: "headline1", sx: { fontSize: "48px", color: "grey.900" }, children: o } ), /* @__PURE__ */ e( p, { sx: (n) => ({ display: "flex", flexWrap: "wrap", gap: "64px", flex: "1 1 0", justifyContent: r === "centered" ? "center" : "flex-start", [n.breakpoints.down("sm")]: { justifyContent: "center" } }), children: c?.map((n, C) => /* @__PURE__ */ e( j, { partner: n, imageColIndex: x, organizationNameColIndex: h, websiteColIndex: I, entityId: s, isLoading: d }, `partner-${C}` )) } ) ] } ); }; export { ge as default }; //# sourceMappingURL=PortalFeaturedPartners.js.map