@arbidocs/blocks 0.5.153 → 0.5.154
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConnectedNativeDocxComparison-244UIHSM.cjs → ConnectedNativeDocxComparison-2DAQX5GX.cjs} +9 -9
- package/dist/{ConnectedStreamedWordArtifact-V6BRZMEQ.cjs.map → ConnectedNativeDocxComparison-2DAQX5GX.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-JUXIXKYN.cjs → ConnectedPresentation-J42JPUVR.cjs} +13 -13
- package/dist/{ConnectedPresentation-JUXIXKYN.cjs.map → ConnectedPresentation-J42JPUVR.cjs.map} +1 -1
- package/dist/{ConnectedSlidesTab-JA3VB66W.cjs → ConnectedSlidesTab-BYS7HFNK.cjs} +12 -12
- package/dist/{ConnectedSlidesTab-JA3VB66W.cjs.map → ConnectedSlidesTab-BYS7HFNK.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-V6BRZMEQ.cjs → ConnectedStreamedWordArtifact-LTYB62VM.cjs} +9 -9
- package/dist/{ConnectedNativeDocxComparison-244UIHSM.cjs.map → ConnectedStreamedWordArtifact-LTYB62VM.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-5W2QQWKA.cjs → DocumentReviewCard-ILDLYZ5A.cjs} +15 -13
- package/dist/DocumentReviewCard-ILDLYZ5A.cjs.map +1 -0
- package/dist/{FilesViewerDialog-63QUTG4L.cjs → FilesViewerDialog-YLD5YFP2.cjs} +25 -22
- package/dist/FilesViewerDialog-YLD5YFP2.cjs.map +1 -0
- package/dist/{RechartsRenderer-NU6WUZJS.cjs → RechartsRenderer-EPVL5QZA.cjs} +2 -2
- package/dist/{RechartsRenderer-NU6WUZJS.cjs.map → RechartsRenderer-EPVL5QZA.cjs.map} +1 -1
- package/dist/{SpotlightStrip-HXQFPAAL.cjs → SpotlightStrip-JE6MXUBT.cjs} +6 -6
- package/dist/{SpotlightStrip-HXQFPAAL.cjs.map → SpotlightStrip-JE6MXUBT.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-2QP2HJLK.cjs → WorkspaceTableView-V3N64LJG.cjs} +13 -11
- package/dist/WorkspaceTableView-V3N64LJG.cjs.map +1 -0
- package/dist/agents/index.cjs +245 -244
- package/dist/agents/workflows/WorkflowLauncher.d.ts +3 -1
- package/dist/agents/workflows/WorkflowLauncher.js +2 -0
- package/dist/agents/workflows/WorkflowLauncher.js.map +2 -2
- package/dist/{ai-ODGRIL6Y.cjs → ai-QFY4LYQZ.cjs} +16 -16
- package/dist/ai-QFY4LYQZ.cjs.map +1 -0
- package/dist/calls/index.cjs +25 -24
- package/dist/calls/index.cjs.map +1 -1
- package/dist/{chunk-MAKCWF45.cjs → chunk-6GKCGCMT.cjs} +4 -4
- package/dist/{chunk-MAKCWF45.cjs.map → chunk-6GKCGCMT.cjs.map} +1 -1
- package/dist/{chunk-LYKT336H.cjs → chunk-6I5HHWCD.cjs} +5 -5
- package/dist/{chunk-LYKT336H.cjs.map → chunk-6I5HHWCD.cjs.map} +1 -1
- package/dist/{chunk-KWJW5TMH.cjs → chunk-6OPDKROP.cjs} +4 -41
- package/dist/chunk-6OPDKROP.cjs.map +1 -0
- package/dist/{chunk-QWOPEBH2.cjs → chunk-6P4U63HO.cjs} +4 -4
- package/dist/{chunk-QWOPEBH2.cjs.map → chunk-6P4U63HO.cjs.map} +1 -1
- package/dist/{chunk-QKCFV36K.cjs → chunk-7UPEFZCV.cjs} +9 -9
- package/dist/{chunk-QKCFV36K.cjs.map → chunk-7UPEFZCV.cjs.map} +1 -1
- package/dist/{chunk-DUNXLT63.cjs → chunk-AHUEBRLX.cjs} +2 -238
- package/dist/chunk-AHUEBRLX.cjs.map +1 -0
- package/dist/{chunk-B5BGVPQ5.cjs → chunk-AURL2KT5.cjs} +4 -4
- package/dist/{chunk-B5BGVPQ5.cjs.map → chunk-AURL2KT5.cjs.map} +1 -1
- package/dist/chunk-BH322H5B.cjs +594 -0
- package/dist/chunk-BH322H5B.cjs.map +1 -0
- package/dist/{chunk-ZCQXQIBA.cjs → chunk-BNDIMTWJ.cjs} +28 -28
- package/dist/{chunk-ZCQXQIBA.cjs.map → chunk-BNDIMTWJ.cjs.map} +1 -1
- package/dist/{chunk-AG6KAGAX.cjs → chunk-BTQ7IAOH.cjs} +4 -4
- package/dist/{chunk-AG6KAGAX.cjs.map → chunk-BTQ7IAOH.cjs.map} +1 -1
- package/dist/{chunk-FCT62ZPE.cjs → chunk-BZVK7JW5.cjs} +5 -5
- package/dist/{chunk-FCT62ZPE.cjs.map → chunk-BZVK7JW5.cjs.map} +1 -1
- package/dist/{chunk-WUM76MJU.cjs → chunk-CNBYM5Q7.cjs} +7 -7
- package/dist/{chunk-WUM76MJU.cjs.map → chunk-CNBYM5Q7.cjs.map} +1 -1
- package/dist/{chunk-HNLNRAEU.cjs → chunk-DSLMJ24E.cjs} +2 -261
- package/dist/chunk-DSLMJ24E.cjs.map +1 -0
- package/dist/chunk-DWRUGOTQ.cjs +35 -0
- package/dist/chunk-DWRUGOTQ.cjs.map +1 -0
- package/dist/{chunk-GAA222SK.cjs → chunk-EG3DPKXM.cjs} +5 -5
- package/dist/{chunk-GAA222SK.cjs.map → chunk-EG3DPKXM.cjs.map} +1 -1
- package/dist/chunk-FEAHTNTY.cjs +1447 -0
- package/dist/chunk-FEAHTNTY.cjs.map +1 -0
- package/dist/{chunk-VSDD5TH5.cjs → chunk-G3MRW4WB.cjs} +10 -8
- package/dist/chunk-G3MRW4WB.cjs.map +1 -0
- package/dist/{chunk-TFRCNIUY.cjs → chunk-GF6AYAMI.cjs} +9 -9
- package/dist/{chunk-TFRCNIUY.cjs.map → chunk-GF6AYAMI.cjs.map} +1 -1
- package/dist/{chunk-4ZR4O5SP.cjs → chunk-GK3U3FWY.cjs} +60 -28
- package/dist/chunk-GK3U3FWY.cjs.map +1 -0
- package/dist/{chunk-3CJTO6RV.cjs → chunk-GXRD5OSU.cjs} +8 -8
- package/dist/{chunk-3CJTO6RV.cjs.map → chunk-GXRD5OSU.cjs.map} +1 -1
- package/dist/{chunk-JLNKD56X.cjs → chunk-GYI4UXX6.cjs} +4 -4
- package/dist/{chunk-JLNKD56X.cjs.map → chunk-GYI4UXX6.cjs.map} +1 -1
- package/dist/{chunk-4I2PCP7O.cjs → chunk-I3XTTTPZ.cjs} +41 -40
- package/dist/chunk-I3XTTTPZ.cjs.map +1 -0
- package/dist/chunk-JWCVA4LC.cjs +248 -0
- package/dist/chunk-JWCVA4LC.cjs.map +1 -0
- package/dist/{chunk-UM3EWCDE.cjs → chunk-K5F2VNCX.cjs} +35 -10
- package/dist/chunk-K5F2VNCX.cjs.map +1 -0
- package/dist/chunk-KD66CBYO.cjs +44 -0
- package/dist/chunk-KD66CBYO.cjs.map +1 -0
- package/dist/chunk-LLVE5TST.cjs +318 -0
- package/dist/chunk-LLVE5TST.cjs.map +1 -0
- package/dist/{chunk-JCFXS336.cjs → chunk-NRGLF4J4.cjs} +2 -466
- package/dist/chunk-NRGLF4J4.cjs.map +1 -0
- package/dist/{chunk-CVVQHFLR.cjs → chunk-O7U6KL2W.cjs} +72 -650
- package/dist/chunk-O7U6KL2W.cjs.map +1 -0
- package/dist/{chunk-Z3N32LL4.cjs → chunk-OOANNOH4.cjs} +35 -33
- package/dist/chunk-OOANNOH4.cjs.map +1 -0
- package/dist/chunk-SGYURQ23.cjs +271 -0
- package/dist/chunk-SGYURQ23.cjs.map +1 -0
- package/dist/{chunk-A5SKK3CU.cjs → chunk-SLCH5JRI.cjs} +64 -35
- package/dist/chunk-SLCH5JRI.cjs.map +1 -0
- package/dist/chunk-T26UYA6Q.cjs +64 -0
- package/dist/chunk-T26UYA6Q.cjs.map +1 -0
- package/dist/chunk-T3Y3LZ4Y.cjs +477 -0
- package/dist/chunk-T3Y3LZ4Y.cjs.map +1 -0
- package/dist/{chunk-4XNP27N4.cjs → chunk-T7BUGVSG.cjs} +36 -36
- package/dist/{chunk-4XNP27N4.cjs.map → chunk-T7BUGVSG.cjs.map} +1 -1
- package/dist/{chunk-SMO4SPPB.cjs → chunk-TD5V5BZ3.cjs} +5 -5
- package/dist/{chunk-SMO4SPPB.cjs.map → chunk-TD5V5BZ3.cjs.map} +1 -1
- package/dist/{chunk-IXTDOPSB.cjs → chunk-TSAZWUPZ.cjs} +4 -4
- package/dist/{chunk-IXTDOPSB.cjs.map → chunk-TSAZWUPZ.cjs.map} +1 -1
- package/dist/{chunk-5DGNJ6VJ.cjs → chunk-UD3LPATQ.cjs} +6 -6
- package/dist/{chunk-5DGNJ6VJ.cjs.map → chunk-UD3LPATQ.cjs.map} +1 -1
- package/dist/{chunk-OF7KMG6R.cjs → chunk-UJHQ4DA4.cjs} +5 -5
- package/dist/{chunk-OF7KMG6R.cjs.map → chunk-UJHQ4DA4.cjs.map} +1 -1
- package/dist/{chunk-NUFZFWHZ.cjs → chunk-W5QSKW7T.cjs} +3 -29
- package/dist/chunk-W5QSKW7T.cjs.map +1 -0
- package/dist/{chunk-NNZFZYTI.cjs → chunk-WOVNXJK5.cjs} +4 -54
- package/dist/chunk-WOVNXJK5.cjs.map +1 -0
- package/dist/{chunk-E6BM5ENI.cjs → chunk-WRTEKOQP.cjs} +2 -309
- package/dist/chunk-WRTEKOQP.cjs.map +1 -0
- package/dist/{chunk-KRQCUVH7.cjs → chunk-YSAUOJA7.cjs} +9 -3
- package/dist/chunk-YSAUOJA7.cjs.map +1 -0
- package/dist/{chunk-6ZZWQ3OL.cjs → chunk-YXY52OGU.cjs} +4 -4
- package/dist/{chunk-6ZZWQ3OL.cjs.map → chunk-YXY52OGU.cjs.map} +1 -1
- package/dist/{chunk-D5DOK2AE.cjs → chunk-ZW2ZFC3Q.cjs} +58 -58
- package/dist/{chunk-D5DOK2AE.cjs.map → chunk-ZW2ZFC3Q.cjs.map} +1 -1
- package/dist/components/gestures/usePointerGesture.d.ts +13 -1
- package/dist/components/gestures/usePointerGesture.js +33 -8
- package/dist/components/gestures/usePointerGesture.js.map +2 -2
- package/dist/connect/docx.cjs +12 -12
- package/dist/connect/index.cjs +1281 -2346
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +1 -0
- package/dist/connect/index.js +1 -0
- package/dist/connect/index.js.map +2 -2
- package/dist/connect/viewer.cjs +15 -12
- package/dist/connection/dashboards/DashboardPanel.d.ts +2 -0
- package/dist/connection/dashboards/DashboardPanel.js +4 -0
- package/dist/connection/dashboards/DashboardPanel.js.map +2 -2
- package/dist/connection/dashboards/index.d.ts +1 -1
- package/dist/connection/dashboards/index.js +2 -0
- package/dist/connection/dashboards/index.js.map +2 -2
- package/dist/connection/dashboards/templates.d.ts +10 -5
- package/dist/connection/dashboards/templates.js +7 -1
- package/dist/connection/dashboards/templates.js.map +2 -2
- package/dist/connection/live-blocks/ConnectedAgendaBlock.d.ts +13 -0
- package/dist/connection/live-blocks/ConnectedAgendaBlock.js +19 -0
- package/dist/connection/live-blocks/ConnectedAgendaBlock.js.map +7 -0
- package/dist/connection/live-blocks/ConnectedCarouselBlock.d.ts +7 -0
- package/dist/connection/live-blocks/ConnectedCarouselBlock.js +84 -0
- package/dist/connection/live-blocks/ConnectedCarouselBlock.js.map +7 -0
- package/dist/connection/live-blocks/ConnectedListBlock.d.ts +29 -0
- package/dist/connection/live-blocks/ConnectedListBlock.js +193 -0
- package/dist/connection/live-blocks/ConnectedListBlock.js.map +7 -0
- package/dist/connection/live-blocks/ConnectedStartBlock.d.ts +7 -0
- package/dist/connection/live-blocks/ConnectedStartBlock.js +16 -0
- package/dist/connection/live-blocks/ConnectedStartBlock.js.map +7 -0
- package/dist/connection/live-blocks/DashboardAgenda.d.ts +10 -0
- package/dist/connection/{workspace-dashboard → live-blocks}/DashboardAgenda.js +10 -2
- package/dist/connection/live-blocks/DashboardAgenda.js.map +7 -0
- package/dist/connection/{workspace-dashboard → live-blocks}/DashboardStart.js.map +1 -1
- package/dist/connection/live-blocks/LiveBlockRoot.d.ts +11 -0
- package/dist/connection/live-blocks/LiveBlockRoot.js +22 -0
- package/dist/connection/live-blocks/LiveBlockRoot.js.map +7 -0
- package/dist/connection/live-blocks/index.d.ts +5 -0
- package/dist/connection/live-blocks/index.js +20 -0
- package/dist/connection/live-blocks/index.js.map +7 -0
- package/dist/connection/{workspace-dashboard/dashboard-rows.d.ts → live-blocks/list-rows.d.ts} +22 -4
- package/dist/connection/{workspace-dashboard/dashboard-rows.js → live-blocks/list-rows.js} +13 -8
- package/dist/connection/live-blocks/list-rows.js.map +7 -0
- package/dist/connection/{workspace-dashboard → live-blocks}/useDashboardAdd.js.map +1 -1
- package/dist/connection/live-blocks/workspace-dashboard-blocks.d.ts +23 -0
- package/dist/connection/live-blocks/workspace-dashboard-blocks.js +58 -0
- package/dist/connection/live-blocks/workspace-dashboard-blocks.js.map +7 -0
- package/dist/connection/pages/BlockEditor.d.ts +3 -1
- package/dist/connection/pages/BlockEditor.js +18 -1
- package/dist/connection/pages/BlockEditor.js.map +2 -2
- package/dist/connection/pages/ConnectedPagesPage.d.ts +5 -4
- package/dist/connection/pages/ConnectedPagesPage.js +122 -46
- package/dist/connection/pages/ConnectedPagesPage.js.map +2 -2
- package/dist/connection/pages/EditablePageGrid.d.ts +25 -15
- package/dist/connection/pages/EditablePageGrid.js +145 -50
- package/dist/connection/pages/EditablePageGrid.js.map +2 -2
- package/dist/connection/pages/LiveBlockEditor.d.ts +30 -0
- package/dist/connection/pages/LiveBlockEditor.js +175 -0
- package/dist/connection/pages/LiveBlockEditor.js.map +7 -0
- package/dist/connection/pages/PageBlockView.d.ts +5 -3
- package/dist/connection/pages/PageBlockView.js +69 -4
- package/dist/connection/pages/PageBlockView.js.map +2 -2
- package/dist/connection/pages/PageGrid.d.ts +4 -3
- package/dist/connection/pages/PageGrid.js +4 -2
- package/dist/connection/pages/PageGrid.js.map +2 -2
- package/dist/connection/pages/PagesList.d.ts +4 -3
- package/dist/connection/pages/PagesList.js.map +2 -2
- package/dist/connection/pages/grid-layout.d.ts +44 -12
- package/dist/connection/pages/grid-layout.js +71 -27
- package/dist/connection/pages/grid-layout.js.map +2 -2
- package/dist/connection/pages/index.d.ts +4 -2
- package/dist/connection/pages/index.js +34 -5
- package/dist/connection/pages/index.js.map +2 -2
- package/dist/connection/pages/labels.js +5 -1
- package/dist/connection/pages/labels.js.map +2 -2
- package/dist/connection/pages/page-templates.d.ts +10 -0
- package/dist/connection/pages/page-templates.js +16 -0
- package/dist/connection/pages/page-templates.js.map +7 -0
- package/dist/connection/workflows/ConnectedWorkflowStart.d.ts +2 -0
- package/dist/connection/workflows/ConnectedWorkflowStart.js.map +2 -2
- package/dist/connection/workspace-dashboard/ConnectedWorkspaceDashboard.d.ts +10 -7
- package/dist/connection/workspace-dashboard/ConnectedWorkspaceDashboard.js +31 -171
- package/dist/connection/workspace-dashboard/ConnectedWorkspaceDashboard.js.map +3 -3
- package/dist/dashboards/ChartRenderer.d.ts +5 -3
- package/dist/dashboards/ChartRenderer.js +29 -18
- package/dist/dashboards/ChartRenderer.js.map +2 -2
- package/dist/dashboards/PanelView.d.ts +6 -1
- package/dist/dashboards/PanelView.js +24 -7
- package/dist/dashboards/PanelView.js.map +2 -2
- package/dist/dashboards/RechartsRenderer.d.ts +2 -1
- package/dist/dashboards/RechartsRenderer.js.map +2 -2
- package/dist/dashboards/index.cjs +25 -21
- package/dist/embed/index.cjs +23 -20
- package/dist/files/index.cjs +250 -249
- package/dist/home/FactsStrip.d.ts +3 -1
- package/dist/home/FactsStrip.js +3 -2
- package/dist/home/FactsStrip.js.map +2 -2
- package/dist/home/RecentList.d.ts +4 -2
- package/dist/home/RecentList.js +3 -2
- package/dist/home/RecentList.js.map +2 -2
- package/dist/home/StartTiles.d.ts +6 -1
- package/dist/home/StartTiles.js +55 -33
- package/dist/home/StartTiles.js.map +2 -2
- package/dist/home/index.cjs +62 -57
- package/dist/home/index.d.ts +1 -1
- package/dist/home/index.js +2 -1
- package/dist/home/index.js.map +2 -2
- package/dist/home/sections.d.ts +5 -0
- package/dist/home/sections.js +7 -0
- package/dist/home/sections.js.map +2 -2
- package/dist/index.cjs +339 -337
- package/dist/index.cjs.map +1 -1
- package/dist/pages/index.cjs +620 -139
- package/dist/pages/index.cjs.map +1 -1
- package/dist/settings/index.cjs +170 -169
- package/dist/shell/index.cjs +35 -34
- package/dist/studio/index.cjs +12 -12
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +33 -29
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workspaces/index.cjs +49 -47
- package/dist/workspaces/index.cjs.map +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/DocumentReviewCard-5W2QQWKA.cjs.map +0 -1
- package/dist/FilesViewerDialog-63QUTG4L.cjs.map +0 -1
- package/dist/WorkspaceTableView-2QP2HJLK.cjs.map +0 -1
- package/dist/ai-ODGRIL6Y.cjs.map +0 -1
- package/dist/chunk-4I2PCP7O.cjs.map +0 -1
- package/dist/chunk-4ZR4O5SP.cjs.map +0 -1
- package/dist/chunk-A5SKK3CU.cjs.map +0 -1
- package/dist/chunk-CVVQHFLR.cjs.map +0 -1
- package/dist/chunk-DUNXLT63.cjs.map +0 -1
- package/dist/chunk-E6BM5ENI.cjs.map +0 -1
- package/dist/chunk-HNLNRAEU.cjs.map +0 -1
- package/dist/chunk-JCFXS336.cjs.map +0 -1
- package/dist/chunk-KRQCUVH7.cjs.map +0 -1
- package/dist/chunk-KWJW5TMH.cjs.map +0 -1
- package/dist/chunk-NNZFZYTI.cjs.map +0 -1
- package/dist/chunk-NUFZFWHZ.cjs.map +0 -1
- package/dist/chunk-UM3EWCDE.cjs.map +0 -1
- package/dist/chunk-VSDD5TH5.cjs.map +0 -1
- package/dist/chunk-Z3N32LL4.cjs.map +0 -1
- package/dist/connection/workspace-dashboard/DashboardAgenda.d.ts +0 -1
- package/dist/connection/workspace-dashboard/DashboardAgenda.js.map +0 -7
- package/dist/connection/workspace-dashboard/dashboard-rows.js.map +0 -7
- /package/dist/connection/{workspace-dashboard → live-blocks}/DashboardStart.d.ts +0 -0
- /package/dist/connection/{workspace-dashboard → live-blocks}/DashboardStart.js +0 -0
- /package/dist/connection/{workspace-dashboard → live-blocks}/useDashboardAdd.d.ts +0 -0
- /package/dist/connection/{workspace-dashboard → live-blocks}/useDashboardAdd.js +0 -0
|
@@ -21,16 +21,16 @@ function humanizeStatus(status) {
|
|
|
21
21
|
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
22
22
|
}
|
|
23
23
|
const time = (iso) => +new Date(iso ?? 0);
|
|
24
|
-
function recentConversations(conversations) {
|
|
25
|
-
return [...conversations].sort((a, b) => time(b.updated_at) - time(a.updated_at)).slice(0,
|
|
24
|
+
function recentConversations(conversations, limit = RECENT_ROWS) {
|
|
25
|
+
return [...conversations].sort((a, b) => time(b.updated_at) - time(a.updated_at)).slice(0, limit).map((c) => ({
|
|
26
26
|
id: c.external_id,
|
|
27
27
|
title: c.title?.trim() || "Untitled thread",
|
|
28
28
|
subtitle: c.status ? [STATUS_LABELS[asTaskStatus(c.status)], c.due_at ? `due ${shortDate(c.due_at)}` : null].filter(Boolean).join(" \xB7 ") : `${c.message_count} ${c.message_count === 1 ? "message" : "messages"}`,
|
|
29
29
|
time: timeAndDate(c.updated_at)
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
|
-
function recentDocuments(documents) {
|
|
33
|
-
return [...documents].sort((a, b) => time(b.updated_at ?? b.created_at) - time(a.updated_at ?? a.created_at)).slice(0,
|
|
32
|
+
function recentDocuments(documents, limit = RECENT_ROWS) {
|
|
33
|
+
return [...documents].sort((a, b) => time(b.updated_at ?? b.created_at) - time(a.updated_at ?? a.created_at)).slice(0, limit).map((d) => ({
|
|
34
34
|
id: d.external_id,
|
|
35
35
|
fileName: d.file_name,
|
|
36
36
|
title: d.file_name || "Untitled document",
|
|
@@ -38,12 +38,15 @@ function recentDocuments(documents) {
|
|
|
38
38
|
time: timeAndDate(d.updated_at ?? d.created_at)
|
|
39
39
|
}));
|
|
40
40
|
}
|
|
41
|
-
function splitFacts(facts, now = /* @__PURE__ */ new Date()
|
|
41
|
+
function splitFacts(facts, now = /* @__PURE__ */ new Date(), {
|
|
42
|
+
limit = FACT_ROWS,
|
|
43
|
+
groups = "upcoming_and_newest"
|
|
44
|
+
} = {}) {
|
|
42
45
|
const startOfToday = new Date(now);
|
|
43
46
|
startOfToday.setHours(0, 0, 0, 0);
|
|
44
|
-
const dated = facts.filter((f) => f.date_start && new Date(f.date_start) >= startOfToday).sort((a, b) => time(a.date_start) - time(b.date_start)).slice(0,
|
|
47
|
+
const dated = groups === "newest" ? [] : facts.filter((f) => f.date_start && new Date(f.date_start) >= startOfToday).sort((a, b) => time(a.date_start) - time(b.date_start)).slice(0, limit);
|
|
45
48
|
const datedIds = new Set(dated.map((f) => f.external_id));
|
|
46
|
-
const rest = facts.filter((f) => !datedIds.has(f.external_id)).sort((a, b) => time(b.created_at) - time(a.created_at)).slice(0,
|
|
49
|
+
const rest = groups === "upcoming" ? [] : facts.filter((f) => !datedIds.has(f.external_id)).sort((a, b) => time(b.created_at) - time(a.created_at)).slice(0, limit);
|
|
47
50
|
const row = (f, stamp) => ({
|
|
48
51
|
id: f.external_id,
|
|
49
52
|
title: f.text,
|
|
@@ -55,8 +58,10 @@ function splitFacts(facts, now = /* @__PURE__ */ new Date()) {
|
|
|
55
58
|
};
|
|
56
59
|
}
|
|
57
60
|
export {
|
|
61
|
+
FACT_ROWS,
|
|
62
|
+
RECENT_ROWS,
|
|
58
63
|
recentConversations,
|
|
59
64
|
recentDocuments,
|
|
60
65
|
splitFacts
|
|
61
66
|
};
|
|
62
|
-
//# sourceMappingURL=
|
|
67
|
+
//# sourceMappingURL=list-rows.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/connection/live-blocks/list-rows.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * A list block's rows: the last few threads and files (newest first, each with the one fact worth\n * knowing before opening it), and the facts split into upcoming dated ones and the newest others.\n */\nimport type { ListBlockConfig } from '@arbidocs/react'\nimport { STATUS_LABELS, asTaskStatus } from '../../agents/tasks/taskLabels'\nimport type { ConnectedConversationRow, ConnectedDocument } from '../workspaceData'\n\n/**\n * Rows per card: as far back as \"recent\" usefully reaches, and what lets the whole dashboard land\n * on one 900px-tall screen.\n */\nexport const RECENT_ROWS = 5\n/** Rows per facts group: a glanceable band, not a third list. */\nexport const FACT_ROWS = 3\n\n/** \"30 Jun\": an upcoming date shows as the date, not an age. */\nfunction shortDate(iso: string): string {\n return new Date(iso).toLocaleDateString(undefined, { day: 'numeric', month: 'short' })\n}\n\n/** \"14:30 \u00B7 4 Jan\": the exact time (24h) before the date. */\nfunction timeAndDate(iso: string | null | undefined): string {\n if (!iso) return ''\n const d = new Date(iso)\n if (Number.isNaN(d.getTime())) return ''\n const time = d.toLocaleTimeString(undefined, {\n hour: '2-digit',\n minute: '2-digit',\n hour12: false,\n })\n return `${time} \u00B7 ${shortDate(iso)}`\n}\n\n/** \"low-content\" \u2192 \"Low content\": a processing state in words. */\nfunction humanizeStatus(status: string): string {\n const words = status.replace(/[-_]/g, ' ')\n return words.charAt(0).toUpperCase() + words.slice(1)\n}\n\nconst time = (iso: string | null | undefined) => +new Date(iso ?? 0)\n\nexport interface DashboardRowData {\n id: string\n title: string\n subtitle: string\n time: string\n}\n\n/** A task says where it stands (and when it is due); a plain thread says how long it is. */\nexport function recentConversations(\n conversations: ConnectedConversationRow[],\n limit: number = RECENT_ROWS\n): DashboardRowData[] {\n return [...conversations]\n .sort((a, b) => time(b.updated_at) - time(a.updated_at))\n .slice(0, limit)\n .map((c) => ({\n id: c.external_id,\n title: c.title?.trim() || 'Untitled thread',\n subtitle: c.status\n ? [STATUS_LABELS[asTaskStatus(c.status)], c.due_at ? `due ${shortDate(c.due_at)}` : null]\n .filter(Boolean)\n .join(' \u00B7 ')\n : `${c.message_count} ${c.message_count === 1 ? 'message' : 'messages'}`,\n time: timeAndDate(c.updated_at),\n }))\n}\n\n/** A file still processing says so; otherwise its length. */\nexport function recentDocuments(\n documents: ConnectedDocument[],\n limit: number = RECENT_ROWS\n): Array<DashboardRowData & { fileName: string | null | undefined }> {\n return [...documents]\n .sort((a, b) => time(b.updated_at ?? b.created_at) - time(a.updated_at ?? a.created_at))\n .slice(0, limit)\n .map((d) => ({\n id: d.external_id,\n fileName: d.file_name,\n title: d.file_name || 'Untitled document',\n subtitle:\n d.status && d.status !== 'ready' && d.status !== 'completed'\n ? humanizeStatus(d.status)\n : d.n_pages\n ? `${d.n_pages} ${d.n_pages === 1 ? 'page' : 'pages'}`\n : (d.file_type ?? 'Document'),\n time: timeAndDate(d.updated_at ?? d.created_at),\n }))\n}\n\nexport type DashboardFactRow = Omit<DashboardRowData, 'subtitle'>\n\ninterface DashboardFact {\n external_id: string\n text: string\n date_start?: string | null\n created_at?: string | null\n}\n\n/** Which groups a facts list shows (`ListBlockConfig.facts`; absent: both). */\nexport type FactsGroups = NonNullable<ListBlockConfig['facts']>\n\n/**\n * Upcoming: dated facts from today on, soonest first (what you plan around). Recent: the newest of\n * the rest (what the work just learned), stamped like the other rows. With only one group shown,\n * `newest` is the newest of every fact, and `upcoming` alone leaves `recent` empty.\n */\nexport function splitFacts(\n facts: DashboardFact[],\n now: Date = new Date(),\n {\n limit = FACT_ROWS,\n groups = 'upcoming_and_newest',\n }: { limit?: number; groups?: FactsGroups } = {}\n): { upcoming: DashboardFactRow[]; recent: DashboardFactRow[] } {\n const startOfToday = new Date(now)\n startOfToday.setHours(0, 0, 0, 0)\n const dated =\n groups === 'newest'\n ? []\n : facts\n .filter((f) => f.date_start && new Date(f.date_start) >= startOfToday)\n .sort((a, b) => time(a.date_start) - time(b.date_start))\n .slice(0, limit)\n const datedIds = new Set(dated.map((f) => f.external_id))\n const rest =\n groups === 'upcoming'\n ? []\n : facts\n .filter((f) => !datedIds.has(f.external_id))\n .sort((a, b) => time(b.created_at) - time(a.created_at))\n .slice(0, limit)\n const row = (f: DashboardFact, stamp: string): DashboardFactRow => ({\n id: f.external_id,\n title: f.text,\n time: stamp,\n })\n return {\n upcoming: dated.map((f) => row(f, f.date_start ? shortDate(f.date_start) : '')),\n recent: rest.map((f) => row(f, timeAndDate(f.created_at))),\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAKA,SAAS,eAAe,oBAAoB;AAOrC,MAAM,cAAc;AAEpB,MAAM,YAAY;AAGzB,SAAS,UAAU,KAAqB;AACtC,SAAO,IAAI,KAAK,GAAG,EAAE,mBAAmB,QAAW,EAAE,KAAK,WAAW,OAAO,QAAQ,CAAC;AACvF;AAGA,SAAS,YAAY,KAAwC;AAC3D,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,IAAI,IAAI,KAAK,GAAG;AACtB,MAAI,OAAO,MAAM,EAAE,QAAQ,CAAC,EAAG,QAAO;AACtC,QAAMA,QAAO,EAAE,mBAAmB,QAAW;AAAA,IAC3C,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV,CAAC;AACD,SAAO,GAAGA,KAAI,SAAM,UAAU,GAAG,CAAC;AACpC;AAGA,SAAS,eAAe,QAAwB;AAC9C,QAAM,QAAQ,OAAO,QAAQ,SAAS,GAAG;AACzC,SAAO,MAAM,OAAO,CAAC,EAAE,YAAY,IAAI,MAAM,MAAM,CAAC;AACtD;AAEA,MAAM,OAAO,CAAC,QAAmC,CAAC,IAAI,KAAK,OAAO,CAAC;AAU5D,SAAS,oBACd,eACA,QAAgB,aACI;AACpB,SAAO,CAAC,GAAG,aAAa,EACrB,KAAK,CAAC,GAAG,MAAM,KAAK,EAAE,UAAU,IAAI,KAAK,EAAE,UAAU,CAAC,EACtD,MAAM,GAAG,KAAK,EACd,IAAI,CAAC,OAAO;AAAA,IACX,IAAI,EAAE;AAAA,IACN,OAAO,EAAE,OAAO,KAAK,KAAK;AAAA,IAC1B,UAAU,EAAE,SACR,CAAC,cAAc,aAAa,EAAE,MAAM,CAAC,GAAG,EAAE,SAAS,OAAO,UAAU,EAAE,MAA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CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,WAAW,CAAC,EAC1C,KAAK,CAAC,GAAG,MAAM,KAAK,EAAE,UAAU,IAAI,KAAK,EAAE,UAAU,CAAC,EACtD,MAAM,GAAG,KAAK;AACvB,QAAM,MAAM,CAAC,GAAkB,WAAqC;AAAA,IAClE,IAAI,EAAE;AAAA,IACN,OAAO,EAAE;AAAA,IACT,MAAM;AAAA,EACR;AACA,SAAO;AAAA,IACL,UAAU,MAAM,IAAI,CAAC,MAAM,IAAI,GAAG,EAAE,aAAa,UAAU,EAAE,UAAU,IAAI,EAAE,CAAC;AAAA,IAC9E,QAAQ,KAAK,IAAI,CAAC,MAAM,IAAI,GAAG,YAAY,EAAE,UAAU,CAAC,CAAC;AAAA,EAC3D;AACF;",
|
|
6
|
+
"names": ["time"]
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/connection/
|
|
3
|
+
"sources": ["../../../src/connection/live-blocks/useDashboardAdd.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * Adding to the workspace from its home: the \"Add\" source menu (the Files page's, with the same\n * sources) and the dialogs it opens itself. \"From URL\" opens the URL dialog in place, \"Email this\n * workspace\" its email-in dialog; the other sources go to the host's upload (`openUpload`), or,\n * for a host without one, to its Files page (`openFiles`), which adds files itself.\n */\nimport { useState, type ReactNode } from 'react'\nimport { useCurrentWorkspace } from '@arbidocs/react'\nimport { UrlInputDialog } from '../../files/UrlInputDialog'\nimport type { UploadSource } from '../../provider/dialog-registry'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { ConnectedWorkspaceEntity } from '../entities/ConnectedWorkspaceEntity'\nimport { DocumentsUploadButton } from '../files/page/DocumentsUploadButton'\nimport { useAddFromUrls } from '../files/upload/useAddFromUrls'\nimport { ConnectedEmailWorkspaceDialog } from '../workspace-settings/ConnectedEmailWorkspaceDialog'\n\nexport interface DashboardAddOptions {\n /** \"Create new\" in the menu (the host's new-file chooser). Absent: not offered. */\n onCreateNew?: () => void\n /** \"Take photo\" in the menu. Absent: not offered. */\n onTakePhoto?: () => void\n}\n\nexport interface DashboardAdd {\n /** The source menu, as a section action. */\n menu: (props: { canUpload: boolean; className?: string }) => ReactNode\n /** Adds files with no source picked (the whole upload dialog). */\n addFiles: () => void\n /** The dialogs the menu opens; render once. */\n dialogs: ReactNode\n}\n\nexport function useDashboardAdd({ onCreateNew, onTakePhoto }: DashboardAddOptions): DashboardAdd {\n const { openUpload, openFiles } = useBlocksEnvironment()\n const { workspace, isMember } = useCurrentWorkspace()\n const [urlDialogOpen, setUrlDialogOpen] = useState(false)\n const [emailDialogOpen, setEmailDialogOpen] = useState(false)\n\n const upload = (files?: File[], source?: UploadSource) => {\n if (openUpload) openUpload(files, source ? { source } : undefined)\n else openFiles()\n }\n // A zip's files are extracted here, then reviewed in the computer upload (as on Files).\n const uploadUrls = useAddFromUrls({ onZipFiles: (files) => upload(files, 'computer') })\n\n const selectSource = (source: UploadSource) => {\n if (source === 'internet') setUrlDialogOpen(true)\n else upload(undefined, source)\n }\n\n return {\n menu: (props) => (\n <DocumentsUploadButton\n isCompact={false}\n isGuest={false}\n size=\"sm\"\n onSelectSource={selectSource}\n onEmailWorkspace={() => setEmailDialogOpen(true)}\n onCreateNew={onCreateNew}\n onTakePhoto={onTakePhoto}\n {...props}\n />\n ),\n addFiles: () => upload(),\n dialogs: (\n <>\n <UrlInputDialog\n open={urlDialogOpen}\n onOpenChange={setUrlDialogOpen}\n onUrlsSubmit={uploadUrls}\n titleWorkspaceName={workspace?.name}\n titleIcon={\n workspace && <ConnectedWorkspaceEntity workspace={workspace} size={24} variant=\"icon\" />\n }\n />\n {workspace && (\n <ConnectedEmailWorkspaceDialog\n open={emailDialogOpen}\n onOpenChange={setEmailDialogOpen}\n workspace={workspace}\n isMember={isMember}\n />\n )}\n </>\n ),\n }\n}\n"],
|
|
5
5
|
"mappings": ";AAoDM,SAaA,U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,aACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,cAAc;AAAA,UACd;AAAA,UACA;AAAA;AAAA,MACF;AAAA,OAEJ;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": []
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workspace dashboard as blocks: the one definition `ConnectedWorkspaceDashboard` renders (in
|
|
3
|
+
* its fixed bands, not editable) and the "Dashboard" page template copies (`WORKSPACE_DASHBOARD_PAGE`),
|
|
4
|
+
* so a page made from it is the dashboard, ready to be changed. In the page's slots (3 columns by 3
|
|
5
|
+
* rows each): the Start band across the top (4×1), recent files beside recent threads (2×2 each),
|
|
6
|
+
* then the facts beside the agenda (2×2 each).
|
|
7
|
+
*/
|
|
8
|
+
import type { PageBlock, PageSpec } from '@arbidocs/react';
|
|
9
|
+
export type BlockOf<K extends PageBlock['kind']> = Extract<PageBlock, {
|
|
10
|
+
kind: K;
|
|
11
|
+
}>;
|
|
12
|
+
/** The dashboard's sections by name, for the dashboard's own bands. */
|
|
13
|
+
export declare const WORKSPACE_DASHBOARD_LAYOUT: {
|
|
14
|
+
readonly start: BlockOf<'start'>;
|
|
15
|
+
readonly files: BlockOf<'list'>;
|
|
16
|
+
readonly threads: BlockOf<'list'>;
|
|
17
|
+
readonly facts: BlockOf<'list'>;
|
|
18
|
+
readonly agenda: BlockOf<'agenda'>;
|
|
19
|
+
};
|
|
20
|
+
/** The dashboard's blocks in reading order (top to bottom, left to right). */
|
|
21
|
+
export declare const WORKSPACE_DASHBOARD_BLOCKS: readonly PageBlock[];
|
|
22
|
+
/** The "Dashboard" page template: the workspace dashboard as an editable page. */
|
|
23
|
+
export declare const WORKSPACE_DASHBOARD_PAGE: PageSpec;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { FACT_ROWS, RECENT_ROWS } from "./list-rows.js";
|
|
3
|
+
const START = {
|
|
4
|
+
id: "start",
|
|
5
|
+
kind: "start",
|
|
6
|
+
layout: { x: 0, y: 0, w: 12, h: 3 },
|
|
7
|
+
config: {}
|
|
8
|
+
};
|
|
9
|
+
const FILES = {
|
|
10
|
+
id: "recent-files",
|
|
11
|
+
kind: "list",
|
|
12
|
+
layout: { x: 0, y: 3, w: 6, h: 6 },
|
|
13
|
+
config: { source: "documents", limit: RECENT_ROWS }
|
|
14
|
+
};
|
|
15
|
+
const THREADS = {
|
|
16
|
+
id: "recent-threads",
|
|
17
|
+
kind: "list",
|
|
18
|
+
layout: { x: 6, y: 3, w: 6, h: 6 },
|
|
19
|
+
config: { source: "conversations", limit: RECENT_ROWS }
|
|
20
|
+
};
|
|
21
|
+
const FACTS = {
|
|
22
|
+
id: "facts",
|
|
23
|
+
kind: "list",
|
|
24
|
+
layout: { x: 0, y: 9, w: 6, h: 6 },
|
|
25
|
+
config: { source: "facts", limit: FACT_ROWS, facts: "upcoming_and_newest" }
|
|
26
|
+
};
|
|
27
|
+
const AGENDA = {
|
|
28
|
+
id: "agenda",
|
|
29
|
+
kind: "agenda",
|
|
30
|
+
layout: { x: 6, y: 9, w: 6, h: 6 },
|
|
31
|
+
config: { days: 7, limit: 8 }
|
|
32
|
+
};
|
|
33
|
+
const WORKSPACE_DASHBOARD_LAYOUT = {
|
|
34
|
+
start: START,
|
|
35
|
+
files: FILES,
|
|
36
|
+
threads: THREADS,
|
|
37
|
+
facts: FACTS,
|
|
38
|
+
agenda: AGENDA
|
|
39
|
+
};
|
|
40
|
+
const WORKSPACE_DASHBOARD_BLOCKS = [
|
|
41
|
+
START,
|
|
42
|
+
FILES,
|
|
43
|
+
THREADS,
|
|
44
|
+
FACTS,
|
|
45
|
+
AGENDA
|
|
46
|
+
];
|
|
47
|
+
const WORKSPACE_DASHBOARD_PAGE = {
|
|
48
|
+
version: 1,
|
|
49
|
+
title: "Dashboard",
|
|
50
|
+
description: "The workspace home: what you can start, recent files and threads, facts, agenda.",
|
|
51
|
+
blocks: [...WORKSPACE_DASHBOARD_BLOCKS]
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
WORKSPACE_DASHBOARD_BLOCKS,
|
|
55
|
+
WORKSPACE_DASHBOARD_LAYOUT,
|
|
56
|
+
WORKSPACE_DASHBOARD_PAGE
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=workspace-dashboard-blocks.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/connection/live-blocks/workspace-dashboard-blocks.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The workspace dashboard as blocks: the one definition `ConnectedWorkspaceDashboard` renders (in\n * its fixed bands, not editable) and the \"Dashboard\" page template copies (`WORKSPACE_DASHBOARD_PAGE`),\n * so a page made from it is the dashboard, ready to be changed. In the page's slots (3 columns by 3\n * rows each): the Start band across the top (4\u00D71), recent files beside recent threads (2\u00D72 each),\n * then the facts beside the agenda (2\u00D72 each).\n */\nimport type { PageBlock, PageSpec } from '@arbidocs/react'\nimport { FACT_ROWS, RECENT_ROWS } from './list-rows'\n\nexport type BlockOf<K extends PageBlock['kind']> = Extract<PageBlock, { kind: K }>\n\nconst START: BlockOf<'start'> = {\n id: 'start',\n kind: 'start',\n layout: { x: 0, y: 0, w: 12, h: 3 },\n config: {},\n}\nconst FILES: BlockOf<'list'> = {\n id: 'recent-files',\n kind: 'list',\n layout: { x: 0, y: 3, w: 6, h: 6 },\n config: { source: 'documents', limit: RECENT_ROWS },\n}\nconst THREADS: BlockOf<'list'> = {\n id: 'recent-threads',\n kind: 'list',\n layout: { x: 6, y: 3, w: 6, h: 6 },\n config: { source: 'conversations', limit: RECENT_ROWS },\n}\nconst FACTS: BlockOf<'list'> = {\n id: 'facts',\n kind: 'list',\n layout: { x: 0, y: 9, w: 6, h: 6 },\n config: { source: 'facts', limit: FACT_ROWS, facts: 'upcoming_and_newest' },\n}\nconst AGENDA: BlockOf<'agenda'> = {\n id: 'agenda',\n kind: 'agenda',\n layout: { x: 6, y: 9, w: 6, h: 6 },\n config: { days: 7, limit: 8 },\n}\n\n/** The dashboard's sections by name, for the dashboard's own bands. */\nexport const WORKSPACE_DASHBOARD_LAYOUT: {\n readonly start: BlockOf<'start'>\n readonly files: BlockOf<'list'>\n readonly threads: BlockOf<'list'>\n readonly facts: BlockOf<'list'>\n readonly agenda: BlockOf<'agenda'>\n} = {\n start: START,\n files: FILES,\n threads: THREADS,\n facts: FACTS,\n agenda: AGENDA,\n}\n\n/** The dashboard's blocks in reading order (top to bottom, left to right). */\nexport const WORKSPACE_DASHBOARD_BLOCKS: readonly PageBlock[] = [\n START,\n FILES,\n THREADS,\n FACTS,\n AGENDA,\n]\n\n/** The \"Dashboard\" page template: the workspace dashboard as an editable page. */\nexport const WORKSPACE_DASHBOARD_PAGE: PageSpec = {\n version: 1,\n title: 'Dashboard',\n description: 'The workspace home: what you can start, recent files and threads, facts, agenda.',\n blocks: [...WORKSPACE_DASHBOARD_BLOCKS],\n}\n"],
|
|
5
|
+
"mappings": ";AAQA,SAAS,WAAW,mBAAmB;AAIvC,MAAM,QAA0B;AAAA,EAC9B,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,EAAE;AAAA,EAClC,QAAQ,CAAC;AACX;AACA,MAAM,QAAyB;AAAA,EAC7B,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AAAA,EACjC,QAAQ,EAAE,QAAQ,aAAa,OAAO,YAAY;AACpD;AACA,MAAM,UAA2B;AAAA,EAC/B,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AAAA,EACjC,QAAQ,EAAE,QAAQ,iBAAiB,OAAO,YAAY;AACxD;AACA,MAAM,QAAyB;AAAA,EAC7B,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AAAA,EACjC,QAAQ,EAAE,QAAQ,SAAS,OAAO,WAAW,OAAO,sBAAsB;AAC5E;AACA,MAAM,SAA4B;AAAA,EAChC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AAAA,EACjC,QAAQ,EAAE,MAAM,GAAG,OAAO,EAAE;AAC9B;AAGO,MAAM,6BAMT;AAAA,EACF,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AACV;AAGO,MAAM,6BAAmD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,2BAAqC;AAAA,EAChD,SAAS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AAAA,EACb,QAAQ,CAAC,GAAG,0BAA0B;AACxC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type PageBlock } from '@arbidocs/react';
|
|
2
2
|
import { type PanelEditorLabels } from '../dashboards/PanelEditor';
|
|
3
3
|
import { type DocumentsPickerLabels } from './DocumentsPicker';
|
|
4
|
+
import { type LiveBlockEditorLabels } from './LiveBlockEditor';
|
|
4
5
|
import { type ViewPickerLabels } from './ViewPicker';
|
|
5
6
|
export interface BlockEditorLabels {
|
|
6
7
|
title: string;
|
|
@@ -22,6 +23,7 @@ export interface BlockEditorProps {
|
|
|
22
23
|
editorLabels?: Partial<PanelEditorLabels>;
|
|
23
24
|
pickerLabels?: Partial<ViewPickerLabels>;
|
|
24
25
|
documentsLabels?: Partial<DocumentsPickerLabels>;
|
|
26
|
+
liveLabels?: Partial<LiveBlockEditorLabels>;
|
|
25
27
|
testId?: string;
|
|
26
28
|
}
|
|
27
|
-
export declare function BlockEditor({ block, shared, onDone, onCancel, labels, editorLabels, pickerLabels, documentsLabels, testId, }: BlockEditorProps): import("react").JSX.Element;
|
|
29
|
+
export declare function BlockEditor({ block, shared, onDone, onCancel, labels, editorLabels, pickerLabels, documentsLabels, liveLabels, testId, }: BlockEditorProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
blockOfPanel,
|
|
6
|
+
panelOfBlock,
|
|
7
|
+
useFeature
|
|
8
|
+
} from "@arbidocs/react";
|
|
5
9
|
import {
|
|
6
10
|
Button,
|
|
7
11
|
Dialog,
|
|
@@ -15,6 +19,7 @@ import {
|
|
|
15
19
|
} from "@arbidocs/react/ui";
|
|
16
20
|
import { PanelEditor } from "../dashboards/PanelEditor.js";
|
|
17
21
|
import { DocumentsPicker } from "./DocumentsPicker.js";
|
|
22
|
+
import { LiveBlockEditor } from "./LiveBlockEditor.js";
|
|
18
23
|
import { ViewPicker } from "./ViewPicker.js";
|
|
19
24
|
const DEFAULT_BLOCK_EDITOR_LABELS = {
|
|
20
25
|
title: "Block",
|
|
@@ -33,9 +38,11 @@ function BlockEditor({
|
|
|
33
38
|
editorLabels,
|
|
34
39
|
pickerLabels,
|
|
35
40
|
documentsLabels,
|
|
41
|
+
liveLabels,
|
|
36
42
|
testId = "page-block-editor"
|
|
37
43
|
}) {
|
|
38
44
|
const l = { ...DEFAULT_BLOCK_EDITOR_LABELS, ...labels };
|
|
45
|
+
const workflowsOn = useFeature("workflows");
|
|
39
46
|
const [value, setValue] = useState(block);
|
|
40
47
|
useEffect(() => setValue(block), [block]);
|
|
41
48
|
const setPanel = (panel) => setValue((b) => b ? { ...blockOfPanel(panel, b.layout.h), layout: b.layout } : b);
|
|
@@ -90,6 +97,16 @@ function BlockEditor({
|
|
|
90
97
|
labels: documentsLabels,
|
|
91
98
|
testId: `${testId}-documents`
|
|
92
99
|
}
|
|
100
|
+
),
|
|
101
|
+
(value.kind === "list" || value.kind === "carousel" || value.kind === "agenda" || value.kind === "start") && /* @__PURE__ */ jsx(
|
|
102
|
+
LiveBlockEditor,
|
|
103
|
+
{
|
|
104
|
+
value,
|
|
105
|
+
onChange: setValue,
|
|
106
|
+
workflowsOn,
|
|
107
|
+
labels: liveLabels,
|
|
108
|
+
testId: `${testId}-live`
|
|
109
|
+
}
|
|
93
110
|
)
|
|
94
111
|
] }),
|
|
95
112
|
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/pages/BlockEditor.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * `BlockEditor`: the dialog that changes one block of a page being edited: a chart or metric through\n * the Analytics `PanelEditor`, a text block's Markdown, a table block's view (`ViewPicker`: on a\n * shared page, shared views only), a document or a gallery's documents. Its place and size are set
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * `BlockEditor`: the dialog that changes one block of a page being edited: a chart or metric through\n * the Analytics `PanelEditor`, a text block's Markdown, a table block's view (`ViewPicker`: on a\n * shared page, shared views only), a document or a gallery's documents, a live block's source and\n * size (`LiveBlockEditor`). Its place and size are set on the page itself, by dragging it\n * (`EditablePageGrid`).\n */\nimport { useEffect, useState } from 'react'\nimport {\n blockOfPanel,\n panelOfBlock,\n useFeature,\n type PageBlock,\n type PanelSpec,\n} from '@arbidocs/react'\nimport {\n Button,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Label,\n Textarea,\n} from '@arbidocs/react/ui'\nimport { PanelEditor, type PanelEditorLabels } from '../dashboards/PanelEditor'\nimport { DocumentsPicker, type DocumentsPickerLabels } from './DocumentsPicker'\nimport { LiveBlockEditor, type LiveBlockEditorLabels } from './LiveBlockEditor'\nimport { ViewPicker, type ViewPickerLabels } from './ViewPicker'\n\nexport interface BlockEditorLabels {\n title: string\n description: string\n text: string\n view: string\n cancel: string\n done: string\n}\n\nexport const DEFAULT_BLOCK_EDITOR_LABELS: BlockEditorLabels = {\n title: 'Block',\n description: 'Choose what the block shows. Drag it on the page to place and size it.',\n text: 'Text (Markdown)',\n view: 'Table view',\n cancel: 'Cancel',\n done: 'Done',\n}\n\nexport interface BlockEditorProps {\n /** The block being edited; `null` closes the dialog. */\n block: PageBlock | null\n /** The page is shared: a table block offers shared views only. */\n shared: boolean\n onDone: (block: PageBlock) => void\n onCancel: () => void\n labels?: Partial<BlockEditorLabels>\n editorLabels?: Partial<PanelEditorLabels>\n pickerLabels?: Partial<ViewPickerLabels>\n documentsLabels?: Partial<DocumentsPickerLabels>\n liveLabels?: Partial<LiveBlockEditorLabels>\n testId?: string\n}\n\nexport function BlockEditor({\n block,\n shared,\n onDone,\n onCancel,\n labels,\n editorLabels,\n pickerLabels,\n documentsLabels,\n liveLabels,\n testId = 'page-block-editor',\n}: BlockEditorProps) {\n const l = { ...DEFAULT_BLOCK_EDITOR_LABELS, ...labels }\n const workflowsOn = useFeature('workflows')\n const [value, setValue] = useState<PageBlock | null>(block)\n useEffect(() => setValue(block), [block])\n\n const setPanel = (panel: PanelSpec) =>\n setValue((b) => (b ? { ...blockOfPanel(panel, b.layout.h), layout: b.layout } : b))\n\n const ready =\n !!value &&\n (value.kind === 'table'\n ? !!value.config.view\n : value.kind === 'document'\n ? !!value.config.document\n : value.kind === 'gallery'\n ? value.config.documents.length > 0\n : true)\n\n return (\n <Dialog open={block !== null} onOpenChange={(open) => !open && onCancel()}>\n <DialogContent className=\"max-h-[90dvh] max-w-5xl overflow-y-auto\" data-testid={testId}>\n <DialogHeader>\n <DialogTitle>{l.title}</DialogTitle>\n <DialogDescription>{l.description}</DialogDescription>\n </DialogHeader>\n {value && (\n <div className=\"space-y-4\">\n {(value.kind === 'chart' || value.kind === 'metric') && (\n <PanelEditor\n value={panelOfBlock(value)}\n onChange={setPanel}\n labels={editorLabels}\n testId={`${testId}-panel`}\n />\n )}\n {value.kind === 'text' && (\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor={`${testId}-text`}>{l.text}</Label>\n <Textarea\n id={`${testId}-text`}\n rows={8}\n value={value.config.text}\n onChange={(e) =>\n setValue({ ...value, config: { text: e.target.value } } as PageBlock)\n }\n data-testid={`${testId}-text`}\n />\n </div>\n )}\n {value.kind === 'table' && (\n <ViewPicker\n value={value.config.view || null}\n sharedOnly={shared}\n onChange={(view) => setValue({ ...value, config: { view } } as PageBlock)}\n labels={pickerLabels}\n testId={`${testId}-view`}\n />\n )}\n {(value.kind === 'document' || value.kind === 'gallery') && (\n <DocumentsPicker\n value={\n value.kind === 'document'\n ? value.config.document\n ? [value.config.document]\n : []\n : value.config.documents\n }\n multiple={value.kind === 'gallery'}\n sharedOnly={shared}\n onChange={(ids) =>\n setValue(\n (value.kind === 'document'\n ? { ...value, config: { document: ids[0] ?? '' } }\n : { ...value, config: { documents: ids } }) as PageBlock\n )\n }\n labels={documentsLabels}\n testId={`${testId}-documents`}\n />\n )}\n {(value.kind === 'list' ||\n value.kind === 'carousel' ||\n value.kind === 'agenda' ||\n value.kind === 'start') && (\n <LiveBlockEditor\n value={value}\n onChange={setValue}\n workflowsOn={workflowsOn}\n labels={liveLabels}\n testId={`${testId}-live`}\n />\n )}\n </div>\n )}\n <DialogFooter>\n <Button variant=\"ghost\" onClick={onCancel}>\n {l.cancel}\n </Button>\n <Button\n disabled={!ready}\n onClick={() => value && onDone(value)}\n data-testid={`${testId}-done`}\n >\n {l.done}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAiGQ,SACE,KADF;AA1FR,SAAS,WAAW,gBAAgB;AACpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,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,GAAG,MAAM;AAAA;AAAA,MACnB;AAAA,OAEA,MAAM,SAAS,UACf,MAAM,SAAS,cACf,MAAM,SAAS,YACf,MAAM,SAAS,YACf;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,UAAU;AAAA,UACV;AAAA,UACA,QAAQ;AAAA,UACR,QAAQ,GAAG,MAAM;AAAA;AAAA,MACnB;AAAA,OAEJ;AAAA,IAEF,qBAAC,gBACC;AAAA,0BAAC,UAAO,SAAQ,SAAQ,SAAS,UAC9B,YAAE,QACL;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,UAAU,CAAC;AAAA,UACX,SAAS,MAAM,SAAS,OAAO,KAAK;AAAA,UACpC,eAAa,GAAG,MAAM;AAAA,UAErB,YAAE;AAAA;AAAA,MACL;AAAA,OACF;AAAA,KACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type DashboardSpec } from '@arbidocs/react';
|
|
2
1
|
import type { DashboardPanelLabels } from '../dashboards/DashboardPanel';
|
|
3
2
|
import type { PanelEditorLabels } from '../dashboards/PanelEditor';
|
|
3
|
+
import { type PageTemplate } from '../dashboards/templates';
|
|
4
4
|
import { type BlockEditorLabels } from './BlockEditor';
|
|
5
5
|
import { type EditablePageGridLabels } from './EditablePageGrid';
|
|
6
6
|
import { type PagesPageLabels } from './labels';
|
|
@@ -8,11 +8,12 @@ import type { TableViewBlockLabels } from './TableViewBlock';
|
|
|
8
8
|
import type { ViewPickerLabels } from './ViewPicker';
|
|
9
9
|
export interface ConnectedPagesPageProps {
|
|
10
10
|
/**
|
|
11
|
-
* Starting points for a new page
|
|
11
|
+
* Starting points for a new page: dashboards of Analytics panels or whole pages. Default: the
|
|
12
|
+
* workspace dashboard (its live blocks), an overview and one per area (documents, tags and
|
|
12
13
|
* facts, workflows, AI usage, recent activity) over the built-in sources; Workflows only while
|
|
13
14
|
* the host's `workflows` feature is on.
|
|
14
15
|
*/
|
|
15
|
-
templates?: readonly
|
|
16
|
+
templates?: readonly PageTemplate[];
|
|
16
17
|
/** The open page (controlled, for a route): `null` is the list. */
|
|
17
18
|
pageId?: string | null;
|
|
18
19
|
onPageChange?: (id: string | null) => void;
|
|
@@ -20,7 +21,7 @@ export interface ConnectedPagesPageProps {
|
|
|
20
21
|
panelLabels?: Partial<DashboardPanelLabels>;
|
|
21
22
|
editorLabels?: Partial<PanelEditorLabels>;
|
|
22
23
|
blockLabels?: Partial<BlockEditorLabels>;
|
|
23
|
-
/** The
|
|
24
|
+
/** The arranging grid's words (its move and resize handles, its keyboard hint). */
|
|
24
25
|
gridLabels?: Partial<EditablePageGridLabels>;
|
|
25
26
|
tableLabels?: Partial<TableViewBlockLabels>;
|
|
26
27
|
pickerLabels?: Partial<ViewPickerLabels>;
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import {
|
|
5
|
+
CalendarClock,
|
|
5
6
|
FileText,
|
|
7
|
+
GalleryHorizontal,
|
|
8
|
+
ListOrdered,
|
|
6
9
|
Pencil,
|
|
7
10
|
Plus,
|
|
11
|
+
Rocket,
|
|
8
12
|
Sigma,
|
|
9
13
|
Table2,
|
|
10
14
|
FileImage,
|
|
@@ -14,7 +18,7 @@ import {
|
|
|
14
18
|
} from "lucide-react";
|
|
15
19
|
import {
|
|
16
20
|
ANALYTICS_CHART_VIEW,
|
|
17
|
-
|
|
21
|
+
LIVE_BLOCK_LIMITS,
|
|
18
22
|
blockOfPanel,
|
|
19
23
|
pageFromDashboard,
|
|
20
24
|
useArbi,
|
|
@@ -40,10 +44,11 @@ import {
|
|
|
40
44
|
} from "@arbidocs/react/ui";
|
|
41
45
|
import { PageHeader } from "../../components/PageHeader.js";
|
|
42
46
|
import { useBlocksEnvironment } from "../../provider/environment.js";
|
|
43
|
-
import {
|
|
47
|
+
import { newPanel, newPanelId, templatesFor } from "../dashboards/templates.js";
|
|
48
|
+
import { PAGE_TEMPLATES, pageOfTemplate } from "./page-templates.js";
|
|
44
49
|
import { BlockEditor } from "./BlockEditor.js";
|
|
45
50
|
import { EditablePageGrid } from "./EditablePageGrid.js";
|
|
46
|
-
import { appendBlock, compactLayout } from "./grid-layout.js";
|
|
51
|
+
import { appendBlock, compactLayout, defaultLayout, normalizeLayout } from "./grid-layout.js";
|
|
47
52
|
import { PageBlockView } from "./PageBlockView.js";
|
|
48
53
|
import { PageCell, PageGrid, inReadingOrder } from "./PageGrid.js";
|
|
49
54
|
import { PagesList } from "./PagesList.js";
|
|
@@ -55,10 +60,26 @@ const KIND_ICONS = {
|
|
|
55
60
|
text: FileText,
|
|
56
61
|
table: Table2,
|
|
57
62
|
document: FileImage,
|
|
58
|
-
gallery: Images
|
|
63
|
+
gallery: Images,
|
|
64
|
+
list: ListOrdered,
|
|
65
|
+
carousel: GalleryHorizontal,
|
|
66
|
+
agenda: CalendarClock,
|
|
67
|
+
start: Rocket
|
|
59
68
|
};
|
|
69
|
+
const ADDABLE_KINDS = [
|
|
70
|
+
"chart",
|
|
71
|
+
"metric",
|
|
72
|
+
"text",
|
|
73
|
+
"table",
|
|
74
|
+
"document",
|
|
75
|
+
"gallery",
|
|
76
|
+
"list",
|
|
77
|
+
"carousel",
|
|
78
|
+
"agenda",
|
|
79
|
+
"start"
|
|
80
|
+
];
|
|
60
81
|
function newBlock(kind) {
|
|
61
|
-
const layout =
|
|
82
|
+
const layout = defaultLayout(kind);
|
|
62
83
|
if (kind === "chart" || kind === "metric") {
|
|
63
84
|
const panel = newPanel();
|
|
64
85
|
return {
|
|
@@ -69,6 +90,22 @@ function newBlock(kind) {
|
|
|
69
90
|
if (kind === "text") return { id: newPanelId(), kind, layout, config: { text: "" } };
|
|
70
91
|
if (kind === "document") return { id: newPanelId(), kind, layout, config: { document: "" } };
|
|
71
92
|
if (kind === "gallery") return { id: newPanelId(), kind, layout, config: { documents: [] } };
|
|
93
|
+
if (kind === "list") {
|
|
94
|
+
const config = { source: "documents", limit: LIVE_BLOCK_LIMITS.listRows.default };
|
|
95
|
+
return { id: newPanelId(), kind, layout, config };
|
|
96
|
+
}
|
|
97
|
+
if (kind === "carousel") {
|
|
98
|
+
const config = { source: "skills", limit: LIVE_BLOCK_LIMITS.carouselItems.default };
|
|
99
|
+
return { id: newPanelId(), kind, layout, config };
|
|
100
|
+
}
|
|
101
|
+
if (kind === "agenda") {
|
|
102
|
+
const config = {
|
|
103
|
+
days: LIVE_BLOCK_LIMITS.agendaDays.default,
|
|
104
|
+
limit: LIVE_BLOCK_LIMITS.agendaEvents.default
|
|
105
|
+
};
|
|
106
|
+
return { id: newPanelId(), kind, layout, config };
|
|
107
|
+
}
|
|
108
|
+
if (kind === "start") return { id: newPanelId(), kind, layout, config: {} };
|
|
72
109
|
return { id: newPanelId(), kind, layout, config: { view: "" } };
|
|
73
110
|
}
|
|
74
111
|
const errorText = (error) => error instanceof Error ? error.message : String(error);
|
|
@@ -91,7 +128,7 @@ function ConnectedPagesPage({
|
|
|
91
128
|
const arbi = useArbi();
|
|
92
129
|
const me = arbi.isLoggedIn ? arbi.user.identity()?.externalId ?? null : null;
|
|
93
130
|
const workflowsOn = useFeature("workflows");
|
|
94
|
-
const templates = siteTemplates ?? templatesFor(
|
|
131
|
+
const templates = siteTemplates ?? templatesFor(PAGE_TEMPLATES, { workflows: workflowsOn });
|
|
95
132
|
const canEditShared = useCanEditShared();
|
|
96
133
|
const isOwner = useIsWorkspaceOwner();
|
|
97
134
|
const pages = usePages();
|
|
@@ -141,6 +178,18 @@ function ConnectedPagesPage({
|
|
|
141
178
|
}, [chartRequest]);
|
|
142
179
|
const canEdit = (p) => p.shared ? canEditShared : p.legacy || p.createdBy === null || p.createdBy === me;
|
|
143
180
|
const canDelete = (p) => p.shared ? isOwner : canEdit(p);
|
|
181
|
+
const canArrange = (p) => canEdit(p) && !p.legacy;
|
|
182
|
+
const [arranged, setArranged] = useState(null);
|
|
183
|
+
const arrange = async (p, blocks) => {
|
|
184
|
+
setArranged({ id: p.id, blocks });
|
|
185
|
+
try {
|
|
186
|
+
await save.mutateAsync({ id: p.id, spec: { ...p.spec, blocks } });
|
|
187
|
+
} catch (error) {
|
|
188
|
+
notify(`${l.saveFailed}: ${errorText(error)}`, "error");
|
|
189
|
+
} finally {
|
|
190
|
+
setArranged((a) => a?.blocks === blocks ? null : a);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
144
193
|
const startEditing = (p) => setDraft({ id: p.id, spec: p.spec, base: p.spec, shared: p.shared });
|
|
145
194
|
const createBlank = () => {
|
|
146
195
|
const spec = { version: 1, title: l.untitled, blocks: [] };
|
|
@@ -151,7 +200,7 @@ function ConnectedPagesPage({
|
|
|
151
200
|
setCreating(true);
|
|
152
201
|
const openWhenStarted = openIdRef.current;
|
|
153
202
|
try {
|
|
154
|
-
const result = await save.mutateAsync({ spec:
|
|
203
|
+
const result = await save.mutateAsync({ spec: pageOfTemplate(template) });
|
|
155
204
|
if (openIdRef.current === openWhenStarted) setOpenId(result.id);
|
|
156
205
|
notify(l.saved, "success");
|
|
157
206
|
} catch (error) {
|
|
@@ -261,42 +310,41 @@ function ConnectedPagesPage({
|
|
|
261
310
|
onChange: setBlocks,
|
|
262
311
|
labels: gridLabels,
|
|
263
312
|
testId,
|
|
264
|
-
renderBlock: (block
|
|
313
|
+
renderBlock: (block) => /* @__PURE__ */ jsx(
|
|
265
314
|
PageBlockView,
|
|
266
315
|
{
|
|
267
316
|
block,
|
|
268
317
|
panelLabels,
|
|
269
318
|
tableLabels,
|
|
270
|
-
testId: `${testId}-block-${block.id}
|
|
271
|
-
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
272
|
-
grip,
|
|
273
|
-
/* @__PURE__ */ jsx(
|
|
274
|
-
Button,
|
|
275
|
-
{
|
|
276
|
-
variant: "ghost",
|
|
277
|
-
size: "icon",
|
|
278
|
-
className: "size-7",
|
|
279
|
-
"aria-label": l.editBlock,
|
|
280
|
-
onClick: () => setEditing({ block, isNew: false }),
|
|
281
|
-
"data-testid": `${testId}-edit-block-${block.id}`,
|
|
282
|
-
children: /* @__PURE__ */ jsx(Pencil, { className: "size-3.5" })
|
|
283
|
-
}
|
|
284
|
-
),
|
|
285
|
-
/* @__PURE__ */ jsx(
|
|
286
|
-
Button,
|
|
287
|
-
{
|
|
288
|
-
variant: "ghost",
|
|
289
|
-
size: "icon",
|
|
290
|
-
className: "size-7",
|
|
291
|
-
"aria-label": l.removeBlock,
|
|
292
|
-
onClick: () => setBlocks(compactLayout(blocks.filter((b) => b.id !== block.id))),
|
|
293
|
-
"data-testid": `${testId}-remove-block-${block.id}`,
|
|
294
|
-
children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" })
|
|
295
|
-
}
|
|
296
|
-
)
|
|
297
|
-
] })
|
|
319
|
+
testId: `${testId}-block-${block.id}`
|
|
298
320
|
}
|
|
299
|
-
)
|
|
321
|
+
),
|
|
322
|
+
actionsOf: (block) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
323
|
+
/* @__PURE__ */ jsx(
|
|
324
|
+
Button,
|
|
325
|
+
{
|
|
326
|
+
variant: "ghost",
|
|
327
|
+
size: "icon",
|
|
328
|
+
className: "size-7",
|
|
329
|
+
"aria-label": l.editBlock,
|
|
330
|
+
onClick: () => setEditing({ block, isNew: false }),
|
|
331
|
+
"data-testid": `${testId}-edit-block-${block.id}`,
|
|
332
|
+
children: /* @__PURE__ */ jsx(Pencil, { className: "size-3.5" })
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
/* @__PURE__ */ jsx(
|
|
336
|
+
Button,
|
|
337
|
+
{
|
|
338
|
+
variant: "ghost",
|
|
339
|
+
size: "icon",
|
|
340
|
+
className: "size-7",
|
|
341
|
+
"aria-label": l.removeBlock,
|
|
342
|
+
onClick: () => setBlocks(compactLayout(blocks.filter((b) => b.id !== block.id))),
|
|
343
|
+
"data-testid": `${testId}-remove-block-${block.id}`,
|
|
344
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" })
|
|
345
|
+
}
|
|
346
|
+
)
|
|
347
|
+
] })
|
|
300
348
|
}
|
|
301
349
|
) : /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: l.noBlocks }),
|
|
302
350
|
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
@@ -305,7 +353,7 @@ function ConnectedPagesPage({
|
|
|
305
353
|
" ",
|
|
306
354
|
l.addBlock
|
|
307
355
|
] }) }),
|
|
308
|
-
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", children:
|
|
356
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", children: ADDABLE_KINDS.map((kind) => {
|
|
309
357
|
const Icon = KIND_ICONS[kind];
|
|
310
358
|
return /* @__PURE__ */ jsxs(
|
|
311
359
|
DropdownMenuItem,
|
|
@@ -357,15 +405,43 @@ function ConnectedPagesPage({
|
|
|
357
405
|
onShare: () => void sharePage(open),
|
|
358
406
|
onDelete: () => void deletePage(open),
|
|
359
407
|
testId,
|
|
360
|
-
children: open.spec.blocks.length > 0 &&
|
|
361
|
-
|
|
408
|
+
children: open.spec.blocks.length > 0 && (canArrange(open) ? (
|
|
409
|
+
// Who may change the page arranges it as it is read: a drop saves at once.
|
|
410
|
+
/* @__PURE__ */ jsx(
|
|
411
|
+
EditablePageGrid,
|
|
412
|
+
{
|
|
413
|
+
blocks: arranged?.id === open.id ? arranged.blocks : open.spec.blocks,
|
|
414
|
+
onChange: (blocks) => void arrange(open, blocks),
|
|
415
|
+
labels: gridLabels,
|
|
416
|
+
testId,
|
|
417
|
+
renderBlock: (block) => /* @__PURE__ */ jsx(
|
|
418
|
+
PageBlockView,
|
|
419
|
+
{
|
|
420
|
+
block,
|
|
421
|
+
panelLabels,
|
|
422
|
+
tableLabels,
|
|
423
|
+
testId: `${testId}-block-${block.id}`
|
|
424
|
+
}
|
|
425
|
+
)
|
|
426
|
+
}
|
|
427
|
+
)
|
|
428
|
+
) : /* @__PURE__ */ jsx(PageGrid, { testId: `${testId}-grid`, children: inReadingOrder(normalizeLayout(open.spec.blocks)).map((block) => /* @__PURE__ */ jsx(
|
|
429
|
+
PageCell,
|
|
362
430
|
{
|
|
363
|
-
block,
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
431
|
+
layout: block.layout,
|
|
432
|
+
testId: `${testId}-cell-${block.id}`,
|
|
433
|
+
children: /* @__PURE__ */ jsx(
|
|
434
|
+
PageBlockView,
|
|
435
|
+
{
|
|
436
|
+
block,
|
|
437
|
+
panelLabels,
|
|
438
|
+
tableLabels,
|
|
439
|
+
testId: `${testId}-block-${block.id}`
|
|
440
|
+
}
|
|
441
|
+
)
|
|
442
|
+
},
|
|
443
|
+
block.id
|
|
444
|
+
)) }))
|
|
369
445
|
}
|
|
370
446
|
);
|
|
371
447
|
} else {
|