@parallelworks/tandem-web 0.187.0 → 0.188.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.
package/pages/area.js CHANGED
@@ -1,27 +1,28 @@
1
1
  import { api as e, unwrap as t } from "../api/client.js";
2
- import { areaThreadQuery as n, areasQuery as r, countsQuery as ee, inboxQuery as te, teamsQuery as ne } from "../api/queries.js";
3
- import { DecisionCard as re } from "../components/AgentWork.js";
4
- import { AreaLink as ie } from "../components/AreaLink.js";
5
- import { AreaTile as ae, AreaTiles as oe } from "../components/AreaTiles.js";
6
- import { AreaGroup as i, FoldedAnswer as se, KnowledgeRow as a } from "../components/AreaWork.js";
7
- import { Editor as o } from "../components/Editor.js";
8
- import { AddIcon as s, AreaIcon as c, CheckIcon as ce, ChevronRightIcon as l, FileTextIcon as le, InboxIcon as ue, LibraryIcon as de } from "../components/icons.js";
9
- import { WorkCounts as fe } from "../components/WorkCounts.js";
10
- import { docRef as pe } from "../lib/docs.js";
11
- import { useNewIssue as me } from "../lib/newIssue.js";
12
- import { usePageTitle as he } from "../lib/pageTitle.js";
13
- import { Link as u, useNavigate as d } from "../lib/router.js";
14
- import { useShortcuts as ge } from "../lib/shortcuts.js";
15
- import { Button as f, EmptyState as p, Kbd as m } from "@parallelworks/ui";
16
- import { useParams as h, useSearch as g } from "@tanstack/react-router";
17
- import { useEffect as _, useState as _e } from "react";
2
+ import { areaThreadQuery as n, areasQuery as r, countsQuery as ee, inboxQuery as i, teamsQuery as a } from "../api/queries.js";
3
+ import { DecisionCard as te } from "../components/AgentWork.js";
4
+ import { AreaLink as ne } from "../components/AreaLink.js";
5
+ import { AreaTile as re, AreaTiles as ie } from "../components/AreaTiles.js";
6
+ import { AreaGroup as o, FoldedAnswer as ae, KnowledgeRow as oe } from "../components/AreaWork.js";
7
+ import { Editor as se } from "../components/Editor.js";
8
+ import { FavoriteStar as ce } from "../components/FavoriteStar.js";
9
+ import { AddIcon as le, AreaIcon as s, CheckIcon as c, ChevronRightIcon as l, FileTextIcon as u, InboxIcon as d, LibraryIcon as f } from "../components/icons.js";
10
+ import { WorkCounts as ue } from "../components/WorkCounts.js";
11
+ import { docRef as de } from "../lib/docs.js";
12
+ import { useNewIssue as fe } from "../lib/newIssue.js";
13
+ import { usePageTitle as pe } from "../lib/pageTitle.js";
14
+ import { Link as p, useNavigate as me } from "../lib/router.js";
15
+ import { useShortcuts as he } from "../lib/shortcuts.js";
16
+ import { Button as m, EmptyState as ge, Kbd as h } from "@parallelworks/ui";
17
+ import { useParams as g, useSearch as _e } from "@tanstack/react-router";
18
+ import { useEffect as _, useState as ve } from "react";
18
19
  import { useTranslations as v } from "use-intl";
19
20
  import { jsx as y, jsxs as b } from "react/jsx-runtime";
20
- import { useMutation as ve, useQuery as x, useQueryClient as ye, useSuspenseQuery as S } from "@tanstack/react-query";
21
+ import { useMutation as ye, useQuery as x, useQueryClient as be, useSuspenseQuery as S } from "@tanstack/react-query";
21
22
  // src/pages/area.tsx
22
23
  var C = (e) => ({ ...typeof e.decision == "string" && { decision: e.decision } });
23
24
  function w() {
24
- let { workspace: e, area: t } = h({ strict: !1 });
25
+ let { workspace: e, area: t } = g({ strict: !1 });
25
26
  return S(n(e, t)).data;
26
27
  }
