@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.
- package/_virtual/_virtual_i18n/en/common.js +42 -1
- package/_virtual/_virtual_i18n/es/common.js +42 -1
- package/_virtual/_virtual_i18n/ja/common.js +42 -1
- package/_virtual/_virtual_i18n/ko/common.js +42 -1
- package/_virtual/_virtual_i18n/zh/common.js +42 -1
- package/components/DocCalendar.js +115 -83
- package/components/DocSeries.js +277 -0
- package/lib/docSeries.js +80 -0
- package/lib/notifications.js +2 -0
- package/package.json +1 -1
- package/routes/_workspace/docs/space2._space.js +162 -153
- package/routes/_workspace/notifications2.js +39 -37
|
@@ -2,43 +2,44 @@ import { api as e, unwrap as t } from "../api/client.js";
|
|
|
2
2
|
import { docTemplatesQuery as n, teamsQuery as r } from "../api/queries.js";
|
|
3
3
|
import { fromIsoDate as i, isoDate as a } from "../lib/datePhrases.js";
|
|
4
4
|
import { spaceScope as o } from "../lib/docProperties.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
5
|
+
import { docSeriesQuery as s, useDocSeriesActions as c } from "../lib/docSeries.js";
|
|
6
|
+
import { docRef as l } from "../lib/docs.js";
|
|
7
|
+
import { useCan as u } from "../lib/roles.js";
|
|
8
|
+
import { DocIcon as d } from "./DocIcon.js";
|
|
9
|
+
import { useSpaceDocs as f } from "./DocTable.js";
|
|
10
|
+
import { AddIcon as p, ChevronRightIcon as m, CycleIcon as h } from "./icons.js";
|
|
11
|
+
import { Button as g, cx as _ } from "@parallelworks/ui";
|
|
12
|
+
import { Link as ee, useNavigate as v } from "@tanstack/react-router";
|
|
13
|
+
import { useMemo as y, useState as te } from "react";
|
|
14
|
+
import { useFormatter as b, useLocale as ne, useTranslations as x } from "use-intl";
|
|
14
15
|
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
15
|
-
import { useMutation as w, useQueryClient as T } from "@tanstack/react-query";
|
|
16
|
+
import { useMutation as w, useQuery as re, useQueryClient as T } from "@tanstack/react-query";
|
|
16
17
|
// src/components/DocCalendar.tsx
|
|
17
18
|
var E = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
|
|
18
|
-
function
|
|
19
|
+
function ie(e) {
|
|
19
20
|
let t = new Intl.Locale(e);
|
|
20
21
|
return (t.getWeekInfo?.().firstDay ?? t.weekInfo?.firstDay ?? 7) % 7;
|
|
21
22
|
}
|
|
22
|
-
var
|
|
23
|
-
function
|
|
24
|
-
let
|
|
23
|
+
var D = (e, t) => E(e, -((e.getDay() - t + 7) % 7));
|
|
24
|
+
function O(i, o, s) {
|
|
25
|
+
let c = x("docViews"), u = b(), d = T(), f = v();
|
|
25
26
|
return w({
|
|
26
|
-
mutationFn: async (
|
|
27
|
-
let [f, p] = await Promise.all([d.fetchQuery(n(i)), d.fetchQuery(r(i))]), m = o === "workspace" ? "" : p.find((e) => e.key === o)?.id ?? "", h = f.find((e) => e.spaceDefault && (e.teamId ?? "") === m), g = a(
|
|
27
|
+
mutationFn: async (l) => {
|
|
28
|
+
let [f, p] = await Promise.all([d.fetchQuery(n(i)), d.fetchQuery(r(i))]), m = o === "workspace" ? "" : p.find((e) => e.key === o)?.id ?? "", h = f.find((e) => e.spaceDefault && (e.teamId ?? "") === m), g = a(l), _ = t(await e.POST("/api/v1/workspaces/{workspace}/docs", {
|
|
28
29
|
params: { path: { workspace: i } },
|
|
29
30
|
body: {
|
|
30
|
-
title:
|
|
31
|
+
title: c("meetingTitle", { date: u.dateTime(l, { dateStyle: "medium" }) }),
|
|
31
32
|
template: h?.id ?? "meeting-notes",
|
|
32
33
|
variables: { date: g },
|
|
33
34
|
...o !== "workspace" && { team: o }
|
|
34
35
|
}
|
|
35
36
|
}));
|
|
36
|
-
return
|
|
37
|
+
return s && await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}/properties", {
|
|
37
38
|
params: { path: {
|
|
38
39
|
workspace: i,
|
|
39
40
|
doc: _.key
|
|
40
41
|
} },
|
|
41
|
-
body: { values: { [
|
|
42
|
+
body: { values: { [s]: g } }
|
|
42
43
|
}), _;
|
|
43
44
|
},
|
|
44
45
|
onSuccess: (e) => {
|
|
@@ -50,51 +51,74 @@ function k(i, o, c) {
|
|
|
50
51
|
to: "/$workspace/docs/$doc",
|
|
51
52
|
params: {
|
|
52
53
|
workspace: i,
|
|
53
|
-
doc:
|
|
54
|
+
doc: l(e)
|
|
54
55
|
}
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
-
let
|
|
60
|
+
function k({ workspace: e, space: t, config: n, query: r = "" }) {
|
|
61
|
+
let w = x("docViews"), T = b(), k = ie(ne()), A = u(e, "edit_docs", o(t)), { docs: j, props: oe, isPending: se } = f(e, t, n), M = r.trim().toLowerCase(), N = M ? j.filter((e) => e.title.toLowerCase().includes(M)) : j, P = oe.find((e) => e.id === n.dateProperty && e.kind === "date"), F = O(e, t, P?.id), I = y(() => {
|
|
61
62
|
let e = /* @__PURE__ */ new Date();
|
|
62
63
|
return new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
63
|
-
}, []), [
|
|
64
|
+
}, []), [L, R] = te(I), ce = v(), z = c(e), B = D(new Date(L.getFullYear(), L.getMonth(), 1), k), { data: V = [] } = re(s(e, t, a(B), a(E(B, 41)))), H = y(() => {
|
|
64
65
|
let e = /* @__PURE__ */ new Map();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
for (let t of V) for (let n of t.upcoming ?? []) e.set(n, [...e.get(n) ?? [], t]);
|
|
67
|
+
return e;
|
|
68
|
+
}, [V]), U = y(() => {
|
|
69
|
+
let e = /* @__PURE__ */ new Map();
|
|
70
|
+
if (!P) return e;
|
|
71
|
+
for (let t of N) {
|
|
72
|
+
let n = t.properties?.[P.id];
|
|
68
73
|
typeof n == "string" && i(n) && e.set(n, [...e.get(n) ?? [], t]);
|
|
69
74
|
}
|
|
70
75
|
return e;
|
|
71
|
-
}, [
|
|
72
|
-
if (
|
|
76
|
+
}, [N, P]);
|
|
77
|
+
if (se) return /* @__PURE__ */ S("p", {
|
|
73
78
|
className: "p-4 text-sm text-muted-foreground",
|
|
74
|
-
children:
|
|
79
|
+
children: w("loading")
|
|
75
80
|
});
|
|
76
|
-
if (!
|
|
81
|
+
if (!P) return /* @__PURE__ */ S("p", {
|
|
77
82
|
className: "p-4 text-sm text-muted-foreground",
|
|
78
|
-
children:
|
|
83
|
+
children: w("pickDate")
|
|
79
84
|
});
|
|
80
|
-
let
|
|
85
|
+
let W = new Date(L.getFullYear(), L.getMonth(), 1), G = D(W, k), le = Math.ceil(((W.getTime() - G.getTime()) / 864e5 + ae(W)) / 7), K = Array.from({ length: le * 7 }, (e, t) => E(G, t)), q = D(L, k), J = Array.from({ length: 7 }, (e, t) => E(q, t)), Y = (e) => R((t) => new Date(t.getFullYear(), t.getMonth() + e, Math.min(t.getDate(), 28))), X = (e) => R((t) => E(t, 7 * e)), Z = (t) => /* @__PURE__ */ C(ee, {
|
|
81
86
|
to: "/$workspace/docs/$doc",
|
|
82
87
|
params: {
|
|
83
88
|
workspace: e,
|
|
84
|
-
doc:
|
|
89
|
+
doc: l(t)
|
|
85
90
|
},
|
|
86
91
|
className: "flex min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-xs hover:bg-accent",
|
|
87
|
-
children: [/* @__PURE__ */ S(
|
|
92
|
+
children: [/* @__PURE__ */ S(d, { icon: t.icon }), /* @__PURE__ */ S("span", {
|
|
93
|
+
className: "truncate",
|
|
94
|
+
children: t.title
|
|
95
|
+
})]
|
|
96
|
+
}, t.id), Q = (t, n) => /* @__PURE__ */ C("button", {
|
|
97
|
+
type: "button",
|
|
98
|
+
disabled: !A || z.makeDoc.isPending,
|
|
99
|
+
onClick: () => z.makeDoc.mutate({
|
|
100
|
+
id: t.id,
|
|
101
|
+
day: n
|
|
102
|
+
}, { onSuccess: (t) => ce({
|
|
103
|
+
to: "/$workspace/docs/$doc",
|
|
104
|
+
params: {
|
|
105
|
+
workspace: e,
|
|
106
|
+
doc: l(t)
|
|
107
|
+
}
|
|
108
|
+
}) }),
|
|
109
|
+
"aria-label": w("makeSeriesDoc", { series: t.title }),
|
|
110
|
+
className: "flex min-w-0 items-center gap-1 rounded border border-dashed border-border px-1.5 py-0.5 text-left text-xs text-muted-foreground enabled:hover:border-primary enabled:hover:text-foreground",
|
|
111
|
+
children: [/* @__PURE__ */ S(h, { className: "size-3 shrink-0" }), /* @__PURE__ */ S("span", {
|
|
88
112
|
className: "truncate",
|
|
89
113
|
children: t.title
|
|
90
114
|
})]
|
|
91
|
-
}, t.id),
|
|
115
|
+
}, `${t.id}-${n}`), $ = (e) => A && /* @__PURE__ */ S("button", {
|
|
92
116
|
type: "button",
|
|
93
|
-
onClick: () =>
|
|
94
|
-
disabled:
|
|
95
|
-
"aria-label":
|
|
117
|
+
onClick: () => F.mutate(e),
|
|
118
|
+
disabled: F.isPending,
|
|
119
|
+
"aria-label": w("newMeetingOn", { date: T.dateTime(e, { dateStyle: "medium" }) }),
|
|
96
120
|
className: "rounded px-1 text-xs text-muted-foreground opacity-0 group-hover:opacity-100 max-sm:opacity-100 focus-visible:opacity-100 hover:bg-accent hover:text-foreground",
|
|
97
|
-
children: /* @__PURE__ */ S(
|
|
121
|
+
children: /* @__PURE__ */ S(p, { className: "size-3.5" })
|
|
98
122
|
});
|
|
99
123
|
return /* @__PURE__ */ C("div", {
|
|
100
124
|
className: "flex flex-col",
|
|
@@ -104,54 +128,54 @@ function A({ workspace: e, space: t, config: n, query: r = "" }) {
|
|
|
104
128
|
children: [
|
|
105
129
|
/* @__PURE__ */ S("h2", {
|
|
106
130
|
className: "text-sm font-medium max-sm:hidden",
|
|
107
|
-
children:
|
|
131
|
+
children: T.dateTime(W, {
|
|
108
132
|
month: "long",
|
|
109
133
|
year: "numeric"
|
|
110
134
|
})
|
|
111
135
|
}),
|
|
112
136
|
/* @__PURE__ */ S("h2", {
|
|
113
137
|
className: "text-sm font-medium sm:hidden",
|
|
114
|
-
children:
|
|
138
|
+
children: T.dateTimeRange(J[0], J[6], { dateStyle: "medium" })
|
|
115
139
|
}),
|
|
116
140
|
/* @__PURE__ */ C("span", {
|
|
117
141
|
className: "ml-auto flex items-center gap-1",
|
|
118
142
|
children: [
|
|
119
|
-
/* @__PURE__ */ S(
|
|
143
|
+
/* @__PURE__ */ S(g, {
|
|
120
144
|
size: "xs",
|
|
121
145
|
variant: "ghost",
|
|
122
|
-
onClick: () =>
|
|
123
|
-
children:
|
|
146
|
+
onClick: () => R(I),
|
|
147
|
+
children: w("today")
|
|
124
148
|
}),
|
|
125
149
|
/* @__PURE__ */ C("span", {
|
|
126
150
|
className: "flex gap-1 max-sm:hidden",
|
|
127
|
-
children: [/* @__PURE__ */ S(
|
|
151
|
+
children: [/* @__PURE__ */ S(g, {
|
|
128
152
|
size: "xs",
|
|
129
153
|
variant: "ghost",
|
|
130
154
|
onClick: () => Y(-1),
|
|
131
|
-
"aria-label":
|
|
132
|
-
children: /* @__PURE__ */ S(
|
|
133
|
-
}), /* @__PURE__ */ S(
|
|
155
|
+
"aria-label": w("previousMonth"),
|
|
156
|
+
children: /* @__PURE__ */ S(m, { className: "rotate-180" })
|
|
157
|
+
}), /* @__PURE__ */ S(g, {
|
|
134
158
|
size: "xs",
|
|
135
159
|
variant: "ghost",
|
|
136
160
|
onClick: () => Y(1),
|
|
137
|
-
"aria-label":
|
|
138
|
-
children: /* @__PURE__ */ S(
|
|
161
|
+
"aria-label": w("nextMonth"),
|
|
162
|
+
children: /* @__PURE__ */ S(m, {})
|
|
139
163
|
})]
|
|
140
164
|
}),
|
|
141
165
|
/* @__PURE__ */ C("span", {
|
|
142
166
|
className: "flex gap-1 sm:hidden",
|
|
143
|
-
children: [/* @__PURE__ */ S(
|
|
167
|
+
children: [/* @__PURE__ */ S(g, {
|
|
144
168
|
size: "xs",
|
|
145
169
|
variant: "ghost",
|
|
146
170
|
onClick: () => X(-1),
|
|
147
|
-
"aria-label":
|
|
148
|
-
children: /* @__PURE__ */ S(
|
|
149
|
-
}), /* @__PURE__ */ S(
|
|
171
|
+
"aria-label": w("previousWeek"),
|
|
172
|
+
children: /* @__PURE__ */ S(m, { className: "rotate-180" })
|
|
173
|
+
}), /* @__PURE__ */ S(g, {
|
|
150
174
|
size: "xs",
|
|
151
175
|
variant: "ghost",
|
|
152
176
|
onClick: () => X(1),
|
|
153
|
-
"aria-label":
|
|
154
|
-
children: /* @__PURE__ */ S(
|
|
177
|
+
"aria-label": w("nextWeek"),
|
|
178
|
+
children: /* @__PURE__ */ S(m, {})
|
|
155
179
|
})]
|
|
156
180
|
})
|
|
157
181
|
]
|
|
@@ -164,50 +188,58 @@ function A({ workspace: e, space: t, config: n, query: r = "" }) {
|
|
|
164
188
|
className: "grid grid-cols-7 border-y border-border text-xs text-muted-foreground",
|
|
165
189
|
children: K.slice(0, 7).map((e) => /* @__PURE__ */ S("span", {
|
|
166
190
|
className: "px-2 py-1",
|
|
167
|
-
children:
|
|
191
|
+
children: T.dateTime(e, { weekday: "short" })
|
|
168
192
|
}, e.getDay()))
|
|
169
193
|
}), /* @__PURE__ */ S("ol", {
|
|
170
194
|
className: "grid grid-cols-7",
|
|
171
|
-
"aria-label":
|
|
195
|
+
"aria-label": w("calendar"),
|
|
172
196
|
children: K.map((e) => {
|
|
173
|
-
let t = a(e), n =
|
|
197
|
+
let t = a(e), n = U.get(t) ?? [], r = e.getMonth() === W.getMonth();
|
|
174
198
|
return /* @__PURE__ */ C("li", {
|
|
175
|
-
"aria-label":
|
|
176
|
-
className:
|
|
177
|
-
children: [
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
199
|
+
"aria-label": T.dateTime(e, { dateStyle: "full" }),
|
|
200
|
+
className: _("group flex min-h-24 min-w-0 flex-col gap-1 border-r border-b border-border p-1.5", !r && "bg-muted/30"),
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ C("span", {
|
|
203
|
+
className: "flex items-center justify-between",
|
|
204
|
+
children: [/* @__PURE__ */ S("span", {
|
|
205
|
+
className: _("flex size-6 items-center justify-center rounded-full text-xs tabular-nums", t === a(I) ? "bg-primary text-primary-foreground" : r ? "" : "text-muted-foreground"),
|
|
206
|
+
children: e.getDate()
|
|
207
|
+
}), $(e)]
|
|
208
|
+
}),
|
|
209
|
+
n.map(Z),
|
|
210
|
+
(H.get(t) ?? []).map((e) => Q(e, t))
|
|
211
|
+
]
|
|
184
212
|
}, t);
|
|
185
213
|
})
|
|
186
214
|
})]
|
|
187
215
|
}),
|
|
188
216
|
/* @__PURE__ */ S("ol", {
|
|
189
217
|
className: "divide-y divide-border border-y border-border sm:hidden",
|
|
190
|
-
"aria-label":
|
|
218
|
+
"aria-label": w("calendar"),
|
|
191
219
|
children: J.map((e) => {
|
|
192
|
-
let t = a(e), n =
|
|
220
|
+
let t = a(e), n = U.get(t) ?? [];
|
|
193
221
|
return /* @__PURE__ */ C("li", {
|
|
194
222
|
className: "group flex flex-col gap-1 px-4 py-2",
|
|
195
|
-
children: [
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ C("span", {
|
|
225
|
+
className: "flex items-center justify-between text-xs",
|
|
226
|
+
children: [/* @__PURE__ */ S("span", {
|
|
227
|
+
className: _(t === a(I) ? "font-medium text-primary" : "text-muted-foreground"),
|
|
228
|
+
children: T.dateTime(e, {
|
|
229
|
+
weekday: "long",
|
|
230
|
+
month: "short",
|
|
231
|
+
day: "numeric"
|
|
232
|
+
})
|
|
233
|
+
}), $(e)]
|
|
234
|
+
}),
|
|
235
|
+
n.map(Z),
|
|
236
|
+
(H.get(t) ?? []).map((e) => Q(e, t))
|
|
237
|
+
]
|
|
206
238
|
}, t);
|
|
207
239
|
})
|
|
208
240
|
})
|
|
209
241
|
]
|
|
210
242
|
});
|
|
211
243
|
}
|
|
212
|
-
var
|
|
213
|
-
export {
|
|
244
|
+
var ae = (e) => new Date(e.getFullYear(), e.getMonth() + 1, 0).getDate();
|
|
245
|
+
export { k as DocCalendar, O as useNewMeetingNotes };
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { docTemplatesQuery as e } from "../api/queries.js";
|
|
2
|
+
import { isoDate as t } from "../lib/datePhrases.js";
|
|
3
|
+
import { browserZone as n, docSeriesQuery as r, seriesRepeats as i, useDocSeriesActions as a } from "../lib/docSeries.js";
|
|
4
|
+
import { usePeople as o } from "../lib/people.js";
|
|
5
|
+
import { CycleIcon as s } from "./icons.js";
|
|
6
|
+
import { Button as c, Combobox as l, DatePicker as u, ErrorText as d, Input as f, Modal as p, Popover as m, Select as h, ToggleGroup as g, useClosePopover as _ } from "@parallelworks/ui";
|
|
7
|
+
import { useId as v, useState as y } from "react";
|
|
8
|
+
import { useErrorMessage as b } from "@parallelworks/problem/react";
|
|
9
|
+
import { useFormatter as x, useTranslations as S } from "use-intl";
|
|
10
|
+
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
11
|
+
import { useQuery as E } from "@tanstack/react-query";
|
|
12
|
+
// src/components/DocSeries.tsx
|
|
13
|
+
function D() {
|
|
14
|
+
let e = x();
|
|
15
|
+
return Array.from({ length: 7 }, (t, n) => e.dateTime(new Date(2026, 10, 1 + n), { weekday: "short" }));
|
|
16
|
+
}
|
|
17
|
+
function O() {
|
|
18
|
+
let e = S("docSeries"), t = D();
|
|
19
|
+
return (n) => n.repeat === "weekly" || n.repeat === "biweekly" ? e(`summary.${n.repeat}`, { days: n.weekdays.map((e) => t[e]).join(", ") }) : e(`summary.${n.repeat}`);
|
|
20
|
+
}
|
|
21
|
+
function k({ workspace: e, space: t, dateProperty: n }) {
|
|
22
|
+
let r = S("docSeries"), [i, a] = y(null);
|
|
23
|
+
return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(m, {
|
|
24
|
+
trigger: /* @__PURE__ */ T(c, {
|
|
25
|
+
size: "xs",
|
|
26
|
+
children: [/* @__PURE__ */ w(s, {}), r("series")]
|
|
27
|
+
}),
|
|
28
|
+
align: "start",
|
|
29
|
+
className: "w-80",
|
|
30
|
+
"aria-label": r("series"),
|
|
31
|
+
children: /* @__PURE__ */ w(A, {
|
|
32
|
+
workspace: e,
|
|
33
|
+
space: t,
|
|
34
|
+
onEdit: a
|
|
35
|
+
})
|
|
36
|
+
}), i && /* @__PURE__ */ w(j, {
|
|
37
|
+
workspace: e,
|
|
38
|
+
space: t,
|
|
39
|
+
series: i === "new" ? void 0 : i,
|
|
40
|
+
dateProperty: n,
|
|
41
|
+
onClose: () => a(null)
|
|
42
|
+
})] });
|
|
43
|
+
}
|
|
44
|
+
function A({ workspace: e, space: t, onEdit: n }) {
|
|
45
|
+
let i = S("docSeries"), a = _(), o = O(), { data: s = [] } = E(r(e, t));
|
|
46
|
+
return /* @__PURE__ */ T("div", {
|
|
47
|
+
className: "space-y-2",
|
|
48
|
+
children: [s.length === 0 ? /* @__PURE__ */ w("p", {
|
|
49
|
+
className: "text-sm text-muted-foreground",
|
|
50
|
+
children: i("none")
|
|
51
|
+
}) : /* @__PURE__ */ w("ul", {
|
|
52
|
+
className: "divide-y divide-border",
|
|
53
|
+
children: s.map((e) => /* @__PURE__ */ T("li", {
|
|
54
|
+
className: "flex items-center gap-2 py-1.5",
|
|
55
|
+
children: [/* @__PURE__ */ T("span", {
|
|
56
|
+
className: "min-w-0 flex-1",
|
|
57
|
+
children: [/* @__PURE__ */ w("span", {
|
|
58
|
+
className: "block truncate text-sm font-medium",
|
|
59
|
+
children: e.title
|
|
60
|
+
}), /* @__PURE__ */ w("span", {
|
|
61
|
+
className: "block truncate text-xs text-muted-foreground",
|
|
62
|
+
children: e.stoppedAt ? i("stopped") : o(e)
|
|
63
|
+
})]
|
|
64
|
+
}), !e.stoppedAt && /* @__PURE__ */ w(c, {
|
|
65
|
+
size: "xs",
|
|
66
|
+
variant: "ghost",
|
|
67
|
+
onClick: () => {
|
|
68
|
+
a(), n(e);
|
|
69
|
+
},
|
|
70
|
+
children: i("edit")
|
|
71
|
+
})]
|
|
72
|
+
}, e.id))
|
|
73
|
+
}), /* @__PURE__ */ w(c, {
|
|
74
|
+
size: "xs",
|
|
75
|
+
variant: "primary",
|
|
76
|
+
onClick: () => {
|
|
77
|
+
a(), n("new");
|
|
78
|
+
},
|
|
79
|
+
children: i("new")
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function j({ workspace: r, space: s, series: m, dateProperty: _, onClose: x }) {
|
|
84
|
+
let O = S("docSeries"), k = S("common"), A = b(), j = D(), M = v(), N = a(r), { members: P } = o(r), { data: F = [] } = E(e(r)), [I, L] = y(() => m ? {
|
|
85
|
+
title: m.title,
|
|
86
|
+
repeat: m.repeat,
|
|
87
|
+
weekdays: m.weekdays,
|
|
88
|
+
startsOn: m.startsOn,
|
|
89
|
+
template: m.template,
|
|
90
|
+
attendees: m.attendees,
|
|
91
|
+
leadDays: m.leadDays,
|
|
92
|
+
timeZone: m.timeZone,
|
|
93
|
+
...m.dateProperty && { dateProperty: m.dateProperty }
|
|
94
|
+
} : {
|
|
95
|
+
space: s,
|
|
96
|
+
title: "",
|
|
97
|
+
repeat: "weekly",
|
|
98
|
+
weekdays: [(/* @__PURE__ */ new Date()).getDay()],
|
|
99
|
+
startsOn: t(/* @__PURE__ */ new Date()),
|
|
100
|
+
template: "",
|
|
101
|
+
attendees: [],
|
|
102
|
+
leadDays: 1,
|
|
103
|
+
timeZone: n(),
|
|
104
|
+
..._ && { dateProperty: _ }
|
|
105
|
+
}), R = (e) => L((t) => ({
|
|
106
|
+
...t,
|
|
107
|
+
...e
|
|
108
|
+
})), [z, B] = y(!1), V = m ? () => N.update.mutateAsync({
|
|
109
|
+
id: m.id,
|
|
110
|
+
...I
|
|
111
|
+
}).then(x) : () => N.create.mutateAsync(I).then(x), H = N.create.isPending || N.update.isPending, U = N.create.error ?? N.update.error ?? N.stop.error, W = I.repeat === "weekly" || I.repeat === "biweekly", G = "block text-xs font-medium text-muted-foreground";
|
|
112
|
+
return /* @__PURE__ */ w(p, {
|
|
113
|
+
open: !0,
|
|
114
|
+
onClose: x,
|
|
115
|
+
size: "lg",
|
|
116
|
+
title: O(m ? "editTitle" : "newTitle"),
|
|
117
|
+
description: O("description"),
|
|
118
|
+
footer: /* @__PURE__ */ T(C, { children: [
|
|
119
|
+
m && /* @__PURE__ */ w(c, {
|
|
120
|
+
variant: "danger",
|
|
121
|
+
className: "mr-auto",
|
|
122
|
+
loading: N.stop.isPending,
|
|
123
|
+
onClick: () => N.stop.mutateAsync(m.id).then(x),
|
|
124
|
+
children: O("stop")
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ w(c, {
|
|
127
|
+
variant: "secondary",
|
|
128
|
+
onClick: x,
|
|
129
|
+
children: k("cancel")
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ w(c, {
|
|
132
|
+
variant: "primary",
|
|
133
|
+
loading: H,
|
|
134
|
+
disabled: !I.title.trim() || W && (I.weekdays ?? []).length === 0,
|
|
135
|
+
onClick: () => V().catch(() => {}),
|
|
136
|
+
children: m ? k("save") : O("create")
|
|
137
|
+
})
|
|
138
|
+
] }),
|
|
139
|
+
children: /* @__PURE__ */ T("form", {
|
|
140
|
+
className: "space-y-3",
|
|
141
|
+
onSubmit: (e) => {
|
|
142
|
+
e.preventDefault(), V().catch(() => {});
|
|
143
|
+
},
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ w("label", {
|
|
146
|
+
htmlFor: M,
|
|
147
|
+
className: G,
|
|
148
|
+
children: O("title")
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ w(f, {
|
|
151
|
+
id: M,
|
|
152
|
+
value: I.title,
|
|
153
|
+
onChange: (e) => R({ title: e.target.value }),
|
|
154
|
+
placeholder: O("titlePlaceholder"),
|
|
155
|
+
maxLength: 200,
|
|
156
|
+
className: "-mt-2",
|
|
157
|
+
autoFocus: !0
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ T("div", {
|
|
160
|
+
className: "flex flex-wrap items-end gap-3",
|
|
161
|
+
children: [/* @__PURE__ */ T("div", {
|
|
162
|
+
className: G,
|
|
163
|
+
children: [O("repeat"), /* @__PURE__ */ w("div", {
|
|
164
|
+
className: "mt-1",
|
|
165
|
+
children: /* @__PURE__ */ w(h, {
|
|
166
|
+
value: I.repeat,
|
|
167
|
+
items: i.map((e) => ({
|
|
168
|
+
value: e,
|
|
169
|
+
label: O(`repeats.${e}`)
|
|
170
|
+
})),
|
|
171
|
+
onValueChange: (e) => e && R({ repeat: e }),
|
|
172
|
+
"aria-label": O("repeat")
|
|
173
|
+
})
|
|
174
|
+
})]
|
|
175
|
+
}), /* @__PURE__ */ T("div", {
|
|
176
|
+
className: G,
|
|
177
|
+
children: [O("startsOn"), /* @__PURE__ */ w("div", {
|
|
178
|
+
className: "mt-1",
|
|
179
|
+
children: /* @__PURE__ */ w(u, {
|
|
180
|
+
value: I.startsOn,
|
|
181
|
+
onValueChange: (e) => e && R({ startsOn: e }),
|
|
182
|
+
required: !0,
|
|
183
|
+
"aria-label": O("startsOn")
|
|
184
|
+
})
|
|
185
|
+
})]
|
|
186
|
+
})]
|
|
187
|
+
}),
|
|
188
|
+
W && /* @__PURE__ */ T("div", {
|
|
189
|
+
className: G,
|
|
190
|
+
children: [O("weekdays"), /* @__PURE__ */ w("div", {
|
|
191
|
+
className: "mt-1",
|
|
192
|
+
children: /* @__PURE__ */ w(g, {
|
|
193
|
+
multiple: !0,
|
|
194
|
+
label: O("weekdays"),
|
|
195
|
+
value: (I.weekdays ?? []).map(String),
|
|
196
|
+
options: j.map((e, t) => ({
|
|
197
|
+
value: String(t),
|
|
198
|
+
label: e
|
|
199
|
+
})),
|
|
200
|
+
onValueChange: (e) => R({ weekdays: e.map(Number).sort() })
|
|
201
|
+
})
|
|
202
|
+
})]
|
|
203
|
+
}),
|
|
204
|
+
/* @__PURE__ */ T("div", {
|
|
205
|
+
className: "flex flex-wrap items-end gap-3",
|
|
206
|
+
children: [/* @__PURE__ */ T("div", {
|
|
207
|
+
className: G,
|
|
208
|
+
children: [O("template"), /* @__PURE__ */ w("div", {
|
|
209
|
+
className: "mt-1",
|
|
210
|
+
children: /* @__PURE__ */ w(h, {
|
|
211
|
+
value: I.template ?? "",
|
|
212
|
+
items: [{
|
|
213
|
+
value: "",
|
|
214
|
+
label: O("spaceDefault")
|
|
215
|
+
}, ...F.map((e) => ({
|
|
216
|
+
value: e.id,
|
|
217
|
+
label: e.title
|
|
218
|
+
}))],
|
|
219
|
+
onValueChange: (e) => R({ template: e ?? "" }),
|
|
220
|
+
"aria-label": O("template")
|
|
221
|
+
})
|
|
222
|
+
})]
|
|
223
|
+
}), /* @__PURE__ */ T("div", {
|
|
224
|
+
className: G,
|
|
225
|
+
children: [O("lead"), /* @__PURE__ */ w("div", {
|
|
226
|
+
className: "mt-1",
|
|
227
|
+
children: /* @__PURE__ */ w(h, {
|
|
228
|
+
value: String(I.leadDays ?? 0),
|
|
229
|
+
items: [
|
|
230
|
+
0,
|
|
231
|
+
1,
|
|
232
|
+
2,
|
|
233
|
+
3,
|
|
234
|
+
7
|
|
235
|
+
].map((e) => ({
|
|
236
|
+
value: String(e),
|
|
237
|
+
label: O("leadDays", { days: e })
|
|
238
|
+
})),
|
|
239
|
+
onValueChange: (e) => e !== null && R({ leadDays: Number(e) }),
|
|
240
|
+
"aria-label": O("lead")
|
|
241
|
+
})
|
|
242
|
+
})]
|
|
243
|
+
})]
|
|
244
|
+
}),
|
|
245
|
+
/* @__PURE__ */ T("div", {
|
|
246
|
+
className: G,
|
|
247
|
+
children: [O("attendees"), /* @__PURE__ */ w("div", {
|
|
248
|
+
className: "mt-1",
|
|
249
|
+
children: /* @__PURE__ */ w(l, {
|
|
250
|
+
open: z,
|
|
251
|
+
onOpenChange: B,
|
|
252
|
+
multiple: !0,
|
|
253
|
+
items: P.map((e) => ({
|
|
254
|
+
value: e.user.username,
|
|
255
|
+
label: e.user.name || e.user.username
|
|
256
|
+
})),
|
|
257
|
+
value: I.attendees ?? [],
|
|
258
|
+
onValueChange: (e) => R({ attendees: e }),
|
|
259
|
+
placeholder: O("attendees"),
|
|
260
|
+
trigger: /* @__PURE__ */ w(c, {
|
|
261
|
+
type: "button",
|
|
262
|
+
className: "font-normal",
|
|
263
|
+
children: (I.attendees ?? []).length ? (I.attendees ?? []).map((e) => P.find((t) => t.user.username === e)?.user.name || e).join(", ") : O("noAttendees")
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
})]
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ w("p", {
|
|
269
|
+
className: "text-xs text-muted-foreground",
|
|
270
|
+
children: O("zone", { zone: I.timeZone ?? "UTC" })
|
|
271
|
+
}),
|
|
272
|
+
U && /* @__PURE__ */ w(d, { children: A(U) })
|
|
273
|
+
]
|
|
274
|
+
})
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
export { k as SeriesMenu, O as useSeriesSummary };
|