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)

99 lines (95 loc) 3.95 kB
import "../../../chunks/chunk-U5RRZUYZ.js"; // src/dashboard/view/entry/EntrySummary.tsx import { Entry, Type, view } from "alinea/core"; import { Chip, HStack, TextLabel, Typo, VStack, fromModule } from "alinea/ui"; import { Ellipsis } from "alinea/ui/Ellipsis"; import { IcRoundKeyboardArrowRight } from "alinea/ui/icons/IcRoundKeyboardArrowRight"; import { Fragment } from "react"; import { useDashboard } from "../../hook/UseDashboard.js"; import { useNav } from "../../hook/UseNav.js"; // src/dashboard/view/entry/EntrySummary.module.scss var EntrySummary_module_default = { "row": "alinea-EntrySummary-row", "thumb": "alinea-EntrySummary-thumb", "thumb-header": "alinea-EntrySummary-thumb-header", "thumbHeader": "alinea-EntrySummary-thumb-header", "thumb-title": "alinea-EntrySummary-thumb-title", "thumbTitle": "alinea-EntrySummary-thumb-title", "thumb-footer": "alinea-EntrySummary-thumb-footer", "thumbFooter": "alinea-EntrySummary-thumb-footer" }; // src/dashboard/view/entry/EntrySummary.tsx import { jsx, jsxs } from "react/jsx-runtime"; var styles = fromModule(EntrySummary_module_default); function entrySummaryQuery() { return { entryId: Entry.entryId, i18nId: Entry.i18nId, type: Entry.type, workspace: Entry.workspace, root: Entry.root, title: Entry.title, parents({ parents }) { return parents(Entry).select({ entryId: Entry.entryId, i18nId: Entry.i18nId, title: Entry.title }); }, childrenAmount({ children }) { return children(Entry).count(); } }; } var EntrySummaryRow = view( entrySummaryQuery, function EntrySummaryRow2({ entryId, title, type: typeName, parents }) { const nav = useNav(); const { schema } = useDashboard().config; const type = schema[typeName]; if (!type) return null; return /* @__PURE__ */ jsxs(HStack, { center: true, full: true, gap: 10, className: styles.row(), children: [ /* @__PURE__ */ jsxs(VStack, { children: [ parents.length > 0 && /* @__PURE__ */ jsx(Ellipsis, { children: /* @__PURE__ */ jsx(Typo.Small, { children: /* @__PURE__ */ jsx(HStack, { center: true, gap: 3, children: parents.map(({ entryId: entryId2, title: title2 }) => /* @__PURE__ */ jsx(Fragment, { children: title2 }, entryId2)).reduce((prev, curr, i) => [ prev, /* @__PURE__ */ jsx(IcRoundKeyboardArrowRight, {}, `s${i}`), curr ]) }) }) }), /* @__PURE__ */ jsx(Ellipsis, { children: /* @__PURE__ */ jsx(TextLabel, { label: title }) }) ] }), /* @__PURE__ */ jsx(Chip, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(TextLabel, { label: Type.label(type) }) }) ] }); } ); var EntrySummaryThumb = view( entrySummaryQuery, function EntrySummaryThumb2({ entryId, title, type: typeName, parents }) { const { schema } = useDashboard().config; const type = schema[typeName]; return /* @__PURE__ */ jsxs("div", { className: styles.thumb(), children: [ parents.length > 0 && /* @__PURE__ */ jsx("header", { className: styles.thumb.header(), children: /* @__PURE__ */ jsx(Typo.Small, { children: /* @__PURE__ */ jsx(HStack, { center: true, gap: 3, children: parents.map(({ entryId: entryId2, title: title2 }) => /* @__PURE__ */ jsx(Fragment, { children: title2 }, entryId2)).reduce((prev, curr, i) => [ prev, /* @__PURE__ */ jsx(IcRoundKeyboardArrowRight, {}, `s${i}`), curr ]) }) }) }), /* @__PURE__ */ jsx("div", { className: styles.thumb.title(), children: /* @__PURE__ */ jsx(TextLabel, { label: title }) }), /* @__PURE__ */ jsx("div", { className: styles.thumb.footer(), children: /* @__PURE__ */ jsx(Chip, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(TextLabel, { label: Type.label(type) }) }) }) ] }); } ); export { EntrySummaryRow, EntrySummaryThumb, entrySummaryQuery };