@parallelworks/tandem-web 0.179.2 → 0.181.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.
@@ -277,14 +277,14 @@ function at() {
277
277
  className: "relative flex",
278
278
  children: [e, n && t && /* @__PURE__ */ A("span", { className: it })]
279
279
  }), s = v.filter((e) => !e.archivedAt), c = new Set(s.map((e) => e.id)), u = (e) => s.filter((t) => (t.parentId && c.has(t.parentId) ? t.parentId : "") === e), f = (e) => {
280
- let t = (t) => Ie(d, e.key, t), n = kt.filter((t) => t.identifier.startsWith(`${e.key}-`)).length;
280
+ let t = (t) => Ie(d, e.key, t), n = kt.filter((t) => t.identifier.startsWith(`${e.key}-`)).length, i = (t) => !e.sidebarHidden.includes(t);
281
281
  return /* @__PURE__ */ j(P, {
282
282
  label: e.name,
283
283
  icon: o(/* @__PURE__ */ A(l, {
284
284
  icon: e.icon,
285
285
  color: e.color,
286
286
  name: e.name
287
- }), Mt(e.id) > 0),
287
+ }), i("triage") && Mt(e.id) > 0),
288
288
  selected: x(J.pathname, d)?.team === e.key,
289
289
  open: !Et.has(e.key),
290
290
  onOpenChange: (t) => Ot(e.key, t),
@@ -294,7 +294,7 @@ function at() {
294
294
  label: W("moreActionsFor", { name: e.name })
295
295
  }),
