@parallelworks/tandem-web 0.166.1 → 0.168.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.
@@ -10,7 +10,10 @@ function H(F, I) {
10
10
  switch (F) {
11
11
  case "issue.status_changed": {
12
12
  let e = L.to;
13
- return e?.category ? /* @__PURE__ */ B(E, { category: e.category }) : /* @__PURE__ */ B(m, {});
13
+ return e?.category ? /* @__PURE__ */ B(E, {
14
+ category: e.category,
15
+ step: Number(e.step) || 0
16
+ }) : /* @__PURE__ */ B(m, {});
14
17
  }
15
18
  case "issue.priority_changed": return /* @__PURE__ */ B(v, { priority: typeof L.to == "number" ? L.to : 0 });
16
19
  case "issue.created":
@@ -0,0 +1,29 @@
1
+ import { CodeHostIcon as e } from "./icons.js";
2
+ import { actorAvatar as t } from "../lib/avatar.js";
3
+ import { Avatar as n } from "@parallelworks/ui";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ // src/components/ActorAvatar.tsx
6
+ function a({ actor: a, name: o, src: s, badge: c }) {
7
+ let l = a.kind === "connector" ? a.handle.split(":")[0] : void 0;
8
+ return /* @__PURE__ */ i("span", {
9
+ className: "relative flex",
10
+ children: [l === "github" || l === "gitlab" ? /* @__PURE__ */ r("span", {
11
+ className: "flex size-5 items-center justify-center rounded-full bg-muted text-foreground",
12
+ children: /* @__PURE__ */ r(e, {
13
+ provider: l,
14
+ className: "size-3.5"
15
+ })
16
+ }) : /* @__PURE__ */ r(n, {
17
+ name: o,
18
+ src: s,
19
+ ...t(a.kind),
20
+ size: "sm",
21
+ decorative: !0
22
+ }), c && /* @__PURE__ */ r("span", {
23
+ "aria-hidden": !0,
24
+ className: "absolute -right-1.5 -bottom-1.5 flex size-3.5 items-center justify-center rounded-full border border-border bg-card text-muted-foreground [&_svg]:size-2.5",
25
+ children: c
26
+ })]
27
+ });
28
+ }
29
+ export { a as ActorAvatar };
@@ -24,6 +24,7 @@ function f({ workspace: f, event: p }) {
24
24
  let t = C.to;
25
25
  return /* @__PURE__ */ l(e, {
26
26
  category: t.category,
27
+ step: Number(t.step) || 0,
27
28
  className: "inline align-[-2px]"
28
29
  });
29
30
  }
@@ -5,53 +5,64 @@ import { jsx as c } from "react/jsx-runtime";
5
5
  import { defaultRangeExtractor as l, useVirtualizer as u } from "@tanstack/react-virtual";
6
6
  // src/components/IssueGroupList.tsx
7
7
  var d = 41, f = 33;
8
- function p({ groups: p, count: m, scrollRef: h, keepInView: g, renderRow: _ }) {
9
- let [v, y] = s(() => /* @__PURE__ */ new Set()), b = a(() => e(p, v), [p, v]), x = a(() => b.flatMap((e, t) => e.kind === "group" ? [t] : []), [b]), S = a(() => new Map(b.flatMap((e, t) => e.kind === "row" ? [[e.issue.id, t]] : [])), [b]), C = o(null), w = o(0), T = r((e) => (w.current = t(x, e.startIndex), [.../* @__PURE__ */ new Set([w.current, ...l(e)])].sort((e, t) => e - t)), [x]), E = u({
10
- count: b.length,
11
- getScrollElement: () => h.current,
12
- estimateSize: (e) => b[e]?.kind === "group" ? f : d,
8
+ function p({ groups: p, count: h, scrollRef: g, keepInView: _, renderRow: v, onMore: y, moreLabel: b }) {
9
+ let [x, S] = s(() => /* @__PURE__ */ new Set()), C = a(() => e(p, x), [p, x]), w = a(() => C.flatMap((e, t) => e.kind === "group" ? [t] : []), [C]), T = a(() => new Map(C.flatMap((e, t) => e.kind === "row" ? [[e.issue.id, t]] : [])), [C]), E = o(null), D = o(0), O = r((e) => (D.current = t(w, e.startIndex), [.../* @__PURE__ */ new Set([D.current, ...l(e)])].sort((e, t) => e - t)), [w]), k = u({
10
+ count: C.length,
11
+ getScrollElement: () => g.current,
12
+ estimateSize: (e) => C[e]?.kind === "group" ? f : d,
13
13
  getItemKey: (e) => {
14
- let t = b[e];
15
- return t?.kind === "group" ? `group:${t.group.key}` : t?.issue.id ?? e;
14
+ let t = C[e];
15
+ return t?.kind === "group" ? `group:${t.group.key}` : t?.kind === "more" ? `more:${t.group.key}` : t?.issue.id ?? e;
16
16
  },
17
17
  overscan: 12,
18
- rangeExtractor: T,
19
- scrollMargin: C.current?.offsetTop ?? 0
20
- });
18
+ rangeExtractor: O,
19
+ scrollMargin: E.current?.offsetTop ?? 0
20
+ }), A = o(void 0);
21
21
  i(() => {
22
- let e = g === void 0 ? void 0 : S.get(g);
23
- e !== void 0 && E.scrollToIndex(e, { align: "auto" });
22
+ if (_ === A.current) return;
23
+ let e = _ === void 0 ? void 0 : T.get(_);
24
+ e !== void 0 && (A.current = _, k.scrollToIndex(e, { align: "auto" }));
24
25
  }, [
25
- g,
26
- S,
27
- E
26
+ _,
27
+ T,
28
+ k
28
29
  ]);
29
- let D = (e) => y((t) => {
30
+ let j = (e) => S((t) => {
30
31
  let n = new Set(t);
31
32
  return n.delete(e) || n.add(e), n;
32
33
  });
33
34
  return /* @__PURE__ */ c("ul", {
34
- ref: C,
35
+ ref: E,
35
36
  className: "relative w-full",
36
- style: { height: E.getTotalSize() },
37
- children: E.getVirtualItems().map((e) => {
38
- let t = b[e.index];
37
+ style: { height: k.getTotalSize() },
38
+ children: k.getVirtualItems().map((e) => {
39
+ let t = C[e.index];
39
40
  if (!t) return null;
40
41
  let r = {
41
42
  position: "absolute",
42
43
  top: 0,
43
44
  left: 0,
44
45
  width: "100%",
45
- transform: `translateY(${e.start - E.options.scrollMargin}px)`
46
+ transform: `translateY(${e.start - k.options.scrollMargin}px)`
46
47
  };
47
- if (t.kind === "row") return _(t.issue, {
48
- ref: E.measureElement,
48
+ if (t.kind === "row") return v(t.issue, {
49
+ ref: k.measureElement,
49
50
  style: r,
50
51
  index: e.index
51
52
  });
52
- let i = e.index === w.current;
53
+ if (t.kind === "more") return /* @__PURE__ */ c(m, {
54
+ place: {
55
+ ref: k.measureElement,
56
+ style: r,
57
+ index: e.index
58
+ },
59
+ group: t.group,
60
+ label: b,
61
+ onMore: y
62
+ }, `${e.key}:${t.group.issues.length}`);
63
+ let i = e.index === D.current;
53
64
  return /* @__PURE__ */ c("li", {
54
- ref: E.measureElement,
65
+ ref: k.measureElement,
55
66
  "data-index": e.index,
56
67
  style: i ? {
57
68
  position: "sticky",
@@ -61,12 +72,24 @@ function p({ groups: p, count: m, scrollRef: h, keepInView: g, renderRow: _ }) {
61
72
  children: /* @__PURE__ */ c("h2", { children: /* @__PURE__ */ c(n, {
62
73
  label: t.group.label,
63
74
  icon: t.group.icon,
64
- count: m(t.group),
65
- open: !v.has(t.group.key),
66
- onToggle: () => D(t.group.key)
75
+ count: h(t.group),
76
+ open: !x.has(t.group.key),
77
+ onToggle: () => j(t.group.key)
67
78
  }) })
68
79
  }, e.key);
69
80
  })
70
81
  });
71
82
  }
83
+ function m({ place: e, group: t, label: n, onMore: r }) {
84
+ return i(() => {
85
+ r?.(t.key);
86
+ }, [r, t.key]), /* @__PURE__ */ c("li", {
87
+ ref: e.ref,
88
+ "data-index": e.index,
89
+ style: e.style,
90
+ className: "flex h-10 items-center px-5 text-xs text-muted-foreground",
91
+ role: "status",
92
+ children: n
93
+ });
94
+ }
72
95
  export { p as IssueGroupList };
@@ -16,7 +16,17 @@ function c() {
16
16
  function l(n) {
17
17
  return n instanceof e ? i(n.status) : n instanceof t ? "network" : void 0;
18
18
  }
19
- function u({ error: t }) {
19
+ function u({ title: e, description: t }) {
20
+ return /* @__PURE__ */ s("div", {
21
+ className: "flex h-full min-h-0 flex-1",
22
+ children: /* @__PURE__ */ s(n, {
23
+ status: 404,
24
+ ...e !== void 0 && { title: e },
25
+ ...t !== void 0 && { description: t }
26
+ })
27
+ });
28
+ }
29
+ function d({ error: t }) {
20
30
  let r = o("errors"), i = a(), c = l(t);
21
31
  return /* @__PURE__ */ s("div", {
22
32
  className: "flex h-full min-h-0 flex-1",
@@ -35,4 +45,4 @@ function u({ error: t }) {
35
45
  })
36
46
  });
37
47
  }
38
- export { u as ErrorMessage, c as Pending };
48
+ export { d as ErrorMessage, u as NotFound, c as Pending };
package/lib/groupList.js CHANGED
@@ -1,12 +1,22 @@
1
1
  // src/lib/groupList.ts
2
2
  function e(e, t) {
3
- return e.flatMap((e) => [{
3
+ return e.flatMap((e) => t.has(e.key) ? [{
4
4
  kind: "group",
5
5
  group: e
6
- }, ...t.has(e.key) ? [] : e.issues.map((e) => ({
7
- kind: "row",
8
- issue: e
9
- }))]);
6
+ }] : [
7
+ {
8
+ kind: "group",
9
+ group: e
10
+ },
11
+ ...e.issues.map((e) => ({
12
+ kind: "row",
13
+ issue: e
14
+ })),
15
+ ...e.more ? [{
16
+ kind: "more",
17
+ group: e
18
+ }] : []
19
+ ]);
10
20
  }
11
21
  function t(e, t) {
12
22
  return e.findLast((e) => e <= t) ?? 0;
@@ -0,0 +1,130 @@
1
+ import { issueGroupPageQuery as e } from "../api/queries.js";
2
+ import { useCallback as t, useEffect as n, useMemo as r, useState as i } from "react";
3
+ import { useQueries as a, useQueryClient as o } from "@tanstack/react-query";
4
+ // src/lib/pagedGroups.ts
5
+ var s = [
6
+ "status",
7
+ "priority",
8
+ "project",
9
+ "type"
10
+ ];
11
+ function c(e, t, n) {
12
+ switch (t) {
13
+ case "status": return n === "triage" ? {
14
+ ...e,
15
+ triage: "only"
16
+ } : {
17
+ ...e,
18
+ category: [n]
19
+ };
20
+ case "priority": return {
21
+ ...e,
22
+ priority: [Number(n)]
23
+ };
24
+ case "project":
25
+ if (n === "none") {
26
+ let { project: t, ...n } = e;
27
+ return {
28
+ ...n,
29
+ noProject: !0
30
+ };
31
+ }
32
+ return {
33
+ ...e,
34
+ project: n
35
+ };
36
+ case "type": return {
37
+ ...e,
38
+ type: [n]
39
+ };
40
+ }
41
+ }
42
+ var l = (e) => e.map((e) => ({
43
+ data: e.data,
44
+ fetching: e.isFetching,
45
+ error: e.error
46
+ }));
47
+ function u(s, u, d, f, p, m) {
48
+ let h = o(), g = JSON.stringify([
49
+ s,
50
+ u,
51
+ d,
52
+ f
53
+ ]), [_, v] = i({
54
+ scope: g,
55
+ pages: {}
56
+ }), y = (e) => _.scope === g ? _.pages[e] ?? 0 : 0, b = [];
57
+ for (let [t, n] of p ?? []) {
58
+ if (!n) continue;
59
+ let r = "";
60
+ for (let n = 0; n < y(t); n++) {
61
+ b.push({
62
+ key: t,
63
+ cursor: r
64
+ });
65
+ let n = h.getQueryData(e(s, c(u, d, t), f, r).queryKey);
66
+ if (!n?.next) break;
67
+ r = n.next;
68
+ }
69
+ }
70
+ let x = JSON.stringify(b), S = a({
71
+ queries: b.map((t) => ({
72
+ ...e(s, c(u, d, t.key), f, t.cursor),
73
+ enabled: m
74
+ })),
75
+ combine: l
76
+ }), C = r(() => {
77
+ let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
78
+ return JSON.parse(x).forEach((n, r) => {
79
+ let i = S[r], a = t.get(n.key) ?? {
80
+ pages: 0,
81
+ next: !0,
82
+ fetching: !1
83
+ };
84
+ if (i?.data) {
85
+ let t = new Set((e.get(n.key) ?? []).map((e) => e.id));
86
+ e.set(n.key, [...e.get(n.key) ?? [], ...i.data.issues.filter((e) => !t.has(e.id))]), a.pages++, a.next = !!i.data.next;
87
+ }
88
+ a.fetching ||= !!i?.fetching, t.set(n.key, a);
89
+ }), {
90
+ issues: e,
91
+ state: t
92
+ };
93
+ }, [x, S]), w = t((e) => (p?.get(e) ?? 0) > 0 && (C.state.get(e)?.next ?? !0), [p, C]), T = t((e) => {
94
+ let t = C.state.get(e);
95
+ if (t?.fetching || t && !t.next) return;
96
+ let n = (t?.pages ?? 0) + 1;
97
+ v((t) => {
98
+ let r = t.scope === g ? t.pages : {};
99
+ return (r[e] ?? 0) >= n ? t : {
100
+ scope: g,
101
+ pages: {
102
+ ...r,
103
+ [e]: n
104
+ }
105
+ };
106
+ });
107
+ }, [C, g]), [E, D] = i(""), O = t(() => D(g), [g]);
108
+ n(() => {
109
+ if (E === g && m) for (let [e, t] of p ?? []) t && w(e) && !C.state.get(e)?.fetching && T(e);
110
+ }, [
111
+ E,
112
+ g,
113
+ m,
114
+ p,
115
+ w,
116
+ C,
117
+ T
118
+ ]);
119
+ let k = !!p && [...p].every(([e, t]) => !t || C.state.get(e)?.next === !1);
120
+ return {
121
+ issues: C.issues,
122
+ more: w,
123
+ loadMore: T,
124
+ loadAll: O,
125
+ complete: k,
126
+ fetching: S.some((e) => e.fetching),
127
+ error: S.find((e) => e.error)?.error ?? null
128
+ };
129
+ }
130
+ export { c as groupFilter, s as pagedGroupings, u as usePagedGroups };
@@ -16,7 +16,7 @@ function i(e, t) {
16
16
  }
17
17
  var a = (n) => ({
18
18
  ...typeof n.team == "string" && n.team && { team: n.team },
19
- ...t.includes(n.status) && { status: n.status },
19
+ ...(n.status === "all" || t.includes(n.status)) && { status: n.status },
20
20
  ...e.includes(n.health) && { health: n.health },
21
21
  ...(n.view === "list" || n.view === "timeline" || n.view === "templates") && { view: n.view },
22
22
  ...typeof n.parent == "string" && n.parent && { parent: n.parent }
@@ -12,4 +12,7 @@ var e = [
12
12
  "missing",
13
13
  "none"
14
14
  ];
15
- export { t as healthStates, e as projectStatuses };
15
+ function n(e, t) {
16
+ if (!(t || e === "all")) return e ?? "in_progress";
17
+ }
18
+ export { t as healthStates, e as projectStatuses, n as shownStatus };
package/lib/triage.js CHANGED
@@ -1,7 +1,22 @@
1
- import { issuesQuery as e } from "../api/queries.js";
1
+ import { api as e, unwrap as t } from "../api/client.js";
2
+ import { issuesQuery as n, triageVisitsQuery as r } from "../api/queries.js";
3
+ import { useMutation as i, useQueryClient as a } from "@tanstack/react-query";
2
4
  // src/lib/triage.ts
3
- var t = (t, n) => e(t, {
5
+ var o = (e, t) => n(e, {
4
6
  triage: "only",
5
- ...n && { team: n }
6
- }), n = (e) => typeof e.issue == "string" ? { issue: e.issue } : {};
7
- export { t as triageQuery, n as triageSearch };
7
+ ...t && { team: t }
8
+ }), s = (e) => typeof e.issue == "string" ? { issue: e.issue } : {};
9
+ function c(n) {
10
+ let o = a(), { queryKey: s } = r(n);
11
+ return i({
12
+ mutationFn: async ({ identifier: r }) => t(await e.POST("/api/v1/workspaces/{workspace}/issues/{identifier}/triage/visit", { params: { path: {
13
+ workspace: n,
14
+ identifier: r
15
+ } } })),
16
+ onMutate: async ({ id: e }) => {
17
+ await o.cancelQueries({ queryKey: s }), o.setQueryData(s, (t) => t?.includes(e) ? t : [...t ?? [], e]);
18
+ },
19
+ onSettled: () => o.invalidateQueries({ queryKey: s })
20
+ });
21
+ }
22
+ export { o as triageQuery, s as triageSearch, c as useVisitTriage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/tandem-web",
3
- "version": "0.166.1",
3
+ "version": "0.168.0",
4
4
  "description": "Tandem's pages, for a host app to render in its own",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",