@parallelworks/tandem-web 0.184.0 → 0.186.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.
@@ -1,108 +1,112 @@
1
1
  import { allDecisionsQuery as e, inboxQuery as t, myAllDecisionsQuery as n, myDecisionsQuery as r, teamsQuery as i, workspaceRunsQuery as a } from "../api/queries.js";
2
2
  import { AnsweredDecision as o, DecisionCard as s } from "../components/AgentWork.js";
3
- import { FavoriteStar as c } from "../components/FavoriteStar.js";
3
+ import { ListFavoriteStar as c } from "../components/FavoriteStar.js";
4
4
  import { InboxIcon as l } from "../components/icons.js";
5
5
  import { recentlyAnswered as u, saveScope as d, savedScope as f } from "../lib/decisionScope.js";
6
6
  import { usePageTitle as p } from "../lib/pageTitle.js";
7
- import { EmptyState as m, SegmentedControl as h, useOpenMenu as g } from "@parallelworks/ui";
8
- import { useParams as _, useSearch as v } from "@tanstack/react-router";
9
- import { useState as y } from "react";
10
- import { useTranslations as b } from "use-intl";
11
- import { jsx as x, jsxs as S } from "react/jsx-runtime";
12
- import { useQuery as C, useSuspenseQuery as w } from "@tanstack/react-query";
7
+ import { teamPath as m } from "../lib/teamPaths.js";
8
+ import { EmptyState as h, SegmentedControl as g, useOpenMenu as _ } from "@parallelworks/ui";
9
+ import { useParams as v, useSearch as y } from "@tanstack/react-router";
10
+ import { useState as b } from "react";
11
+ import { useTranslations as x } from "use-intl";
12
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
13
+ import { useQuery as w, useSuspenseQuery as T } from "@tanstack/react-query";
13
14
  // src/pages/decisions.tsx
