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