synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
335 lines (334 loc) • 10.6 kB
JavaScript
import { jsxs as l, jsx as o } from "react/jsx-runtime";
import N from "../../assets/icons/SynapseFullLogo.js";
import "../../utils/PermissionLevelToAccessType.js";
import "../../utils/SynapseConstants.js";
import { useState as d } from "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 "@sage-bionetworks/synapse-types";
import "../../utils/functions/EntityTypeUtils.js";
import "lodash-es";
import "@sage-bionetworks/synapse-client/util/synapseClientFetch";
import { useOneSageURL as C } from "../../utils/hooks/useOneSageURL.js";
import "use-deep-compare-effect";
import { useSynapseContext as P } from "../../utils/context/SynapseContext.js";
import "@tanstack/react-query";
import "@tanstack/query-core";
import "lodash-es/isEmpty";
import "lodash-es/isEqual";
import "lodash-es/xorWith";
import { useTheme as T, useMediaQuery as z, Box as m, Button as t, IconButton as k, Divider as H, styled as M, Menu as O, MenuItem as _ } from "@mui/material";
import "@sage-bionetworks/synapse-client";
import "../../utils/types/IsType.js";
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 { MenuOutlined as j, Close as D } from "@mui/icons-material";
import { SageResourcesPopover as b } from "../SageResourcesPopover/SageResourcesPopover.js";
const W = "/LoginPlace:0", G = "/Home:x", w = "/Plans:0", v = "/Profile:v/projects/all", a = {
fontSize: "18px",
lineHeight: "24px",
fontWeight: 400
}, h = {
borderRadius: "0",
p: {
xs: "7px 10px",
sm: "7px 30px"
}
}, K = M(O)(() => ({
"& .MuiPaper-root": {
width: "100vw",
height: "100vh",
maxWidth: "100vw",
maxHeight: "100vh",
margin: 0,
top: "0 !important",
left: "0 !important",
transform: "none"
}
})), r = M(_)(() => ({
fontSize: "36px",
fontWeight: 200,
lineHeight: "32px",
height: "80px",
paddingLeft: "30px"
}));
function Mo({
gotoPlace: i
}) {
const { isAuthenticated: s } = P(), u = C("/register1"), x = T(), g = z(x.breakpoints.down("md")), L = C("/sageresources"), [y, S] = d(null), A = (n) => {
S(n.currentTarget);
}, e = () => {
S(null);
}, [R, c] = d(null), I = () => {
c(null);
}, [B, p] = d(null), E = () => {
p(null);
}, f = () => {
i(W);
};
return /* @__PURE__ */ l(
m,
{
sx: {
display: "flex",
justifyContent: "space-between",
alignItems: "center",
columnGap: "5px",
p: {
xs: "10px 5px",
sm: "20px 15px"
}
},
children: [
/* @__PURE__ */ o("a", { onClick: () => i(G), children: /* @__PURE__ */ o(
N,
{
color: x.palette.primary[900]
}
) }),
!g && /* @__PURE__ */ l(
m,
{
sx: {
display: "flex",
justifyContent: "flex-end",
alignItems: "center",
gap: "20px"
},
children: [
/* @__PURE__ */ o(t, { sx: a, onClick: () => i(w), children: "Plans" }),
/* @__PURE__ */ o(
t,
{
sx: a,
onClick: (n) => c(n.currentTarget),
children: "Portals"
}
),
/* @__PURE__ */ o(
t,
{
sx: a,
onClick: (n) => p(n.currentTarget),
children: "Applications"
}
),
/* @__PURE__ */ o(
t,
{
sx: { ...a, mr: "15px" },
href: "https://sagebionetworks.org/",
target: "_blank",
children: "Sage Bionetworks"
}
),
!s && /* @__PURE__ */ o(
t,
{
size: "large",
variant: "outlined",
color: "secondary",
sx: h,
onClick: f,
children: "Login"
}
),
!s && /* @__PURE__ */ o(
t,
{
size: "large",
variant: "contained",
color: "secondary",
sx: h,
href: u.toString(),
children: "Register Now"
}
),
s && /* @__PURE__ */ o(
t,
{
size: "large",
variant: "outlined",
color: "secondary",
sx: h,
onClick: () => {
i(v);
},
children: "View Dashboard"
}
)
]
}
),
/* @__PURE__ */ o(
b,
{
anchorEl: R,
onClose: I,
filterByType: "SynapsePortal",
allResourcesUrl: L.toString()
}
),
/* @__PURE__ */ o(
b,
{
anchorEl: B,
onClose: E,
filterByType: "SageSolution",
resourceName: "Applications",
description: "Innovative tools in the Synapse ecosystem promoting crowd-sourced data science competitions, translational research, and more"
}
),
g && /* @__PURE__ */ l(
m,
{
sx: {
display: "flex",
justifyContent: "flex-end",
columnGap: "10px"
},
children: [
/* @__PURE__ */ o(
k,
{
color: "secondary",
sx: {
borderWidth: 1,
borderStyle: "solid",
borderRadius: "0",
ml: "70px"
},
onClick: A,
children: /* @__PURE__ */ o(j, {})
}
),
/* @__PURE__ */ l(
K,
{
anchorEl: y,
anchorOrigin: {
vertical: "top",
horizontal: "right"
},
keepMounted: !0,
transformOrigin: {
vertical: "top",
horizontal: "right"
},
open: !!y,
onClose: e,
MenuListProps: {
style: {
width: "100%",
height: "100%"
}
},
children: [
/* @__PURE__ */ o(
k,
{
onClick: e,
sx: {
position: "absolute",
top: 5,
right: 5,
zIndex: 1,
color: "secondary.main",
borderWidth: 1,
borderStyle: "solid",
borderRadius: "0"
},
children: /* @__PURE__ */ o(D, {})
}
),
/* @__PURE__ */ o(
r,
{
sx: { mt: "70px" },
onClick: () => {
i(w), e();
},
children: "Plans"
}
),
/* @__PURE__ */ o(
r,
{
onClick: (n) => {
c(n.currentTarget), e();
},
children: "Portals"
}
),
/* @__PURE__ */ o(
r,
{
onClick: (n) => {
p(n.currentTarget), e();
},
children: "Applications"
}
),
/* @__PURE__ */ o(
r,
{
onClick: () => {
window.open("https://sagebionetworks.org/", "_blank"), e();
},
children: "Sage Bionetworks"
}
),
/* @__PURE__ */ o(H, { sx: { pt: "100px" } }),
!s && /* @__PURE__ */ o(
r,
{
sx: { mt: "30px", color: "secondary.main" },
onClick: () => {
window.open(u.toString(), "_blank"), e();
},
children: "Register Now"
}
),
!s && /* @__PURE__ */ o(
r,
{
sx: { mb: "40px" },
onClick: () => {
e(), f();
},
children: "Log In"
}
),
s && /* @__PURE__ */ o(
r,
{
sx: { mb: "40px", color: "secondary.main" },
onClick: () => {
e(), i(v);
},
children: "View Dashboard"
}
)
]
}
)
]
}
)
]
}
);
}
export {
w as PLANS_LINK,
Mo as SynapseHomepageNavBar
};
//# sourceMappingURL=SynapseHomepageNavBar.js.map