@parallelworks/tandem-web 0.178.0 → 0.178.1

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,80 @@
1
+ import { api as e, unwrap as t } from "../api/client.js";
2
+ import { keepPreviousData as n, queryOptions as r, useMutation as i, useQueryClient as a } from "@tanstack/react-query";
3
+ // src/lib/docSeries.ts
4
+ var o = [
5
+ "daily",
6
+ "weekly",
7
+ "biweekly",
8
+ "monthly"
9
+ ], s = (i, a, o, s) => r({
10
+ queryKey: [
11
+ "workspace",
12
+ i,
13
+ "docs",
14
+ "series",
15
+ a,
16
+ o ?? "",
17
+ s ?? ""
18
+ ],
19
+ queryFn: async ({ signal: n }) => t(await e.GET("/api/v1/workspaces/{workspace}/doc-series", {
20
+ params: {
21
+ path: { workspace: i },
22
+ query: {
23
+ space: a,
24
+ ...o && s && {
25
+ from: o,
26
+ to: s
27
+ }
28
+ }
29
+ },
30
+ signal: n
31
+ })).series,
32
+ placeholderData: n
33
+ });
34
+ function c(n) {
35
+ let r = a(), o = () => r.invalidateQueries({ queryKey: [
36
+ "workspace",
37
+ n,
38
+ "docs"
39
+ ] });
40
+ return {
41
+ create: i({
42
+ mutationFn: async (r) => t(await e.POST("/api/v1/workspaces/{workspace}/doc-series", {
43
+ params: { path: { workspace: n } },
44
+ body: r
45
+ })),
46
+ onSettled: o
47
+ }),
48
+ update: i({
49
+ mutationFn: async ({ id: r, ...i }) => t(await e.PUT("/api/v1/workspaces/{workspace}/doc-series/{series}", {
50
+ params: { path: {
51
+ workspace: n,
52
+ series: r
53
+ } },
54
+ body: i
55
+ })),
56
+ onSettled: o
57
+ }),
58
+ stop: i({
59
+ mutationFn: async (r) => t(await e.POST("/api/v1/workspaces/{workspace}/doc-series/{series}/stop", { params: { path: {
60
+ workspace: n,
61
+ series: r
62
+ } } })),
63
+ onSettled: o
64
+ }),
65
+ makeDoc: i({
66
+ mutationFn: async ({ id: r, day: i }) => t(await e.POST("/api/v1/workspaces/{workspace}/doc-series/{series}/docs", {
67
+ params: { path: {
68
+ workspace: n,
69
+ series: r
70
+ } },
71
+ body: { day: i }
72
+ })),
73
+ onSettled: o
74
+ })
75
+ };
76
+ }
77
+ function l() {
78
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
79
+ }
80
+ export { l as browserZone, s as docSeriesQuery, o as seriesRepeats, c as useDocSeriesActions };
@@ -86,6 +86,8 @@ function T() {
86
86
  status_changed: e.raw("status_changed"),
87
87
  run_finished: e.raw("run_finished"),
88
88
  run_stopped: e.raw("run_stopped"),
89
+ run_finished_on: e.raw("run_finished_on"),
90
+ run_stopped_on: e.raw("run_stopped_on"),
89
91
  mentioned: e.raw("mentioned"),
90
92
  update_posted: e.raw("update_posted"),
91
93
  reminder: e.raw("reminder"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/tandem-web",
3
- "version": "0.178.0",
3
+ "version": "0.178.1",
4
4
  "description": "Tandem's pages, for a host app to render in its own",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -1,267 +1,276 @@
1
1
  import { teamsQuery as e, workspaceQuery as t } from "../../../api/queries.js";
2
2
  import { useNewMeetingNotes as n } from "../../../components/DocCalendar.js";
3
- import { DocTable as r, groupable as i } from "../../../components/DocTable.js";
4
- import { AddIcon as a, BoardIcon as o, CalendarIcon as s, ListViewIcon as c } from "../../../components/icons.js";
5
- import { docPropertiesQuery as l, docViewsQuery as u, readConfig as ee, useDocPropertyActions as te } from "../../../lib/docProperties.js";
6
- import { useDocActions as ne } from "../../../lib/docs.js";
7
- import { usePageTitle as d } from "../../../lib/pageTitle.js";
8
- import { usePeople as f } from "../../../lib/people.js";
9
- import { Route as p } from "./space._space.js";
10
- import { Breadcrumbs as m, Button as h, ErrorText as g, Input as _, Popover as v, SegmentedControl as y, Select as b, useClosePopover as x } from "@parallelworks/ui";
11
- import { useNavigate as re } from "@tanstack/react-router";
12
- import { useEffect as S, useState as C } from "react";
13
- import { useErrorMessage as ie } from "@parallelworks/problem/react";
14
- import { useTranslations as w } from "use-intl";
15
- import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
16
- import { useQuery as O, useSuspenseQuery as k } from "@tanstack/react-query";
3
+ import { SeriesMenu as r } from "../../../components/DocSeries.js";
4
+ import { DocTable as i, groupable as a } from "../../../components/DocTable.js";
5
+ import { AddIcon as o, BoardIcon as s, CalendarIcon as c, ListViewIcon as l } from "../../../components/icons.js";
6
+ import { docPropertiesQuery as u, docViewsQuery as d, readConfig as f, useDocPropertyActions as p } from "../../../lib/docProperties.js";
7
+ import { useDocActions as m } from "../../../lib/docs.js";
8
+ import { usePageTitle as h } from "../../../lib/pageTitle.js";
9
+ import { usePeople as g } from "../../../lib/people.js";
10
+ import { Route as _ } from "./space._space.js";
11
+ import { Breadcrumbs as ee, Button as v, ErrorText as y, Input as b, Popover as x, SegmentedControl as S, Select as C, useClosePopover as w } from "@parallelworks/ui";
12
+ import { useNavigate as te } from "@tanstack/react-router";
13
+ import { useEffect as ne, useState as T } from "react";
14
+ import { useErrorMessage as re } from "@parallelworks/problem/react";
15
+ import { useTranslations as E } from "use-intl";
16
+ import { Fragment as ie, jsx as D, jsxs as O } from "react/jsx-runtime";
17
+ import { useQuery as k, useSuspenseQuery as A } from "@tanstack/react-query";
17
18
  // src/routes/$workspace/docs/space.$space.tsx?tsr-split=component
18
- function A() {
19
- let f = w("docViews"), v = ie(), { workspace: x, space: A } = p.useParams(), { view: N } = p.useSearch(), P = re(), F = (e) => P({
19
+ function j() {
20
+ let g = E("docViews"), x = re(), { workspace: w, space: j } = _.useParams(), { view: P } = _.useSearch(), ae = te(), F = (e) => ae({
20
21
  to: "/$workspace/docs/space/$space",
21
22
  params: {
22
- workspace: x,
23
- space: A
23
+ workspace: w,
24
+ space: j
24
25
  },
25
26
  search: e ? { view: e } : {}
26
- }), { data: ae } = k(e(x)), { data: oe } = k(t(x)), I = A === "workspace" ? oe.name : ae.find((e) => e.key === A)?.name ?? A;
27
- d(f("title"), I);
28
- let { data: L = [] } = O(l(x, A)), { data: R = [] } = O(u(x, A)), z = te(x), B = R.find((e) => e.id === N), [V, H] = C("table"), [U, W] = C({}), [G, K] = C(""), q = w("docs"), J = ne(x);
29
- S(() => {
30
- B && (H(B.layout), W(ee(B.config)));
31
- }, [B]);
32
- let Y = (e) => W(e), X = L.filter((e) => e.kind === "date"), Z = V === "calendar" && !U.dateProperty && X[0] ? {
33
- ...U,
27
+ }), { data: oe } = A(e(w)), { data: I } = A(t(w)), L = j === "workspace" ? I.name : oe.find((e) => e.key === j)?.name ?? j;
28
+ h(g("title"), L);
29
+ let { data: R = [] } = k(u(w, j)), { data: z = [] } = k(d(w, j)), B = p(w), V = z.find((e) => e.id === P), [H, U] = T("table"), [W, G] = T({}), [K, se] = T(""), q = E("docs"), J = m(w);
30
+ ne(() => {
31
+ V && (U(V.layout), G(f(V.config)));
32
+ }, [V]);
33
+ let Y = (e) => G(e), X = R.filter((e) => e.kind === "date"), Z = H === "calendar" && !W.dateProperty && X[0] ? {
34
+ ...W,
34
35
  dateProperty: X[0].id
35
- } : U, Q = n(x, A, Z.dateProperty), se = [
36
+ } : W, Q = n(w, j, Z.dateProperty), ce = [
36
37
  {
37
38
  value: "title",
38
- label: f("docTitle")
39
+ label: g("docTitle")
39
40
  },
40
41
  {
41
42
  value: "updated",
42
- label: f("updated")
43
+ label: g("updated")
43
44
  },
44
- ...L.map((e) => ({
45
+ ...R.map((e) => ({
45
46
  value: e.id,
46
47
  label: e.name
47
48
  }))
48
- ], $ = z.saveView.error ?? z.updateView.error ?? z.create.error;
49
- return /* @__PURE__ */ D("div", {
49
+ ], $ = B.saveView.error ?? B.updateView.error ?? B.create.error;
50
+ return /* @__PURE__ */ O("div", {
50
51
  className: "flex h-full flex-col",
51
52
  children: [
52
- /* @__PURE__ */ D("header", {
53
+ /* @__PURE__ */ O("header", {
53
54
  className: "flex min-h-12 shrink-0 flex-wrap items-center gap-2 border-b border-border px-4 py-2 md:px-5",
54
55
  children: [
55
- /* @__PURE__ */ E(m, {
56
+ /* @__PURE__ */ D(ee, {
56
57
  crumbs: [{
57
- label: f("docs"),
58
- href: `/${x}/docs`
59
- }, { label: I }],
58
+ label: g("docs"),
59
+ href: `/${w}/docs`
60
+ }, { label: L }],
60
61
  className: "min-w-0 flex-1"
61
62
  }),
62
- /* @__PURE__ */ E(b, {
63
- value: N ?? "",
63
+ /* @__PURE__ */ D(C, {
64
+ value: P ?? "",
64
65
  items: [{
65
66
  value: "",
66
- label: f("unsaved")
67
- }, ...R.map((e) => ({
67
+ label: g("unsaved")
68
+ }, ...z.map((e) => ({
68
69
  value: e.id,
69
70
  label: e.name
70
71
  }))],
71
72
  onValueChange: (e) => F(e || void 0),
72
- "aria-label": f("savedViews"),
73
+ "aria-label": g("savedViews"),
73
74
  size: "sm",
74
75
  width: "content"
75
76
  }),
76
- B ? /* @__PURE__ */ E(h, {
77
+ V ? /* @__PURE__ */ D(v, {
77
78
  size: "sm",
78
- loading: z.updateView.isPending,
79
- onClick: () => z.updateView.mutate({
80
- id: B.id,
81
- layout: V,
79
+ loading: B.updateView.isPending,
80
+ onClick: () => B.updateView.mutate({
81
+ id: V.id,
82
+ layout: H,
82
83
  config: { ...Z }
83
84
  }),
84
- children: f("update")
85
- }) : /* @__PURE__ */ E(M, {
85
+ children: g("update")
86
+ }) : /* @__PURE__ */ D(N, {
86
87
  onSave: async (e) => {
87
- let t = await z.saveView.mutateAsync({
88
- space: A,
88
+ let t = await B.saveView.mutateAsync({
89
+ space: j,
89
90
  name: e,
90
- layout: V,
91
+ layout: H,
91
92
  config: { ...Z }
92
93
  });
93
94
  F(t.id);
94
95
  },
95
- pending: z.saveView.isPending
96
+ pending: B.saveView.isPending
96
97
  }),
97
- /* @__PURE__ */ E(h, {
98
+ /* @__PURE__ */ D(v, {
98
99
  variant: "primary",
99
100
  size: "sm",
100
- icon: /* @__PURE__ */ E(a, {}),
101
+ icon: /* @__PURE__ */ D(o, {}),
101
102
  loading: J.create.isPending,
102
- onClick: () => J.create.mutate(A === "workspace" ? {} : { team: A }),
103
+ onClick: () => J.create.mutate(j === "workspace" ? {} : { team: j }),
103
104
  children: q("new")
104
105
  }),
105
- /* @__PURE__ */ E(y, {
106
- label: f("layout"),
106
+ /* @__PURE__ */ D(S, {
107
+ label: g("layout"),
107
108
  size: "sm",
108
- value: V,
109
- onValueChange: H,
109
+ value: H,
110
+ onValueChange: U,
110
111
  options: [
111
112
  {
112
113
  value: "table",
113
- label: f("table"),
114
- icon: /* @__PURE__ */ E(c, {})
114
+ label: g("table"),
115
+ icon: /* @__PURE__ */ D(l, {})
115
116
  },
116
117
  {
117
118
  value: "board",
118
- label: f("board"),
119
- icon: /* @__PURE__ */ E(o, {})
119
+ label: g("board"),
120
+ icon: /* @__PURE__ */ D(s, {})
120
121
  },
121
122
  {
122
123
  value: "calendar",
123
- label: f("calendar"),
124
- icon: /* @__PURE__ */ E(s, {})
124
+ label: g("calendar"),
125
+ icon: /* @__PURE__ */ D(c, {})
125
126
  }
126
127
  ]
127
128
  })
128
129
  ]
129
130
  }),
130
- /* @__PURE__ */ D("div", {
131
+ /* @__PURE__ */ O("div", {
131
132
  className: "flex flex-wrap items-center gap-2 border-b border-border px-4 py-2 text-xs md:px-5",
132
133
  children: [
133
- /* @__PURE__ */ E(_, {
134
+ /* @__PURE__ */ D(b, {
134
135
  type: "search",
135
136
  size: "sm",
136
- value: G,
137
- onChange: (e) => K(e.target.value),
137
+ value: K,
138
+ onChange: (e) => se(e.target.value),
138
139
  placeholder: q("search"),
139
140
  "aria-label": q("search"),
140
141
  className: "w-48"
141
142
  }),
142
- V === "calendar" ? /* @__PURE__ */ D(T, { children: [X.length > 0 ? /* @__PURE__ */ E(b, {
143
- value: Z.dateProperty ?? "",
144
- items: X.map((e) => ({
145
- value: e.id,
146
- label: e.name
147
- })),
148
- onValueChange: (e) => Y({
149
- ...U,
150
- dateProperty: e
143
+ H === "calendar" ? /* @__PURE__ */ O(ie, { children: [
144
+ X.length > 0 ? /* @__PURE__ */ D(C, {
145
+ value: Z.dateProperty ?? "",
146
+ items: X.map((e) => ({
147
+ value: e.id,
148
+ label: e.name
149
+ })),
150
+ onValueChange: (e) => Y({
151
+ ...W,
152
+ dateProperty: e
153
+ }),
154
+ "aria-label": g("dateProperty"),
155
+ size: "sm",
156
+ width: "content"
157
+ }) : /* @__PURE__ */ D(v, {
158
+ size: "xs",
159
+ loading: B.create.isPending,
160
+ onClick: async () => {
161
+ let e = await B.create.mutateAsync({
162
+ space: j,
163
+ name: g("dateName"),
164
+ kind: "date"
165
+ });
166
+ Y({
167
+ ...W,
168
+ dateProperty: e.id
169
+ });
170
+ },
171
+ children: g("addDate")
151
172
  }),
152
- "aria-label": f("dateProperty"),
153
- size: "sm",
154
- width: "content"
155
- }) : /* @__PURE__ */ E(h, {
156
- size: "xs",
157
- loading: z.create.isPending,
158
- onClick: async () => {
159
- let e = await z.create.mutateAsync({
160
- space: A,
161
- name: f("dateName"),
162
- kind: "date"
163
- });
164
- Y({
165
- ...U,
166
- dateProperty: e.id
167
- });
168
- },
169
- children: f("addDate")
170
- }), /* @__PURE__ */ E(h, {
171
- size: "xs",
172
- variant: "primary",
173
- loading: Q.isPending,
174
- onClick: () => Q.mutate(/* @__PURE__ */ new Date()),
175
- children: f("newMeeting")
176
- })] }) : V === "board" ? /* @__PURE__ */ E(b, {
177
- value: U.groupBy ?? "",
173
+ /* @__PURE__ */ D(v, {
174
+ size: "xs",
175
+ variant: "primary",
176
+ loading: Q.isPending,
177
+ onClick: () => Q.mutate(/* @__PURE__ */ new Date()),
178
+ children: g("newMeeting")
179
+ }),
180
+ /* @__PURE__ */ D(r, {
181
+ workspace: w,
182
+ space: j,
183
+ dateProperty: Z.dateProperty
184
+ })
185
+ ] }) : H === "board" ? /* @__PURE__ */ D(C, {
186
+ value: W.groupBy ?? "",
178
187
  items: [{
179
188
  value: "",
180
- label: f("groupBy")
181
- }, ...L.filter(i).map((e) => ({
189
+ label: g("groupBy")
190
+ }, ...R.filter(a).map((e) => ({
182
191
  value: e.id,
183
192
  label: e.name
184
193
  }))],
185
194
  onValueChange: (e) => Y({
186
- ...U,
195
+ ...W,
187
196
  ...e ? { groupBy: e } : { groupBy: void 0 }
188
197
  }),
189
- "aria-label": f("groupBy"),
198
+ "aria-label": g("groupBy"),
190
199
  size: "sm",
191
200
  width: "content"
192
- }) : /* @__PURE__ */ E(b, {
201
+ }) : /* @__PURE__ */ D(C, {
193
202
  multiple: !0,
194
- value: U.columns ?? L.map((e) => e.id),
195
- items: L.map((e) => ({
203
+ value: W.columns ?? R.map((e) => e.id),
204
+ items: R.map((e) => ({
196
205
  value: e.id,
197
206
  label: e.name
198
207
  })),
199
208
  onValueChange: (e) => Y({
200
- ...U,
209
+ ...W,
201
210
  columns: e
202
211
  }),
203
- "aria-label": f("columns"),
204
- placeholder: f("columns"),
212
+ "aria-label": g("columns"),
213
+ placeholder: g("columns"),
205
214
  size: "sm",
206
215
  width: "content"
207
216
  }),
208
- /* @__PURE__ */ E(b, {
209
- value: U.sort ?? "title",
210
- items: se,
217
+ /* @__PURE__ */ D(C, {
218
+ value: W.sort ?? "title",
219
+ items: ce,
211
220
  onValueChange: (e) => Y({
212
- ...U,
221
+ ...W,
213
222
  sort: e
214
223
  }),
215
- "aria-label": f("sortBy"),
224
+ "aria-label": g("sortBy"),
216
225
  size: "sm",
217
226
  width: "content"
218
227
  }),
219
- /* @__PURE__ */ E(h, {
228
+ /* @__PURE__ */ D(v, {
220
229
  size: "xs",
221
230
  variant: "ghost",
222
231
  onClick: () => Y({
223
- ...U,
224
- desc: !U.desc
232
+ ...W,
233
+ desc: !W.desc
225
234
  }),
226
- children: U.desc ? f("descending") : f("ascending")
235
+ children: W.desc ? g("descending") : g("ascending")
227
236
  }),
228
- L.map((e) => /* @__PURE__ */ E(j, {
229
- workspace: x,
237
+ R.map((e) => /* @__PURE__ */ D(M, {
238
+ workspace: w,
230
239
  property: e,
231
- value: U.filters?.[e.id] ?? "",
240
+ value: W.filters?.[e.id] ?? "",
232
241
  onChange: (t) => {
233
- let n = { ...U.filters };
242
+ let n = { ...W.filters };
234
243
  t ? n[e.id] = t : delete n[e.id], Y({
235
- ...U,
244
+ ...W,
236
245
  filters: n
237
246
  });
238
247
  }
239
248
  }, e.id)),
240
- Q.error && /* @__PURE__ */ E(g, {
249
+ Q.error && /* @__PURE__ */ D(y, {
241
250
  inline: !0,
242
- children: v(Q.error)
251
+ children: x(Q.error)
243
252
  }),
244
- $ && /* @__PURE__ */ E(g, {
253
+ $ && /* @__PURE__ */ D(y, {
245
254
  inline: !0,
246
- children: v($)
255
+ children: x($)
247
256
  })
248
257
  ]
249
258
  }),
250
- /* @__PURE__ */ E("div", {
259
+ /* @__PURE__ */ D("div", {
251
260
  className: "min-h-0 flex-1 overflow-y-auto",
252
- children: /* @__PURE__ */ E(r, {
253
- workspace: x,
254
- space: A,
255
- layout: V,
261
+ children: /* @__PURE__ */ D(i, {
262
+ workspace: w,
263
+ space: j,
264
+ layout: H,
256
265
  config: Z,
257
- query: G
266
+ query: K
258
267
  })
259
268
  })
260
269
  ]
261
270
  });
262
271
  }
263
- function j({ workspace: e, property: t, value: n, onChange: r }) {
264
- let i = w("docViews"), { members: a } = f(e), o = t.kind === "select" || t.kind === "multi_select" ? t.options.map((e) => ({
272
+ function M({ workspace: e, property: t, value: n, onChange: r }) {
273
+ let i = E("docViews"), { members: a } = g(e), o = t.kind === "select" || t.kind === "multi_select" ? t.options.map((e) => ({
265
274
  value: e.id ?? "",
266
275
  label: e.name
267
276
  })) : t.kind === "person" ? a.map((e) => ({
@@ -271,7 +280,7 @@ function j({ workspace: e, property: t, value: n, onChange: r }) {
271
280
  value: "true",
272
281
  label: i("checked")
273
282
  }] : null;
274
- return o ? /* @__PURE__ */ E(b, {
283
+ return o ? /* @__PURE__ */ D(C, {
275
284
  value: n,
276
285
  items: [{
277
286
  value: "",
@@ -283,10 +292,10 @@ function j({ workspace: e, property: t, value: n, onChange: r }) {
283
292
  width: "content"
284
293
  }) : null;
285
294
  }
286
- function M({ onSave: e, pending: t }) {
287
- let n = w("docViews");
288
- return /* @__PURE__ */ E(v, {
289
- trigger: /* @__PURE__ */ E(h, {
295
+ function N({ onSave: e, pending: t }) {
296
+ let n = E("docViews");
297
+ return /* @__PURE__ */ D(x, {
298
+ trigger: /* @__PURE__ */ D(v, {
290
299
  size: "sm",
291
300
  children: n("save")
292
301
  }),
@@ -294,25 +303,25 @@ function M({ onSave: e, pending: t }) {
294
303
  className: "w-64",
295
304
  initialFocus: "first-control",
296
305
  "aria-label": n("save"),
297
- children: /* @__PURE__ */ E(N, {
306
+ children: /* @__PURE__ */ D(P, {
298
307
  onSave: e,
299
308
  pending: t
300
309
  })
301
310
  });
302
311
  }
303
- function N({ onSave: e, pending: t }) {
304
- let n = w("docViews"), r = x(), [i, a] = C("");
305
- return /* @__PURE__ */ D("form", {
312
+ function P({ onSave: e, pending: t }) {
313
+ let n = E("docViews"), r = w(), [i, a] = T("");
314
+ return /* @__PURE__ */ O("form", {
306
315
  className: "space-y-2",
307
316
  onSubmit: (t) => {
308
317
  t.preventDefault(), i.trim() && (e(i.trim()), r());
309
318
  },
310
- children: [/* @__PURE__ */ E(_, {
319
+ children: [/* @__PURE__ */ D(b, {
311
320
  value: i,
312
321
  onChange: (e) => a(e.target.value),
313
322
  placeholder: n("viewName"),
314
323
  "aria-label": n("viewName")
315
- }), /* @__PURE__ */ E(h, {
324
+ }), /* @__PURE__ */ D(v, {
316
325
  type: "submit",
317
326
  size: "sm",
318
327
  variant: "primary",
@@ -322,4 +331,4 @@ function N({ onSave: e, pending: t }) {
322
331
  })]
323
332
  });
324
333
  }
325
- export { A as component };
334
+ export { j as component };