@parallelworks/tandem-web 0.168.1 → 0.168.2

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