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

50 lines (49 loc) 1.37 kB
import { jsx as l } from "react/jsx-runtime"; import { WideButton as m } from "../styled/WideButton.js"; import { Box as c } from "@mui/material"; import { useEffect as a } from "react"; import { SynapseSpinner as p } from "../LoadingScreen/LoadingScreen.js"; import { useIsBot as d } from "../../utils/hooks/useIsBot.js"; import { useSuspenseGetQueryMetadata as x } from "./useGetQueryMetadata.js"; function C(f) { const { hasNextPage: o, fetchNextPage: n, isFetchingNextPage: t, initialLimit: r, initialLimitIsApplied: i, onRemoveInitialLimit: e } = f, { data: { queryCount: s } } = x(), u = d(); return a(() => { i && r != null && s != null && e != null && r >= s && e(); }, [i, r, s, e]), a(() => { u && o && !t && n(); }, [u, o, t, n]), i || o ? /* @__PURE__ */ l( c, { sx: { display: "flex", justifyContent: "flex-start" }, children: /* @__PURE__ */ l( m, { variant: "contained", color: "secondary", size: "large", onClick: () => { i && e != null ? e() : n(); }, disabled: t, children: t ? /* @__PURE__ */ l(p, { size: 24 }) : "View More" } ) } ) : null; } export { C as ViewMoreQueryResultsButton }; //# sourceMappingURL=ViewMoreQueryResultsButton.js.map