@parallelworks/tandem-web 0.184.0 → 0.186.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,110 +1,120 @@
1
1
  import { api as e, unwrap as t } from "../../../../../api/client.js";
2
2
  import { cyclesQuery as n, teamsQuery as r } from "../../../../../api/queries.js";
3
- import { AddIcon as i, CycleIcon as a } from "../../../../../components/icons.js";
4
- import { BurnUp as o } from "../../../../../components/Reports.js";
5
- import { cycleParam as s } from "../../../../../lib/cycleLinks.js";
6
- import { byStart as c } from "../../../../../lib/cycleOrder.js";
7
- import { usePageTitle as l } from "../../../../../lib/pageTitle.js";
8
- import { useCan as u } from "../../../../../lib/roles.js";
9
- import { Link as d } from "../../../../../lib/router.js";
10
- import { teamPath as f } from "../../../../../lib/teamPaths.js";
11
- import { useTime as p } from "../../../../../lib/time.js";
12
- import { Route as m } from "./index.js";
13
- import { Button as h, EmptyState as g, ErrorText as _, PageHeader as v, StatusBadge as y } from "@parallelworks/ui";
14
- import { useState as b } from "react";
15
- import { useErrorMessage as x } from "@parallelworks/problem/react";
16
- import { useFormatter as S, useTranslations as C } from "use-intl";
17
- import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
18
- import { useMutation as D, useQueryClient as O, useSuspenseQuery as k } from "@tanstack/react-query";
3
+ import { FavoriteStar as i } from "../../../../../components/FavoriteStar.js";
4
+ import { AddIcon as a, CycleIcon as o } from "../../../../../components/icons.js";
5
+ import { BurnUp as s } from "../../../../../components/Reports.js";
6
+ import { cycleParam as c } from "../../../../../lib/cycleLinks.js";
7
+ import { byStart as l } from "../../../../../lib/cycleOrder.js";
8
+ import { usePageTitle as u } from "../../../../../lib/pageTitle.js";
9
+ import { useCan as d } from "../../../../../lib/roles.js";
10
+ import { Link as f } from "../../../../../lib/router.js";
11
+ import { teamPath as p } from "../../../../../lib/teamPaths.js";
12
+ import { useTime as m } from "../../../../../lib/time.js";
13
+ import { Route as h } from "./index.js";
14
+ import { Button as g, EmptyState as _, ErrorText as v, PageHeader as y, StatusBadge as b } from "@parallelworks/ui";
15
+ import { useState as x } from "react";
16
+ import { useErrorMessage as S } from "@parallelworks/problem/react";
17
+ import { useFormatter as C, useTranslations as w } from "use-intl";
18
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
19
+ import { useMutation as O, useQueryClient as k, useSuspenseQuery as A } from "@tanstack/react-query";
19
20
  // src/routes/$workspace/teams/$key/cycles/index.tsx?tsr-split=component
