synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
65 lines (64 loc) • 3.37 kB
JavaScript
import { jsx as a, jsxs as t } from "react/jsx-runtime";
import b from "../../../synapse-queries/entity/useEntityBundle.js";
import { useGetUploadDestinationForStorageLocation as T } from "../../../synapse-queries/file/useUploadDestination.js";
import { formatDate as s } from "../../../utils/functions/DateFormatter.js";
import { isVersionableEntity as N, entityTypeToFriendlyName as M, getVersionDisplay as h } from "../../../utils/functions/EntityTypeUtils.js";
import { getDataFileHandle as w, getStorageLocationName as R } from "../../../utils/functions/FileHandleUtils.js";
import n from "dayjs";
import { UserBadge as r } from "../../UserCard/UserBadge.js";
const L = ({
entityId: _,
versionNumber: c
}) => {
const { data: e } = b(_, c), m = e && N(e.entity), l = e ? w(e) : void 0, o = e?.entity?.parentId, i = l?.storageLocationId, { data: y } = T(o, i, {
enabled: o !== void 0 && i != null
});
let d;
return l && (d = R(
l,
y
)), e ? /* @__PURE__ */ a("table", { className: "MetadataTable", children: /* @__PURE__ */ t("tbody", { children: [
/* @__PURE__ */ t("tr", { className: "MetadataTable__Row", children: [
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Key", children: "Name" }),
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Value", children: e.entity?.name })
] }),
/* @__PURE__ */ t("tr", { className: "MetadataTable__Row", children: [
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Key", children: "Type" }),
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Value", children: M(e.entityType) })
] }),
/* @__PURE__ */ t("tr", { className: "MetadataTable__Row", children: [
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Key", children: "Synapse ID" }),
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Value", children: e.entity?.id })
] }),
m && /* @__PURE__ */ t("tr", { className: "MetadataTable__Row", children: [
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Key", children: "Version" }),
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Value", children: h(e.entity) })
] }),
d && /* @__PURE__ */ t("tr", { className: "MetadataTable__Row", children: [
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Key", children: "Storage" }),
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Value", children: d })
] }),
/* @__PURE__ */ t("tr", { className: "MetadataTable__Row", children: [
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Key", children: " Last Modified By" }),
/* @__PURE__ */ t("td", { className: "MetadataTable__Row__Value", children: [
/* @__PURE__ */ a(r, { userId: e.entity?.modifiedBy }),
" at",
" ",
s(n(e.entity?.modifiedOn))
] })
] }),
/* @__PURE__ */ t("tr", { className: "MetadataTable__Row", children: [
/* @__PURE__ */ a("td", { className: "MetadataTable__Row__Key", children: "Created By" }),
/* @__PURE__ */ t("td", { className: "MetadataTable__Row__Value", children: [
/* @__PURE__ */ a(r, { userId: e.entity?.createdBy }),
" at",
" ",
s(n(e.entity?.createdOn))
] })
] })
] }) }) : null;
};
export {
L as MetadataTable
};
//# sourceMappingURL=MetadataTable.js.map