@parallelworks/tandem-web 0.139.0 → 0.139.1

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.
@@ -1,40 +1,40 @@
1
1
  import { api as e, unwrap as t } from "../../../api/client.js";
2
- import { Link as n, useNavigate as r } from "../../../lib/router.js";
3
- import { areaThreadQuery as i, areasQuery as a, countsQuery as o, teamsQuery as s } from "../../../api/queries.js";
2
+ import { usePageTitle as n } from "../../../lib/pageTitle.js";
3
+ import { Link as r, useNavigate as i } from "../../../lib/router.js";
4
+ import { areaThreadQuery as a, areasQuery as ee, countsQuery as o, teamsQuery as s } from "../../../api/queries.js";
4
5
  import { Route as c } from "./_area.js";
5
- import { AddIcon as l, ChevronRightIcon as u, FileTextIcon as ee } from "../../../components/icons.js";
6
- import { docRef as d } from "../../../lib/docs.js";
7
- import { useNewIssue as f } from "../../../lib/newIssue.js";
8
- import { usePageTitle as p } from "../../../lib/pageTitle.js";
9
- import { Editor as m } from "../../../components/Editor.js";
10
- import { useShortcuts as te } from "../../../lib/shortcuts.js";
11
- import { DecisionCard as h } from "../../../components/AgentWork.js";
12
- import { FoldedAnswer as ne, KnowledgeRow as re } from "../../../components/AreaWork.js";
13
- import { WorkCounts as ie } from "../../../components/WorkCounts.js";
14
- import { Button as g, CountBadge as _, Kbd as v } from "@parallelworks/ui";
15
- import { useEffect as y, useState as ae } from "react";
16
- import { useLocale as oe, useTranslations as b } from "use-intl";
17
- import { jsx as x, jsxs as S } from "react/jsx-runtime";
18
- import { useMutation as C, useQuery as w, useQueryClient as T, useSuspenseQuery as E } from "@tanstack/react-query";
6
+ import { AddIcon as l, ChevronRightIcon as u, FileTextIcon as te } from "../../../components/icons.js";
7
+ import { docRef as ne } from "../../../lib/docs.js";
8
+ import { useNewIssue as re } from "../../../lib/newIssue.js";
9
+ import { Editor as ie } from "../../../components/Editor.js";
10
+ import { useShortcuts as ae } from "../../../lib/shortcuts.js";
11
+ import { DecisionCard as d } from "../../../components/AgentWork.js";
12
+ import { FoldedAnswer as f, KnowledgeRow as p } from "../../../components/AreaWork.js";
13
+ import { WorkCounts as m } from "../../../components/WorkCounts.js";
14
+ import { Button as h, CountBadge as g, Kbd as _ } from "@parallelworks/ui";
15
+ import { useEffect as v, useState as y } from "react";
16
+ import { useLocale as b, useTranslations as x } from "use-intl";
17
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
18
+ import { useMutation as oe, useQuery as w, useQueryClient as se, useSuspenseQuery as T } from "@tanstack/react-query";
19
19
  // src/routes/$workspace/areas/$area.tsx?tsr-split=component
