@parallelworks/tandem-web 0.179.2 → 0.180.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,193 +1,115 @@
1
- import { allDecisionsQuery as e, inboxQuery as t, myAllDecisionsQuery as n, myDecisionsQuery as r, teamsQuery as i } from "../api/queries.js";
2
- import { AnsweredDecision as a, DecisionCard as o } from "../components/AgentWork.js";
3
- import { FavoriteStar as s } from "../components/FavoriteStar.js";
4
- import { ChevronRightIcon as c, PriorityIcon as l, usePriorityNames as u } from "../components/icons.js";
5
- import { issuePath as d } from "../lib/branch.js";
6
- import { recentlyAnswered as f, saveScope as p, savedScope as m } from "../lib/decisionScope.js";
7
- import { copyItem as h, useLinkItems as g } from "../lib/menus.js";
8
- import { usePageTitle as _ } from "../lib/pageTitle.js";
9
- import { Link as v } from "../lib/router.js";
10
- import { SegmentedControl as y, Tooltip as b, useOpenMenu as x } from "@parallelworks/ui";
11
- import { useParams as S, useSearch as C } from "@tanstack/react-router";
12
- import { useState as w } from "react";
13
- import { useTranslations as T } from "use-intl";
14
- import { jsx as E, jsxs as D } from "react/jsx-runtime";
15
- import { useSuspenseQuery as O } from "@tanstack/react-query";
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
+ import { AnsweredDecision as o, DecisionCard as s } from "../components/AgentWork.js";
3
+ import { FavoriteStar as c } from "../components/FavoriteStar.js";
4
+ import { InboxIcon as l } from "../components/icons.js";
5
+ import { recentlyAnswered as u, saveScope as d, savedScope as f } from "../lib/decisionScope.js";
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";
16
13
  // src/pages/decisions.tsx
