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