synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
105 lines (104 loc) • 3.63 kB
JavaScript
import { jsxs as s, jsx as a } from "react/jsx-runtime";
import { getValueOrMultiValue as r } from "../GenericCard/CardUtils.js";
import g from "./utils/ChipContainer.js";
import { calculateFriendlyFileSize as k } from "../../utils/functions/calculateFriendlyFileSize.js";
import { PRODUCTION_ENDPOINT_CONFIG as f } from "../../utils/functions/getEndpoint.js";
import { DATASET as T } from "../../utils/SynapseConstants.js";
import { Button as A } from "@mui/material";
import { Component as F } from "react";
import b from "./utils/CardFooter.js";
import O from "../Icon/Icon.js";
class M extends F {
constructor(e) {
super(e), this.handleLinkClick = this.handleLinkClick.bind(this);
}
handleLinkClick = (e) => (t) => {
t.preventDefault(), window.open(
`${f.PORTAL}Synapse:${e}`,
"_blank"
);
};
render() {
const {
data: e,
schema: t,
selectColumns: n,
columnModels: i,
genericCardSchema: o,
queryVisualizationContext: { getColumnDisplayName: y }
} = this.props, N = e[t.datasetName], S = e[t.summary], v = r({
columnName: "tumorType",
value: e[t.tumorType],
selectColumns: n,
columnModels: i
}).str, D = r({
columnName: "diseaseFocus",
value: e[t.diseaseFocus],
selectColumns: n,
columnModels: i
}).str, d = e[t.id], R = e[t.fundingAgency], L = e[t.fileCount], m = k(e[t.fileSize]), u = [
{
columnDisplayName: "FUNDER",
value: r({
columnName: "fundingAgency",
value: R,
selectColumns: n,
columnModels: i
}).str
},
{ columnDisplayName: "SIZE", value: m },
{ columnDisplayName: "FILES", value: L }
];
if (o && o.secondaryLabels) {
const { secondaryLabels: p } = o;
for (let l = 0; l < p.length; l++) {
const c = p[l], h = e[t[c]];
let C;
h && (C = y(c), u.push({ columnDisplayName: C, value: h, columnName: c }));
}
}
return /* @__PURE__ */ s("div", { className: "SRC-portalCard SRC-typeDataset ", children: [
/* @__PURE__ */ s("div", { className: "SRC-cardThumbnail", children: [
/* @__PURE__ */ a(O, { type: T }),
/* @__PURE__ */ a("div", { children: m })
] }),
/* @__PURE__ */ s("div", { className: "SRC-cardContent SRC-dataset", children: [
/* @__PURE__ */ a("div", { className: "SRC-type", children: "Dataset " }),
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a("h3", { children: /* @__PURE__ */ a(
"a",
{
target: "_self",
href: `${f.PORTAL}Synapse:${d}`,
children: N
}
) }) }),
/* @__PURE__ */ s("div", { className: "SRC-description-dataset", children: [
/* @__PURE__ */ a("p", { className: "SRC-description-text", children: S }),
/* @__PURE__ */ a("div", { className: "SRC-cardAction", children: /* @__PURE__ */ a(
A,
{
className: "SRC-datasetButton",
onClick: this.handleLinkClick(d),
color: "secondary",
variant: "contained",
children: "Download Dataset"
}
) })
] }),
/* @__PURE__ */ a("div", { className: "SRC-cardAnnotations", children: /* @__PURE__ */ a(g, { chips: [v, D] }) })
] }),
/* @__PURE__ */ a(
b,
{
isHeader: !1,
secondaryLabelLimit: this.props.secondaryLabelLimit,
values: u
}
)
] });
}
}
export {
M as default
};
//# sourceMappingURL=Dataset.js.map