@parallelworks/tandem-web 0.179.2 → 0.181.0
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/_virtual/_virtual_i18n/en/common.js +66 -19
- package/_virtual/_virtual_i18n/es/common.js +66 -19
- package/_virtual/_virtual_i18n/ja/common.js +66 -19
- package/_virtual/_virtual_i18n/ko/common.js +66 -19
- package/_virtual/_virtual_i18n/zh/common.js +66 -19
- package/components/AgentWork.js +419 -382
- package/components/DocOutline.js +38 -35
- package/components/DocSeries.js +92 -88
- package/components/DocStart.js +288 -0
- package/components/DocTable.js +100 -93
- package/components/HoverCards.js +139 -124
- package/components/SharedViewer.js +1 -0
- package/components/SubpageViews.js +475 -0
- package/lib/docs.js +76 -65
- package/lib/glossary.js +11 -7
- package/lib/subpageViews.js +85 -0
- package/package.json +1 -1
- package/pages/decisions.js +90 -168
- package/routes/_workspace/docs/_doc2.js +236 -179
- package/routes/_workspace/docs/space2._space.js +113 -172
- package/routes/_workspace/teams/_key/settings2.js +94 -22
- package/routes/_workspace2.js +9 -9
- package/components/DocCalendar.js +0 -245
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { api as e, unwrap as t } from "../api/client.js";
|
|
2
|
+
import { agentsQuery as n, docTemplatesQuery as r, runnersQuery as i, teamsQuery as a, workspaceRunsQuery as o } from "../api/queries.js";
|
|
3
|
+
import { runnersFor as s } from "../lib/agents.js";
|
|
4
|
+
import { isoDate as c } from "../lib/datePhrases.js";
|
|
5
|
+
import { docPath as l, useTemplateValues as u } from "../lib/docs.js";
|
|
6
|
+
import { modeBelow as d, runnerModeCommand as f, usePermissionModeName as p } from "../lib/permissionModes.js";
|
|
7
|
+
import { Link as m } from "../lib/router.js";
|
|
8
|
+
import { AgentIcon as h, CalendarIcon as g, FileTextIcon as _, FolderIcon as v, UploadIcon as y } from "./icons.js";
|
|
9
|
+
import { useMarkdownTransfer as b } from "./MarkdownTransfer.js";
|
|
10
|
+
import { RunnerBadge as x } from "./RunnerBadge.js";
|
|
11
|
+
import { ActionMenu as S, Button as C, ErrorText as w, Popover as T, RelativeTime as E, Select as D, Textarea as O, useClosePopover as k } from "@parallelworks/ui";
|
|
12
|
+
import { useEffect as A, useState as j } from "react";
|
|
13
|
+
import { useErrorMessage as M } from "@parallelworks/problem/react";
|
|
14
|
+
import { useFormatter as N, useTranslations as P } from "use-intl";
|
|
15
|
+
import { jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
16
|
+
import { useMutation as L, useQuery as R, useQueryClient as z } from "@tanstack/react-query";
|
|
17
|
+
// src/components/DocStart.tsx
|
|
18
|
+
function B(e, t) {
|
|
19
|
+
let [n, r] = j(e ? e.isEmpty : !t.trim());
|
|
20
|
+
return A(() => {
|
|
21
|
+
if (!e) return;
|
|
22
|
+
let t = () => r(e.isEmpty);
|
|
23
|
+
return t(), e.on("update", t), () => {
|
|
24
|
+
e.off("update", t);
|
|
25
|
+
};
|
|
26
|
+
}, [e]), n;
|
|
27
|
+
}
|
|
28
|
+
function V({ workspace: n, doc: i, team: a, editor: o }) {
|
|
29
|
+
let s = P("docStart"), l = P("docs"), d = N(), f = M(), p = z(), m = B(o, i.body ?? ""), { data: h = [] } = R(r(n)), x = b(n), T = u(), E = L({
|
|
30
|
+
mutationFn: async (r) => t(await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}", {
|
|
31
|
+
params: { path: {
|
|
32
|
+
workspace: n,
|
|
33
|
+
doc: i.key
|
|
34
|
+
} },
|
|
35
|
+
body: {
|
|
36
|
+
...r,
|
|
37
|
+
ifVersion: i.version
|
|
38
|
+
}
|
|
39
|
+
})),
|
|
40
|
+
onSuccess: (e) => p.setQueryData([
|
|
41
|
+
"workspace",
|
|
42
|
+
n,
|
|
43
|
+
"docs",
|
|
44
|
+
i.key
|
|
45
|
+
], e),
|
|
46
|
+
onSettled: () => p.invalidateQueries({ queryKey: [
|
|
47
|
+
"workspace",
|
|
48
|
+
n,
|
|
49
|
+
"docs"
|
|
50
|
+
] })
|
|
51
|
+
});
|
|
52
|
+
if (!m) return null;
|
|
53
|
+
let D = !i.title.trim() || i.title === l("untitled"), O = /* @__PURE__ */ new Date(), k = h.filter((e) => e.starter || (e.teamId ?? "") === (i.teamId ?? "")).sort((e, t) => Number(e.starter) - Number(t.starter));
|
|
54
|
+
return /* @__PURE__ */ I("section", {
|
|
55
|
+
"aria-labelledby": "doc-start",
|
|
56
|
+
className: "mt-2",
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ F("h2", {
|
|
59
|
+
id: "doc-start",
|
|
60
|
+
className: "text-xs text-muted-foreground",
|
|
61
|
+
children: s("title")
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ I("div", {
|
|
64
|
+
className: "mt-2 flex flex-wrap items-center gap-2",
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ F(H, {
|
|
67
|
+
workspace: n,
|
|
68
|
+
doc: i,
|
|
69
|
+
team: a
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ I(C, {
|
|
72
|
+
size: "sm",
|
|
73
|
+
variant: "secondary",
|
|
74
|
+
disabled: E.isPending,
|
|
75
|
+
onClick: () => E.mutate({
|
|
76
|
+
startFrom: "meeting-notes",
|
|
77
|
+
variables: { date: c(O) },
|
|
78
|
+
...D && { title: s("meetingTitle", { date: d.dateTime(O, { dateStyle: "medium" }) }) }
|
|
79
|
+
}),
|
|
80
|
+
children: [/* @__PURE__ */ F(g, { className: "size-3.5" }), s("meetingNotes")]
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ F(S, {
|
|
83
|
+
label: s("templates"),
|
|
84
|
+
empty: s("noTemplates"),
|
|
85
|
+
items: k.map((e) => ({
|
|
86
|
+
label: e.title,
|
|
87
|
+
onClick: () => E.mutate({
|
|
88
|
+
startFrom: e.id,
|
|
89
|
+
variables: T()
|
|
90
|
+
})
|
|
91
|
+
})),
|
|
92
|
+
trigger: /* @__PURE__ */ I(C, {
|
|
93
|
+
size: "sm",
|
|
94
|
+
variant: "secondary",
|
|
95
|
+
disabled: E.isPending,
|
|
96
|
+
children: [/* @__PURE__ */ F(_, { className: "size-3.5" }), s("templates")]
|
|
97
|
+
})
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ I(C, {
|
|
100
|
+
size: "sm",
|
|
101
|
+
variant: "secondary",
|
|
102
|
+
onClick: () => x.pick({ parent: i.key }),
|
|
103
|
+
children: [/* @__PURE__ */ F(y, { className: "size-3.5" }), s("importFiles")]
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ I(C, {
|
|
106
|
+
size: "sm",
|
|
107
|
+
variant: "secondary",
|
|
108
|
+
onClick: () => x.pick({ parent: i.key }, !0),
|
|
109
|
+
children: [/* @__PURE__ */ F(v, { className: "size-3.5" }), s("importFolder")]
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
}),
|
|
113
|
+
E.isError && /* @__PURE__ */ F(w, {
|
|
114
|
+
className: "mt-2",
|
|
115
|
+
children: f(E.error)
|
|
116
|
+
}),
|
|
117
|
+
x.dialog
|
|
118
|
+
]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function H({ workspace: e, doc: t, team: n }) {
|
|
122
|
+
let r = P("docStart");
|
|
123
|
+
return /* @__PURE__ */ F(T, {
|
|
124
|
+
title: r("askAgent"),
|
|
125
|
+
align: "start",
|
|
126
|
+
initialFocus: "first-control",
|
|
127
|
+
className: "w-96 max-w-[calc(100vw-2rem)]",
|
|
128
|
+
trigger: /* @__PURE__ */ I(C, {
|
|
129
|
+
size: "sm",
|
|
130
|
+
variant: "secondary",
|
|
131
|
+
children: [/* @__PURE__ */ F(h, { className: "size-3.5" }), r("askAgent")]
|
|
132
|
+
}),
|
|
133
|
+
children: /* @__PURE__ */ F(U, {
|
|
134
|
+
workspace: e,
|
|
135
|
+
doc: t,
|
|
136
|
+
team: n
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function U({ workspace: r, doc: o, team: c }) {
|
|
141
|
+
let u = P("docStart"), m = M(), h = p(), g = k(), _ = z(), { data: v = [] } = R(n(r)), { data: y = [] } = R(i(r)), { data: b = [] } = R(a(r)), S = v.filter((e) => !e.archivedAt), [T, E] = j(S[0]?.slug ?? ""), [A, N] = j(c?.key ?? b.find((e) => !e.archivedAt)?.key ?? ""), [B, V] = j(""), H = S.find((e) => e.slug === T), U = H ? s(H, y).find((e) => e.online)?.runner : void 0, W = H && U?.permissionMode && d(U.permissionMode, H.permissionMode) ? U.permissionMode : void 0, G = L({
|
|
142
|
+
mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/teams/{key}/issues", {
|
|
143
|
+
params: { path: {
|
|
144
|
+
workspace: r,
|
|
145
|
+
key: A
|
|
146
|
+
} },
|
|
147
|
+
body: {
|
|
148
|
+
title: u("issueTitle", { doc: o.title || u("thisDoc") }),
|
|
149
|
+
body: `${B.trim()}\n\n${u("issueBody", { doc: `[${o.title || u("thisDoc")}](${l(r, o)})` })}`,
|
|
150
|
+
origin: { doc: o.key },
|
|
151
|
+
assignees: [{
|
|
152
|
+
kind: "agent",
|
|
153
|
+
handle: T
|
|
154
|
+
}]
|
|
155
|
+
}
|
|
156
|
+
})),
|
|
157
|
+
onSuccess: () => {
|
|
158
|
+
_.invalidateQueries({ queryKey: [
|
|
159
|
+
"workspace",
|
|
160
|
+
r,
|
|
161
|
+
"runs"
|
|
162
|
+
] }), g();
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
return S.length === 0 ? /* @__PURE__ */ F("p", {
|
|
166
|
+
className: "text-sm text-muted-foreground",
|
|
167
|
+
children: u("noAgents")
|
|
168
|
+
}) : /* @__PURE__ */ I("form", {
|
|
169
|
+
className: "space-y-3",
|
|
170
|
+
onSubmit: (e) => {
|
|
171
|
+
e.preventDefault(), B.trim() && T && A && G.mutate();
|
|
172
|
+
},
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ I("div", {
|
|
175
|
+
className: "flex gap-2",
|
|
176
|
+
children: [/* @__PURE__ */ F(D, {
|
|
177
|
+
"aria-label": u("agent"),
|
|
178
|
+
value: T,
|
|
179
|
+
onValueChange: (e) => e && E(e),
|
|
180
|
+
items: S.map((e) => ({
|
|
181
|
+
value: e.slug,
|
|
182
|
+
label: e.name
|
|
183
|
+
})),
|
|
184
|
+
width: "fill"
|
|
185
|
+
}), !c && /* @__PURE__ */ F(D, {
|
|
186
|
+
"aria-label": u("team"),
|
|
187
|
+
value: A,
|
|
188
|
+
onValueChange: (e) => e && N(e),
|
|
189
|
+
items: b.filter((e) => !e.archivedAt).map((e) => ({
|
|
190
|
+
value: e.key,
|
|
191
|
+
label: e.name
|
|
192
|
+
})),
|
|
193
|
+
width: "fill"
|
|
194
|
+
})]
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ F(O, {
|
|
197
|
+
"aria-label": u("prompt"),
|
|
198
|
+
placeholder: u("promptPlaceholder"),
|
|
199
|
+
value: B,
|
|
200
|
+
onChange: (e) => V(e.target.value),
|
|
201
|
+
onKeyDown: (e) => {
|
|
202
|
+
e.key === "Enter" && (e.metaKey || e.ctrlKey) && e.currentTarget.form?.requestSubmit();
|
|
203
|
+
},
|
|
204
|
+
rows: 4
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ I("div", {
|
|
207
|
+
className: "space-y-1 text-xs text-muted-foreground",
|
|
208
|
+
children: [U ? /* @__PURE__ */ F("p", {
|
|
209
|
+
className: "flex flex-wrap items-center gap-1",
|
|
210
|
+
children: u.rich("runsOn", { runner: () => /* @__PURE__ */ F(x, {
|
|
211
|
+
workspace: r,
|
|
212
|
+
name: U.name,
|
|
213
|
+
kind: U.kind
|
|
214
|
+
}) })
|
|
215
|
+
}) : /* @__PURE__ */ F("p", {
|
|
216
|
+
className: "text-warning",
|
|
217
|
+
children: u("noRunner")
|
|
218
|
+
}), U && W && H && /* @__PURE__ */ F("p", {
|
|
219
|
+
className: "text-pretty",
|
|
220
|
+
children: u.rich("capped", {
|
|
221
|
+
runner: U.name,
|
|
222
|
+
got: h(W),
|
|
223
|
+
asked: h(H.permissionMode),
|
|
224
|
+
code: () => /* @__PURE__ */ F("code", { children: f(H.permissionMode) })
|
|
225
|
+
})
|
|
226
|
+
})]
|
|
227
|
+
}),
|
|
228
|
+
G.isError && /* @__PURE__ */ F(w, { children: m(G.error) }),
|
|
229
|
+
/* @__PURE__ */ F("div", {
|
|
230
|
+
className: "flex justify-end",
|
|
231
|
+
children: /* @__PURE__ */ F(C, {
|
|
232
|
+
type: "submit",
|
|
233
|
+
size: "sm",
|
|
234
|
+
variant: "primary",
|
|
235
|
+
loading: G.isPending,
|
|
236
|
+
disabled: !B.trim() || !T || !A,
|
|
237
|
+
children: u("start")
|
|
238
|
+
})
|
|
239
|
+
})
|
|
240
|
+
]
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function W({ workspace: e, doc: t }) {
|
|
244
|
+
let n = P("docStart"), r = P("agentWork.state"), { data: i = [] } = R(o(e, {
|
|
245
|
+
doc: t.key,
|
|
246
|
+
live: !0
|
|
247
|
+
}));
|
|
248
|
+
return i.length === 0 ? null : /* @__PURE__ */ F("ul", {
|
|
249
|
+
"aria-label": n("runs"),
|
|
250
|
+
className: "mt-3 space-y-1.5",
|
|
251
|
+
children: i.map((t) => /* @__PURE__ */ I("li", {
|
|
252
|
+
className: "flex flex-wrap items-center gap-x-2 gap-y-1 rounded-lg border border-agent/50 bg-card px-3 py-2 text-xs",
|
|
253
|
+
children: [
|
|
254
|
+
/* @__PURE__ */ F("span", {
|
|
255
|
+
className: "font-medium",
|
|
256
|
+
children: t.agentName
|
|
257
|
+
}),
|
|
258
|
+
/* @__PURE__ */ F("span", {
|
|
259
|
+
className: "text-muted-foreground",
|
|
260
|
+
children: r(t.state)
|
|
261
|
+
}),
|
|
262
|
+
/* @__PURE__ */ F(m, {
|
|
263
|
+
to: "/$workspace/issues/$identifier",
|
|
264
|
+
params: {
|
|
265
|
+
workspace: e,
|
|
266
|
+
identifier: t.identifier
|
|
267
|
+
},
|
|
268
|
+
className: "min-w-0 flex-1 truncate text-muted-foreground hover:text-foreground hover:underline",
|
|
269
|
+
children: t.identifier
|
|
270
|
+
}),
|
|
271
|
+
t.lastRunnerName ? /* @__PURE__ */ F(x, {
|
|
272
|
+
workspace: e,
|
|
273
|
+
name: t.lastRunnerName,
|
|
274
|
+
kind: t.runnerKind
|
|
275
|
+
}) : /* @__PURE__ */ F("span", {
|
|
276
|
+
className: "text-muted-foreground",
|
|
277
|
+
children: n("waitingForRunner")
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ F(E, {
|
|
280
|
+
value: t.createdAt,
|
|
281
|
+
format: "compact",
|
|
282
|
+
className: "text-muted-foreground"
|
|
283
|
+
})
|
|
284
|
+
]
|
|
285
|
+
}, t.id))
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
export { W as DocRuns, V as DocStart };
|
package/components/DocTable.js
CHANGED
|
@@ -3,120 +3,127 @@ import { docPropertiesQuery as t, spaceScope as n, useDocPropertyActions as r }
|
|
|
3
3
|
import { docRef as i } from "../lib/docs.js";
|
|
4
4
|
import { usePeople as a } from "../lib/people.js";
|
|
5
5
|
import { useCan as o } from "../lib/roles.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { keepPreviousData as _, useQuery as v } from "@tanstack/react-query";
|
|
6
|
+
import { DocIcon as s } from "./DocIcon.js";
|
|
7
|
+
import { usePropertyText as c } from "./DocProperties.js";
|
|
8
|
+
import { cx as l } from "@parallelworks/ui";
|
|
9
|
+
import { Link as u } from "@tanstack/react-router";
|
|
10
|
+
import { useState as d } from "react";
|
|
11
|
+
import { useFormatter as f, useTranslations as p } from "use-intl";
|
|
12
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
13
|
+
import { keepPreviousData as g, useQuery as _ } from "@tanstack/react-query";
|
|
15
14
|
// src/components/DocTable.tsx
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
let
|
|
15
|
+
var v = (e) => e.kind === "select" || e.kind === "person";
|
|
16
|
+
function y(n, r, i, a = !1) {
|
|
17
|
+
let o = Object.entries(i.filters ?? {}).map(([e, t]) => `${e}=${t}`), { data: s = [], isPending: l } = _({
|
|
19
18
|
...e(n, {
|
|
20
19
|
...r === "workspace" ? { workspace: !0 } : { team: r },
|
|
21
|
-
...
|
|
20
|
+
...o.length > 0 && { property: o },
|
|
21
|
+
...a && { top: !0 }
|
|
22
22
|
}),
|
|
23
|
-
placeholderData:
|
|
24
|
-
}), { data:
|
|
25
|
-
if (
|
|
26
|
-
if (!
|
|
27
|
-
let t = e.properties?.[
|
|
28
|
-
return
|
|
23
|
+
placeholderData: g
|
|
24
|
+
}), { data: u = [] } = _(t(n, r)), d = c(n), f = i.sort ?? "title", p = u.find((e) => e.id === f), m = (e) => {
|
|
25
|
+
if (f === "updated") return e.updatedAt;
|
|
26
|
+
if (!p) return e.title.toLowerCase();
|
|
27
|
+
let t = e.properties?.[p.id];
|
|
28
|
+
return p.kind === "number" ? typeof t == "number" ? t : -Infinity : d(p, t).toLowerCase();
|
|
29
29
|
};
|
|
30
30
|
return {
|
|
31
|
-
docs:
|
|
32
|
-
let n =
|
|
31
|
+
docs: s.filter((e) => !e.template).sort((e, t) => {
|
|
32
|
+
let n = m(e), r = m(t), a = n < r ? -1 : +(n > r);
|
|
33
33
|
return i.desc ? -a : a;
|
|
34
34
|
}),
|
|
35
|
-
props:
|
|
36
|
-
isPending:
|
|
35
|
+
props: u,
|
|
36
|
+
isPending: l
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
let
|
|
41
|
-
|
|
39
|
+
function b({ workspace: e, space: t, layout: n, config: r, query: o = "" }) {
|
|
40
|
+
let l = p("docViews"), d = f(), { actorName: g } = a(e), _ = o.trim().toLowerCase(), b = n === "table" && !_ && Object.keys(r.filters ?? {}).length === 0, { docs: S, props: C, isPending: w } = y(e, t, r, b), T = _ ? S.filter((e) => e.title.toLowerCase().includes(_)) : S, E = new Map(S.map((e) => [e.id, e])), D = (e) => {
|
|
41
|
+
let t = [];
|
|
42
|
+
for (let n = E.get(e.parentId ?? ""); n && !(t.length > 20); n = E.get(n.parentId ?? "")) t.unshift(n.title);
|
|
43
|
+
return t.join(" / ");
|
|
44
|
+
}, O = c(e), k = (e, t) => e.properties?.[t.id];
|
|
45
|
+
if (w) return /* @__PURE__ */ m("p", {
|
|
42
46
|
className: "p-4 text-sm text-muted-foreground",
|
|
43
|
-
children:
|
|
44
|
-
});
|
|
45
|
-
if (n === "calendar") return /* @__PURE__ */ h(s, {
|
|
46
|
-
workspace: e,
|
|
47
|
-
space: t,
|
|
48
|
-
config: r,
|
|
49
|
-
query: o
|
|
47
|
+
children: l("loading")
|
|
50
48
|
});
|
|
51
49
|
if (n === "board") {
|
|
52
|
-
let n =
|
|
53
|
-
return n ? /* @__PURE__ */
|
|
50
|
+
let n = C.find((e) => e.id === r.groupBy && v(e));
|
|
51
|
+
return n ? /* @__PURE__ */ m(x, {
|
|
54
52
|
workspace: e,
|
|
55
53
|
space: t,
|
|
56
54
|
docs: T,
|
|
57
|
-
props:
|
|
55
|
+
props: C,
|
|
58
56
|
by: n
|
|
59
|
-
}) : /* @__PURE__ */
|
|
57
|
+
}) : /* @__PURE__ */ m("p", {
|
|
60
58
|
className: "p-4 text-sm text-muted-foreground",
|
|
61
|
-
children:
|
|
59
|
+
children: l("pickGroup")
|
|
62
60
|
});
|
|
63
61
|
}
|
|
64
|
-
let
|
|
65
|
-
return T.length === 0 ? /* @__PURE__ */
|
|
62
|
+
let A = r.columns ? r.columns.flatMap((e) => C.filter((t) => t.id === e)) : C;
|
|
63
|
+
return T.length === 0 ? /* @__PURE__ */ m("p", {
|
|
66
64
|
className: "p-4 text-sm text-muted-foreground",
|
|
67
|
-
children:
|
|
68
|
-
}) : /* @__PURE__ */
|
|
65
|
+
children: l("none")
|
|
66
|
+
}) : /* @__PURE__ */ m("div", {
|
|
69
67
|
className: "overflow-x-auto",
|
|
70
|
-
children: /* @__PURE__ */
|
|
68
|
+
children: /* @__PURE__ */ h("table", {
|
|
71
69
|
className: "doc-table w-full min-w-max text-sm",
|
|
72
|
-
children: [/* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
70
|
+
children: [/* @__PURE__ */ m("thead", { children: /* @__PURE__ */ h("tr", { children: [
|
|
71
|
+
/* @__PURE__ */ m("th", {
|
|
74
72
|
scope: "col",
|
|
75
|
-
children:
|
|
73
|
+
children: l("docTitle")
|
|
76
74
|
}),
|
|
77
|
-
|
|
75
|
+
A.map((e) => /* @__PURE__ */ m("th", {
|
|
78
76
|
scope: "col",
|
|
79
77
|
children: e.name
|
|
80
78
|
}, e.id)),
|
|
81
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ m("th", {
|
|
82
80
|
scope: "col",
|
|
83
|
-
children:
|
|
81
|
+
children: l("author")
|
|
84
82
|
}),
|
|
85
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ m("th", {
|
|
86
84
|
scope: "col",
|
|
87
|
-
children:
|
|
85
|
+
children: l("updated")
|
|
88
86
|
})
|
|
89
|
-
] }) }), /* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
87
|
+
] }) }), /* @__PURE__ */ m("tbody", { children: T.map((t) => {
|
|
88
|
+
let n = b ? "" : D(t);
|
|
89
|
+
return /* @__PURE__ */ h("tr", { children: [
|
|
90
|
+
/* @__PURE__ */ h("td", { children: [/* @__PURE__ */ h("div", {
|
|
91
|
+
className: "flex items-center gap-2",
|
|
92
|
+
children: [/* @__PURE__ */ h(u, {
|
|
93
|
+
to: "/$workspace/docs/$doc",
|
|
94
|
+
params: {
|
|
95
|
+
workspace: e,
|
|
96
|
+
doc: i(t)
|
|
97
|
+
},
|
|
98
|
+
className: "flex min-w-0 items-center gap-2 font-medium hover:underline",
|
|
99
|
+
children: [/* @__PURE__ */ m(s, { icon: t.icon }), /* @__PURE__ */ m("span", {
|
|
100
|
+
className: "truncate",
|
|
101
|
+
children: t.title
|
|
102
|
+
})]
|
|
103
|
+
}), b && (t.children ?? 0) > 0 && /* @__PURE__ */ m("span", {
|
|
104
|
+
className: "shrink-0 text-xs tabular-nums text-muted-foreground",
|
|
105
|
+
children: l("childCount", { count: t.children ?? 0 })
|
|
106
|
+
})]
|
|
107
|
+
}), n && /* @__PURE__ */ m("span", {
|
|
108
|
+
className: "ml-6 block truncate text-xs text-muted-foreground",
|
|
109
|
+
children: l("inParent", { parent: n })
|
|
110
|
+
})] }),
|
|
111
|
+
A.map((e) => /* @__PURE__ */ m("td", { children: O(e, k(t, e)) }, e.id)),
|
|
112
|
+
/* @__PURE__ */ m("td", {
|
|
113
|
+
className: "text-muted-foreground",
|
|
114
|
+
children: g(t.creator)
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ m("td", {
|
|
117
|
+
className: "text-muted-foreground",
|
|
118
|
+
children: d.dateTime(new Date(t.updatedAt), { dateStyle: "medium" })
|
|
119
|
+
})
|
|
120
|
+
] }, t.id);
|
|
121
|
+
}) })]
|
|
115
122
|
})
|
|
116
123
|
});
|
|
117
124
|
}
|
|
118
|
-
function
|
|
119
|
-
let v =
|
|
125
|
+
function x({ workspace: e, space: t, docs: f, props: g, by: _ }) {
|
|
126
|
+
let v = p("docViews"), { members: y } = a(e), b = c(e), x = o(e, "edit_docs", n(t)), S = r(e), [C, w] = d(null), [T, E] = d(null), D = [..._.kind === "select" ? _.options.map((e) => ({
|
|
120
127
|
key: e.id ?? "",
|
|
121
128
|
label: e.name
|
|
122
129
|
})) : y.map((e) => ({
|
|
@@ -128,13 +135,13 @@ function S({ workspace: e, space: t, docs: s, props: p, by: _ }) {
|
|
|
128
135
|
}], O = (e) => {
|
|
129
136
|
let t = e.properties?.[_.id];
|
|
130
137
|
return typeof t == "string" ? t : "";
|
|
131
|
-
}, k = D.filter((e) => _.kind === "select" || e.key === "" ||
|
|
132
|
-
return /* @__PURE__ */
|
|
138
|
+
}, k = D.filter((e) => _.kind === "select" || e.key === "" || f.some((t) => O(t) === e.key)), A = g.filter((e) => e.id !== _.id).slice(0, 2);
|
|
139
|
+
return /* @__PURE__ */ m("ul", {
|
|
133
140
|
className: "flex gap-3 overflow-x-auto p-3",
|
|
134
141
|
"aria-label": v("board"),
|
|
135
142
|
children: k.map((t) => {
|
|
136
|
-
let n =
|
|
137
|
-
return /* @__PURE__ */
|
|
143
|
+
let n = f.filter((e) => O(e) === t.key);
|
|
144
|
+
return /* @__PURE__ */ h("li", {
|
|
138
145
|
"aria-label": t.label,
|
|
139
146
|
onDragOver: (e) => {
|
|
140
147
|
C && (e.preventDefault(), E(t.key));
|
|
@@ -146,37 +153,37 @@ function S({ workspace: e, space: t, docs: s, props: p, by: _ }) {
|
|
|
146
153
|
values: { [_.id]: t.key || null }
|
|
147
154
|
}), w(null), E(null);
|
|
148
155
|
},
|
|
149
|
-
className:
|
|
150
|
-
children: [/* @__PURE__ */
|
|
156
|
+
className: l("flex w-64 shrink-0 flex-col rounded-lg border bg-muted/30", T === t.key ? "border-primary" : "border-border"),
|
|
157
|
+
children: [/* @__PURE__ */ h("p", {
|
|
151
158
|
className: "flex items-center gap-2 px-3 py-2 text-xs font-medium",
|
|
152
|
-
children: [/* @__PURE__ */
|
|
159
|
+
children: [/* @__PURE__ */ m("span", {
|
|
153
160
|
className: "truncate",
|
|
154
161
|
children: t.label
|
|
155
|
-
}), /* @__PURE__ */
|
|
162
|
+
}), /* @__PURE__ */ m("span", {
|
|
156
163
|
className: "text-muted-foreground tabular-nums",
|
|
157
164
|
children: n.length
|
|
158
165
|
})]
|
|
159
|
-
}), /* @__PURE__ */
|
|
166
|
+
}), /* @__PURE__ */ m("ul", {
|
|
160
167
|
className: "flex flex-col gap-2 px-2 pb-2",
|
|
161
|
-
children: n.map((t) => /* @__PURE__ */
|
|
168
|
+
children: n.map((t) => /* @__PURE__ */ h("li", {
|
|
162
169
|
draggable: x,
|
|
163
170
|
onDragStart: () => w(t.key),
|
|
164
171
|
onDragEnd: () => w(null),
|
|
165
172
|
className: "rounded-md border border-border bg-card p-2.5 text-sm shadow-xs",
|
|
166
|
-
children: [/* @__PURE__ */
|
|
173
|
+
children: [/* @__PURE__ */ h(u, {
|
|
167
174
|
to: "/$workspace/docs/$doc",
|
|
168
175
|
params: {
|
|
169
176
|
workspace: e,
|
|
170
177
|
doc: i(t)
|
|
171
178
|
},
|
|
172
179
|
className: "flex items-center gap-2 font-medium hover:underline",
|
|
173
|
-
children: [/* @__PURE__ */
|
|
180
|
+
children: [/* @__PURE__ */ m(s, { icon: t.icon }), /* @__PURE__ */ m("span", {
|
|
174
181
|
className: "truncate",
|
|
175
182
|
children: t.title
|
|
176
183
|
})]
|
|
177
184
|
}), A.map((e) => {
|
|
178
185
|
let n = b(e, t.properties?.[e.id]);
|
|
179
|
-
return n ? /* @__PURE__ */
|
|
186
|
+
return n ? /* @__PURE__ */ h("p", {
|
|
180
187
|
className: "mt-1 truncate text-xs text-muted-foreground",
|
|
181
188
|
children: [
|
|
182
189
|
e.name,
|
|
@@ -191,4 +198,4 @@ function S({ workspace: e, space: t, docs: s, props: p, by: _ }) {
|
|
|
191
198
|
})
|
|
192
199
|
});
|
|
193
200
|
}
|
|
194
|
-
export {
|
|
201
|
+
export { b as DocTable, v as groupable, y as useSpaceDocs };
|