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

131 lines (130 loc) 3.43 kB
import { jsx as e, jsxs as o } from "react/jsx-runtime"; import y from "../../synapse-queries/entity/useGetQueryResultBundle.js"; import { getFieldIndex as S } from "../../utils/functions/queryUtils.js"; import { getMetricValues as w, SUSTAINABILITY_ICON_COLORS as x } from "./SustainabilityScorecardUtils.js"; import { useTheme as k, Skeleton as I, Box as r, Stack as B, Typography as m, Card as b } from "@mui/material"; import C from "@mui/icons-material/CheckCircle"; import R from "@mui/icons-material/Cancel"; import T from "../SynapseTable/NoContentAvailable.js"; import v from "./Dial.js"; import { Markdown as L } from "../Markdown/MarkdownSynapse.js"; const D = ({ label: i, markdownText: a, metricValues: t, index: n }) => /* @__PURE__ */ o( r, { sx: { display: "flex", padding: "24px 32px", alignItems: "center" }, children: [ /* @__PURE__ */ o(r, { sx: { maxWidth: "800px" }, children: [ /* @__PURE__ */ e(m, { variant: "headline3", sx: { marginBottom: "12px" }, children: i }), /* @__PURE__ */ e( r, { sx: { ".markdown p": { color: "grey.700" } }, children: /* @__PURE__ */ e(L, { markdown: a }) } ) ] }), t[n] === "true" ? /* @__PURE__ */ e( C, { sx: { marginLeft: "auto", fill: x.check, width: "32px", height: "32px" } } ) : /* @__PURE__ */ e( R, { sx: { marginLeft: "auto", fill: x.close, width: "32px", height: "32px" } } ) ] } ), Q = ({ queryRequest: i, description: a, metricsConfig: t, scoreDescriptorColumnName: n }) => { const c = k(), { data: l, isLoading: h } = y(i); if (h) return /* @__PURE__ */ e(I, { width: "100%", height: "90px" }); const s = l?.queryResult.queryResults; if (!s?.rows?.length) return /* @__PURE__ */ e(r, { sx: { paddingTop: "60px" }, children: /* @__PURE__ */ e(T, {}) }); const u = S( n, l ), g = s?.rows[0].values[u], f = w( s?.rows[0], l, t ); return /* @__PURE__ */ o(B, { children: [ /* @__PURE__ */ o( r, { sx: { display: "flex", gap: "40px", marginBottom: "30px", padding: "60px 12px 4px 0px" }, children: [ /* @__PURE__ */ o(r, { sx: { flex: 1 }, children: [ /* @__PURE__ */ e(m, { variant: "headline1", sx: { marginBottom: "10px" }, children: "Sustainability Index" }), a ] }), /* @__PURE__ */ e( v, { scoreDescriptor: g ?? "", isScorecardSummary: !0 } ) ] } ), /* @__PURE__ */ e(b, { children: t.map((d, p) => /* @__PURE__ */ e( r, { sx: { borderBottom: p !== t.length - 1 ? `1px solid ${c.palette.grey[300]}` : void 0 }, children: /* @__PURE__ */ e( D, { label: d.label, markdownText: d.text ?? "", index: p, metricValues: f } ) }, d.key )) }) ] }); }; export { Q as default }; //# sourceMappingURL=SustainabilityScorecardSummary.js.map