14
- var T = ["workspace", "all"];
15
- function E() {
16
- let { workspace: E, key: D } = _({ strict: !1 }), O = b("decisions"), k = g(), { team: A = D } = v({ strict: !1 }), { data: j } = w(i(E)), M = j.find((e) => e.key === A);
17
- p(O("title"), M?.name);
18
- let [N, P] = y(f), F = M ? "workspace" : N, I = F === "all", L = (e) => M ? e.filter((e) => e.identifier.startsWith(`${M.key}-`)) : e, R = (e) => {
19
- P(e), d(e);
20
- }, { data: z } = w(I ? r : t(E)), { data: B } = w(I ? n : e(E)), V = L(z), H = u(L(B)), { data: U = [] } = C(a(E, {
15
+ var E = ["workspace", "all"];
16
+ function D() {
17
+ let { workspace: D, key: O } = v({ strict: !1 }), k = x("decisions"), A = _(), { team: j = O } = y({ strict: !1 }), { data: M } = T(i(D)), N = M.find((e) => e.key === j);
18
+ p(k("title"), N?.name);
19
+ let [P, F] = b(f), I = N ? "workspace" : P, L = I === "all", R = (e) => N ? e.filter((e) => e.identifier.startsWith(`${N.key}-`)) : e, z = (e) => {
20
+ F(e), d(e);
21
+ }, { data: B } = T(L ? r : t(D)), { data: V } = T(L ? n : e(D)), H = R(B), U = u(R(V)), { data: W = [] } = w(a(D, {
21
22
  live: !0,
22
23
  limit: 200
23
- })), W = new Map(U.map((e) => [e.id, e])), G = () => T.map((e) => ({
24
- label: O(`scopes.${e}`),
25
- checked: e === F,
26
- onClick: () => R(e)
24
+ })), G = new Map(W.map((e) => [e.id, e])), K = () => E.map((e) => ({
25
+ label: k(`scopes.${e}`),
26
+ checked: e === I,
27
+ onClick: () => z(e)
27
28
  }));
28
- return /* @__PURE__ */ S("div", {
29
+ return /* @__PURE__ */ C("div", {
29
30
  className: "flex h-full flex-col",
30
- children: [/* @__PURE__ */ S("header", {
31
+ children: [/* @__PURE__ */ C("header", {
31
32
  className: "flex min-h-12 shrink-0 flex-wrap items-center gap-x-3 gap-y-2 border-b border-border px-4 py-2 md:px-5",
32
33
  children: [
33
- /* @__PURE__ */ x("h1", {
34
+ /* @__PURE__ */ S("h1", {
34
35
  className: "text-sm font-semibold",
35
- children: M ? O("teamTitle", { team: M.name }) : O("title")
36
+ children: N ? k("teamTitle", { team: N.name }) : k("title")
36
37
  }),
37
- !M && /* @__PURE__ */ x(c, {
38
- workspace: E,
39
- kind: "page",
40
- target: "decisions"
38
+ /* @__PURE__ */ S(c, {
39
+ workspace: D,
40
+ page: "decisions",
41
+ team: N && {
42
+ href: m(D, N.key, "decisions"),
43
+ label: k("teamTitle", { team: N.name })
44
+ }
41
45
  }),
42
- /* @__PURE__ */ x("span", {
46
+ /* @__PURE__ */ S("span", {
43
47
  className: "text-xs text-muted-foreground",
44
- children: O("openCount", { count: V.length })
48
+ children: k("openCount", { count: H.length })
45
49
  }),
46
- !M && /* @__PURE__ */ x("div", {
50
+ !N && /* @__PURE__ */ S("div", {
47
51
  className: "ml-auto",
48
- children: /* @__PURE__ */ x(h, {
52
+ children: /* @__PURE__ */ S(g, {
49
53
  size: "sm",
50
- label: O("scope"),
51
- options: T.map((e) => ({
54
+ label: k("scope"),
55
+ options: E.map((e) => ({
52
56
  value: e,
53
- label: O(`scopes.${e}`)
57
+ label: k(`scopes.${e}`)
54
58
  })),
55
- value: F,
56
- onValueChange: R,
57
- onContextMenu: (e) => k(e, G())
59
+ value: I,
60
+ onValueChange: z,
61
+ onContextMenu: (e) => A(e, K())
58
62
  })
59
63
  })
60
64
  ]
61
- }), /* @__PURE__ */ x("div", {
65
+ }), /* @__PURE__ */ S("div", {
62
66
  className: "min-h-0 flex-1 overflow-y-auto",
63
- children: /* @__PURE__ */ S("div", {
67
+ children: /* @__PURE__ */ C("div", {
64
68
  className: "mx-auto w-full max-w-reading space-y-10 px-4 py-6 md:px-8",
65
- children: [V.length === 0 ? /* @__PURE__ */ x(m, {
66
- icon: /* @__PURE__ */ x(l, {}),
67
- title: O("emptyTitle"),
68
- description: O(I ? "emptyDescriptionAll" : "emptyDescription"),
69
+ children: [H.length === 0 ? /* @__PURE__ */ S(h, {
70
+ icon: /* @__PURE__ */ S(l, {}),
71
+ title: k("emptyTitle"),
72
+ description: k(L ? "emptyDescriptionAll" : "emptyDescription"),
69
73
  variant: "plain"
70
- }) : /* @__PURE__ */ S("section", {
74
+ }) : /* @__PURE__ */ C("section", {
71
75
  "aria-labelledby": "decisions-open",
72
76
  className: "space-y-3",
73
- children: [/* @__PURE__ */ x("h2", {
77
+ children: [/* @__PURE__ */ S("h2", {
74
78
  id: "decisions-open",
75
79
  className: "text-sm font-semibold",
76
- children: O("waitingOnYou")
77
- }), V.map((e) => {
78
- let t = e.workspace === E ? W.get(e.runId) : void 0;
79
- return /* @__PURE__ */ x(s, {
80
+ children: k("waitingOnYou")
81
+ }), H.map((e) => {
82
+ let t = e.workspace === D ? G.get(e.runId) : void 0;
83
+ return /* @__PURE__ */ S(s, {
80
84
  workspace: e.workspace,
81
85
  decision: e,
82
86
  showIssue: !0,
83
- showWorkspace: I,
87
+ showWorkspace: L,
84
88
  runner: t?.lastRunnerName ? {
85
89
  name: t.lastRunnerName,
86
90
  kind: t.runnerKind
87
91
  } : void 0
88
92
  }, e.id);
89
93
  })]
90
- }), H.length > 0 && /* @__PURE__ */ S("section", {
94
+ }), U.length > 0 && /* @__PURE__ */ C("section", {
91
95
  "aria-labelledby": "decisions-answered",
92
96
  className: "space-y-3",
93
- children: [/* @__PURE__ */ x("h2", {
97
+ children: [/* @__PURE__ */ S("h2", {
94
98
  id: "decisions-answered",
95
99
  className: "text-sm font-semibold",
96
- children: O("recentlyAnswered")
97
- }), /* @__PURE__ */ x("ul", {
100
+ children: k("recentlyAnswered")
101
+ }), /* @__PURE__ */ S("ul", {
98
102
  className: "divide-y divide-border rounded-xl border border-border bg-card",
99
- children: H.map((e) => /* @__PURE__ */ x("li", {
103
+ children: U.map((e) => /* @__PURE__ */ S("li", {
100
104
  className: "px-3 py-2.5",
101
- children: /* @__PURE__ */ x(o, {
105
+ children: /* @__PURE__ */ S(o, {
102
106
  workspace: e.workspace,
103
107
  decision: e,
104
108
  showIssue: !0,
105
- showWorkspace: I,
109
+ showWorkspace: L,
106
110
  bare: !0
107
111
  })
108
112
  }, e.id))
@@ -112,4 +116,4 @@ function E() {
112
116
  })]
113
117
  });
114
118
  }
115
- export { E as Inbox };
119
+ export { D as Inbox };
package/pages/projects.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { projectsQuery as e, teamsQuery as t } from "../api/queries.js";
2
2
  import { DisplayMenu as n } from "../components/DisplayMenu.js";
3
3
  import { EntityIcon as r } from "../components/EntityIcon.js";
4
- import { FavoriteStar as i } from "../components/FavoriteStar.js";
4
+ import { ListFavoriteStar as i } from "../components/FavoriteStar.js";
5
5
  import { ChevronDownIcon as a, ListViewIcon as o, PriorityIcon as s, ProjectIcon as c, TimelineIcon as l, usePriorityNames as u } from "../components/icons.js";
6
6
  import { NewProjectDialog as d } from "../components/NewProjectDialog.js";
7
7
  import { HealthIcon as f, ProgressBar as p, ProjectStatusIcon as m, healthOf as h } from "../components/Planning.js";
@@ -11,25 +11,26 @@ import { usePageTitle as y } from "../lib/pageTitle.js";
11
11
  import { usePeople as b } from "../lib/people.js";
12
12
  import { storeLayout as x, storedLayout as S } from "../lib/projectList.js";
13
13
  import { healthStates as C, projectStatuses as ee, shownStatus as te } from "../lib/projectStates.js";
14
- import { projectRef as w, projectTree as T, projectsUnder as E } from "../lib/projects.js";
15
- import { useCan as ne } from "../lib/roles.js";
16
- import { Link as D, useNavigate as re } from "../lib/router.js";
14
+ import { projectLevel as ne, projectRef as w, projectTree as T, projectsUnder as E } from "../lib/projects.js";
15
+ import { useCan as re } from "../lib/roles.js";
16
+ import { Link as D, useNavigate as ie } from "../lib/router.js";
17
+ import { teamPath as ae } from "../lib/teamPaths.js";
17
18
  import { useTime as O } from "../lib/time.js";
18
- import { Avatar as k, Button as A, Combobox as ie, EmptyState as ae, PageHeaderAddButton as oe, Switch as se, Tabs as j, ToggleGroup as ce, Tooltip as M, menuDivider as le, useOpenMenu as ue } from "@parallelworks/ui";
19
- import { useParams as N, useSearch as de } from "@tanstack/react-router";
20
- import { useEffect as P, useId as fe, useRef as F, useState as I } from "react";
19
+ import { Avatar as k, Button as A, Combobox as oe, EmptyState as se, PageHeaderAddButton as ce, Switch as le, Tabs as j, ToggleGroup as ue, Tooltip as M, menuDivider as N, useOpenMenu as de } from "@parallelworks/ui";
20
+ import { useParams as fe, useSearch as pe } from "@tanstack/react-router";
21
+ import { useEffect as P, useId as me, useRef as F, useState as I } from "react";
21
22
  import { useFormatter as L, useTranslations as R } from "use-intl";
22
23
  import { jsx as z, jsxs as B } from "react/jsx-runtime";
23
24
  import { useSuspenseQuery as V } from "@tanstack/react-query";
24
25
  import { MoreButton as H } from "@parallelworks/ui/list";
25
26
  // src/pages/projects.tsx
26
27
  function U() {
27
- let { workspace: r, key: a } = N({ strict: !1 }), s = de({ strict: !1 }), u = a ? {
28
+ let { workspace: r, key: a } = fe({ strict: !1 }), s = pe({ strict: !1 }), u = a ? {
28
29
  ...s,
29
30
  team: a
30
31
  } : s, f = R("planning"), p = R("common"), { data: m } = V(e(r)), { data: b } = V(t(r)), C = b.find((e) => e.key === u.team);
31
32
  y(C ? f("teamProjects", { team: C.name }) : f("projects"));
32
- let T = a ? "list" : "timeline", D = u.view ?? S(!!a) ?? T, O = m.filter((e) => (!C || e.teamIds.includes(C.id)) && !!e.template == (D === "templates")), k = ne(r, "manage_projects"), [j, M] = I(!1), P = fe(), F = re(), L = ue(), H = v(), U = u.parent ? m.find((e) => e.id === u.parent) : void 0, W = U && new Set(E(m, U.id).map((e) => e.id)), G = te(u.status, D === "templates"), K = O.filter((e) => (!G || e.status === G) && (!u.health || h(e) === u.health) && (!W || W.has(e.id))), q = O.length > 0 && (!!G || !!u.health), J = (e) => {
33
+ let T = a ? "list" : "timeline", D = u.view ?? S(!!a) ?? T, O = m.filter((e) => (!C || e.teamIds.includes(C.id)) && !!e.template == (D === "templates")), k = re(r, "manage_projects"), [j, M] = I(null), P = me(), F = ie(), L = de(), H = v(), U = u.parent ? m.find((e) => e.id === u.parent) : void 0, W = U && new Set(E(m, U.id).map((e) => e.id)), G = te(u.status, D === "templates"), K = O.filter((e) => (!G || e.status === G) && (!u.health || h(e) === u.health) && (!W || W.has(e.id))), q = O.length > 0 && (!!G || !!u.health), J = (e) => {
33
34
  let { team: t, ...n } = Object.fromEntries(Object.entries({
34
35
  ...u,
35
36
  ...e
@@ -74,7 +75,11 @@ function U() {
74
75
  label: Y.find("project", e.id) ? X("remove") : X("add"),
75
76
  onClick: () => Y.toggle("project", e.id)
76
77
  },
77
- le,
78
+ ...k && !e.template && ne(m, e.id) < 5 ? [{
79
+ label: f("newSubProject"),
80
+ onClick: () => M(e.id)
81
+ }] : [],
82
+ N,
78
83
  ...H(`/${r}/projects/${w(e)}`),
79
84
  _(p("copyName"), e.name)
80
85
  ], Q = (e) => ({
@@ -93,10 +98,13 @@ function U() {
93
98
  className: "min-w-0 truncate text-sm font-semibold",
94
99
  children: C ? f("teamProjects", { team: C.name }) : f("projects")
95
100
  }),
96
- !C && /* @__PURE__ */ z(i, {
101
+ /* @__PURE__ */ z(i, {
97
102
  workspace: r,
98
- kind: "page",
99
- target: "projects"
103
+ page: "projects",
104
+ team: C && {
105
+ href: ae(r, C.key, "projects"),
106
+ label: f("teamProjects", { team: C.name })
107
+ }
100
108
  }),
101
109
  /* @__PURE__ */ z("span", {
102
110
  className: "ml-auto flex items-center gap-1",
@@ -123,7 +131,7 @@ function U() {
123
131
  id: P,
124
132
  className: "text-sm",
125
133
  children: f("showTemplates")
126
- }), /* @__PURE__ */ z(se, {
134
+ }), /* @__PURE__ */ z(le, {
127
135
  size: "sm",
128
136
  checked: D === "templates",
129
137
  onCheckedChange: (e) => J({ view: e ? "templates" : void 0 }),
@@ -132,16 +140,16 @@ function U() {
132
140
  })
133
141
  })
134
142
  }),
135
- k && /* @__PURE__ */ z(oe, {
143
+ k && /* @__PURE__ */ z(ce, {
136
144
  label: f("newProject"),
137
- onClick: () => M(!0)
145
+ onClick: () => M("")
138
146
  })
139
147
  ]
140
148
  }),
141
149
  /* @__PURE__ */ B("div", {
142
150
  className: "flex shrink-0 flex-wrap items-center gap-1 border-b border-border px-4 py-2 md:px-5",
143
151
  children: [
144
- /* @__PURE__ */ z(ce, {
152
+ /* @__PURE__ */ z(ue, {
145
153
  label: f("filterStatus"),
146
154
  multiple: !1,
147
155
  all: { count: O.length },
@@ -160,7 +168,7 @@ function U() {
160
168
  onClick: () => J({ health: void 0 }),
161
169
  children: f("healthFilter", { health: f(`health.${u.health}`) })
162
170
  }),
163
- O.some((e) => e.parentId) && /* @__PURE__ */ z(ie, {
171
+ O.some((e) => e.parentId) && /* @__PURE__ */ z(oe, {
164
172
  items: [{
165
173
  value: "",
166
174
  label: f("anyParent")
@@ -187,42 +195,43 @@ function U() {
187
195
  className: "min-h-0 min-w-0 flex-1 overflow-auto",
188
196
  children: K.length === 0 ? /* @__PURE__ */ z("div", {
189
197
  className: "p-6",
190
- children: /* @__PURE__ */ z(ae, {
198
+ children: /* @__PURE__ */ z(se, {
191
199
  icon: /* @__PURE__ */ z(c, {}),
192
200
  title: f(q ? "noProjectsWithStatus" : D === "templates" ? "noTemplates" : "noProjects"),
193
201
  ...!q && { description: f(D === "templates" ? "noTemplatesDescription" : "noProjectsDescription") },
194
202
  ...k && !q && D !== "templates" && { action: /* @__PURE__ */ z(A, {
195
203
  type: "button",
196
204
  variant: "primary",
197
- onClick: () => M(!0),
205
+ onClick: () => M(""),
198
206
  children: f("newProject")
199
207
  }) }
200
208
  })
201
- }) : D === "timeline" ? /* @__PURE__ */ z(ge, {
209
+ }) : D === "timeline" ? /* @__PURE__ */ z(ve, {
202
210
  workspace: r,
203
211
  projects: K,
204
212
  rowProps: Q
205
- }) : /* @__PURE__ */ z(pe, {
213
+ }) : /* @__PURE__ */ z(he, {
206
214
  projects: K,
207
215
  rowProps: Q
208
216
  })
209
- }), /* @__PURE__ */ z(ve, {
217
+ }), /* @__PURE__ */ z(be, {
210
218
  workspace: r,
211
219
  projects: O,
212
220
  health: u.health,
213
221
  onHealth: (e) => J({ health: e === u.health ? void 0 : e })
214
222
  })]
215
223
  }),
216
- j && /* @__PURE__ */ z(d, {
224
+ j !== null && /* @__PURE__ */ z(d, {
217
225
  workspace: r,
218
226
  teamId: C?.id,
219
- onClose: () => M(!1)
227
+ parentId: j || void 0,
228
+ onClose: () => M(null)
220
229
  })
221
230
  ]
222
231
  });
223
232
  }
224
233
  var W = "@4xl:grid @4xl:grid-cols-[minmax(0,1fr)_10rem_2rem_2rem_6rem_8rem_2rem]";
225
- function pe({ projects: e, rowProps: t }) {
234
+ function he({ projects: e, rowProps: t }) {
226
235
  let n = R("planning"), [r, i] = I(/* @__PURE__ */ new Set()), a = new Set([...r].flatMap((t) => E(e, t).map((e) => e.id))), o = (e) => i((t) => {
227
236
  let n = new Set(t);
228
237
  return n.delete(e) || n.add(e), n;
@@ -360,15 +369,15 @@ function K({ workspace: e, project: t, onContextMenu: n, menu: r, depth: i = 0,
360
369
  var q = 864e5, J = 5, Y = 64, X = 256, Z = 56, Q = (e) => Date.parse(`${e}T00:00:00Z`), $ = (e) => {
361
370
  let t = new Date(e);
362
371
  return Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), 1);
363
- }, me = () => {
372
+ }, ge = () => {
364
373
  let e = /* @__PURE__ */ new Date();
365
374
  return Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
366
- }, he = (e) => e - (new Date(e).getUTCDay() + 6) % 7 * q;
367
- function ge({ workspace: e, projects: t, rowProps: n }) {
375
+ }, _e = (e) => e - (new Date(e).getUTCDay() + 6) % 7 * q;
376
+ function ve({ workspace: e, projects: t, rowProps: n }) {
368
377
  let r = R("planning"), i = L(), a = F(null), [o, s] = I({
369
378
  left: 0,
370
379
  width: 0
371
- }), c = me(), l = t.map((e) => {
380
+ }), c = ge(), l = t.map((e) => {
372
381
  let t = e.targetDate ? Q(e.targetDate) : void 0;
373
382
  return {
374
383
  p: e,
@@ -378,7 +387,7 @@ function ge({ workspace: e, projects: t, rowProps: n }) {
378
387
  }), u = l.flatMap((e) => [e.start, e.end].filter((e) => e !== void 0)), d = $(Math.min(c - 90 * q, ...u)), f = $(Math.max(c + 300 * q, ...u) + 40 * q), p = (e) => (e - d) / q * J, m = p(f), h = [];
379
388
  for (let e = d; e < f; e = $(e + 32 * q)) h.push(e);
380
389
  let g = [];
381
- for (let e = he(d) + 7 * q; e < f; e += 7 * q) g.push(e);
390
+ for (let e = _e(d) + 7 * q; e < f; e += 7 * q) g.push(e);
382
391
  let _ = (e, t) => i.dateTime(new Date(e), {
383
392
  ...t,
384
393
  timeZone: "UTC"
@@ -488,7 +497,7 @@ function ge({ workspace: e, projects: t, rowProps: n }) {
488
497
  return /* @__PURE__ */ B("li", {
489
498
  className: "group flex hover:bg-muted/40",
490
499
  style: { height: Y },
491
- children: [/* @__PURE__ */ z(_e, { ...n(t) }), /* @__PURE__ */ B("div", {
500
+ children: [/* @__PURE__ */ z(ye, { ...n(t) }), /* @__PURE__ */ B("div", {
492
501
  className: "relative",
493
502
  style: { width: m },
494
503
  children: [a && !u && !d && /* @__PURE__ */ z(M, {
@@ -553,7 +562,7 @@ function ge({ workspace: e, projects: t, rowProps: n }) {
553
562
  })
554
563
  });
555
564
  }
556
- function _e({ workspace: e, project: t, onContextMenu: n }) {
565
+ function ye({ workspace: e, project: t, onContextMenu: n }) {
557
566
  let r = R("planning"), { person: i } = b(e), a = t.lead ? i(t.lead) : void 0, o = h(t);
558
567
  return /* @__PURE__ */ B(D, {
559
568
  to: "/$workspace/projects/$projectId",
@@ -596,7 +605,7 @@ function _e({ workspace: e, project: t, onContextMenu: n }) {
596
605
  ]
597
606
  });
598
607
  }
599
- function ve({ workspace: e, projects: n, health: i, onHealth: a }) {
608
+ function be({ workspace: e, projects: n, health: i, onHealth: a }) {
600
609
  let o = R("planning"), { data: s } = V(t(e)), { person: c } = b(e), [l, u] = I("health"), d = (e) => n.filter(e).length, p = "flex h-9 w-full items-center gap-2.5 rounded-md px-2 text-sm", m = [...new Set(n.map((e) => e.lead ?? ""))];
601
610
  return /* @__PURE__ */ B("aside", {
602
611
  "aria-label": o("breakdown"),