synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
142 lines (141 loc) • 3.82 kB
JavaScript
import { jsx as e, jsxs as u, Fragment as r } from "react/jsx-runtime";
import { LightTooltip as b } from "../styled/LightTooltip.js";
import { HelpOutlineTwoTone as x } from "@mui/icons-material";
import { Typography as d, Box as c, Autocomplete as g, TextField as E, MenuItem as L, Button as S, Collapse as w, List as A, ListItem as M } from "@mui/material";
import { noop as h } from "lodash-es";
import { useEffect as T, useState as p } from "react";
import { Markdown as k } from "../Markdown/MarkdownSynapse.js";
function m(t) {
const { text: i, tooltipMarkdownText: n } = t;
return /* @__PURE__ */ u(r, { children: [
i,
n && /* @__PURE__ */ e(
b,
{
title: /* @__PURE__ */ e(
d,
{
variant: "body1",
sx: {
mb: 0
},
children: /* @__PURE__ */ e(k, { markdown: n })
}
),
children: /* @__PURE__ */ e(
x,
{
sx: {
ml: 1,
color: "grey.600",
fontSize: "16px"
}
}
)
}
)
] });
}
function v(t) {
const { evaluations: i } = t;
return /* @__PURE__ */ u(r, { children: [
/* @__PURE__ */ e(d, { variant: "body1", children: "Available Evaluation Queues:" }),
/* @__PURE__ */ e(A, { dense: !0, children: i.map((n) => /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(
m,
{
text: n.name,
tooltipMarkdownText: n.submissionInstructionsMessage
}
) }, n.id)) })
] });
}
function y(t) {
const { evaluations: i, isSelectable: n } = t, [a, l] = p(!1), o = n ? 2 : 8, s = i.length >= o;
return /* @__PURE__ */ e(
c,
{
sx: {
mt: 2
},
children: s ? /* @__PURE__ */ u(r, { children: [
/* @__PURE__ */ e(
S,
{
variant: "contained",
sx: { mb: 1 },
onClick: () => l(!a),
children: `${a ? "Hide" : "Show"} All Available Evaluation Queues`
}
),
/* @__PURE__ */ e(w, { in: a, children: /* @__PURE__ */ e(v, { ...t }) })
] }) : /* @__PURE__ */ e(r, { children: /* @__PURE__ */ e(v, { ...t }) })
}
);
}
function C(t) {
const { evaluations: i, onChangeSelectedEvaluation: n = h } = t, [a, l] = p(null);
return /* @__PURE__ */ e(
g,
{
disablePortal: !1,
value: a,
onChange: (o, s) => {
l(s), n(s);
},
options: i,
getOptionLabel: (o) => o.name,
renderOption: (o, s, I, f) => /* @__PURE__ */ e(L, { ...o, children: /* @__PURE__ */ e(
m,
{
text: f.getOptionLabel(s),
tooltipMarkdownText: s.submissionInstructionsMessage
}
) }),
renderInput: (o) => /* @__PURE__ */ e(E, { ...o, label: "Selected Evaluation Queue" })
}
);
}
function z(t) {
const {
isSelectable: i = !0,
onChangeSelectedEvaluation: n = h,
evaluations: a
} = t, l = a.length;
if (T(() => {
l === 1 && i && n(a[0]);
}, [a, i, l, n]), l === 0)
return /* @__PURE__ */ e(d, { variant: "body1", children: "No evaluations found" });
if (l === 1) {
const o = a[0];
return /* @__PURE__ */ e(
c,
{
sx: {
display: "flex",
alignItems: "center"
},
children: /* @__PURE__ */ e(
m,
{
text: o.name,
tooltipMarkdownText: o.submissionInstructionsMessage
}
)
}
);
}
return /* @__PURE__ */ u(
c,
{
className: "AvailableEvaluationQueueList",
children: [
i && /* @__PURE__ */ e(C, { ...t }),
/* @__PURE__ */ e(y, { ...t })
]
}
);
}
export {
z as default
};
//# sourceMappingURL=AvailableEvaluationQueueList.js.map