@parallelworks/tandem-web 0.170.0 → 0.170.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.
@@ -1,46 +1,47 @@
1
1
  import { useNavigate as e } from "../lib/router.js";
2
2
  import { ChevronDownIcon as t, ChevronRightIcon as n } from "./icons.js";
3
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";
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";
9
10
  // 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", {
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", {
12
13
  number: e.number,
13
14
  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", {
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", {
16
17
  className: "flex min-w-0 items-center gap-1.5 text-[13px] leading-none",
17
- children: [/* @__PURE__ */ c(n, {
18
+ children: [/* @__PURE__ */ l(n, {
18
19
  "aria-hidden": "true",
19
20
  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),
21
+ }), /* @__PURE__ */ l(s, {
22
+ "aria-label": h("switchCycle"),
23
+ placeholder: h("findCycle"),
24
+ items: y,
25
+ value: i(m),
25
26
  onValueChange: (e) => {
26
- e !== null && e !== String(p.number) && g({
27
+ e !== null && e !== i(m) && _({
27
28
  to: "/$workspace/teams/$key/cycles/$number",
28
29
  params: {
29
- workspace: u,
30
- key: d,
30
+ workspace: d,
31
+ key: f,
31
32
  number: e
32
33
  }
33
34
  });
34
35
  },
35
- trigger: /* @__PURE__ */ l("button", {
36
+ trigger: /* @__PURE__ */ u("button", {
36
37
  type: "button",
37
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",
38
- children: [/* @__PURE__ */ c("span", {
39
+ children: [/* @__PURE__ */ l("span", {
39
40
  className: "truncate",
40
- children: _(p)
41
- }), /* @__PURE__ */ c(t, { className: "size-3.5 shrink-0 text-muted-foreground" })]
41
+ children: v(m)
42
+ }), /* @__PURE__ */ l(t, { className: "size-3.5 shrink-0 text-muted-foreground" })]
42
43
  })
43
44
  })]
44
45
  });
45
46
  }
46
- export { u as CycleSwitcher };
47
+ export { d as CycleSwitcher };
@@ -264,7 +264,7 @@ function M(v, O, j, M = !1) {
264
264
  kind: "enum",
265
265
  ...e,
266
266
  options: H.map((e) => ({
267
- value: String(e.number),
267
+ value: e.id,
268
268
  label: t(e),
269
269
  description: P(`states.${e.state}`)
270
270
  }))
@@ -0,0 +1,11 @@
1
+ // src/lib/cycleLinks.ts
2
+ var e = (e) => e.replaceAll("-", "").slice(-8).toLowerCase(), t = (t) => `${t.number}~${e(t.id)}`;
3
+ function n(t, n) {
4
+ let [r, i] = n.split("~");
5
+ if (i) {
6
+ let n = t.find((t) => e(t.id) === i.toLowerCase());
7
+ if (n) return n;
8
+ }
9
+ return t.find((e) => String(e.number) === r);
10
+ }
11
+ export { t as cycleParam, n as findCycle };
@@ -1,14 +1,14 @@
1
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),
2
+ function e(e, t, n, r, i) {
3
+ let a = [], o = "";
4
+ for (let s of e) (s.state !== o || a.length === 0) && (a.push({
5
+ label: i(s.state),
6
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)
7
+ }), o = s.state), a[a.length - 1]?.items.push({
8
+ value: t(s),
9
+ label: n(s),
10
+ hint: r(s)
11
11
  });
12
- return i;
12
+ return a;
13
13
  }
14
14
  export { e as cycleChoices };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/tandem-web",
3
- "version": "0.170.0",
3
+ "version": "0.170.2",
4
4
  "description": "Tandem's pages, for a host app to render in its own",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
package/pages/issues.js CHANGED
@@ -325,8 +325,8 @@ function Mt({ person: e } = {}) {
325
325
  x.label && e.test(x.label) && n && (t.label = n.name);
326
326
  let r = ir?.find((e) => e.id === x.project);
327
327
  x.project && e.test(x.project) && r && (t.project = _e(r));
328
- let i = ar?.find((e) => e.id === x.cycle);
329
- x.cycle && e.test(x.cycle) && i && (t.cycle = String(i.number)), x.saved && e.test(x.saved) && Q && (t.saved = De(Q)), JSON.stringify(t) !== JSON.stringify(x) && zt.current(t);
328
+ let i = ar?.find((e) => String(e.number) === x.cycle);
329
+ i && (t.cycle = i.id), x.saved && e.test(x.saved) && Q && (t.saved = De(Q)), JSON.stringify(t) !== JSON.stringify(x) && zt.current(t);
330
330
  }, [
331
331
  x,
332
332
  rr,
@@ -1,21 +1,22 @@
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 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";
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 ee, teamsQuery as o } from "../../../../../api/queries.js";
6
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
- import { IssueBreakdown as _, breakdownKeys as re } from "../../../../../components/IssueBreakdown.js";
16
- import { StatusGroups as ie } from "../../../../../components/IssueGroup.js";
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";
7
+ import { CloseIcon as te, CycleIcon as ne } from "../../../../../components/icons.js";
8
+ import { addDays as re, today as c, useTime as l } from "../../../../../lib/time.js";
9
+ import { ProgressBar as ie } from "../../../../../components/Planning.js";
10
+ import { useCan as u } from "../../../../../lib/roles.js";
11
+ import { teamPath as d } from "../../../../../lib/teamPaths.js";
12
+ import { Route as f } from "./_number.js";
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";
19
+ import { Button as g, Card as _, EmptyState as v, ErrorText as y, IconButton as b, PageHeader as x } from "@parallelworks/ui";
19
20
  import { useState as S } from "react";
20
21
  import { useErrorMessage as C } from "@parallelworks/problem/react";
21
22
  import { useTranslations as w } from "use-intl";
@@ -29,48 +30,48 @@ var M = [
29
30
  "projects"
30
31
  ];
31
32
  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
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
40
41
  }), X = O({
41
42
  mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/teams/{key}/cycles/{number}/move-unfinished", { params: { path: {
42
43
  workspace: N,
43
44
  key: P,
44
- number: Number(F)
45
+ number: H?.number ?? 0
45
46
  } } })),