296
296
  children: [
297
- e.triageEnabled && /* @__PURE__ */ A(F, {
297
+ e.triageEnabled && i("triage") && /* @__PURE__ */ A(F, {
298
298
  label: U("triage"),
299
299
  icon: /* @__PURE__ */ A(de, { className: "size-4" }),
300
300
  href: t("triage"),
@@ -306,28 +306,28 @@ function at() {
306
306
  label: U("triageCount")
307
307
  })
308
308
  }),
309
- /* @__PURE__ */ A(F, {
309
+ i("issues") && /* @__PURE__ */ A(F, {
310
310
  label: U("issues"),
311
311
  icon: /* @__PURE__ */ A(ce, { className: "size-4" }),
312
312
  href: t("issues"),
313
313
  selected: Tt.team === e.key,
314
314
  onContextMenu: a(t("issues"))
315
315
  }),
316
- /* @__PURE__ */ A(F, {
316
+ i("projects") && /* @__PURE__ */ A(F, {
317
317
  label: U("projects"),
318
318
  icon: /* @__PURE__ */ A(ue, { className: "size-4" }),
319
319
  href: t("projects"),
320
320
  selected: Y("projects", e.key),
321
321
  onContextMenu: a(t("projects"))
322
322
  }),
323
- /* @__PURE__ */ A(F, {
323
+ i("areas") && /* @__PURE__ */ A(F, {
324
324
  label: U("areas"),
325
325
  icon: /* @__PURE__ */ A(ne, { className: "size-4" }),
326
326
  href: t("areas"),
327
327
  selected: Y("areas", e.key),
328
328
  onContextMenu: a(t("areas"))
329
329
  }),
330
- /* @__PURE__ */ A(F, {
330
+ i("decisions") && /* @__PURE__ */ A(F, {
331
331
  label: U("decisions"),
332
332
  icon: /* @__PURE__ */ A(oe, { className: "size-4" }),
333
333
  href: t("decisions"),
@@ -340,14 +340,14 @@ function at() {
340
340
  className: "bg-agent! text-agent-foreground!"
341
341
  })
342
342
  }),
343
- /* @__PURE__ */ A(F, {
343
+ i("docs") && /* @__PURE__ */ A(F, {
344
344
  label: U("docs"),
345
345
  icon: /* @__PURE__ */ A(ae, { className: "size-4" }),
346
346
  href: `/${d}/docs/space/${e.key}`,
347
347
  selected: r(`/${d}/docs/space/${e.key}`),
348
348
  onContextMenu: a(`/${d}/docs/space/${e.key}`)
349
349
  }),
350
- e.cyclesEnabled && /* @__PURE__ */ A(F, {
350
+ e.cyclesEnabled && i("cycles") && /* @__PURE__ */ A(F, {
351
351
  label: U("cycles"),
352
352
  icon: /* @__PURE__ */ A(ie, { className: "size-4" }),
353
353
  href: t("cycles"),
@@ -1,245 +0,0 @@
1
- import { api as e, unwrap as t } from "../api/client.js";
2
- import { docTemplatesQuery as n, teamsQuery as r } from "../api/queries.js";
3
- import { fromIsoDate as i, isoDate as a } from "../lib/datePhrases.js";
4
- import { spaceScope as o } from "../lib/docProperties.js";
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";
15
- import { jsx as S, jsxs as C } from "react/jsx-runtime";
16
- import { useMutation as w, useQuery as re, useQueryClient as T } from "@tanstack/react-query";
17
- // src/components/DocCalendar.tsx
18
- var E = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
19
- function ie(e) {
20
- let t = new Intl.Locale(e);
21
- return (t.getWeekInfo?.().firstDay ?? t.weekInfo?.firstDay ?? 7) % 7;
22
- }
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();
26
- return w({
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", {
29
- params: { path: { workspace: i } },
30
- body: {
31
- title: c("meetingTitle", { date: u.dateTime(l, { dateStyle: "medium" }) }),
32
- template: h?.id ?? "meeting-notes",
33
- variables: { date: g },
34
- ...o !== "workspace" && { team: o }
35
- }
36
- }));
37
- return s && await e.PATCH("/api/v1/workspaces/{workspace}/docs/{doc}/properties", {
38
- params: { path: {
39
- workspace: i,
40
- doc: _.key
41
- } },
42
- body: { values: { [s]: g } }
43
- }), _;
44
- },
45
- onSuccess: (e) => {
46
- d.invalidateQueries({ queryKey: [
47
- "workspace",
48
- i,
49
- "docs"
50
- ] }), f({
51
- to: "/$workspace/docs/$doc",
52
- params: {
53
- workspace: i,
54
- doc: l(e)
55
- }
56
- });
57
- }
58
- });
59
- }
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(() => {
62
- let e = /* @__PURE__ */ new Date();
63
- return new Date(e.getFullYear(), e.getMonth(), e.getDate());
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(() => {
65
- let e = /* @__PURE__ */ new Map();
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];
73
- typeof n == "string" && i(n) && e.set(n, [...e.get(n) ?? [], t]);
74
- }
75
- return e;
76
- }, [N, P]);
77
- if (se) return /* @__PURE__ */ S("p", {
78
- className: "p-4 text-sm text-muted-foreground",
79
- children: w("loading")
80
- });
81
- if (!P) return /* @__PURE__ */ S("p", {
82
- className: "p-4 text-sm text-muted-foreground",
83
- children: w("pickDate")
84
- });
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, {
86
- to: "/$workspace/docs/$doc",
87
- params: {
88
- workspace: e,
89
- doc: l(t)
90
- },
91
- className: "flex min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-xs hover:bg-accent",
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", {
112
- className: "truncate",
113
- children: t.title
114
- })]
115
- }, `${t.id}-${n}`), $ = (e) => A && /* @__PURE__ */ S("button", {
116
- type: "button",
117
- onClick: () => F.mutate(e),
118
- disabled: F.isPending,
119
- "aria-label": w("newMeetingOn", { date: T.dateTime(e, { dateStyle: "medium" }) }),
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",
121
- children: /* @__PURE__ */ S(p, { className: "size-3.5" })
122
- });
123
- return /* @__PURE__ */ C("div", {
124
- className: "flex flex-col",
125
- children: [
126
- /* @__PURE__ */ C("div", {
127
- className: "flex items-center gap-2 px-4 py-2 md:px-5",
128
- children: [
129
- /* @__PURE__ */ S("h2", {
130
- className: "text-sm font-medium max-sm:hidden",
131
- children: T.dateTime(W, {
132
- month: "long",
133
- year: "numeric"
134
- })
135
- }),
136
- /* @__PURE__ */ S("h2", {
137
- className: "text-sm font-medium sm:hidden",
138
- children: T.dateTimeRange(J[0], J[6], { dateStyle: "medium" })
139
- }),
140
- /* @__PURE__ */ C("span", {
141
- className: "ml-auto flex items-center gap-1",
142
- children: [
143
- /* @__PURE__ */ S(g, {
144
- size: "xs",
145
- variant: "ghost",
146
- onClick: () => R(I),
147
- children: w("today")
148
- }),
149
- /* @__PURE__ */ C("span", {
150
- className: "flex gap-1 max-sm:hidden",
151
- children: [/* @__PURE__ */ S(g, {
152
- size: "xs",
153
- variant: "ghost",
154
- onClick: () => Y(-1),
155
- "aria-label": w("previousMonth"),
156
- children: /* @__PURE__ */ S(m, { className: "rotate-180" })
157
- }), /* @__PURE__ */ S(g, {
158
- size: "xs",
159
- variant: "ghost",
160
- onClick: () => Y(1),
161
- "aria-label": w("nextMonth"),
162
- children: /* @__PURE__ */ S(m, {})
163
- })]
164
- }),
165
- /* @__PURE__ */ C("span", {
166
- className: "flex gap-1 sm:hidden",
167
- children: [/* @__PURE__ */ S(g, {
168
- size: "xs",
169
- variant: "ghost",
170
- onClick: () => X(-1),
171
- "aria-label": w("previousWeek"),
172
- children: /* @__PURE__ */ S(m, { className: "rotate-180" })
173
- }), /* @__PURE__ */ S(g, {
174
- size: "xs",
175
- variant: "ghost",
176
- onClick: () => X(1),
177
- "aria-label": w("nextWeek"),
178
- children: /* @__PURE__ */ S(m, {})
179
- })]
180
- })
181
- ]
182
- })
183
- ]
184
- }),
185
- /* @__PURE__ */ C("div", {
186
- className: "max-sm:hidden",
187
- children: [/* @__PURE__ */ S("div", {
188
- className: "grid grid-cols-7 border-y border-border text-xs text-muted-foreground",
189
- children: K.slice(0, 7).map((e) => /* @__PURE__ */ S("span", {
190
- className: "px-2 py-1",
191
- children: T.dateTime(e, { weekday: "short" })
192
- }, e.getDay()))
193
- }), /* @__PURE__ */ S("ol", {
194
- className: "grid grid-cols-7",
195
- "aria-label": w("calendar"),
196
- children: K.map((e) => {
197
- let t = a(e), n = U.get(t) ?? [], r = e.getMonth() === W.getMonth();
198
- return /* @__PURE__ */ C("li", {
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
- ]
212
- }, t);
213
- })
214
- })]
215
- }),
216
- /* @__PURE__ */ S("ol", {
217
- className: "divide-y divide-border border-y border-border sm:hidden",
218
- "aria-label": w("calendar"),
219
- children: J.map((e) => {
220
- let t = a(e), n = U.get(t) ?? [];
221
- return /* @__PURE__ */ C("li", {
222
- className: "group flex flex-col gap-1 px-4 py-2",
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
- ]
238
- }, t);
239
- })
240
- })
241
- ]
242
- });
243
- }
244
- var ae = (e) => new Date(e.getFullYear(), e.getMonth() + 1, 0).getDate();
245
- export { k as DocCalendar, O as useNewMeetingNotes };