@parallelworks/tandem-web 0.189.8 → 0.189.10

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.
@@ -750,8 +750,17 @@ var e = {
750
750
  findIssue: "Find the issue it duplicates…",
751
751
  declineReason: "Why decline it? (optional, posted as a comment)",
752
752
  acceptInto: "Status",
753
- acceptWhereItIs: "Where it is now",
754
- assignToMe: "Assign to me"
753
+ assignToMe: "Assign to me",
754
+ acceptedToast: "{key} accepted",
755
+ declinedToast: "{key} declined",
756
+ assignedToYou: "assigned to you",
757
+ assignedTo: "assigned to {name}",
758
+ undo: "Undo",
759
+ paneFailed: "This issue couldn't load",
760
+ paneFailedHelp: "Pick another one, or open it on its own page.",
761
+ addReason: "Add a reason",
762
+ acceptKey: "Accept (1)",
763
+ declineKey: "Decline (2)"
755
764
  },
756
765
  subscription: {
757
766
  subscribe: "Subscribe to updates on this issue",
@@ -2111,7 +2120,6 @@ var e = {
2111
2120
  share: "{percent} of {count}",
2112
2121
  doneOf: "{done} of {total} done",
2113
2122
  showing: "{count, plural, one {Showing # issue} other {Showing # issues}}",
2114
- showAll: "Show all issues",
2115
2123
  cycles: "Cycles",
2116
2124
  noCycle: "No cycle",
2117
2125
  cycle: "Cycle {number}",
@@ -750,8 +750,17 @@ var e = {
750
750
  findIssue: "Busca la incidencia que duplica…",
751
751
  declineReason: "¿Por qué rechazarla? (opcional, se publica como comentario)",
752
752
  acceptInto: "Estado",
753
- acceptWhereItIs: "Donde está ahora",
754
- assignToMe: "Asignármela"
753
+ assignToMe: "Asignármela",
754
+ acceptedToast: "{key} aceptada",
755
+ declinedToast: "{key} rechazada",
756
+ assignedToYou: "asignada a ti",
757
+ assignedTo: "asignada a {name}",
758
+ undo: "Deshacer",
759
+ paneFailed: "No se pudo cargar esta incidencia",
760
+ paneFailedHelp: "Elige otra o ábrela en su propia página.",
761
+ addReason: "Añadir un motivo",
762
+ acceptKey: "Aceptar (1)",
763
+ declineKey: "Rechazar (2)"
755
764
  },
756
765
  subscription: {
757
766
  subscribe: "Suscribirse a las novedades de esta incidencia",
@@ -2111,7 +2120,6 @@ var e = {
2111
2120
  share: "{percent} de {count}",
2112
2121
  doneOf: "{done} de {total} hechas",
2113
2122
  showing: "{count, plural, one {Mostrando # incidencia} other {Mostrando # incidencias}}",
2114
- showAll: "Mostrar todas las incidencias",
2115
2123
  cycles: "Ciclos",
2116
2124
  noCycle: "Sin ciclo",
2117
2125
  cycle: "Ciclo {number}",
@@ -750,8 +750,17 @@ var e = {
750
750
  findIssue: "重複先のイシューを検索…",
751
751
  declineReason: "却下する理由(任意、コメントとして投稿)",
752
752
  acceptInto: "ステータス",
753
- acceptWhereItIs: "現在のまま",
754
- assignToMe: "自分に割り当てる"
753
+ assignToMe: "自分に割り当てる",
754
+ acceptedToast: "{key} を受け入れました",
755
+ declinedToast: "{key} を却下しました",
756
+ assignedToYou: "あなたに割り当て",
757
+ assignedTo: "{name} に割り当て",
758
+ undo: "元に戻す",
759
+ paneFailed: "この課題を読み込めませんでした",
760
+ paneFailedHelp: "別の課題を選ぶか、課題のページで開いてください。",
761
+ addReason: "理由を追加",
762
+ acceptKey: "受け入れる (1)",
763
+ declineKey: "却下する (2)"
755
764
  },
756
765
  subscription: {
757
766
  subscribe: "この課題の更新を購読",
@@ -2111,7 +2120,6 @@ var e = {
2111
2120
  share: "{count} 件中 {percent}",
2112
2121
  doneOf: "{total} 件中 {done} 件完了",
2113
2122
  showing: "{count} 件の課題を表示中",
2114
- showAll: "すべての課題を表示",
2115
2123
  cycles: "サイクル",
2116
2124
  noCycle: "サイクルなし",
2117
2125
  cycle: "サイクル {number}",
@@ -750,8 +750,17 @@ var e = {
750
750
  findIssue: "중복된 이슈 찾기…",
751
751
  declineReason: "거절하는 이유 (선택, 댓글로 게시됨)",
752
752
  acceptInto: "상태",
753
- acceptWhereItIs: "현재 상태 그대로",
754
- assignToMe: "나에게 할당"
753
+ assignToMe: "나에게 할당",
754
+ acceptedToast: "{key} 수락됨",
755
+ declinedToast: "{key} 거절됨",
756
+ assignedToYou: "나에게 할당됨",
757
+ assignedTo: "{name}에게 할당됨",
758
+ undo: "실행 취소",
759
+ paneFailed: "이 이슈를 불러오지 못했습니다",
760
+ paneFailedHelp: "다른 이슈를 고르거나 이슈 페이지에서 여세요.",
761
+ addReason: "사유 추가",
762
+ acceptKey: "수락 (1)",
763
+ declineKey: "거절 (2)"
755
764
  },
756
765
  subscription: {
757
766
  subscribe: "이 이슈의 업데이트 구독",
@@ -2111,7 +2120,6 @@ var e = {
2111
2120
  share: "{count}개 중 {percent}",
2112
2121
  doneOf: "{total}개 중 {done}개 완료",
2113
2122
  showing: "이슈 {count}개 표시 중",
2114
- showAll: "모든 이슈 보기",
2115
2123
  cycles: "사이클",
2116
2124
  noCycle: "사이클 없음",
2117
2125
  cycle: "사이클 {number}",
@@ -750,8 +750,17 @@ var e = {
750
750
  findIssue: "查找它重复的问题…",
751
751
  declineReason: "拒绝原因(可选,作为评论发布)",
752
752
  acceptInto: "状态",
753
- acceptWhereItIs: "保持当前状态",
754
- assignToMe: "分配给我"
753
+ assignToMe: "分配给我",
754
+ acceptedToast: "已接受 {key}",
755
+ declinedToast: "已拒绝 {key}",
756
+ assignedToYou: "已分配给你",
757
+ assignedTo: "已分配给 {name}",
758
+ undo: "撤销",
759
+ paneFailed: "无法加载此问题",
760
+ paneFailedHelp: "选择另一个问题,或在其页面中打开。",
761
+ addReason: "添加原因",
762
+ acceptKey: "接受 (1)",
763
+ declineKey: "拒绝 (2)"
755
764
  },
756
765
  subscription: {
757
766
  subscribe: "订阅此议题的更新",
@@ -2111,7 +2120,6 @@ var e = {
2111
2120
  share: "{count} 个中的 {percent}",
2112
2121
  doneOf: "{total} 个中已完成 {done} 个",
2113
2122
  showing: "显示 {count} 个问题",
2114
- showAll: "显示所有问题",
2115
2123
  cycles: "周期",
2116
2124
  noCycle: "无周期",
2117
2125
  cycle: "周期 {number}",
@@ -4,9 +4,10 @@ import { CycleIcon as n, PriorityIcon as r, ProjectIcon as i, UserIcon as a, use
4
4
  import { Avatar as s, Tabs as c } from "@parallelworks/ui";
5
5
  import { useLocale as l, useTranslations as u } from "use-intl";
6
6
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
7
+ import { ListFilterBar as m, useListFilters as h } from "@parallelworks/ui/list";
7
8
  // src/components/IssueBreakdown.tsx
8
- var m = "";
9
- function h(e, t) {
9
+ var g = "";
10
+ function _(e, t) {
10
11
  let n;
11
12
  switch (t) {
12
13
  case "assignees":
@@ -21,109 +22,147 @@ function h(e, t) {
21
22
  break;
22
23
  case "cycles": n = e.cycle ? [e.cycle.id] : [];
23
24
  }
24
- return n.length > 0 ? n : [m];
25
+ return n.length > 0 ? n : [g];
25
26
  }
26
- var g = [
27
+ var v = [
27
28
  1,
28
29
  2,
29
30
  3,
30
31
  4,
31
32
  0
32
33
  ];
33
- function _({ workspace: _, issues: b, tabs: x, tab: S, onTabChange: C, focus: w, onFocus: T }) {
34
- let E = u("planning.issueBreakdown"), D = l(), O = o(), { nameOf: k, avatarOf: A } = t(_), j = new Intl.NumberFormat(D, {
35
- style: "percent",
36
- maximumFractionDigits: 0
37
- }), M = /* @__PURE__ */ new Map();
38
- for (let e of b) {
39
- if (e.status.category === "canceled") continue;
40
- let t = +(e.status.category === "completed");
41
- for (let n of h(e, S)) {
42
- let r = M.get(n);
43
- r || (r = {
44
- key: n,
45
- ...N(e, n),
46
- done: 0,
47
- total: 0
48
- }, M.set(n, r)), r.done += t, r.total++;
49
- }
34
+ function y(e, t, n) {
35
+ for (let [r, i] of Object.entries(t)) if (r !== n && i.length !== 0 && !_(e, r).some((e) => i.includes(e))) return !1;
36
+ return !0;
37
+ }
38
+ var b = [
39
+ "assignees",
40
+ "labels",
41
+ "priority",
42
+ "projects",
43
+ "cycles"
44
+ ];
45
+ function x(e) {
46
+ let t = {};
47
+ if (typeof e != "string") return t;
48
+ for (let n of e.split(",")) {
49
+ let e = n.indexOf(":"), r = n.slice(0, e);
50
+ if (e < 0 || !b.includes(r)) continue;
51
+ let i = n.slice(e + 1), a = t[r] ?? [];
52
+ a.includes(i) || (t[r] = [...a, i]);
50
53
  }
51
- function N(t, o) {
52
- switch (S) {
54
+ return t;
55
+ }
56
+ function S(e) {
57
+ let t = b.flatMap((t) => (e[t] ?? []).map((e) => `${t}:${e}`));
58
+ return t.length > 0 ? t.join(",") : void 0;
59
+ }
60
+ var C = (e) => Object.values(e).reduce((e, t) => e + t.length, 0), w = (e) => e === "priority";
61
+ function T(e, t, n) {
62
+ let r = e[t] ?? [], i = r.includes(n) ? r.filter((e) => e !== n) : w(t) ? [...r, n] : [n], { [t]: a, ...o } = e;
63
+ return i.length > 0 ? {
64
+ ...o,
65
+ [t]: i
66
+ } : o;
67
+ }
68
+ function E(c) {
69
+ let l = u("planning.issueBreakdown"), d = o(), { nameOf: p, avatarOf: m } = t(c);
70
+ return (t, o, c) => {
71
+ switch (t) {
53
72
  case "assignees": {
54
- if (o === m) return {
55
- name: E("noAssignee"),
73
+ if (c === g) return {
74
+ name: l("noAssignee"),
56
75
  icon: /* @__PURE__ */ f(a, { className: "size-5 text-muted-foreground" })
57
76
  };
58
- let n = t.assignees.find((e) => `${e.kind}:${e.handle}` === o), r = n ? k(n.kind, n.handle) : o;
77
+ let t = o.assignees.find((e) => `${e.kind}:${e.handle}` === c), n = t ? p(t.kind, t.handle) : c;
59
78
  return {
60
- name: r,
61
- icon: n && /* @__PURE__ */ f(s, {
79
+ name: n,
80
+ icon: t && /* @__PURE__ */ f(s, {
62
81
  size: "xs",
63
- ...e(n.kind),
64
- name: r,
65
- src: A(n.kind, n.handle)
82
+ ...e(t.kind),
83
+ name: n,
84
+ src: m(t.kind, t.handle)
66
85
  })
67
86
  };
68
87
  }
69
88
  case "labels": {
70
- if (o === m) return {
71
- name: E("noLabel"),
72
- icon: /* @__PURE__ */ f(v, { color: "" })
89
+ if (c === g) return {
90
+ name: l("noLabel"),
91
+ icon: /* @__PURE__ */ f(N, { color: "" })
73
92
  };
74
- let e = t.labels.find((e) => e.id === o);
93
+ let e = o.labels.find((e) => e.id === c);
75
94
  return {
76
- name: e?.name ?? o,
77
- icon: /* @__PURE__ */ f(v, { color: e?.color ?? "" })
95
+ name: e?.name ?? c,
96
+ icon: /* @__PURE__ */ f(N, { color: e?.color ?? "" })
78
97
  };
79
98
  }
80
99
  case "priority": return {
81
- name: O[Number(o)] ?? o,
100
+ name: d[Number(c)] ?? c,
82
101
  icon: /* @__PURE__ */ f(r, {
83
- priority: Number(o),
102
+ priority: Number(c),
84
103
  className: "text-muted-foreground"
85
104
  })
86
105
  };
87
- case "projects": return o === m ? {
88
- name: E("noProject"),
106
+ case "projects": return c === g ? {
107
+ name: l("noProject"),
89
108
  icon: /* @__PURE__ */ f(i, { className: "text-muted-foreground" })
90
109
  } : {
91
- name: t.project?.name ?? o,
110
+ name: o.project?.name ?? c,
92
111
  icon: /* @__PURE__ */ f(i, { className: "text-muted-foreground" })
93
112
  };
94
113
  case "cycles": {
95
- let e = /* @__PURE__ */ f(n, { className: "text-muted-foreground" }), r = t.cycle;
96
- return o === m || !r ? {
97
- name: E("noCycle"),
114
+ let e = /* @__PURE__ */ f(n, { className: "text-muted-foreground" }), t = o.cycle;
115
+ return c === g || !t ? {
116
+ name: l("noCycle"),
98
117
  icon: e
99
118
  } : {
100
- name: r.name ? E("cycleNamed", {
101
- number: r.number,
102
- name: r.name
103
- }) : E("cycle", { number: r.number }),
119
+ name: t.name ? l("cycleNamed", {
120
+ number: t.number,
121
+ name: t.name
122
+ }) : l("cycle", { number: t.number }),
104
123
  icon: e
105
124
  };
106
125
  }
107
126
  }
127
+ };
128
+ }
129
+ function D({ workspace: e, issues: t, tabs: n, tab: r, onTabChange: i, focus: a, onFocus: o }) {
130
+ let s = u("planning.issueBreakdown"), m = l(), h = E(e), b = new Intl.NumberFormat(m, {
131
+ style: "percent",
132
+ maximumFractionDigits: 0
133
+ }), x = a?.[r] ?? [], S = /* @__PURE__ */ new Map();
134
+ for (let e of t) {
135
+ if (e.status.category === "canceled") continue;
136
+ let t = _(e, r), n = !a || y(e, a, r);
137
+ for (let i of t) {
138
+ if (!n && !x.includes(i)) continue;
139
+ let t = S.get(i);
140
+ t || (t = {
141
+ key: i,
142
+ ...h(r, e, i),
143
+ done: 0,
144
+ total: 0
145
+ }, S.set(i, t)), n && (t.done += +(e.status.category === "completed"), t.total++);
146
+ }
108
147
  }
109
- let P = [...M.values()].sort((e, t) => S === "priority" ? g.indexOf(Number(e.key)) - g.indexOf(Number(t.key)) : S === "cycles" && e.key !== m && t.key !== m ? e.name.localeCompare(t.name, D, { numeric: !0 }) : e.key === m == (t.key === m) ? t.total - e.total || e.name.localeCompare(t.name, D) : e.key === m ? -1 : 1);
110
- return P.length === 0 ? /* @__PURE__ */ f("p", {
148
+ let w = [...S.values()].sort((e, t) => r === "priority" ? v.indexOf(Number(e.key)) - v.indexOf(Number(t.key)) : r === "cycles" && e.key !== g && t.key !== g ? e.name.localeCompare(t.name, m, { numeric: !0 }) : e.key === g == (t.key === g) ? t.total - e.total || e.name.localeCompare(t.name, m) : e.key === g ? -1 : 1);
149
+ return w.length === 0 && (!a || C(a) === 0) ? /* @__PURE__ */ f("p", {
111
150
  className: "rounded-lg border border-border px-4 py-5 text-sm text-muted-foreground",
112
- children: E("empty")
151
+ children: s("empty")
113
152
  }) : /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f(c, {
114
- label: E("label"),
153
+ label: s("label"),
115
154
  variant: "line",
116
155
  size: "sm",
117
- items: x.map((e) => ({
156
+ items: n.map((e) => ({
118
157
  value: e,
119
- label: E(e)
158
+ label: s(e)
120
159
  })),
121
- value: S,
122
- onValueChange: C
160
+ value: r,
161
+ onValueChange: i
123
162
  }), /* @__PURE__ */ f("ul", {
124
163
  className: "mt-3 space-y-0.5",
125
- children: P.map((e) => {
126
- let t = e.total ? e.done / e.total : 0, n = w?.tab === S && w.key === e.key, r = /* @__PURE__ */ p(d, { children: [
164
+ children: w.map((e) => {
165
+ let t = e.total ? e.done / e.total : 0, n = x.includes(e.key), i = /* @__PURE__ */ p(d, { children: [
127
166
  /* @__PURE__ */ f("span", {
128
167
  className: "flex size-5 shrink-0 items-center justify-center",
129
168
  children: e.icon
@@ -132,36 +171,83 @@ function _({ workspace: _, issues: b, tabs: x, tab: S, onTabChange: C, focus: w,
132
171
  className: "min-w-0 flex-1 truncate",
133
172
  children: e.name
134
173
  }),
135
- /* @__PURE__ */ f(y, { share: t }),
174
+ /* @__PURE__ */ f(P, { share: t }),
136
175
  /* @__PURE__ */ f("span", {
137
176
  className: "min-w-16 shrink-0 text-right text-xs whitespace-nowrap text-muted-foreground tabular-nums",
138
- title: E("doneOf", {
177
+ title: s("doneOf", {
139
178
  done: e.done,
140
179
  total: e.total
141
180
  }),
142
- children: E("share", {
143
- percent: j.format(t),
181
+ children: s("share", {
182
+ percent: b.format(t),
144
183
  count: e.total
145
184
  })
146
185
  })
147
- ] }), i = "flex h-9 w-full items-center gap-2.5 rounded-md px-2 text-left text-sm";
148
- return /* @__PURE__ */ f("li", { children: T ? /* @__PURE__ */ f("button", {
186
+ ] }), c = "flex h-9 w-full items-center gap-2.5 rounded-md px-2 text-left text-sm";
187
+ return /* @__PURE__ */ f("li", { children: o ? /* @__PURE__ */ f("button", {
149
188
  type: "button",
150
189
  "aria-pressed": n,
151
- onClick: () => T(n ? null : {
152
- tab: S,
153
- key: e.key
154
- }),
155
- className: `${i} transition-colors hover:bg-muted ${n ? "bg-muted" : ""}`,
156
- children: r
190
+ onClick: () => o(T(a ?? {}, r, e.key)),
191
+ className: `${c} transition-colors hover:bg-muted ${n ? "bg-muted" : ""}`,
192
+ children: i
157
193
  }) : /* @__PURE__ */ f("div", {
158
- className: i,
159
- children: r
194
+ className: c,
195
+ children: i
160
196
  }) }, e.key);
161
197
  })
162
198
  })] });
163
199
  }
164
- function v({ color: e }) {
200
+ var O = {
201
+ assignees: "assignee",
202
+ labels: "label",
203
+ priority: "priority",
204
+ projects: "project",
205
+ cycles: "cycle"
206
+ }, k = ":none", A = (e) => e === g ? k : e, j = (e) => e === k ? g : e;
207
+ function M({ workspace: e, issues: t, tabs: n, focus: r, onFocus: i, className: a }) {
208
+ let o = u("planning.issueBreakdown"), s = u("issueFilters"), c = E(e), l = n.map((e) => {
209
+ let n = /* @__PURE__ */ new Map();
210
+ for (let r of t) for (let t of _(r, e)) if (!n.has(t)) {
211
+ let { name: i, icon: a } = c(e, r, t);
212
+ n.set(t, {
213
+ value: A(t),
214
+ label: i,
215
+ icon: a
216
+ });
217
+ }
218
+ return {
219
+ key: e,
220
+ label: s(O[e]),
221
+ kind: "enum",
222
+ operators: ["is"],
223
+ multiple: w(e),
224
+ options: [...n.values()]
225
+ };
226
+ }), d = h({
227
+ storageKey: "tandem:issueBreakdown",
228
+ fields: l,
229
+ remember: !1,
230
+ store: {
231
+ value: Object.entries(r).map(([e, t]) => ({
232
+ field: e,
233
+ op: "is",
234
+ values: t.map(A)
235
+ })),
236
+ onChange: (e) => i(Object.fromEntries(e.filter((e) => e.values.length > 0).map((e) => [e.field, e.values.map(j)])))
237
+ }
238
+ }), p = t.filter((e) => y(e, r)).length;
239
+ return C(r) === 0 ? null : /* @__PURE__ */ f(m, {
240
+ filters: d,
241
+ label: o("label"),
242
+ className: a,
243
+ trailing: /* @__PURE__ */ f("span", {
244
+ className: "text-xs whitespace-nowrap text-muted-foreground",
245
+ role: "status",
246
+ children: o("showing", { count: p })
247
+ })
248
+ });
249
+ }
250
+ function N({ color: e }) {
165
251
  return /* @__PURE__ */ f("span", {
166
252
  className: "size-2.5 rounded-full border border-border",
167
253
  style: e ? {
@@ -170,7 +256,7 @@ function v({ color: e }) {
170
256
  } : void 0
171
257
  });
172
258
  }
173
- function y({ share: e }) {
259
+ function P({ share: e }) {
174
260
  let t = 2 * Math.PI * 6;
175
261
  return e >= 1 ? /* @__PURE__ */ p("svg", {
176
262
  viewBox: "0 0 16 16",
@@ -212,4 +298,4 @@ function y({ share: e }) {
212
298
  })]
213
299
  });
214
300
  }
215
- export { _ as IssueBreakdown, h as breakdownKeys };
301
+ export { M as BreakdownFilterBar, D as IssueBreakdown, C as breakdownCount, _ as breakdownKeys, S as formatBreakdown, y as inBreakdown, x as parseBreakdown };