20
- var A = 5, j = (e) => e.progress.total + e.carriedOut;
21
- function M(e) {
22
- let t = e.filter((e) => e.state === "past").sort(c).slice(-3);
21
+ var j = 5, M = (e) => e.progress.total + e.carriedOut;
22
+ function N(e) {
23
+ let t = e.filter((e) => e.state === "past").sort(l).slice(-3);
23
24
  if (t.length === 0) return null;
24
25
  let n = t.reduce((e, t) => e + t.progress.completed, 0) / t.length;
25
26
  return n > 0 ? n : null;
26
27
  }
27
- function N() {
28
- let { workspace: o, key: s } = m.useParams(), p = C("planning"), y = x(), { data: S } = k(r(o)), { data: j } = k(n(o, s)), N = S.find((e) => e.key === s);
29
- l(p("cycles"), N?.name);
30
- let F = u(o, "manage_cycles", { team: s }), I = O(), [L, R] = b(!1), z = D({
28
+ function P() {
29
+ let { workspace: s, key: c } = h.useParams(), m = w("favorites"), b = w("planning"), C = S(), { data: M } = A(r(s)), { data: P } = A(n(s, c)), I = M.find((e) => e.key === c);
30
+ u(b("cycles"), I?.name);
31
+ let L = d(s, "manage_cycles", { team: c }), R = k(), [z, B] = x(!1), V = O({
31
32
  mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/teams/{key}/cycles", {
32
33
  params: { path: {
33
- workspace: o,
34
- key: s
34
+ workspace: s,
35
+ key: c
35
36
  } },
36
37
  body: {}
37
38
  })),
38
- onSettled: () => I.invalidateQueries({ queryKey: n(o, s).queryKey })
39
- }), B = [...j].sort(c), V = B.filter((e) => e.state === "past"), H = L ? 0 : Math.max(0, V.length - A), U = B.filter((e) => e.state !== "past" || V.indexOf(e) >= H), W = M(j);
40
- return /* @__PURE__ */ E("div", {
39
+ onSettled: () => R.invalidateQueries({ queryKey: n(s, c).queryKey })
40
+ }), H = [...P].sort(l), U = H.filter((e) => e.state === "past"), W = z ? 0 : Math.max(0, U.length - j), G = H.filter((e) => e.state !== "past" || U.indexOf(e) >= W), K = N(P);
41
+ return /* @__PURE__ */ D("div", {
41
42
  className: "flex h-full min-h-0 flex-col",
42
- children: [/* @__PURE__ */ T(v, {
43
+ children: [/* @__PURE__ */ E(y, {
43
44
  heading: !1,
44
45
  breadcrumbs: [{
45
- label: N?.name ?? s,
46
- href: f(o, s, "issues")
47
- }, { label: p("cycles") }]
48
- }), /* @__PURE__ */ T("div", {
46
+ label: I?.name ?? c,
47
+ href: p(s, c, "issues")
48
+ }, { label: b("cycles") }],
49
+ titleActions: /* @__PURE__ */ E(i, {
50
+ workspace: s,
51
+ kind: "view",
52
+ target: p(s, c, "cycles"),
53
+ label: m("teamPage", {
54
+ team: I?.name ?? c,
55
+ page: b("cycles")
56
+ })
57
+ })
58
+ }), /* @__PURE__ */ E("div", {
49
59
  className: "min-h-0 flex-1 overflow-y-auto",
50
- children: /* @__PURE__ */ E("div", {
60
+ children: /* @__PURE__ */ D("div", {
51
61
  className: "w-full px-4 py-6 md:px-8 md:py-8",
52
62
  children: [
53
- /* @__PURE__ */ E("div", {
63
+ /* @__PURE__ */ D("div", {
54
64
  className: "flex items-center gap-3",
55
- children: [/* @__PURE__ */ T("div", {
65
+ children: [/* @__PURE__ */ E("div", {
56
66
  className: "min-w-0",
57
- children: /* @__PURE__ */ T("h1", {
67
+ children: /* @__PURE__ */ E("h1", {
58
68
  className: "text-xl font-semibold tracking-tight",
59
- children: p("cycles")
69
+ children: b("cycles")
60
70
  })
61
- }), F && N?.cyclesEnabled && /* @__PURE__ */ E(h, {
71
+ }), L && I?.cyclesEnabled && /* @__PURE__ */ D(g, {
62
72
  type: "button",
63
- onClick: () => z.mutate(),
64
- loading: z.isPending,
73
+ onClick: () => V.mutate(),
74
+ loading: V.isPending,
65
75
  className: "ml-auto",
66
- children: [/* @__PURE__ */ T(i, { className: "size-3.5" }), p("newCycle")]
76
+ children: [/* @__PURE__ */ E(a, { className: "size-3.5" }), b("newCycle")]
67
77
  })]
68
78
  }),
69
- z.isError && /* @__PURE__ */ T(_, {
79
+ V.isError && /* @__PURE__ */ E(v, {
70
80
  size: "md",
71
81
  className: "mt-2",
72
- children: y(z.error)
82
+ children: C(V.error)
73
83
  }),
74
- !N?.cyclesEnabled && j.length === 0 ? /* @__PURE__ */ T("div", {
84
+ !I?.cyclesEnabled && P.length === 0 ? /* @__PURE__ */ E("div", {
75
85
  className: "mt-8",
76
- children: /* @__PURE__ */ T(g, {
77
- icon: /* @__PURE__ */ T(a, {}),
78
- title: p("cyclesOff"),
79
- description: p("cyclesOffDescription"),
80
- action: /* @__PURE__ */ T(d, {
86
+ children: /* @__PURE__ */ E(_, {
87
+ icon: /* @__PURE__ */ E(o, {}),
88
+ title: b("cyclesOff"),
89
+ description: b("cyclesOffDescription"),
90
+ action: /* @__PURE__ */ E(f, {
81
91
  to: "/$workspace/teams/$key/settings",
82
92
  params: {
83
- workspace: o,
84
- key: s
93
+ workspace: s,
94
+ key: c
85
95
  },
86
96
  className: "text-sm text-primary hover:underline",
87
- children: p("teamSettings")
97
+ children: b("teamSettings")
88
98
  })
89
99
  })
90
- }) : /* @__PURE__ */ E(w, { children: [V.length > A && /* @__PURE__ */ T("div", {
100
+ }) : /* @__PURE__ */ D(T, { children: [U.length > j && /* @__PURE__ */ E("div", {
91
101
  className: "mt-4 flex justify-center",
92
- children: /* @__PURE__ */ T(h, {
102
+ children: /* @__PURE__ */ E(g, {
93
103
  type: "button",
94
104
  variant: "ghost",
95
105
  size: "sm",
96
- onClick: () => R(!L),
97
- children: L ? p("fewerCycles") : p("olderCycles", { count: V.length - A })
106
+ onClick: () => B(!z),
107
+ children: z ? b("fewerCycles") : b("olderCycles", { count: U.length - j })
98
108
  })
99
- }), /* @__PURE__ */ T("ol", {
109
+ }), /* @__PURE__ */ E("ol", {
100
110
  className: "relative mt-6",
101
- children: U.map((e, t) => /* @__PURE__ */ T(P, {
102
- workspace: o,
103
- teamKey: s,
111
+ children: G.map((e, t) => /* @__PURE__ */ E(F, {
112
+ workspace: s,
113
+ teamKey: c,
104
114
  cycle: e,
105
- capacity: W,
115
+ capacity: K,
106
116
  first: t === 0,
107
- last: t === U.length - 1
117
+ last: t === G.length - 1
108
118
  }, e.id))
109
119
  })] })
110
120
  ]
@@ -112,11 +122,11 @@ function N() {
112
122
  })]
113
123
  });
114
124
  }
115
- function P({ workspace: e, teamKey: t, cycle: n, capacity: r, first: i, last: c }) {
116
- let l = C("planning"), u = p(), f = S(), m = n.state === "current", h = (e) => f.number(e, {
125
+ function F({ workspace: e, teamKey: t, cycle: n, capacity: r, first: i, last: a }) {
126
+ let l = w("planning"), u = m(), d = C(), p = n.state === "current", h = (e) => d.number(e, {
117
127
  style: "percent",
118
128
  maximumFractionDigits: 0
119
- }), g = n.state === "past" ? j(n) : n.progress.total, _ = r !== null && n.state !== "past" && g > r, v = n.state === "past" ? [
129
+ }), g = n.state === "past" ? M(n) : n.progress.total, _ = r !== null && n.state !== "past" && g > r, v = n.state === "past" ? [
120
130
  ...g > 0 ? [l("success", { percent: h(n.progress.completed / g) })] : [],
121
131
  l("completedCount", { count: n.progress.completed }),
122
132
  l("scopeCount", { count: g }),
@@ -126,67 +136,67 @@ function P({ workspace: e, teamKey: t, cycle: n, capacity: r, first: i, last: c
126
136
  l("scopeCount", { count: g }),
127
137
  ...n.carriedIn > 0 ? [l("carriedIn", { count: n.carriedIn })] : []
128
138
  ];
129
- return /* @__PURE__ */ E("li", {
139
+ return /* @__PURE__ */ D("li", {
130
140
  className: "grid grid-cols-[3.5rem_1fr] gap-x-3 md:grid-cols-[4.5rem_1fr] md:gap-x-4",
131
- children: [/* @__PURE__ */ E("div", {
141
+ children: [/* @__PURE__ */ D("div", {
132
142
  className: "relative",
133
143
  children: [
134
- /* @__PURE__ */ T("span", {
144
+ /* @__PURE__ */ E("span", {
135
145
  className: "absolute top-4 right-5 text-right text-xs leading-tight text-muted-foreground tabular-nums",
136
146
  children: u.day(n.startsOn)
137
147
  }),
138
- /* @__PURE__ */ T("span", {
148
+ /* @__PURE__ */ E("span", {
139
149
  "aria-hidden": "true",
140
- className: `absolute right-[7px] w-px ${i ? "top-6" : "top-0"} ${c ? "h-6" : "bottom-0"} ${i && c ? "hidden" : ""} ${m ? "bg-primary" : "bg-border"}`
150
+ className: `absolute right-[7px] w-px ${i ? "top-6" : "top-0"} ${a ? "h-6" : "bottom-0"} ${i && a ? "hidden" : ""} ${p ? "bg-primary" : "bg-border"}`
141
151
  }),
142
- /* @__PURE__ */ T("span", {
152
+ /* @__PURE__ */ E("span", {
143
153
  "aria-hidden": "true",
144
- className: `absolute top-[18px] right-0.5 size-[11px] rounded-full border-2 ${m ? "border-primary bg-primary" : n.state === "past" ? "border-muted-foreground bg-muted-foreground" : "border-border bg-background"}`
154
+ className: `absolute top-[18px] right-0.5 size-[11px] rounded-full border-2 ${p ? "border-primary bg-primary" : n.state === "past" ? "border-muted-foreground bg-muted-foreground" : "border-border bg-background"}`
145
155
  })
146
156
  ]
147
- }), /* @__PURE__ */ E("div", {
148
- className: `min-w-0 border-b border-border ${m ? "rounded-xl bg-muted/50" : ""}`,
149
- children: [/* @__PURE__ */ E(d, {
157
+ }), /* @__PURE__ */ D("div", {
158
+ className: `min-w-0 border-b border-border ${p ? "rounded-xl bg-muted/50" : ""}`,
159
+ children: [/* @__PURE__ */ D(f, {
150
160
  to: "/$workspace/teams/$key/cycles/$number",
151
161
  params: {
152
162
  workspace: e,
153
163
  key: t,
154
- number: s(n)
164
+ number: c(n)
155
165
  },
156
166
  className: "flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-xl px-3 py-3.5 hover:bg-muted/60",
157
167
  children: [
158
- /* @__PURE__ */ E("span", {
168
+ /* @__PURE__ */ D("span", {
159
169
  className: "flex min-w-0 flex-1 basis-full items-center gap-2 md:basis-auto",
160
- children: [/* @__PURE__ */ T(a, { className: `size-4 shrink-0 ${m ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ E("span", {
170
+ children: [/* @__PURE__ */ E(o, { className: `size-4 shrink-0 ${p ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ D("span", {
161
171
  className: "min-w-0",
162
- children: [/* @__PURE__ */ T("span", {
172
+ children: [/* @__PURE__ */ E("span", {
163
173
  className: "block truncate text-sm font-medium",
164
174
  children: n.name ? l("cycleNamed", {
165
175
  number: n.number,
166
176
  name: n.name
167
177
  }) : l("cycle", { number: n.number })
168
- }), /* @__PURE__ */ T("span", {
178
+ }), /* @__PURE__ */ E("span", {
169
179
  className: "block text-xs text-muted-foreground",
170
180
  children: u.dayRange(n.startsOn, n.endsOn)
171
181
  })]
172
182
  })]
173
183
  }),
174
- /* @__PURE__ */ T(y, {
175
- variant: m ? "info" : "muted",
184
+ /* @__PURE__ */ E(b, {
185
+ variant: p ? "info" : "muted",
176
186
  size: "sm",
177
187
  children: l(`states.${n.state}`)
178
188
  }),
179
- /* @__PURE__ */ T("span", {
189
+ /* @__PURE__ */ E("span", {
180
190
  className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground tabular-nums",
181
- children: v.map((e, t) => /* @__PURE__ */ T("span", {
191
+ children: v.map((e, t) => /* @__PURE__ */ E("span", {
182
192
  className: _ && t === 0 ? "font-medium text-warning" : void 0,
183
193
  children: e
184
194
  }, e))
185
195
  })
186
196
  ]
187
- }), m && /* @__PURE__ */ T("div", {
197
+ }), p && /* @__PURE__ */ E("div", {
188
198
  className: "px-3 pb-4",
189
- children: /* @__PURE__ */ T(o, {
199
+ children: /* @__PURE__ */ E(s, {
190
200
  workspace: e,
191
201
  teamKey: t,
192
202
  cycle: n
@@ -195,4 +205,4 @@ function P({ workspace: e, teamKey: t, cycle: n, capacity: r, first: i, last: c
195
205
  })]
196
206
  });
197
207
  }
198
- export { N as component };
208
+ export { P as component };
@@ -364,7 +364,7 @@ function at() {
364
364
  icon: o(/* @__PURE__ */ A(le, { className: "size-4" }), Pt > 0),
365
365
  href: `/${d}/notifications`,
366
366
  selected: r(`/${d}/notifications`),
367
- onContextMenu: a(`/${d}/notifications`),
367
+ onContextMenu: i("notifications", `/${d}/notifications`),
368
368
  badge: /* @__PURE__ */ A(Ue, {
369
369
  count: Pt,
370
370
  locale: G,
@@ -389,7 +389,8 @@ function at() {
389
389
  label: U("dashboards"),
390
390
  icon: /* @__PURE__ */ A(re, { className: "size-4" }),
391
391
  href: `/${d}/dashboards`,
392
- selected: r(`/${d}/dashboards`)
392
+ selected: r(`/${d}/dashboards`),
393
+ onContextMenu: i("dashboards", `/${d}/dashboards`)
393
394
  }),
394
395
  /* @__PURE__ */ A(F, {
395
396
  label: U("knowledge"),