@parallelworks/tandem-web 0.168.2 → 0.169.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.
@@ -1855,6 +1855,8 @@ var e = {
1855
1855
  },
1856
1856
  cycle: "Cycle {number}",
1857
1857
  cycleNamed: "Cycle {number}: {name}",
1858
+ switchCycle: "Switch cycle",
1859
+ findCycle: "Find a cycle",
1858
1860
  area: "Area",
1859
1861
  noArea: "No area",
1860
1862
  startedFrom: "Started from",
@@ -1855,6 +1855,8 @@ var e = {
1855
1855
  },
1856
1856
  cycle: "Ciclo {number}",
1857
1857
  cycleNamed: "Ciclo {number}: {name}",
1858
+ switchCycle: "Cambiar de ciclo",
1859
+ findCycle: "Buscar un ciclo",
1858
1860
  area: "Área",
1859
1861
  noArea: "Sin área",
1860
1862
  startedFrom: "Iniciada desde",
@@ -1855,6 +1855,8 @@ var e = {
1855
1855
  },
1856
1856
  cycle: "サイクル {number}",
1857
1857
  cycleNamed: "サイクル {number}:{name}",
1858
+ switchCycle: "サイクルを切り替え",
1859
+ findCycle: "サイクルを検索",
1858
1860
  area: "エリア",
1859
1861
  noArea: "エリアなし",
1860
1862
  startedFrom: "開始元",
@@ -1855,6 +1855,8 @@ var e = {
1855
1855
  },
1856
1856
  cycle: "사이클 {number}",
1857
1857
  cycleNamed: "사이클 {number}: {name}",
1858
+ switchCycle: "사이클 전환",
1859
+ findCycle: "사이클 찾기",
1858
1860
  area: "영역",
1859
1861
  noArea: "영역 없음",
1860
1862
  startedFrom: "시작 위치",
@@ -1855,6 +1855,8 @@ var e = {
1855
1855
  },
1856
1856
  cycle: "周期 {number}",
1857
1857
  cycleNamed: "周期 {number}:{name}",
1858
+ switchCycle: "切换周期",
1859
+ findCycle: "查找周期",
1858
1860
  area: "领域",
1859
1861
  noArea: "无领域",
1860
1862
  startedFrom: "起始于",
@@ -0,0 +1,46 @@
1
+ import { useNavigate as e } from "../lib/router.js";
2
+ import { ChevronDownIcon as t, ChevronRightIcon as n } from "./icons.js";
3
+ import { useTime as r } from "../lib/time.js";
4
+ import { byStart as i } from "../lib/cycleOrder.js";
5
+ import { cycleChoices as a } from "../lib/cycleSwitcher.js";
6
+ import { Combobox as o } from "@parallelworks/ui";
7
+ import { useTranslations as s } from "use-intl";
8
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
+ // src/components/CycleSwitcher.tsx
10
+ function u({ workspace: u, teamKey: d, cycles: f, cycle: p }) {
11
+ let m = s("planning"), h = r(), g = e(), _ = (e) => e.name ? m("cycleNamed", {
12
+ number: e.number,
13
+ name: e.name
14
+ }) : m("cycle", { number: e.number }), v = a([...f].sort(i), _, (e) => h.dayRange(e.startsOn, e.endsOn), (e) => m(`states.${e}`));
15
+ return /* @__PURE__ */ l("span", {
16
+ className: "flex min-w-0 items-center gap-1.5 text-[13px] leading-none",
17
+ children: [/* @__PURE__ */ c(n, {
18
+ "aria-hidden": "true",
19
+ className: "size-3 shrink-0 text-muted-foreground opacity-60 rtl:rotate-180"
20
+ }), /* @__PURE__ */ c(o, {
21
+ "aria-label": m("switchCycle"),
22
+ placeholder: m("findCycle"),
23
+ items: v,
24
+ value: String(p.number),
25
+ onValueChange: (e) => {
26
+ e !== null && e !== String(p.number) && g({
27
+ to: "/$workspace/teams/$key/cycles/$number",
28
+ params: {
29
+ workspace: u,
30
+ key: d,
31
+ number: e
32
+ }
33
+ });
34
+ },
35
+ trigger: /* @__PURE__ */ l("button", {
36
+ type: "button",
37
+ className: "flex min-w-0 cursor-pointer items-center gap-1 rounded-sm px-1 py-0.5 font-medium text-foreground hover:bg-muted",
38
+ children: [/* @__PURE__ */ c("span", {
39
+ className: "truncate",
40
+ children: _(p)
41
+ }), /* @__PURE__ */ c(t, { className: "size-3.5 shrink-0 text-muted-foreground" })]
42
+ })
43
+ })]
44
+ });
45
+ }
46
+ export { u as CycleSwitcher };
@@ -0,0 +1,14 @@
1
+ // src/lib/cycleSwitcher.ts
2
+ function e(e, t, n, r) {
3
+ let i = [], a = "";
4
+ for (let o of e) (o.state !== a || i.length === 0) && (i.push({
5
+ label: r(o.state),
6
+ items: []
7
+ }), a = o.state), i[i.length - 1]?.items.push({
8
+ value: String(o.number),
9
+ label: t(o),
10
+ hint: n(o)
11
+ });
12
+ return i;
13
+ }
14
+ export { e as cycleChoices };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/tandem-web",
3
- "version": "0.168.2",
3
+ "version": "0.169.0",
4
4
  "description": "Tandem's pages, for a host app to render in its own",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -1,201 +1,203 @@