46
- onSuccess: (e) => le(e.moved),
47
- onSettled: () => s(W, N)
47
+ onSuccess: (e) => de(e.moved),
48
+ onSettled: () => s(ue, N)
48
49
  });
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 });
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 });
54
55
  return /* @__PURE__ */ D("div", {
55
56
  className: "flex h-full min-h-0 flex-col",
56
57
  children: [/* @__PURE__ */ E(x, {
57
58
  heading: !1,
58
59
  breadcrumbs: [{
59
- label: H?.name ?? P,
60
- href: h(N, P, "issues")
60
+ label: U?.name ?? P,
61
+ href: d(N, P, "issues")
61
62
  }, {
62
63
  label: I("cycles"),
63
- href: h(N, P, "cycles")
64
+ href: d(N, P, "cycles")
64
65
  }],
65
- titleActions: /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(ae, {
66
+ titleActions: /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(h, {
66
67
  workspace: N,
67
68
  teamKey: P,
68
- cycles: B,
69
- cycle: V
70
- }), /* @__PURE__ */ E(te, {
69
+ cycles: V,
70
+ cycle: H
71
+ }), /* @__PURE__ */ E(p, {
71
72
  workspace: N,
72
73
  kind: "cycle",
73
- target: V.id
74
+ target: H.id
74
75
  })] })
75
76
  }), /* @__PURE__ */ D("div", {
76
77
  className: "flex min-h-0 flex-1 flex-col overflow-y-auto xl:flex-row xl:overflow-hidden",
@@ -80,28 +81,28 @@ function N() {
80
81
  /* @__PURE__ */ D("div", {
81
82
  className: "flex flex-wrap items-center gap-3",
82
83
  children: [
83
- /* @__PURE__ */ E(l, { className: `size-5 shrink-0 ${V.state === "current" ? "text-status-started" : "text-muted-foreground"}` }),
84
+ /* @__PURE__ */ E(ne, { className: `size-5 shrink-0 ${H.state === "current" ? "text-status-started" : "text-muted-foreground"}` }),
84
85
  /* @__PURE__ */ E("h1", {
85
86
  className: "text-xl font-semibold tracking-tight",
86
- children: fe
87
+ children: me
87
88
  }),
88
89
  /* @__PURE__ */ E("span", {
89
90
  className: "rounded-md border border-border px-1.5 py-0.5 text-xs text-muted-foreground",
90
- children: I(`states.${V.state}`)
91
+ children: I(`states.${H.state}`)
91
92
  }),
92
93
  /* @__PURE__ */ E("span", {
93
94
  className: "text-sm text-muted-foreground",
94
- children: L.dayRange(V.startsOn, V.endsOn)
95
+ children: R.dayRange(H.startsOn, H.endsOn)
95
96
  }),
96
- V.carriedIn > 0 && /* @__PURE__ */ E("span", {
97
+ H.carriedIn > 0 && /* @__PURE__ */ E("span", {
97
98
  className: "text-sm text-muted-foreground",
98
- children: I("carriedIn", { count: V.carriedIn })
99
+ children: I("carriedIn", { count: H.carriedIn })
99
100
  }),
100
- V.carriedOut > 0 && /* @__PURE__ */ E("span", {
101
+ H.carriedOut > 0 && /* @__PURE__ */ E("span", {
101
102
  className: "text-sm text-muted-foreground",
102
- children: I("carriedOut", { count: V.carriedOut })
103
+ children: I("carriedOut", { count: H.carriedOut })
103
104
  }),
104
- U && $ > 0 && de && /* @__PURE__ */ E(oe, {
105
+ W && $ > 0 && pe && /* @__PURE__ */ E(g, {
105
106
  type: "button",
106
107
  onClick: () => X.mutate(),
107
108
  loading: X.isPending,
@@ -113,7 +114,7 @@ function N() {
113
114
  X.isError && /* @__PURE__ */ E(y, {
114
115
  size: "md",
115
116
  className: "mt-2",
116
- children: ce(X.error)
117
+ children: L(X.error)
117
118
  }),
118
119
  G !== null && X.data && /* @__PURE__ */ D("p", {
119
120
  className: "mt-2 text-sm text-muted-foreground",
@@ -124,12 +125,12 @@ function N() {
124
125
  /* @__PURE__ */ E("button", {
125
126
  type: "button",
126
127
  className: "text-primary hover:underline",
127
- onClick: () => R({
128
+ onClick: () => z({
128
129
  to: "/$workspace/teams/$key/cycles/$number",
129
130
  params: {
130
131
  workspace: N,
131
132
  key: P,
132
- number: String(X.data.cycle.number)
133
+ number: ce(X.data.cycle)
133
134
  }
134
135
  }),
135
136
  children: I("openCycle", { number: X.data.cycle.number })
@@ -139,19 +140,19 @@ function N() {
139
140
  /* @__PURE__ */ E("section", {
140
141
  className: "mt-6",
141
142
  "aria-label": I("progressTitle"),
142
- children: /* @__PURE__ */ E(p, { progress: V.progress })
143
+ children: /* @__PURE__ */ E(ie, { progress: H.progress })
143
144
  }),
144
145
  /* @__PURE__ */ E("section", {
145
146
  className: "mt-6 rounded-xl border border-border bg-card p-4",
146
- children: /* @__PURE__ */ E(ne, {
147
+ children: /* @__PURE__ */ E(ae, {
147
148
  workspace: N,
148
149
  teamKey: P,
149
- cycle: V
150
+ cycle: H
150
151
  })
151
152
  }),
152
153
  Z.length > 0 && /* @__PURE__ */ E("div", {
153
154
  className: "mt-8 xl:hidden",
154
- children: /* @__PURE__ */ E(_, {
155
+ children: /* @__PURE__ */ E(m, {
155
156
  workspace: N,
156
157
  issues: Z,
157
158
  tabs: M,
@@ -170,14 +171,14 @@ function N() {
170
171
  size: "sm",
171
172
  variant: "ghost",
172
173
  label: I("issueBreakdown.showAll"),
173
- icon: /* @__PURE__ */ E(c, {}),
174
+ icon: /* @__PURE__ */ E(te, {}),
174
175
  onClick: () => Y(null)
175
176
  })]
176
- }), Q.length === 0 ? /* @__PURE__ */ E(v, { title: I("noIssuesInCycle") }) : /* @__PURE__ */ E(se, {
177
+ }), Q.length === 0 ? /* @__PURE__ */ E(v, { title: I("noIssuesInCycle") }) : /* @__PURE__ */ E(_, {
177
178
  size: "fill",
178
179
  padding: "none",
179
180
  className: "overflow-hidden",
180
- children: /* @__PURE__ */ E(ie, {
181
+ children: /* @__PURE__ */ E(se, {
181
182
  workspace: N,
182
183
  issues: Q
183
184
  })
@@ -187,7 +188,7 @@ function N() {
187
188
  }), Z.length > 0 && /* @__PURE__ */ E("aside", {
188
189
  "aria-label": I("issueBreakdown.label"),
189
190
  className: "hidden w-80 shrink-0 overflow-y-auto border-l border-border px-4 py-6 xl:block",
190
- children: /* @__PURE__ */ E(_, {
191
+ children: /* @__PURE__ */ E(m, {
191
192
  workspace: N,
192
193
  issues: Z,
193
194
  tabs: M,
@@ -1,7 +1,17 @@
1
- import { cyclesQuery as e, issuesQuery as t } from "../../../../../api/queries.js";
1
+ import { redirect as e } from "../../../../../lib/router.js";
2
+ import { cyclesQuery as t, issuesQuery as n } from "../../../../../api/queries.js";
3
+ import { cycleParam as r, findCycle as i } from "../../../../../lib/cycleLinks.js";
2
4
  // src/routes/$workspace/teams/$key/cycles/$number.tsx?tsr-split=loader
3
- var n = async ({ context: { queryClient: n }, params: { workspace: r, key: i, number: a } }) => {
4
- let o = (await n.ensureQueryData(e(r, i))).find((e) => String(e.number) === a);
5
- o && await n.ensureQueryData(t(r, { cycle: o.id }));
5
+ var a = async ({ context: { queryClient: a }, params: o }) => {
6
+ let { workspace: s, key: c, number: l } = o, u = await a.ensureQueryData(t(s, c)), d = i(u, l);
7
+ if (d && l !== r(d)) throw e({
8
+ to: "/$workspace/teams/$key/cycles/$number",
9
+ params: {
10
+ ...o,
11
+ number: r(d)
12
+ },
13
+ replace: !0
14
+ });
15
+ d && await a.ensureQueryData(n(s, { cycle: d.id }));
6
16
  };
7
- export { n as loader };
17
+ export { a as loader };
@@ -8,25 +8,26 @@ 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 { 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";
11
+ import { cycleParam as p } from "../../../../../lib/cycleLinks.js";
12
+ import { byStart as m } from "../../../../../lib/cycleOrder.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";
18
19
  // src/routes/$workspace/teams/$key/cycles/index.tsx?tsr-split=component
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);
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(m).slice(-3);
22
23
  if (t.length === 0) return null;
23
24
  let n = t.reduce((e, t) => e + t.progress.completed, 0) / t.length;
24
25
  return n > 0 ? n : null;
25
26
  }
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({
27
+ function N() {
28
+ let { workspace: c, key: f } = d.useParams(), p = C("planning"), y = x(), { data: S } = k(a(c)), { data: j } = k(i(c, f)), N = S.find((e) => e.key === f);
29
+ n(p("cycles"), N?.name);
30
+ let F = l(c, "manage_cycles", { team: f }), I = O(), [L, R] = b(!1), z = D({
30
31
  mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/teams/{key}/cycles", {
31
32
  params: { path: {
32
33
  workspace: c,
@@ -35,69 +36,69 @@ function M() {
35
36
  body: {}
36
37
  })),
37
38
  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
+ }), B = [...j].sort(m), 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", {
40
41
  className: "flex h-full min-h-0 flex-col",
41
- children: [/* @__PURE__ */ w(_, {
42
+ children: [/* @__PURE__ */ T(v, {
42
43
  heading: !1,
43
44
  breadcrumbs: [{
44
- label: P?.name ?? f,
45
+ label: N?.name ?? f,
45
46
  href: u(c, f, "issues")
46
- }, { label: v("cycles") }]
47
- }), /* @__PURE__ */ w("div", {
47
+ }, { label: p("cycles") }]
48
+ }), /* @__PURE__ */ T("div", {
48
49
  className: "min-h-0 flex-1 overflow-y-auto",
49
- children: /* @__PURE__ */ T("div", {
50
+ children: /* @__PURE__ */ E("div", {
50
51
  className: "w-full px-4 py-6 md:px-8 md:py-8",
51
52
  children: [
52
- /* @__PURE__ */ T("div", {
53
+ /* @__PURE__ */ E("div", {
53
54
  className: "flex items-center gap-3",
54
- children: [/* @__PURE__ */ w("div", {
55
+ children: [/* @__PURE__ */ T("div", {
55
56
  className: "min-w-0",
56
- children: /* @__PURE__ */ w("h1", {
57
+ children: /* @__PURE__ */ T("h1", {
57
58
  className: "text-xl font-semibold tracking-tight",
58
- children: v("cycles")
59
+ children: p("cycles")
59
60
  })
60
- }), F && P?.cyclesEnabled && /* @__PURE__ */ T(m, {
61
+ }), F && N?.cyclesEnabled && /* @__PURE__ */ E(h, {
61
62
  type: "button",
62
63
  onClick: () => z.mutate(),
63
64
  loading: z.isPending,
64
65
  className: "ml-auto",
65
- children: [/* @__PURE__ */ w(o, { className: "size-3.5" }), v("newCycle")]
66
+ children: [/* @__PURE__ */ T(o, { className: "size-3.5" }), p("newCycle")]
66
67
  })]
67
68
  }),
68
- z.isError && /* @__PURE__ */ w(g, {
69
+ z.isError && /* @__PURE__ */ T(_, {
69
70
  size: "md",
70
71
  className: "mt-2",
71
- children: x(z.error)
72
+ children: y(z.error)
72
73
  }),
73
- !P?.cyclesEnabled && M.length === 0 ? /* @__PURE__ */ w("div", {
74
+ !N?.cyclesEnabled && j.length === 0 ? /* @__PURE__ */ T("div", {
74
75
  className: "mt-8",
75
- children: /* @__PURE__ */ w(h, {
76
- icon: /* @__PURE__ */ w(s, {}),
77
- title: v("cyclesOff"),
78
- description: v("cyclesOffDescription"),
79
- action: /* @__PURE__ */ w(r, {
76
+ children: /* @__PURE__ */ T(g, {
77
+ icon: /* @__PURE__ */ T(s, {}),
78
+ title: p("cyclesOff"),
79
+ description: p("cyclesOffDescription"),
80
+ action: /* @__PURE__ */ T(r, {
80
81
  to: "/$workspace/teams/$key/settings",
81
82
  params: {
82
83
  workspace: c,
83
84
  key: f
84
85
  },
85
86
  className: "text-sm text-primary hover:underline",
86
- children: v("teamSettings")
87
+ children: p("teamSettings")
87
88
  })
88
89
  })
89
- }) : /* @__PURE__ */ T(C, { children: [V.length > k && /* @__PURE__ */ w("div", {
90
+ }) : /* @__PURE__ */ E(w, { children: [V.length > A && /* @__PURE__ */ T("div", {
90
91
  className: "mt-4 flex justify-center",
91
- children: /* @__PURE__ */ w(m, {
92
+ children: /* @__PURE__ */ T(h, {
92
93
  type: "button",
93
94
  variant: "ghost",
94
95
  size: "sm",
95
96
  onClick: () => R(!L),
96
- children: L ? v("fewerCycles") : v("olderCycles", { count: V.length - k })
97
+ children: L ? p("fewerCycles") : p("olderCycles", { count: V.length - A })
97
98
  })
98
- }), /* @__PURE__ */ w("ol", {
99
+ }), /* @__PURE__ */ T("ol", {
99
100
  className: "relative mt-6",
100
- children: U.map((e, t) => /* @__PURE__ */ w(N, {
101
+ children: U.map((e, t) => /* @__PURE__ */ T(P, {
101
102
  workspace: c,
102
103
  teamKey: f,
103
104
  cycle: e,
@@ -111,81 +112,81 @@ function M() {
111
112
  })]
112
113
  });
113
114
  }
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
+ function P({ workspace: e, teamKey: t, cycle: n, capacity: i, first: a, last: o }) {
116
+ let l = C("planning"), u = c(), d = S(), m = n.state === "current", h = (e) => d.number(e, {
116
117
  style: "percent",
117
118
  maximumFractionDigits: 0
118
- }), h = n.state === "past" ? A(n) : n.progress.total, g = i !== null && n.state !== "past" && h > i, _ = n.state === "past" ? [
119
- ...h > 0 ? [l("success", { percent: m(n.progress.completed / h) })] : [],
119
+ }), g = n.state === "past" ? j(n) : n.progress.total, _ = i !== null && n.state !== "past" && g > i, v = n.state === "past" ? [
120
+ ...g > 0 ? [l("success", { percent: h(n.progress.completed / g) })] : [],
120
121
  l("completedCount", { count: n.progress.completed }),
121
- l("scopeCount", { count: h }),
122
+ l("scopeCount", { count: g }),
122
123
  ...n.carriedOut > 0 ? [l("carriedOut", { count: n.carriedOut })] : []
123
124
  ] : [
124
- ...i ? [l("ofCapacity", { percent: m(h / i) })] : [],
125
- l("scopeCount", { count: h }),
125
+ ...i ? [l("ofCapacity", { percent: h(g / i) })] : [],
126
+ l("scopeCount", { count: g }),
126
127
  ...n.carriedIn > 0 ? [l("carriedIn", { count: n.carriedIn })] : []
127
128
  ];
128
- return /* @__PURE__ */ T("li", {
129
+ return /* @__PURE__ */ E("li", {
129
130
  className: "grid grid-cols-[3.5rem_1fr] gap-x-3 md:grid-cols-[4.5rem_1fr] md:gap-x-4",
130
- children: [/* @__PURE__ */ T("div", {
131
+ children: [/* @__PURE__ */ E("div", {
131
132
  className: "relative",
132
133
  children: [
133
- /* @__PURE__ */ w("span", {
134
+ /* @__PURE__ */ T("span", {
134
135
  className: "absolute top-4 right-5 text-right text-xs leading-tight text-muted-foreground tabular-nums",
135
136
  children: u.day(n.startsOn)
136
137
  }),
137
- /* @__PURE__ */ w("span", {
138
+ /* @__PURE__ */ T("span", {
138
139
  "aria-hidden": "true",
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"}`
140
+ className: `absolute right-[7px] w-px ${a ? "top-6" : "top-0"} ${o ? "h-6" : "bottom-0"} ${a && o ? "hidden" : ""} ${m ? "bg-primary" : "bg-border"}`
140
141
  }),
141
- /* @__PURE__ */ w("span", {
142
+ /* @__PURE__ */ T("span", {
142
143
  "aria-hidden": "true",
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"}`
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"}`
144
145
  })
145
146
  ]
146
- }), /* @__PURE__ */ T("div", {
147
- className: `min-w-0 border-b border-border ${p ? "rounded-xl bg-muted/50" : ""}`,
148
- children: [/* @__PURE__ */ T(r, {
147
+ }), /* @__PURE__ */ E("div", {
148
+ className: `min-w-0 border-b border-border ${m ? "rounded-xl bg-muted/50" : ""}`,
149
+ children: [/* @__PURE__ */ E(r, {
149
150
  to: "/$workspace/teams/$key/cycles/$number",
150
151
  params: {
151
152
  workspace: e,
152
153
  key: t,
153
- number: String(n.number)
154
+ number: p(n)
154
155
  },
155
156
  className: "flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-xl px-3 py-3.5 hover:bg-muted/60",
156
157
  children: [
157
- /* @__PURE__ */ T("span", {
158
+ /* @__PURE__ */ E("span", {
158
159
  className: "flex min-w-0 flex-1 basis-full items-center gap-2 md:basis-auto",
159
- children: [/* @__PURE__ */ w(s, { className: `size-4 shrink-0 ${p ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ T("span", {
160
+ children: [/* @__PURE__ */ T(s, { className: `size-4 shrink-0 ${m ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ E("span", {
160
161
  className: "min-w-0",
161
- children: [/* @__PURE__ */ w("span", {
162
+ children: [/* @__PURE__ */ T("span", {
162
163
  className: "block truncate text-sm font-medium",
163
164
  children: n.name ? l("cycleNamed", {
164
165
  number: n.number,
165
166
  name: n.name
166
167
  }) : l("cycle", { number: n.number })
167
- }), /* @__PURE__ */ w("span", {
168
+ }), /* @__PURE__ */ T("span", {
168
169
  className: "block text-xs text-muted-foreground",
169
170
  children: u.dayRange(n.startsOn, n.endsOn)
170
171
  })]
171
172
  })]
172
173
  }),
173
- /* @__PURE__ */ w(v, {
174
- variant: p ? "info" : "muted",
174
+ /* @__PURE__ */ T(y, {
175
+ variant: m ? "info" : "muted",
175
176
  size: "sm",
176
177
  children: l(`states.${n.state}`)
177
178
  }),
178
- /* @__PURE__ */ w("span", {
179
+ /* @__PURE__ */ T("span", {
179
180
  className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground tabular-nums",
180
- children: _.map((e, t) => /* @__PURE__ */ w("span", {
181
- className: g && t === 0 ? "font-medium text-warning" : void 0,
181
+ children: v.map((e, t) => /* @__PURE__ */ T("span", {
182
+ className: _ && t === 0 ? "font-medium text-warning" : void 0,
182
183
  children: e
183
184
  }, e))
184
185
  })
185
186
  ]
186
- }), p && /* @__PURE__ */ w("div", {
187
+ }), m && /* @__PURE__ */ T("div", {
187
188
  className: "px-3 pb-4",
188
- children: /* @__PURE__ */ w(f, {
189
+ children: /* @__PURE__ */ T(f, {
189
190
  workspace: e,
190
191
  teamKey: t,
191
192
  cycle: n
@@ -194,4 +195,4 @@ function N({ workspace: e, teamKey: t, cycle: n, capacity: i, first: a, last: o
194
195
  })]
195
196
  });
196
197
  }
197
- export { M as component };
198
+ export { N as component };