27
28
  function T() {
@@ -30,9 +31,9 @@ function T() {
30
31
  }
31
32
  var E = (...e) => e.filter(Boolean).join(" ");
32
33
  function D({ thread: n }) {
33
- let m = v("areaPage"), { workspace: C, area: w, key: T } = h({ strict: !1 }), { decision: D } = g({ strict: !1 }), A = d(), j = ye(), { data: M } = S(ee(C)), { data: N = [] } = x(r(C)), { data: P = [] } = x(ne(C)), { data: be = [] } = x(te(C)), xe = me(), { area: F, open: I, answered: L, knowledge: R, siblings: z, summary: B } = n;
34
- he(F.title);
35
- let [V] = _e(() => n.lastVisitedAt ? Date.parse(n.lastVisitedAt) : null), H = (e) => !!e && V !== null && Date.parse(e) > V, U = P.find((e) => e.id === F.teamId), W = (e, t) => {
34
+ let h = v("areaPage"), { workspace: C, area: w, key: T } = g({ strict: !1 }), { decision: D } = _e({ strict: !1 }), A = me(), j = be(), { data: M } = S(ee(C)), { data: N = [] } = x(r(C)), { data: P = [] } = x(a(C)), { data: xe = [] } = x(i(C)), Se = fe(), { area: F, open: I, answered: L, knowledge: R, siblings: z, summary: B } = n;
35
+ pe(F.title);
36
+ let [V] = ve(() => n.lastVisitedAt ? Date.parse(n.lastVisitedAt) : null), H = (e) => !!e && V !== null && Date.parse(e) > V, U = P.find((e) => e.id === F.teamId), W = (e, t) => {
36
37
  let n = P.find((t) => t.id === e.teamId), r = t ? { decision: t } : {};
37
38
  A(n ? {
38
39
  to: "/$workspace/teams/$key/areas/$area",
@@ -52,9 +53,9 @@ function D({ thread: n }) {
52
53
  search: r,
53
54
  replace: !0
54
55
  });
55
- }, Se = P.length > 0 || !F.teamId;
56
+ }, Ce = P.length > 0 || !F.teamId;
56
57
  _(() => {
57
- Se && (w.toLowerCase() !== F.key || T !== U?.key) && W(F, D);
58
+ Ce && (w.toLowerCase() !== F.key || T !== U?.key) && W(F, D);
58
59
  }), _(() => {
59
60
  e.POST("/api/v1/workspaces/{workspace}/areas/{area}/visit", { params: { path: {
60
61
  workspace: C,
@@ -65,7 +66,7 @@ function D({ thread: n }) {
65
66
  _(() => {
66
67
  K && document.getElementById(`decision-${K}`)?.scrollIntoView({ block: "center" });
67
68
  }, [K]);
68
- let q = ve({
69
+ let q = ye({
69
70
  mutationFn: async ({ decision: n, optionId: r }) => t(await e.POST("/api/v1/workspaces/{workspace}/decisions/{decisionId}/answer", {
70
71
  params: { path: {
71
72
  workspace: C,
@@ -78,8 +79,8 @@ function D({ thread: n }) {
78
79
  C,
79
80
  "decisions"
80
81
  ] })
81
- }), Ce = z.findIndex((e) => e.id === F.id), J = (e) => {
82
- let t = z[Ce + e];
82
+ }), we = z.findIndex((e) => e.id === F.id), J = (e) => {
83
+ let t = z[we + e];
83
84
  t && W({
84
85
  key: t.key,
85
86
  teamId: F.teamId
@@ -102,10 +103,10 @@ function D({ thread: n }) {
102
103
  optionId: t.id
103
104
  });
104
105
  };
105
- ge(Y);
106
+ he(Y);
106
107
  let X = [];
107
108
  for (let e = N.find((e) => e.id === F.parentId); e; e = N.find((t) => t.id === e?.parentId)) X.unshift(e);
108
- let Z = N.filter((e) => e.parentId === F.id), Q = (e) => be.filter((t) => t.area?.id === e).length + N.filter((t) => t.parentId === e).reduce((e, t) => e + Q(t.id), 0), we = !F.homeDoc && Z.length === 0 && I.length === 0 && R.length === 0 && L.length === 0, $ = () => xe({
109
+ let Z = N.filter((e) => e.parentId === F.id), Q = (e) => xe.filter((t) => t.area?.id === e).length + N.filter((t) => t.parentId === e).reduce((e, t) => e + Q(t.id), 0), Te = !F.homeDoc && Z.length === 0 && I.length === 0 && R.length === 0 && L.length === 0, $ = () => Se({
109
110
  ...U && { team: U.key },
110
111
  area: F.key,
111
112
  origin: { area: F.key }
@@ -116,23 +117,23 @@ function D({ thread: n }) {
116
117
  /* @__PURE__ */ b("header", {
117
118
  className: "flex h-12 shrink-0 items-center gap-1.5 border-b border-border px-4 text-sm md:px-5",
118
119
  children: [
119
- U ? /* @__PURE__ */ y(u, {
120
+ U ? /* @__PURE__ */ y(p, {
120
121
  to: "/$workspace/teams/$key/areas",
121
122
  params: {
122
123
  workspace: C,
123
124
  key: U.key
124
125
  },
125
126
  className: "shrink-0 text-muted-foreground hover:text-foreground",
126
- children: m("areas")
127
- }) : /* @__PURE__ */ y(u, {
127
+ children: h("areas")
128
+ }) : /* @__PURE__ */ y(p, {
128
129
  to: "/$workspace/areas",
129
130
  params: { workspace: C },
130
131
  className: "shrink-0 text-muted-foreground hover:text-foreground",
131
- children: m("areas")
132
+ children: h("areas")
132
133
  }),
133
134
  X.map((e) => /* @__PURE__ */ b("span", {
134
135
  className: "flex min-w-0 items-center gap-1.5 max-sm:hidden",
135
- children: [/* @__PURE__ */ y(l, { className: "size-3 shrink-0 text-muted-foreground" }), /* @__PURE__ */ y(ie, {
136
+ children: [/* @__PURE__ */ y(l, { className: "size-3 shrink-0 text-muted-foreground" }), /* @__PURE__ */ y(ne, {
136
137
  workspace: C,
137
138
  area: e,
138
139
  className: "truncate text-muted-foreground hover:text-foreground",
@@ -144,22 +145,27 @@ function D({ thread: n }) {
144
145
  className: "truncate font-semibold",
145
146
  children: F.title
146
147
  }),
148
+ /* @__PURE__ */ y(ce, {
149
+ workspace: C,
150
+ kind: "area",
151
+ target: F.id
152
+ }),
147
153
  /* @__PURE__ */ y("span", {
148
154
  className: "shrink-0 font-mono text-xs text-muted-foreground",
149
155
  children: F.key
150
156
  }),
151
- /* @__PURE__ */ y(fe, {
157
+ /* @__PURE__ */ y(ue, {
152
158
  counts: M.areas[F.id],
153
159
  teamId: F.teamId,
154
160
  className: "max-sm:hidden"
155
161
  }),
156
- /* @__PURE__ */ y(f, {
162
+ /* @__PURE__ */ y(m, {
157
163
  variant: "primary",
158
164
  size: "sm",
159
- icon: /* @__PURE__ */ y(s, { className: "size-3.5" }),
165
+ icon: /* @__PURE__ */ y(le, { className: "size-3.5" }),
160
166
  onClick: $,
161
167
  className: "ml-auto",
162
- children: m("newIssue")
168
+ children: h("newIssue")
163
169
  })
164
170
  ]
165
171
  }),
@@ -167,39 +173,39 @@ function D({ thread: n }) {
167
173
  className: "min-h-0 flex-1 overflow-y-auto",
168
174
  children: [
169
175
  F.homeDoc && /* @__PURE__ */ b("section", {
170
- "aria-label": m("about"),
176
+ "aria-label": h("about"),
171
177
  className: "border-b border-border px-4 py-3 md:px-5",
172
178
  children: [
173
179
  F.redirectedFrom && /* @__PURE__ */ y("p", {
174
180
  className: "mb-2 text-xs text-muted-foreground",
175
- children: m("mergedFrom", { key: F.redirectedFrom })
181
+ children: h("mergedFrom", { key: F.redirectedFrom })
176
182
  }),
177
183
  /* @__PURE__ */ y("div", {
178
184
  className: "max-w-3xl",
179
- children: B && /* @__PURE__ */ y(o, {
185
+ children: B && /* @__PURE__ */ y(se, {
180
186
  value: B,
181
187
  editable: !1
182
188
  })
183
189
  }),
184
- /* @__PURE__ */ b(u, {
190
+ /* @__PURE__ */ b(p, {
185
191
  to: "/$workspace/docs/$doc",
186
192
  params: {
187
193
  workspace: C,
188
- doc: pe(F.homeDoc)
194
+ doc: de(F.homeDoc)
189
195
  },
190
196
  className: "mt-1 inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",
191
- children: [/* @__PURE__ */ y(le, { className: "size-3.5" }), m("readDoc", { title: F.homeDoc.title })]
197
+ children: [/* @__PURE__ */ y(u, { className: "size-3.5" }), h("readDoc", { title: F.homeDoc.title })]
192
198
  })
193
199
  ]
194
200
  }),
195
- Z.length > 0 && /* @__PURE__ */ y(i, {
196
- title: m("inside"),
201
+ Z.length > 0 && /* @__PURE__ */ y(o, {
202
+ title: h("inside"),
197
203
  count: Z.length,
198
- icon: /* @__PURE__ */ y(c, { className: "size-4 text-muted-foreground" }),
204
+ icon: /* @__PURE__ */ y(s, { className: "size-4 text-muted-foreground" }),
199
205
  bare: !0,
200
- children: /* @__PURE__ */ y(oe, {
201
- label: m("inside"),
202
- children: Z.map((e) => /* @__PURE__ */ y(ae, {
206
+ children: /* @__PURE__ */ y(ie, {
207
+ label: h("inside"),
208
+ children: Z.map((e) => /* @__PURE__ */ y(re, {
203
209
  workspace: C,
204
210
  area: e,
205
211
  inside: 0,
@@ -208,17 +214,17 @@ function D({ thread: n }) {
208
214
  }, e.id))
209
215
  })
210
216
  }),
211
- I.length > 0 && /* @__PURE__ */ y(i, {
212
- title: m("toDecide"),
217
+ I.length > 0 && /* @__PURE__ */ y(o, {
218
+ title: h("toDecide"),
213
219
  count: I.length,
214
- icon: /* @__PURE__ */ y(ue, { className: "size-4 text-warning" }),
220
+ icon: /* @__PURE__ */ y(d, { className: "size-4 text-warning" }),
215
221
  bare: !0,
216
222
  children: /* @__PURE__ */ y("div", {
217
223
  className: "space-y-3 px-4 py-3 md:px-5",
218
224
  children: I.map((e) => /* @__PURE__ */ b("div", {
219
225
  id: `decision-${e.id}`,
220
226
  className: E("relative max-w-3xl scroll-mt-12 rounded-lg", e.id === G?.id && "ring-2 ring-primary/50"),
221
- children: [H(e.createdAt) && /* @__PURE__ */ y(O, {}), /* @__PURE__ */ y(re, {
227
+ children: [H(e.createdAt) && /* @__PURE__ */ y(O, {}), /* @__PURE__ */ y(te, {
222
228
  workspace: C,
223
229
  decision: e,
224
230
  showIssue: !0
@@ -226,38 +232,38 @@ function D({ thread: n }) {
226
232
  }, e.id))
227
233
  })
228
234
  }),
229
- R.length > 0 && /* @__PURE__ */ y(i, {
230
- title: m("knowledge"),
235
+ R.length > 0 && /* @__PURE__ */ y(o, {
236
+ title: h("knowledge"),
231
237
  count: R.length,
232
- icon: /* @__PURE__ */ y(de, { className: "size-4 text-muted-foreground" }),
233
- children: R.map((e) => /* @__PURE__ */ y(a, {
238
+ icon: /* @__PURE__ */ y(f, { className: "size-4 text-muted-foreground" }),
239
+ children: R.map((e) => /* @__PURE__ */ y(oe, {
234
240
  workspace: C,
235
241
  entry: e,
236
242
  isNew: H(e.createdAt)
237
243
  }, e.id))
238
244
  }),
239
- L.length > 0 && /* @__PURE__ */ y(i, {
240
- title: m("decided"),
245
+ L.length > 0 && /* @__PURE__ */ y(o, {
246
+ title: h("decided"),
241
247
  count: L.length,
242
- icon: /* @__PURE__ */ y(ce, { className: "size-4 text-muted-foreground" }),
243
- children: L.map((e) => /* @__PURE__ */ y(se, {
248
+ icon: /* @__PURE__ */ y(c, { className: "size-4 text-muted-foreground" }),
249
+ children: L.map((e) => /* @__PURE__ */ y(ae, {
244
250
  workspace: C,
245
251
  decision: e,
246
252
  isNew: H(e.answer?.at),
247
253
  notInDocs: n.notInDocs.includes(e.id)
248
254
  }, e.id))
249
255
  }),
250
- we && /* @__PURE__ */ y("div", {
256
+ Te && /* @__PURE__ */ y("div", {
251
257
  className: "p-6",
252
- children: /* @__PURE__ */ y(p, {
253
- icon: /* @__PURE__ */ y(c, {}),
254
- title: m("empty"),
255
- description: m("emptyDescription"),
256
- action: /* @__PURE__ */ y(f, {
258
+ children: /* @__PURE__ */ y(ge, {
259
+ icon: /* @__PURE__ */ y(s, {}),
260
+ title: h("empty"),
261
+ description: h("emptyDescription"),
262
+ action: /* @__PURE__ */ y(m, {
257
263
  variant: "primary",
258
264
  size: "sm",
259
265
  onClick: $,
260
- children: m("newIssue")
266
+ children: h("newIssue")
261
267
  })
262
268
  })
263
269
  })
@@ -284,7 +290,7 @@ function k({ deciding: e }) {
284
290
  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
291
  children: n.map(([e, t]) => /* @__PURE__ */ b("span", {
286
292
  className: "flex items-center gap-1.5",
287
- children: [/* @__PURE__ */ y(m, { keys: e }), t]
293
+ children: [/* @__PURE__ */ y(h, { keys: e }), t]
288
294
  }, t))
289
295
  });
290
296
  }