17
- var k = ["workspace", "all"];
18
- function A(e) {
19
- let t = /* @__PURE__ */ new Map();
20
- for (let n of e) {
21
- let e = `${n.workspace}/${n.identifier}`;
22
- t.set(e, [...t.get(e) ?? [], n]);
23
- }
24
- return [...t.values()];
25
- }
26
- function j({ first: e, count: t, open: n, onToggle: r, showWorkspace: i, children: a }) {
27
- let o = T("decisions"), s = g(), f = x(), p = u();
28
- return /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ D("div", {
29
- className: "mb-1.5 flex min-w-0 items-center gap-1 text-xs text-muted-foreground",
30
- children: [
31
- /* @__PURE__ */ E("button", {
32
- type: "button",
33
- onClick: r,
34
- "aria-expanded": n,
35
- "aria-label": o(n ? "hideDecisions" : "showDecisions", { issue: e.identifier }),
36
- className: "-ml-1 shrink-0 rounded p-0.5 hover:bg-muted hover:text-foreground",
37
- children: /* @__PURE__ */ E(c, { className: n ? "size-3.5 rotate-90" : "size-3.5" })
38
- }),
39
- /* @__PURE__ */ D(v, {
40
- to: "/$workspace/issues/$identifier",
41
- params: {
42
- workspace: e.workspace,
43
- identifier: e.identifier
44
- },
45
- onContextMenu: (t) => f(t, [...s(d(e.workspace, e.identifier)), h(o("copyId"), e.identifier)]),
46
- className: "flex min-w-0 items-center gap-2 hover:text-foreground",
47
- children: [
48
- i && /* @__PURE__ */ E("span", {
49
- className: "max-w-[40%] shrink-0 truncate rounded bg-muted px-1.5 py-0.5 font-medium text-foreground",
50
- children: e.workspaceName
51
- }),
52
- /* @__PURE__ */ E(b, {
53
- content: p[e.issuePriority],
54
- children: /* @__PURE__ */ D("span", {
55
- className: "flex",
56
- children: [/* @__PURE__ */ E(l, { priority: e.issuePriority }), /* @__PURE__ */ E("span", {
57
- className: "sr-only",
58
- children: p[e.issuePriority]
59
- })]
60
- })
61
- }),
62
- /* @__PURE__ */ E("span", {
63
- className: "shrink-0 font-medium",
64
- children: e.identifier
65
- }),
66
- /* @__PURE__ */ E("span", {
67
- className: "truncate",
68
- children: e.issueTitle
69
- })
70
- ]
71
- }),
72
- /* @__PURE__ */ E("span", {
73
- className: "ml-1 shrink-0",
74
- children: t
75
- })
76
- ]
77
- }), n && /* @__PURE__ */ E("div", {
78
- className: "space-y-3",
79
- children: a
80
- })] });
81
- }
82
- function M() {
83
- let { workspace: l, key: u } = S({ strict: !1 }), d = T("decisions"), h = x(), { team: g = u } = C({ strict: !1 }), { data: v } = O(i(l)), b = v.find((e) => e.key === g);
84
- _(d("title"), b?.name);
85
- let [M, N] = w(m), P = b ? "workspace" : M, F = P === "all", I = (e) => b ? e.filter((e) => e.identifier.startsWith(`${b.key}-`)) : e, L = (e) => {
86
- N(e), p(e);
87
- }, { data: R } = O(F ? r : t(l)), { data: z } = O(F ? n : e(l)), B = I(R), V = f(I(z)), [H, U] = w(/* @__PURE__ */ new Set()), [W, G] = w(!1), K = (e) => U((t) => {
88
- let n = new Set(t);
89
- return n.delete(e) || n.add(e), n;
90
- }), q = () => k.map((e) => ({
91
- label: d(`scopes.${e}`),
92
- checked: e === P,
93
- onClick: () => L(e)
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, {
21
+ live: !0,
22
+ 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)
94
27
  }));
95
- return /* @__PURE__ */ D("div", {
28
+ return /* @__PURE__ */ S("div", {
96
29
  className: "flex h-full flex-col",
97
- children: [/* @__PURE__ */ D("header", {
30
+ children: [/* @__PURE__ */ S("header", {
98
31
  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",
99
32
  children: [
100
- /* @__PURE__ */ E("h1", {
33
+ /* @__PURE__ */ x("h1", {
101
34
  className: "text-sm font-semibold",
102
- children: b ? d("teamTitle", { team: b.name }) : d("title")
35
+ children: M ? O("teamTitle", { team: M.name }) : O("title")
103
36
  }),
104
- !b && /* @__PURE__ */ E(s, {
105
- workspace: l,
37
+ !M && /* @__PURE__ */ x(c, {
38
+ workspace: E,
106
39
  kind: "page",
107
40
  target: "decisions"
108
41
  }),
109
- /* @__PURE__ */ E("span", {
42
+ /* @__PURE__ */ x("span", {
110
43
  className: "text-xs text-muted-foreground",
111
- children: d("openCount", { count: B.length })
44
+ children: O("openCount", { count: V.length })
112
45
  }),
113
- !b && /* @__PURE__ */ E("div", {
46
+ !M && /* @__PURE__ */ x("div", {
114
47
  className: "ml-auto",
115
- children: /* @__PURE__ */ E(y, {
48
+ children: /* @__PURE__ */ x(h, {
116
49
  size: "sm",
117
- label: d("scope"),
118
- options: k.map((e) => ({
50
+ label: O("scope"),
51
+ options: T.map((e) => ({
119
52
  value: e,
120
- label: d(`scopes.${e}`)
53
+ label: O(`scopes.${e}`)
121
54
  })),
122
- value: P,
123
- onValueChange: L,
124
- onContextMenu: (e) => h(e, q())
55
+ value: F,
56
+ onValueChange: R,
57
+ onContextMenu: (e) => k(e, G())
125
58
  })
126
59
  })
127
60
  ]
128
- }), /* @__PURE__ */ E("div", {
61
+ }), /* @__PURE__ */ x("div", {
129
62
  className: "min-h-0 flex-1 overflow-y-auto",
130
- children: /* @__PURE__ */ D("div", {
131
- className: "w-full space-y-4 px-4 py-6 md:px-8",
132
- children: [
133
- A(B).map((e) => {
134
- let [t] = e, n = `open:${t.workspace}/${t.identifier}`;
135
- return /* @__PURE__ */ E(j, {
136
- first: t,
137
- count: d("openCount", { count: e.length }),
138
- open: !H.has(n),
139
- onToggle: () => K(n),
140
- showWorkspace: F,
141
- children: e.map((e) => /* @__PURE__ */ E(o, {
63
+ children: /* @__PURE__ */ S("div", {
64
+ 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
+ variant: "plain"
70
+ }) : /* @__PURE__ */ S("section", {
71
+ "aria-labelledby": "decisions-open",
72
+ className: "space-y-3",
73
+ children: [/* @__PURE__ */ x("h2", {
74
+ id: "decisions-open",
75
+ 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
+ workspace: e.workspace,
81
+ decision: e,
82
+ showIssue: !0,
83
+ showWorkspace: I,
84
+ runner: t?.lastRunnerName ? {
85
+ name: t.lastRunnerName,
86
+ kind: t.runnerKind
87
+ } : void 0
88
+ }, e.id);
89
+ })]
90
+ }), H.length > 0 && /* @__PURE__ */ S("section", {
91
+ "aria-labelledby": "decisions-answered",
92
+ className: "space-y-3",
93
+ children: [/* @__PURE__ */ x("h2", {
94
+ id: "decisions-answered",
95
+ className: "text-sm font-semibold",
96
+ children: O("recentlyAnswered")
97
+ }), /* @__PURE__ */ x("ul", {
98
+ className: "divide-y divide-border rounded-xl border border-border bg-card",
99
+ children: H.map((e) => /* @__PURE__ */ x("li", {
100
+ className: "px-3 py-2.5",
101
+ children: /* @__PURE__ */ x(o, {
142
102
  workspace: e.workspace,
143
- decision: e
144
- }, e.id))
145
- }, n);
146
- }),
147
- B.length === 0 && /* @__PURE__ */ D("div", {
148
- className: "py-24 text-center",
149
- children: [/* @__PURE__ */ E("p", {
150
- className: "text-sm font-medium",
151
- children: d("emptyTitle")
152
- }), /* @__PURE__ */ E("p", {
153
- className: "mt-1 text-sm text-muted-foreground",
154
- children: d(F ? "emptyDescriptionAll" : "emptyDescription")
155
- })]
156
- }),
157
- V.length > 0 && /* @__PURE__ */ D("section", {
158
- className: "space-y-3 pt-6",
159
- "aria-label": d("recentlyAnswered"),
160
- children: [/* @__PURE__ */ E("h2", { children: /* @__PURE__ */ D("button", {
161
- type: "button",
162
- onClick: () => G((e) => !e),
163
- "aria-expanded": W,
164
- className: "-ml-1 flex items-center gap-1 rounded px-1 text-base font-semibold hover:bg-muted",
165
- children: [
166
- /* @__PURE__ */ E(c, { className: W ? "size-4 rotate-90" : "size-4" }),
167
- d("recentlyAnswered"),
168
- /* @__PURE__ */ E("span", {
169
- className: "ml-1 text-xs font-normal text-muted-foreground",
170
- children: V.length
171
- })
172
- ]
173
- }) }), W && A(V).map((e) => {
174
- let [t] = e, n = `answered:${t.workspace}/${t.identifier}`;
175
- return /* @__PURE__ */ E(j, {
176
- first: t,
177
- count: d("answeredCount", { count: e.length }),
178
- open: H.has(n),
179
- onToggle: () => K(n),
180
- showWorkspace: F,
181
- children: e.map((e) => /* @__PURE__ */ E(a, {
182
- workspace: e.workspace,
183
- decision: e
184
- }, e.id))
185
- }, n);
186
- })]
187
- })
188
- ]
103
+ decision: e,
104
+ showIssue: !0,
105
+ showWorkspace: I,
106
+ bare: !0
107
+ })
108
+ }, e.id))
109
+ })]
110
+ })]
189
111
  })
190
112
  })]
191
113
  });
192
114
  }
193
- export { M as Inbox };
115
+ export { E as Inbox };