@parallelworks/tandem-web 0.186.0 → 0.187.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 +14 -3
- package/_virtual/_virtual_i18n/es/common.js +14 -3
- package/_virtual/_virtual_i18n/ja/common.js +14 -3
- package/_virtual/_virtual_i18n/ko/common.js +14 -3
- package/_virtual/_virtual_i18n/zh/common.js +14 -3
- package/components/Graph.js +204 -134
- package/components/StatusRules.js +119 -85
- package/lib/projectList.js +16 -2
- package/lib/projects.js +2 -15
- package/package.json +1 -1
- package/pages/projects.js +130 -119
|
@@ -1,134 +1,168 @@
|
|
|
1
1
|
import { api as e, unwrap as t } from "../api/client.js";
|
|
2
2
|
import { statusesQuery as n, teamsQuery as r } from "../api/queries.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { StatusIcon as i } from "./icons.js";
|
|
4
|
+
import { Checkbox as a, ErrorText as o, InfoTip as s, SegmentedControl as c, SettingRow as l, SettingsCard as u, Switch as d, Table as f } from "@parallelworks/ui";
|
|
5
|
+
import { useState as p } from "react";
|
|
6
|
+
import { useErrorMessage as m } from "@parallelworks/problem/react";
|
|
7
|
+
import { useTranslations as h } from "use-intl";
|
|
8
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
9
|
+
import { useMutation as v, useQueryClient as y, useSuspenseQuery as b } from "@tanstack/react-query";
|
|
9
10
|
// src/components/StatusRules.tsx
|
|
10
|
-
var
|
|
11
|
+
var x = [
|
|
11
12
|
"member",
|
|
12
13
|
"agent",
|
|
13
14
|
"admin"
|
|
14
|
-
],
|
|
15
|
+
], S = [
|
|
15
16
|
"assignee",
|
|
16
17
|
"estimate",
|
|
17
18
|
"pullRequest",
|
|
18
19
|
"comment"
|
|
19
20
|
];
|
|
20
|
-
function
|
|
21
|
-
|
|
21
|
+
function C({ status: e }) {
|
|
22
|
+
return /* @__PURE__ */ _("span", {
|
|
23
|
+
className: "inline-flex items-center gap-1.5 whitespace-nowrap",
|
|
24
|
+
children: [/* @__PURE__ */ g(i, {
|
|
25
|
+
category: e.category,
|
|
26
|
+
review: e.review,
|
|
27
|
+
step: e.step
|
|
28
|
+
}), e.name]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function w({ workspace: i, team: w, isAdmin: T }) {
|
|
32
|
+
let E = h("statusRules"), D = m(), O = y(), { data: k } = b(n(i, w.key)), [A, j] = p("member"), M = w.statusRules, N = v({
|
|
22
33
|
mutationFn: async (n) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
|
|
23
34
|
params: { path: {
|
|
24
|
-
workspace:
|
|
25
|
-
key:
|
|
35
|
+
workspace: i,
|
|
36
|
+
key: w.key
|
|
26
37
|
} },
|
|
27
38
|
body: { statusRules: n }
|
|
28
39
|
})),
|
|
29
|
-
onMutate: (e) =>
|
|
40
|
+
onMutate: (e) => O.setQueryData(r(i).queryKey, (t) => t?.map((t) => t.id === w.id ? {
|
|
30
41
|
...t,
|
|
31
42
|
statusRules: e
|
|
32
43
|
} : t)),
|
|
33
|
-
onSettled: () =>
|
|
34
|
-
}),
|
|
35
|
-
...
|
|
36
|
-
moves: [...
|
|
37
|
-
role:
|
|
44
|
+
onSettled: () => O.invalidateQueries({ queryKey: r(i).queryKey })
|
|
45
|
+
}), P = M.moves.find((e) => e.role === A), F = (e) => N.mutate({
|
|
46
|
+
...M,
|
|
47
|
+
moves: [...M.moves.filter((e) => e.role !== A), ...e ? [{
|
|
48
|
+
role: A,
|
|
38
49
|
moves: e
|
|
39
50
|
}] : []]
|
|
40
|
-
}),
|
|
51
|
+
}), I = (e, t) => !P || P.moves.some((n) => n.from === e && n.to === t), L = (e, t, n) => F(n ? [...P?.moves ?? [], {
|
|
41
52
|
from: e,
|
|
42
53
|
to: t
|
|
43
|
-
}] : (
|
|
44
|
-
let r = n ? [...
|
|
45
|
-
|
|
46
|
-
...
|
|
47
|
-
requires: [...
|
|
54
|
+
}] : (P?.moves ?? []).filter((n) => n.from !== e || n.to !== t)), R = (e) => M.requires.find((t) => t.statusId === e)?.fields ?? [], z = (e, t, n) => {
|
|
55
|
+
let r = n ? [...R(e), t] : R(e).filter((e) => e !== t);
|
|
56
|
+
N.mutate({
|
|
57
|
+
...M,
|
|
58
|
+
requires: [...M.requires.filter((t) => t.statusId !== e), ...r.length > 0 ? [{
|
|
48
59
|
statusId: e,
|
|
49
60
|
fields: r
|
|
50
61
|
}] : []]
|
|
51
62
|
});
|
|
52
|
-
},
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
title:
|
|
55
|
-
description:
|
|
63
|
+
}, B = !T;
|
|
64
|
+
return /* @__PURE__ */ _(u, {
|
|
65
|
+
title: E("title"),
|
|
66
|
+
description: E("description"),
|
|
56
67
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
children:
|
|
61
|
-
|
|
68
|
+
/* @__PURE__ */ _("section", {
|
|
69
|
+
"aria-labelledby": "status-needs",
|
|
70
|
+
className: "space-y-2 px-4 py-3",
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ g("h3", {
|
|
73
|
+
id: "status-needs",
|
|
74
|
+
className: "text-sm font-medium",
|
|
75
|
+
children: E("needsTitle")
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ g("p", {
|
|
78
|
+
className: "text-xs text-muted-foreground",
|
|
79
|
+
children: E("needsIntro")
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ _(f, {
|
|
82
|
+
rounded: !0,
|
|
83
|
+
caps: !1,
|
|
84
|
+
density: "compact",
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ g(f.Header, { children: E("status") }),
|
|
87
|
+
S.map((e) => /* @__PURE__ */ g(f.Header, {
|
|
88
|
+
className: "text-center",
|
|
89
|
+
children: /* @__PURE__ */ _("span", {
|
|
90
|
+
className: "inline-flex items-center justify-center gap-1 whitespace-nowrap",
|
|
91
|
+
children: [E(`fields.${e}`), /* @__PURE__ */ g(s, { text: E(`fieldHelp.${e}`) })]
|
|
92
|
+
})
|
|
93
|
+
}, e)),
|
|
94
|
+
k.map((e) => /* @__PURE__ */ _("tr", { children: [/* @__PURE__ */ g(f.Item, { children: /* @__PURE__ */ g(C, { status: e }) }), S.map((t) => /* @__PURE__ */ g(f.Item, { children: /* @__PURE__ */ g(a, {
|
|
95
|
+
className: "mx-auto",
|
|
96
|
+
"aria-label": E("need", {
|
|
97
|
+
field: E(`fields.${t}`),
|
|
98
|
+
status: e.name
|
|
99
|
+
}),
|
|
100
|
+
checked: R(e.id).includes(t),
|
|
101
|
+
disabled: B,
|
|
102
|
+
onCheckedChange: (n) => z(e.id, t, n)
|
|
103
|
+
}) }, t))] }, e.id))
|
|
104
|
+
]
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ g(l, {
|
|
109
|
+
label: E("movesTitle"),
|
|
110
|
+
helpText: E("movesHelp"),
|
|
111
|
+
children: /* @__PURE__ */ g(c, {
|
|
112
|
+
label: E("role"),
|
|
62
113
|
size: "sm",
|
|
63
|
-
value:
|
|
64
|
-
onValueChange:
|
|
65
|
-
options:
|
|
114
|
+
value: A,
|
|
115
|
+
onValueChange: j,
|
|
116
|
+
options: x.map((e) => ({
|
|
66
117
|
value: e,
|
|
67
|
-
label:
|
|
118
|
+
label: E(`roles.${e}`)
|
|
68
119
|
}))
|
|
69
120
|
})
|
|
70
121
|
}),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
label:
|
|
73
|
-
helpText:
|
|
74
|
-
children: /* @__PURE__ */
|
|
75
|
-
"aria-label":
|
|
76
|
-
checked: !!
|
|
77
|
-
disabled:
|
|
78
|
-
onCheckedChange: (e) =>
|
|
122
|
+
/* @__PURE__ */ g(l, {
|
|
123
|
+
label: E("limit", { role: E(`roles.${A}`) }),
|
|
124
|
+
helpText: E("limitHelp"),
|
|
125
|
+
children: /* @__PURE__ */ g(d, {
|
|
126
|
+
"aria-label": E("limit", { role: E(`roles.${A}`) }),
|
|
127
|
+
checked: !!P,
|
|
128
|
+
disabled: B,
|
|
129
|
+
onCheckedChange: (e) => F(e ? k.flatMap((e) => k.filter((t) => t.id !== e.id).map((t) => ({
|
|
79
130
|
from: e.id,
|
|
80
131
|
to: t.id
|
|
81
132
|
}))) : null)
|
|
82
133
|
})
|
|
83
134
|
}),
|
|
84
|
-
|
|
85
|
-
className: "
|
|
86
|
-
children: /* @__PURE__ */
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
children: e.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
children: e.id !== t.id && /* @__PURE__ */ p(i, {
|
|
100
|
-
"aria-label": C("move", {
|
|
135
|
+
P && /* @__PURE__ */ g("div", {
|
|
136
|
+
className: "px-4 py-3",
|
|
137
|
+
children: /* @__PURE__ */ _(f, {
|
|
138
|
+
rounded: !0,
|
|
139
|
+
caps: !1,
|
|
140
|
+
density: "compact",
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ g(f.Header, { children: E("fromTo") }),
|
|
143
|
+
k.map((e) => /* @__PURE__ */ g(f.Header, {
|
|
144
|
+
className: "text-center",
|
|
145
|
+
children: /* @__PURE__ */ g(C, { status: e })
|
|
146
|
+
}, e.id)),
|
|
147
|
+
k.map((e) => /* @__PURE__ */ _("tr", { children: [/* @__PURE__ */ g(f.Item, { children: /* @__PURE__ */ g(C, { status: e }) }), k.map((t) => /* @__PURE__ */ g(f.Item, { children: e.id !== t.id && /* @__PURE__ */ g(a, {
|
|
148
|
+
className: "mx-auto",
|
|
149
|
+
"aria-label": E("move", {
|
|
101
150
|
from: e.name,
|
|
102
151
|
to: t.name
|
|
103
152
|
}),
|
|
104
|
-
checked:
|
|
105
|
-
disabled:
|
|
106
|
-
onCheckedChange: (n) =>
|
|
107
|
-
})
|
|
108
|
-
|
|
153
|
+
checked: I(e.id, t.id),
|
|
154
|
+
disabled: B,
|
|
155
|
+
onCheckedChange: (n) => L(e.id, t.id, n)
|
|
156
|
+
}) }, t.id))] }, e.id))
|
|
157
|
+
]
|
|
109
158
|
})
|
|
110
159
|
}),
|
|
111
|
-
|
|
112
|
-
label: C("needs", { status: e.name }),
|
|
113
|
-
helpText: C("needsHelp"),
|
|
114
|
-
children: /* @__PURE__ */ p("div", {
|
|
115
|
-
className: "flex flex-wrap justify-end gap-x-4 gap-y-2",
|
|
116
|
-
children: y.map((t) => /* @__PURE__ */ m("label", {
|
|
117
|
-
className: "flex items-center gap-1.5 text-sm",
|
|
118
|
-
children: [/* @__PURE__ */ p(i, {
|
|
119
|
-
checked: F(e.id).includes(t),
|
|
120
|
-
disabled: L,
|
|
121
|
-
onCheckedChange: (n) => I(e.id, t, n)
|
|
122
|
-
}), C(`fields.${t}`)]
|
|
123
|
-
}, t))
|
|
124
|
-
})
|
|
125
|
-
}, e.id)),
|
|
126
|
-
A.isError && /* @__PURE__ */ p(a, {
|
|
160
|
+
N.isError && /* @__PURE__ */ g(o, {
|
|
127
161
|
size: "md",
|
|
128
162
|
className: "px-4 pb-3",
|
|
129
|
-
children:
|
|
163
|
+
children: D(N.error)
|
|
130
164
|
})
|
|
131
165
|
]
|
|
132
166
|
});
|
|
133
167
|
}
|
|
134
|
-
export {
|
|
168
|
+
export { w as StatusRules };
|
package/lib/projectList.js
CHANGED
|
@@ -14,11 +14,25 @@ function i(e, t) {
|
|
|
14
14
|
localStorage.setItem(n(e), t);
|
|
15
15
|
} catch {}
|
|
16
16
|
}
|
|
17
|
-
var a =
|
|
17
|
+
var a = "tandem-projects-expanded";
|
|
18
|
+
function o() {
|
|
19
|
+
try {
|
|
20
|
+
let e = JSON.parse(localStorage.getItem(a) ?? "[]");
|
|
21
|
+
return new Set(Array.isArray(e) ? e.filter((e) => typeof e == "string") : []);
|
|
22
|
+
} catch {
|
|
23
|
+
return /* @__PURE__ */ new Set();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function s(e) {
|
|
27
|
+
try {
|
|
28
|
+
localStorage.setItem(a, JSON.stringify([...e]));
|
|
29
|
+
} catch {}
|
|
30
|
+
}
|
|
31
|
+
var c = (n) => ({
|
|
18
32
|
...typeof n.team == "string" && n.team && { team: n.team },
|
|
19
33
|
...(n.status === "all" || t.includes(n.status)) && { status: n.status },
|
|
20
34
|
...e.includes(n.health) && { health: n.health },
|
|
21
35
|
...(n.view === "list" || n.view === "timeline" || n.view === "templates") && { view: n.view },
|
|
22
36
|
...typeof n.parent == "string" && n.parent && { parent: n.parent }
|
|
23
37
|
});
|
|
24
|
-
export {
|
|
38
|
+
export { c as projectSearch, s as storeExpanded, i as storeLayout, o as storedExpanded, r as storedLayout };
|
package/lib/projects.js
CHANGED
|
@@ -8,20 +8,7 @@ function t(e, t) {
|
|
|
8
8
|
};
|
|
9
9
|
return r(t), n;
|
|
10
10
|
}
|
|
11
|
-
function n(e) {
|
|
12
|
-
let t = new Set(e.map((e) => e.id)), n = [], r = (t, i) => {
|
|
13
|
-
let a = e.filter((e) => e.parentId === t.id);
|
|
14
|
-
n.push({
|
|
15
|
-
project: t,
|
|
16
|
-
depth: i,
|
|
17
|
-
children: a.length
|
|
18
|
-
});
|
|
19
|
-
for (let e of a) r(e, i + 1);
|
|
20
|
-
};
|
|
21
|
-
for (let n of e) n.parentId && t.has(n.parentId) || r(n, 0);
|
|
22
|
-
return n;
|
|
23
|
-
}
|
|
24
|
-
function r(e, t) {
|
|
11
|
+
function n(e, t) {
|
|
25
12
|
let n = 1, r = e.find((e) => e.id === t);
|
|
26
13
|
for (; r?.parentId && n <= 5;) {
|
|
27
14
|
let t = r.parentId;
|
|
@@ -29,4 +16,4 @@ function r(e, t) {
|
|
|
29
16
|
}
|
|
30
17
|
return n;
|
|
31
18
|
}
|
|
32
|
-
export {
|
|
19
|
+
export { n as projectLevel, e as projectRef, t as projectsUnder };
|