UNPKG

alinea

Version:

[![npm](https://img.shields.io/npm/v/alinea.svg)](https://npmjs.org/package/alinea) [![install size](https://packagephobia.com/badge?p=alinea)](https://packagephobia.com/result?p=alinea)

72 lines (68 loc) 1.89 kB
import { useAtomValue } from "../../../chunks/chunk-WF77DMLN.js"; import "../../../chunks/chunk-OBOPLPUQ.js"; import { useQuery } from "../../../chunks/chunk-DJKGEOOC.js"; import "../../../chunks/chunk-U5RRZUYZ.js"; // src/dashboard/view/explorer/ExplorerRow.tsx import { fromModule } from "alinea/ui"; import { memo } from "react"; import { graphAtom } from "../../atoms/DbAtoms.js"; import { ExplorerItem } from "./ExplorerItem.js"; // src/dashboard/view/explorer/ExplorerRow.module.scss var ExplorerRow_module_default = { "root": "alinea-ExplorerRow" }; // src/dashboard/view/explorer/ExplorerRow.tsx import { jsx } from "react/jsx-runtime"; var styles = fromModule(ExplorerRow_module_default); var ExplorerRow = memo(function ExplorerRow2({ schema, cursor, batchSize, amount, from, summaryView, defaultView }) { const { preferDraft: active } = useAtomValue(graphAtom); const start = Math.floor(from / batchSize); const startAt = from % batchSize; const { data } = useQuery( ["explorer", "batch", cursor, batchSize, start], async () => { return active.find(cursor.skip(start * batchSize).take(batchSize)); }, { refetchOnWindowFocus: false, keepPreviousData: true, staleTime: 1e4 } ); const entries = data?.slice(startAt, startAt + amount); return /* @__PURE__ */ jsx("div", { className: styles.root(), children: /* @__PURE__ */ jsx( "div", { style: { display: "grid", gridTemplateColumns: `repeat(${amount}, 1fr)`, height: "100%" }, children: entries?.map((entry) => { if (!entry) return null; return /* @__PURE__ */ jsx( ExplorerItem, { schema, entry, summaryView, defaultView }, entry.entryId ); }) } ) }); }); export { ExplorerRow };