synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
73 lines (72 loc) • 2.37 kB
JavaScript
import { jsx as o, jsxs as n, Fragment as a } from "react/jsx-runtime";
import { CopyToClipboardIcon as h } from "../../CopyToClipboardIcon.js";
import { CreateOrUpdateDoiModal as u } from "../../doi/CreateOrUpdateDoiModal.js";
import { useGetDOIAssociation as C } from "../../../synapse-queries/doi/useDOI.js";
import { useGetUserPortalPermissions as I } from "../../../synapse-queries/portal/usePortal.js";
import { CreateTwoTone as O } from "@mui/icons-material";
import { Skeleton as g, Box as x, Tooltip as D, IconButton as E } from "@mui/material";
import d from "@mui/material/Link";
import { useState as T } from "react";
function y(c) {
const [m, e] = T(!1), { portalId: r, resourceId: l } = c, { data: s } = I(r, {
select: (f) => f.canMintDoi
}), { data: t, isLoading: p } = C({
id: l,
portalId: r,
type: "PORTAL_RESOURCE"
});
if (p)
return /* @__PURE__ */ o(g, { role: "progressbar", width: 150 });
const i = t ? `https://doi.org/${t.doiUri}` : void 0;
return /* @__PURE__ */ n(a, { children: [
/* @__PURE__ */ o(
u,
{
open: m,
onClose: () => e(!1),
objectType: "PORTAL_RESOURCE",
objectId: l,
portalId: r
}
),
/* @__PURE__ */ n(
x,
{
sx: {
display: "flex",
alignItems: "center",
gap: 0.5,
// set height to 0 to prevent expanding the table row
height: 0
},
children: [
t && /* @__PURE__ */ n(a, { children: [
/* @__PURE__ */ o(d, { href: i, target: "_blank", children: i }),
/* @__PURE__ */ o(
h,
{
size: "small",
value: i || "",
sx: { color: "inherit" }
}
),
s && /* @__PURE__ */ o(D, { title: "Edit DOI", children: /* @__PURE__ */ o(
E,
{
onClick: () => e(!0),
size: "small",
sx: { color: "inherit" },
children: /* @__PURE__ */ o(O, { fontSize: "inherit" })
}
) })
] }),
!t && s && /* @__PURE__ */ o(d, { role: "button", onClick: () => e(!0), children: "Click to Create a DOI" })
]
}
)
] });
}
export {
y as default
};
//# sourceMappingURL=PortalDOI.js.map