synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
64 lines (63 loc) • 1.88 kB
JavaScript
import { jsx as t, jsxs as r, Fragment as o } from "react/jsx-runtime";
import f from "../../../../assets/icons/NoSearchResults.js";
import g from "../../../../assets/icons/SearchImage.js";
import { useSearchInfinite as p } from "../../../../synapse-queries/search/useSearch.js";
import { convertToConcreteEntityType as h } from "../../../../utils/functions/EntityTypeUtils.js";
import { DetailsView as n } from "../view/DetailsView.js";
function u(e) {
return {
name: e.name,
id: e.id,
type: h(e.node_type),
createdOn: e.created_on.toString(),
modifiedOn: e.modified_on.toString(),
createdBy: e.created_by,
modifiedBy: e.modified_by
};
}
function I({
searchQuery: e,
...a
}) {
const { data: i, isLoading: l, hasNextPage: s, fetchNextPage: m, isFetchingNextPage: c } = p(e, {
enabled: !!e.queryTerm,
throwOnError: !0
});
return e.queryTerm ? /* @__PURE__ */ t(
n,
{
entities: i?.pages.flatMap((d) => d.hits).map(u) ?? [],
isLoading: l,
hasNextPage: s,
fetchNextPage: m,
isFetchingNextPage: c,
noResultsPlaceholder: /* @__PURE__ */ r(o, { children: [
/* @__PURE__ */ t(f, { className: "SearchPlaceholderImage" }),
/* @__PURE__ */ r("p", { children: [
"No results for “",
e.queryTerm.join(" "),
"”"
] })
] }),
...a,
enableSelectAll: !1
}
) : /* @__PURE__ */ t(
n,
{
entities: [],
isLoading: !1,
hasNextPage: !1,
noResultsPlaceholder: /* @__PURE__ */ r(o, { children: [
/* @__PURE__ */ t(g, { className: "SearchPlaceholderImage" }),
/* @__PURE__ */ t("p", { children: "Enter a term or Synapse ID to start searching" })
] }),
...a,
enableSelectAll: !1
}
);
}
export {
I as SearchDetails
};
//# sourceMappingURL=SearchDetails.js.map