1
1
  import { api as e, unwrap as t } from "../../../../../api/client.js";
2
2
  import { NotFound as n } from "../../../../../components/status.js";
3
- import { usePageTitle as r } from "../../../../../lib/pageTitle.js";
4
- import { useNavigate as i } from "../../../../../lib/router.js";
5
- import { cyclesQuery as a, issuesQuery as o, teamsQuery as s } from "../../../../../api/queries.js";
6
- import { invalidateIssueViews as ee } from "../../../../../api/mutations.js";
7
- import { CloseIcon as te, CycleIcon as ne } from "../../../../../components/icons.js";
8
- import { addDays as c, today as l, useTime as u } from "../../../../../lib/time.js";
9
- import { ProgressBar as d } from "../../../../../components/Planning.js";
10
- import { useCan as f } from "../../../../../lib/roles.js";
11
- import { teamPath as p } from "../../../../../lib/teamPaths.js";
12
- import { Route as m } from "./_number.js";
13
- import { FavoriteStar as h } from "../../../../../components/FavoriteStar.js";
14
- import { BurnUp as g } from "../../../../../components/Reports.js";
3
+ import { usePageTitle as ee } from "../../../../../lib/pageTitle.js";
4
+ import { useNavigate as r } from "../../../../../lib/router.js";
5
+ import { cyclesQuery as i, issuesQuery as a, teamsQuery as o } from "../../../../../api/queries.js";
6
+ import { invalidateIssueViews as s } from "../../../../../api/mutations.js";
7
+ import { CloseIcon as c, CycleIcon as l } from "../../../../../components/icons.js";
8
+ import { addDays as u, today as d, useTime as f } from "../../../../../lib/time.js";
9
+ import { ProgressBar as p } from "../../../../../components/Planning.js";
10
+ import { useCan as m } from "../../../../../lib/roles.js";
11
+ import { teamPath as h } from "../../../../../lib/teamPaths.js";
12
+ import { Route as g } from "./_number.js";
13
+ import { FavoriteStar as te } from "../../../../../components/FavoriteStar.js";
14
+ import { BurnUp as ne } from "../../../../../components/Reports.js";
15
15
  import { IssueBreakdown as _, breakdownKeys as re } from "../../../../../components/IssueBreakdown.js";
16
16
  import { StatusGroups as ie } from "../../../../../components/IssueGroup.js";
17
- import { Button as ae, Card as oe, EmptyState as se, ErrorText as v, IconButton as y, PageHeader as b } from "@parallelworks/ui";
18
- import { useState as x } from "react";
19
- import { useErrorMessage as S } from "@parallelworks/problem/react";
20
- import { useTranslations as C } from "use-intl";
21
- import { jsx as w, jsxs as T } from "react/jsx-runtime";
22
- import { useMutation as E, useQuery as D, useQueryClient as O, useSuspenseQuery as k } from "@tanstack/react-query";
17
+ import { CycleSwitcher as ae } from "../../../../../components/CycleSwitcher.js";
18
+ import { Button as oe, Card as se, EmptyState as v, ErrorText as y, IconButton as b, PageHeader as x } from "@parallelworks/ui";
19
+ import { useState as S } from "react";
20
+ import { useErrorMessage as C } from "@parallelworks/problem/react";
21
+ import { useTranslations as w } from "use-intl";
22
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
23
+ import { useMutation as O, useQuery as k, useQueryClient as A, useSuspenseQuery as j } from "@tanstack/react-query";
23
24
  // src/routes/$workspace/teams/$key/cycles/$number.tsx?tsr-split=component