20
- function D() {
20
+ function E() {
21
21
  let { workspace: e, area: t } = c.useParams();
22
- return E(i(e, t)).data;
22
+ return T(a(e, t)).data;
23
23
  }
24
- function O() {
25
- let e = D();
26
- return /* @__PURE__ */ x(k, { thread: e }, e.area.id);
24
+ function D() {
25
+ let e = E();
26
+ return /* @__PURE__ */ S(k, { thread: e }, e.area.id);
27
27
  }
28
- var se = (...e) => e.filter(Boolean).join(" ");
29
- function k({ thread: i }) {
30
- let v = b("areaPage"), D = oe(), { workspace: O, area: k } = c.useParams(), { decision: M } = c.useSearch(), N = r(), P = T(), { data: F } = E(o(O)), { data: I = [] } = w(a(O)), { data: L = [] } = w(s(O)), R = f(), { area: z, open: B, answered: V, knowledge: H, siblings: U, summary: W } = i;
31
- p(z.title);
32
- let [G] = ae(() => i.lastVisitedAt ? Date.parse(i.lastVisitedAt) : null), K = (e) => !!e && G !== null && Date.parse(e) > G;
33
- y(() => {
28
+ var O = (...e) => e.filter(Boolean).join(" ");
29
+ function k({ thread: a }) {
30
+ let _ = x("areaPage"), E = b(), { workspace: D, area: k } = c.useParams(), { decision: M } = c.useSearch(), N = i(), P = se(), { data: F } = T(o(D)), { data: I = [] } = w(ee(D)), { data: L = [] } = w(s(D)), R = re(), { area: z, open: B, answered: V, knowledge: H, siblings: U, summary: W } = a;
31
+ n(z.title);
32
+ let [G] = y(() => a.lastVisitedAt ? Date.parse(a.lastVisitedAt) : null), K = (e) => !!e && G !== null && Date.parse(e) > G;
33
+ v(() => {
34
34
  k.toLowerCase() !== z.key && N({
35
35
  to: "/$workspace/areas/$area",
36
36
  params: {
37
- workspace: O,
37
+ workspace: D,
38
38
  area: z.key
39
39
  },
40
40
  search: (e) => e,
@@ -43,35 +43,35 @@ function k({ thread: i }) {
43
43
  }, [
44
44
  k,
45
45
  z.key,
46
- O,
46
+ D,
47
47
  N
48
- ]), y(() => {
48
+ ]), v(() => {
49
49
  e.POST("/api/v1/workspaces/{workspace}/areas/{area}/visit", { params: { path: {
50
- workspace: O,
50
+ workspace: D,
51
51
  area: z.key
52
52
  } } });
53
- }, [O, z.key]);
53
+ }, [D, z.key]);
54
54
  let q = B.find((e) => e.identifier.toLowerCase() === M?.toLowerCase() || e.id === M), J = q?.id;
55
- y(() => {
55
+ v(() => {
56
56
  J && document.getElementById(`decision-${J}`)?.scrollIntoView({ block: "center" });
57
57
  }, [J]);
58
- let Y = C({
58
+ let Y = oe({
59
59
  mutationFn: async ({ decision: n, optionId: r }) => t(await e.POST("/api/v1/workspaces/{workspace}/decisions/{decisionId}/answer", {
60
60
  params: { path: {
61
- workspace: O,
61
+ workspace: D,
62
62
  decisionId: n.id
63
63
  } },
64
64
  body: { optionId: r }
65
65
  })),
66
66
  onSettled: () => P.invalidateQueries({ queryKey: [
67
67
  "workspace",
68
- O,
68
+ D,
69
69
  "decisions"
70
70
  ] })
71
71
  }), ce = (e) => N({
72
72
  to: "/$workspace/areas/$area",
73
73
  params: {
74
- workspace: O,
74
+ workspace: D,
75
75
  area: z.key
76
76
  },
77
77
  search: e ? { decision: e.identifier.toLowerCase() } : {},
@@ -81,7 +81,7 @@ function k({ thread: i }) {
81
81
  t && N({
82
82
  to: "/$workspace/areas/$area",
83
83
  params: {
84
- workspace: O,
84
+ workspace: D,
85
85
  area: t.key
86
86
  }
87
87
  });
@@ -103,48 +103,48 @@ function k({ thread: i }) {
103
103
  optionId: t.id
104
104
  });
105
105
  };
106
- te(Z);
106
+ ae(Z);
107
107
  let Q = L.find((e) => e.id === z.teamId), $ = [];
108
108
  for (let e = I.find((e) => e.id === z.parentId); e; e = I.find((t) => t.id === e?.parentId)) $.unshift(e);
109
- return /* @__PURE__ */ S("div", {
109
+ return /* @__PURE__ */ C("div", {
110
110
  className: "flex h-full flex-col",
111
111
  children: [
112
- /* @__PURE__ */ S("header", {
112
+ /* @__PURE__ */ C("header", {
113
113
  className: "flex h-12 shrink-0 items-center gap-1.5 border-b border-border px-4 text-sm md:px-5",
114
114
  children: [
115
- /* @__PURE__ */ x(n, {
115
+ /* @__PURE__ */ S(r, {
116
116
  to: "/$workspace/areas",
117
- params: { workspace: O },
117
+ params: { workspace: D },
118
118
  className: "text-muted-foreground hover:text-foreground",
119
- children: v("areas")
119
+ children: _("areas")
120
120
  }),
121
- $.map((e) => /* @__PURE__ */ S("span", {
121
+ $.map((e) => /* @__PURE__ */ C("span", {
122
122
  className: "flex min-w-0 items-center gap-1.5 max-sm:hidden",
123
- children: [/* @__PURE__ */ x(u, { className: "size-3 shrink-0 text-muted-foreground" }), /* @__PURE__ */ x(n, {
123
+ children: [/* @__PURE__ */ S(u, { className: "size-3 shrink-0 text-muted-foreground" }), /* @__PURE__ */ S(r, {
124
124
  to: "/$workspace/areas/$area",
125
125
  params: {
126
- workspace: O,
126
+ workspace: D,
127
127
  area: e.key
128
128
  },
129
129
  className: "truncate text-muted-foreground hover:text-foreground",
130
130
  children: e.title
131
131
  })]
132
132
  }, e.key)),
133
- /* @__PURE__ */ x(u, { className: "size-3 shrink-0 text-muted-foreground" }),
134
- /* @__PURE__ */ x("h1", {
133
+ /* @__PURE__ */ S(u, { className: "size-3 shrink-0 text-muted-foreground" }),
134
+ /* @__PURE__ */ S("h1", {
135
135
  className: "truncate font-medium",
136
136
  children: z.title
137
137
  }),
138
- /* @__PURE__ */ x("span", {
138
+ /* @__PURE__ */ S("span", {
139
139
  className: "shrink-0 font-mono text-xs text-muted-foreground",
140
140
  children: z.key
141
141
  }),
142
- /* @__PURE__ */ x(ie, {
142
+ /* @__PURE__ */ S(m, {
143
143
  counts: F.areas[z.id],
144
144
  teamId: z.teamId,
145
145
  className: "ml-auto max-sm:hidden"
146
146
  }),
147
- /* @__PURE__ */ S(g, {
147
+ /* @__PURE__ */ C(h, {
148
148
  type: "button",
149
149
  size: "sm",
150
150
  onClick: () => R({
@@ -153,139 +153,139 @@ function k({ thread: i }) {
153
153
  origin: { area: z.key }
154
154
  }),
155
155
  className: "max-sm:ml-auto",
156
- children: [/* @__PURE__ */ x(l, { className: "size-3.5" }), v("newIssue")]
156
+ children: [/* @__PURE__ */ S(l, { className: "size-3.5" }), _("newIssue")]
157
157
  })
158
158
  ]
159
159
  }),
160
- U.length > 1 && /* @__PURE__ */ x("nav", {
161
- "aria-label": v("siblings"),
160
+ U.length > 1 && /* @__PURE__ */ S("nav", {
161
+ "aria-label": _("siblings"),
162
162
  className: "flex shrink-0 gap-1 overflow-x-auto border-b border-border px-4 py-1.5 md:px-5",
163
163
  children: U.map((e) => {
164
164
  let t = F.areas[e.id]?.decisions ?? 0;
165
- return /* @__PURE__ */ S(n, {
165
+ return /* @__PURE__ */ C(r, {
166
166
  to: "/$workspace/areas/$area",
167
167
  params: {
168
- workspace: O,
168
+ workspace: D,
169
169
  area: e.key
170
170
  },
171
171
  "aria-current": e.id === z.id ? "page" : void 0,
172
172
  className: "flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground aria-[current=page]:bg-muted aria-[current=page]:font-medium aria-[current=page]:text-foreground",
173
- children: [e.title, /* @__PURE__ */ x(_, {
173
+ children: [e.title, /* @__PURE__ */ S(g, {
174
174
  count: t,
175
175
  emphasis: "soft",
176
176
  size: "sm",
177
- locale: D,
178
- label: v("waitingCount"),
177
+ locale: E,
178
+ label: _("waitingCount"),
179
179
  className: "border-transparent! bg-agent-soft! text-agent!"
180
180
  })]
181
181
  }, e.id);
182
182
  })
183
183
  }),
184
- /* @__PURE__ */ x("div", {
184
+ /* @__PURE__ */ S("div", {
185
185
  className: "min-h-0 flex-1 overflow-y-auto",
186
- children: /* @__PURE__ */ S("div", {
186
+ children: /* @__PURE__ */ C("div", {
187
187
  className: "mx-auto max-w-3xl space-y-8 px-4 py-6 md:px-6",
188
188
  children: [
189
- z.redirectedFrom && /* @__PURE__ */ x("p", {
189
+ z.redirectedFrom && /* @__PURE__ */ S("p", {
190
190
  className: "text-xs text-muted-foreground",
191
- children: v("mergedFrom", { key: z.redirectedFrom })
191
+ children: _("mergedFrom", { key: z.redirectedFrom })
192
192
  }),
193
- z.homeDoc && /* @__PURE__ */ S("section", {
194
- "aria-label": v("about"),
195
- children: [W && /* @__PURE__ */ x(m, {
193
+ z.homeDoc && /* @__PURE__ */ C("section", {
194
+ "aria-label": _("about"),
195
+ children: [W && /* @__PURE__ */ S(ie, {
196
196
  value: W,
197
197
  editable: !1
198
- }), /* @__PURE__ */ S(n, {
198
+ }), /* @__PURE__ */ C(r, {
199
199
  to: "/$workspace/docs/$doc",
200
200
  params: {
201
- workspace: O,
202
- doc: d(z.homeDoc)
201
+ workspace: D,
202
+ doc: ne(z.homeDoc)
203
203
  },
204
204
  className: "mt-1 inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",
205
- children: [/* @__PURE__ */ x(ee, { className: "size-3.5" }), v("readDoc", { title: z.homeDoc.title })]
205
+ children: [/* @__PURE__ */ S(te, { className: "size-3.5" }), _("readDoc", { title: z.homeDoc.title })]
206
206
  })]
207
207
  }),
208
- /* @__PURE__ */ S("section", {
209
- "aria-label": v("toDecide"),
208
+ /* @__PURE__ */ C("section", {
209
+ "aria-label": _("toDecide"),
210
210
  className: "space-y-3",
211
- children: [/* @__PURE__ */ S("h2", {
211
+ children: [/* @__PURE__ */ C("h2", {
212
212
  className: "text-sm font-semibold",
213
213
  children: [
214
- v("toDecide"),
214
+ _("toDecide"),
215
215
  " ",
216
- /* @__PURE__ */ x("span", {
216
+ /* @__PURE__ */ S("span", {
217
217
  className: "font-normal text-muted-foreground",
218
218
  children: B.length
219
219
  })
220
220
  ]
221
- }), B.length === 0 ? /* @__PURE__ */ x("p", {
221
+ }), B.length === 0 ? /* @__PURE__ */ S("p", {
222
222
  className: "text-sm text-muted-foreground",
223
- children: v("nothingToDecide")
224
- }) : B.map((e) => /* @__PURE__ */ S("div", {
223
+ children: _("nothingToDecide")
224
+ }) : B.map((e) => /* @__PURE__ */ C("div", {
225
225
  id: `decision-${e.id}`,
226
- className: se("relative scroll-mt-4 rounded-lg", e.id === q?.id && "ring-2 ring-primary/50"),
227
- children: [K(e.createdAt) && /* @__PURE__ */ x(A, {}), /* @__PURE__ */ x(h, {
228
- workspace: O,
226
+ className: O("relative scroll-mt-4 rounded-lg", e.id === q?.id && "ring-2 ring-primary/50"),
227
+ children: [K(e.createdAt) && /* @__PURE__ */ S(A, {}), /* @__PURE__ */ S(d, {
228
+ workspace: D,
229
229
  decision: e,
230
230
  showIssue: !0
231
231
  })]
232
232
  }, e.id))]
233
233
  }),
234
- H.length > 0 && /* @__PURE__ */ S("section", {
235
- "aria-label": v("knowledge"),
236
- children: [/* @__PURE__ */ x("h2", {
234
+ H.length > 0 && /* @__PURE__ */ C("section", {
235
+ "aria-label": _("knowledge"),
236
+ children: [/* @__PURE__ */ S("h2", {
237
237
  className: "text-sm font-semibold",
238
- children: v("knowledge")
239
- }), /* @__PURE__ */ x("ul", {
238
+ children: _("knowledge")
239
+ }), /* @__PURE__ */ S("ul", {
240
240
  className: "mt-2 divide-y divide-border rounded-lg border border-border",
241
- children: H.map((e) => /* @__PURE__ */ x(re, {
242
- workspace: O,
241
+ children: H.map((e) => /* @__PURE__ */ S(p, {
242
+ workspace: D,
243
243
  entry: e,
244
244
  isNew: K(e.createdAt)
245
245
  }, e.id))
246
246
  })]
247
247
  }),
248
- V.length > 0 && /* @__PURE__ */ S("section", {
249
- "aria-label": v("decided"),
250
- children: [/* @__PURE__ */ x("h2", {
248
+ V.length > 0 && /* @__PURE__ */ C("section", {
249
+ "aria-label": _("decided"),
250
+ children: [/* @__PURE__ */ S("h2", {
251
251
  className: "text-sm font-semibold",
252
- children: v("decided")
253
- }), /* @__PURE__ */ x("ul", {
252
+ children: _("decided")
253
+ }), /* @__PURE__ */ S("ul", {
254
254
  className: "mt-2 divide-y divide-border rounded-lg border border-border",
255
- children: V.map((e) => /* @__PURE__ */ x(ne, {
256
- workspace: O,
255
+ children: V.map((e) => /* @__PURE__ */ S(f, {
256
+ workspace: D,
257
257
  decision: e,
258
258
  isNew: K(e.answer?.at),
259
- notInDocs: i.notInDocs.includes(e.id)
259
+ notInDocs: a.notInDocs.includes(e.id)
260
260
  }, e.id))
261
261
  })]
262
262
  })
263
263
  ]
264
264
  })
265
265
  }),
266
- /* @__PURE__ */ x(j, { deciding: B.length > 0 })
266
+ /* @__PURE__ */ S(j, { deciding: B.length > 0 })
267
267
  ]
268
268
  });
269
269
  }
270
270
  function A() {
271
- let e = b("areaPage");
272
- return /* @__PURE__ */ x("span", {
271
+ let e = x("areaPage");
272
+ return /* @__PURE__ */ S("span", {
273
273
  className: "absolute -top-2 right-3 z-10 rounded bg-primary px-1.5 py-0.5 text-[10px] font-medium text-primary-foreground",
274
274
  children: e("new")
275
275
  });
276
276
  }
277
277
  function j({ deciding: e }) {
278
- let t = b("areaPage"), n = [[["[", "]"], t("keys.move")], ...e ? [
278
+ let t = x("areaPage"), n = [[["[", "]"], t("keys.move")], ...e ? [
279
279
  [["N"], t("keys.next")],
280
280
  [["1–9"], t("keys.choose")],
281
281
  [["E"], t("keys.note")]
282
282
  ] : []];
283
- return /* @__PURE__ */ x("footer", {
283
+ return /* @__PURE__ */ S("footer", {
284
284
  className: "flex shrink-0 items-center gap-4 border-t border-border px-4 py-1.5 text-xs text-muted-foreground max-md:hidden md:px-5",
285
- children: n.map(([e, t]) => /* @__PURE__ */ S("span", {
285
+ children: n.map(([e, t]) => /* @__PURE__ */ C("span", {
286
286
  className: "flex items-center gap-1.5",
287
- children: [/* @__PURE__ */ x(v, { keys: e }), t]
287
+ children: [/* @__PURE__ */ S(_, { keys: e }), t]
288
288
  }, t))
289
289
  });
290
290
  }
291
- export { O as component };
291
+ export { D as component };