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