24
- var A = [
25
+ var M = [
25
26
  "assignees",
26
27
  "labels",
27
28
  "priority",
28
29
  "projects"
29
30
  ];
30
- function j() {
31
- let { workspace: j, key: M, number: N } = m.useParams(), P = C("planning"), F = S(), I = u(), ce = i(), { data: L } = k(s(j)), { data: R } = k(a(j, M)), z = R.find((e) => String(e.number) === N), B = L.find((e) => e.key === M);
32
- r(z && (z.name ? P("cycleNamed", {
33
- number: z.number,
34
- name: z.name
35
- }) : P("cycle", { number: z.number })), B?.name);
36
- let V = f(j, "manage_cycles", { team: M }), H = O(), [U, W] = x(null), [G, K] = x("assignees"), [q, J] = x(null), { data: le } = D({
37
- ...o(j, { cycle: z?.id ?? "" }),
38
- enabled: !!z
39
- }), Y = E({
31
+ function N() {
32
+ let { workspace: N, key: P, number: F } = g.useParams(), I = w("planning"), ce = C(), L = f(), R = r(), { data: z } = j(o(N)), { data: B } = j(i(N, P)), V = B.find((e) => String(e.number) === F), H = z.find((e) => e.key === P);
33
+ ee(V && (V.name ? I("cycleNamed", {
34
+ number: V.number,
35
+ name: V.name
36
+ }) : I("cycle", { number: V.number })), H?.name);
37
+ let U = m(N, "manage_cycles", { team: P }), W = A(), [G, le] = S(null), [K, q] = S("assignees"), [J, Y] = S(null), { data: ue } = k({
38
+ ...a(N, { cycle: V?.id ?? "" }),
39
+ enabled: !!V
40
+ }), X = O({
40
41
  mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/teams/{key}/cycles/{number}/move-unfinished", { params: { path: {
41
- workspace: j,
42
- key: M,
43
- number: Number(N)
42
+ workspace: N,
43
+ key: P,
44
+ number: Number(F)
44
45
  } } })),
45
- onSuccess: (e) => W(e.moved),
46
- onSettled: () => ee(H, j)
46
+ onSuccess: (e) => le(e.moved),
47
+ onSettled: () => s(W, N)
47
48
  });
48
- if (!z) return /* @__PURE__ */ w(n, { title: P("noSuchCycle") });
49
- let X = le?.issues ?? [], Z = q ? X.filter((e) => re(e, q.tab).includes(q.key)) : X, Q = X.filter((e) => e.status.category !== "completed" && e.status.category !== "canceled").length, ue = z.state === "past" || z.state === "current" && c(l(), 2) >= z.endsOn, $ = z.name ? P("cycleNamed", {
50
- number: z.number,
51
- name: z.name
52
- }) : P("cycle", { number: z.number });
53
- return /* @__PURE__ */ T("div", {
49
+ if (!V) return /* @__PURE__ */ E(n, { title: I("noSuchCycle") });
50
+ let Z = ue?.issues ?? [], Q = J ? Z.filter((e) => re(e, J.tab).includes(J.key)) : Z, $ = Z.filter((e) => e.status.category !== "completed" && e.status.category !== "canceled").length, de = V.state === "past" || V.state === "current" && u(d(), 2) >= V.endsOn, fe = V.name ? I("cycleNamed", {
51
+ number: V.number,
52
+ name: V.name
53
+ }) : I("cycle", { number: V.number });
54
+ return /* @__PURE__ */ D("div", {
54
55
  className: "flex h-full min-h-0 flex-col",
55
- children: [/* @__PURE__ */ w(b, {
56
+ children: [/* @__PURE__ */ E(x, {
56
57
  heading: !1,
57
- breadcrumbs: [
58
- {
59
- label: B?.name ?? M,
60
- href: p(j, M, "issues")
61
- },
62
- {
63
- label: P("cycles"),
64
- href: p(j, M, "cycles")
65
- },
66
- { label: $ }
67
- ],
68
- titleActions: /* @__PURE__ */ w(h, {
69
- workspace: j,
58
+ breadcrumbs: [{
59
+ label: H?.name ?? P,
60
+ href: h(N, P, "issues")
61
+ }, {
62
+ label: I("cycles"),
63
+ href: h(N, P, "cycles")
64
+ }],
65
+ titleActions: /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(ae, {
66
+ workspace: N,
67
+ teamKey: P,
68
+ cycles: B,
69
+ cycle: V
70
+ }), /* @__PURE__ */ E(te, {
71
+ workspace: N,
70
72
  kind: "cycle",
71
- target: z.id
72
- })
73
- }), /* @__PURE__ */ T("div", {
73
+ target: V.id
74
+ })] })
75
+ }), /* @__PURE__ */ D("div", {
74
76
  className: "flex min-h-0 flex-1 flex-col overflow-y-auto xl:flex-row xl:overflow-hidden",
75
- children: [/* @__PURE__ */ T("div", {
77
+ children: [/* @__PURE__ */ D("div", {
76
78
  className: "w-full min-w-0 px-4 py-6 md:px-8 md:py-8 xl:flex-1 xl:overflow-y-auto",
77
79
  children: [
78
- /* @__PURE__ */ T("div", {
80
+ /* @__PURE__ */ D("div", {
79
81
  className: "flex flex-wrap items-center gap-3",
80
82
  children: [
81
- /* @__PURE__ */ w(ne, { className: `size-5 shrink-0 ${z.state === "current" ? "text-status-started" : "text-muted-foreground"}` }),
82
- /* @__PURE__ */ w("h1", {
83
+ /* @__PURE__ */ E(l, { className: `size-5 shrink-0 ${V.state === "current" ? "text-status-started" : "text-muted-foreground"}` }),
84
+ /* @__PURE__ */ E("h1", {
83
85
  className: "text-xl font-semibold tracking-tight",
84
- children: $
86
+ children: fe
85
87
  }),
86
- /* @__PURE__ */ w("span", {
88
+ /* @__PURE__ */ E("span", {
87
89
  className: "rounded-md border border-border px-1.5 py-0.5 text-xs text-muted-foreground",
88
- children: P(`states.${z.state}`)
90
+ children: I(`states.${V.state}`)
89
91
  }),
90
- /* @__PURE__ */ w("span", {
92
+ /* @__PURE__ */ E("span", {
91
93
  className: "text-sm text-muted-foreground",
92
- children: I.dayRange(z.startsOn, z.endsOn)
94
+ children: L.dayRange(V.startsOn, V.endsOn)
93
95
  }),
94
- z.carriedIn > 0 && /* @__PURE__ */ w("span", {
96
+ V.carriedIn > 0 && /* @__PURE__ */ E("span", {
95
97
  className: "text-sm text-muted-foreground",
96
- children: P("carriedIn", { count: z.carriedIn })
98
+ children: I("carriedIn", { count: V.carriedIn })
97
99
  }),
98
- z.carriedOut > 0 && /* @__PURE__ */ w("span", {
100
+ V.carriedOut > 0 && /* @__PURE__ */ E("span", {
99
101
  className: "text-sm text-muted-foreground",
100
- children: P("carriedOut", { count: z.carriedOut })
102
+ children: I("carriedOut", { count: V.carriedOut })
101
103
  }),
102
- V && Q > 0 && ue && /* @__PURE__ */ w(ae, {
104
+ U && $ > 0 && de && /* @__PURE__ */ E(oe, {
103
105
  type: "button",
104
- onClick: () => Y.mutate(),
105
- loading: Y.isPending,
106
+ onClick: () => X.mutate(),
107
+ loading: X.isPending,
106
108
  className: "ml-auto",
107
- children: P("moveUnfinished", { count: Q })
109
+ children: I("moveUnfinished", { count: $ })
108
110
  })
109
111
  ]
110
112
  }),
111
- Y.isError && /* @__PURE__ */ w(v, {
113
+ X.isError && /* @__PURE__ */ E(y, {
112
114
  size: "md",
113
115
  className: "mt-2",
114
- children: F(Y.error)
116
+ children: ce(X.error)
115
117
  }),
116
- U !== null && Y.data && /* @__PURE__ */ T("p", {
118
+ G !== null && X.data && /* @__PURE__ */ D("p", {
117
119
  className: "mt-2 text-sm text-muted-foreground",
118
120
  role: "status",
119
121
  children: [
120
- P("moved", { count: U }),
122
+ I("moved", { count: G }),
121
123
  " ",
122
- /* @__PURE__ */ w("button", {
124
+ /* @__PURE__ */ E("button", {
123
125
  type: "button",
124
126
  className: "text-primary hover:underline",
125
- onClick: () => ce({
127
+ onClick: () => R({
126
128
  to: "/$workspace/teams/$key/cycles/$number",
127
129
  params: {
128
- workspace: j,
129
- key: M,
130
- number: String(Y.data.cycle.number)
130
+ workspace: N,
131
+ key: P,
132
+ number: String(X.data.cycle.number)
131
133
  }
132
134
  }),
133
- children: P("openCycle", { number: Y.data.cycle.number })
135
+ children: I("openCycle", { number: X.data.cycle.number })
134
136
  })
135
137
  ]
136
138
  }),
137
- /* @__PURE__ */ w("section", {
139
+ /* @__PURE__ */ E("section", {
138
140
  className: "mt-6",
139
- "aria-label": P("progressTitle"),
140
- children: /* @__PURE__ */ w(d, { progress: z.progress })
141
+ "aria-label": I("progressTitle"),
142
+ children: /* @__PURE__ */ E(p, { progress: V.progress })
141
143
  }),
142
- /* @__PURE__ */ w("section", {
144
+ /* @__PURE__ */ E("section", {
143
145
  className: "mt-6 rounded-xl border border-border bg-card p-4",
144
- children: /* @__PURE__ */ w(g, {
145
- workspace: j,
146
- teamKey: M,
147
- cycle: z
146
+ children: /* @__PURE__ */ E(ne, {
147
+ workspace: N,
148
+ teamKey: P,
149
+ cycle: V
148
150
  })
149
151
  }),
150
- X.length > 0 && /* @__PURE__ */ w("div", {
152
+ Z.length > 0 && /* @__PURE__ */ E("div", {
151
153
  className: "mt-8 xl:hidden",
152
- children: /* @__PURE__ */ w(_, {
153
- workspace: j,
154
- issues: X,
155
- tabs: A,
156
- tab: G,
157
- onTabChange: K,
158
- focus: q,
159
- onFocus: (e) => J(e)
154
+ children: /* @__PURE__ */ E(_, {
155
+ workspace: N,
156
+ issues: Z,
157
+ tabs: M,
158
+ tab: K,
159
+ onTabChange: q,
160
+ focus: J,
161
+ onFocus: (e) => Y(e)
160
162
  })
161
163
  }),
162
- /* @__PURE__ */ T("section", {
164
+ /* @__PURE__ */ D("section", {
163
165
  className: "mt-8",
164
- children: [q && /* @__PURE__ */ T("div", {
166
+ children: [J && /* @__PURE__ */ D("div", {
165
167
  className: "mb-3 flex items-center gap-2 text-sm text-muted-foreground",
166
168
  role: "status",
167
- children: [P("issueBreakdown.showing", { count: Z.length }), /* @__PURE__ */ w(y, {
169
+ children: [I("issueBreakdown.showing", { count: Q.length }), /* @__PURE__ */ E(b, {
168
170
  size: "sm",
169
171
  variant: "ghost",
170
- label: P("issueBreakdown.showAll"),
171
- icon: /* @__PURE__ */ w(te, {}),
172
- onClick: () => J(null)
172
+ label: I("issueBreakdown.showAll"),
173
+ icon: /* @__PURE__ */ E(c, {}),
174
+ onClick: () => Y(null)
173
175
  })]
174
- }), Z.length === 0 ? /* @__PURE__ */ w(se, { title: P("noIssuesInCycle") }) : /* @__PURE__ */ w(oe, {
176
+ }), Q.length === 0 ? /* @__PURE__ */ E(v, { title: I("noIssuesInCycle") }) : /* @__PURE__ */ E(se, {
175
177
  size: "fill",
176
178
  padding: "none",
177
179
  className: "overflow-hidden",
178
- children: /* @__PURE__ */ w(ie, {
179
- workspace: j,
180
- issues: Z
180
+ children: /* @__PURE__ */ E(ie, {
181
+ workspace: N,
182
+ issues: Q
181
183
  })
182
184
  })]
183
185
  })
184
186
  ]
185
- }), X.length > 0 && /* @__PURE__ */ w("aside", {
186
- "aria-label": P("issueBreakdown.label"),
187
+ }), Z.length > 0 && /* @__PURE__ */ E("aside", {
188
+ "aria-label": I("issueBreakdown.label"),
187
189
  className: "hidden w-80 shrink-0 overflow-y-auto border-l border-border px-4 py-6 xl:block",
188
- children: /* @__PURE__ */ w(_, {
189
- workspace: j,
190
- issues: X,
191
- tabs: A,
192
- tab: G,
193
- onTabChange: K,
194
- focus: q,
195
- onFocus: (e) => J(e)
190
+ children: /* @__PURE__ */ E(_, {
191
+ workspace: N,
192
+ issues: Z,
193
+ tabs: M,
194
+ tab: K,
195
+ onTabChange: q,
196
+ focus: J,
197
+ onFocus: (e) => Y(e)
196
198
  })
197
199
  })]
198
200
  })]
199
201
  });
200
202
  }
201
- export { j as component };
203
+ export { N as component };