react-semaphor 0.1.100 → 0.1.102

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.
Files changed (32) hide show
  1. package/dist/chunks/dashboard-controls-B69rp7Eg.js +26 -0
  2. package/dist/chunks/{dashboard-controls-DW1JJWP7.js → dashboard-controls-BcI9OPvx.js} +599 -599
  3. package/dist/chunks/{dashboard-json-C0CKQW3d.js → dashboard-json-BJ1c04y3.js} +1 -1
  4. package/dist/chunks/{dashboard-json-BDAEIUep.js → dashboard-json-DsxHtR1h.js} +1 -1
  5. package/dist/chunks/{edit-dashboard-visual-DQzy1fUR.js → edit-dashboard-visual-C2PPgPSf.js} +30 -21
  6. package/dist/chunks/{edit-dashboard-visual-BtV3RWgf.js → edit-dashboard-visual-CRvSRhC4.js} +31 -31
  7. package/dist/chunks/{editor-action-buttons-CReBF7FV.js → editor-action-buttons-18dPoIIF.js} +1 -1
  8. package/dist/chunks/{editor-action-buttons-BJRrkj_n.js → editor-action-buttons-D74G-fOO.js} +2 -2
  9. package/dist/chunks/{index-BDtdPUUE.js → index-BYjv54tY.js} +160 -160
  10. package/dist/chunks/{index-f2IZ7tlh.js → index-DLEb3N-R.js} +7985 -7967
  11. package/dist/chunks/resource-management-panel-DToljP14.js +11 -0
  12. package/dist/chunks/resource-management-panel-k_ZQIBfh.js +924 -0
  13. package/dist/chunks/{schedule-dashboard-CfeYnMXp.js → schedule-dashboard-fjtSpUVj.js} +4 -4
  14. package/dist/chunks/schedule-dashboard-vZXqGP-q.js +6 -0
  15. package/dist/chunks/use-click-outside-B9T3lmcw.js +1 -0
  16. package/dist/chunks/use-click-outside-CMeO_QFI.js +16 -0
  17. package/dist/chunks/{use-visual-utils-CRA2-3Z2.js → use-visual-utils-Btxew3Er.js} +1 -1
  18. package/dist/chunks/{use-visual-utils-BN4h1-xa.js → use-visual-utils-CMaqO2nT.js} +1 -1
  19. package/dist/dashboard/index.cjs +1 -1
  20. package/dist/dashboard/index.js +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +4 -4
  23. package/dist/style.css +1 -1
  24. package/dist/surfboard/index.cjs +1 -1
  25. package/dist/surfboard/index.js +1 -1
  26. package/package.json +1 -1
  27. package/dist/chunks/dashboard-controls-DKci3my0.js +0 -26
  28. package/dist/chunks/resource-management-panel-BQVERuRi.js +0 -11
  29. package/dist/chunks/resource-management-panel-DNpbhYNu.js +0 -982
  30. package/dist/chunks/schedule-dashboard-D8ctQToc.js +0 -6
  31. package/dist/chunks/use-local-storage-state-CWjTT77L.js +0 -26
  32. package/dist/chunks/use-local-storage-state-DXYWw213.js +0 -1
@@ -1,982 +0,0 @@
1
- import { jsx as e, jsxs as s, Fragment as xe } from "react/jsx-runtime";
2
- import { b as Oe, aM as be, u as K, aa as Je, ak as ve, aN as ke, aO as et, aP as Pe, c as Y, aQ as Ue, aR as Ne, B as O, aS as _, aT as Te, aC as tt, aD as at, aU as st, aF as nt, aG as H, ac as se, aV as rt, aW as Ve, aX as we, aY as it, aZ as ot, a_ as Re, ao as lt, ap as dt, aq as ct, ar as ht, as as ut, at as Le, au as ae, ax as mt, a$ as pt, b0 as ne, b1 as Ie, v as je, R as Me, b2 as ze, b3 as Fe, b4 as Be, b5 as He, b6 as _e, b7 as Qe, b8 as qe, b9 as We, ba as Ge, bb as ft, bc as gt, bd as Nt, aA as te, aj as Dt, be as Ke, bf as xt, bg as bt, bh as vt, bi as wt, bj as yt, bk as Ct, bl as St, bm as Tt, bn as Vt, bo as Lt, I as At, bp as Et, bq as Ot, br as Ae, bs as Ee } from "./index-f2IZ7tlh.js";
3
- import Pt, { useState as m, useEffect as De } from "react";
4
- import { a as Ut } from "./use-visual-utils-CRA2-3Z2.js";
5
- import { u as Rt, a as It } from "./use-local-storage-state-CWjTT77L.js";
6
- /**
7
- * @license lucide-react v0.453.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */
12
- const jt = Oe("FolderOpen", [
13
- [
14
- "path",
15
- {
16
- d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
17
- key: "usdka0"
18
- }
19
- ]
20
- ]);
21
- /**
22
- * @license lucide-react v0.453.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */
27
- const Mt = Oe("PanelLeft", [
28
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
29
- ["path", { d: "M9 3v18", key: "fh3hqa" }]
30
- ]);
31
- function Ye() {
32
- return /* @__PURE__ */ e(be, { className: "w-full flex-1", children: /* @__PURE__ */ s("div", { className: "space-y-4 px-4 py-2", children: [
33
- /* @__PURE__ */ e("div", { className: "h-9 w-full rounded bg-muted animate-pulse" }),
34
- /* @__PURE__ */ e("div", { className: "h-9 w-full rounded bg-muted animate-pulse" }),
35
- /* @__PURE__ */ e("div", { className: "space-y-3 pt-2", children: [...Array(3)].map((t, p) => /* @__PURE__ */ s("div", { className: "flex gap-3 animate-pulse", children: [
36
- /* @__PURE__ */ e("div", { className: "h-8 w-8 rounded bg-muted flex-shrink-0" }),
37
- /* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
38
- /* @__PURE__ */ e("div", { className: "h-4 w-2/3 rounded bg-muted" }),
39
- /* @__PURE__ */ e("div", { className: "h-3 w-4/5 rounded bg-muted" })
40
- ] })
41
- ] }, p)) })
42
- ] }) });
43
- }
44
- const zt = (t) => {
45
- const p = K((r) => r.isVisualEditing), f = K((r) => r.selectedFrameId), d = Je((r) => r.frame);
46
- return !!(p && f && (d == null ? void 0 : d.visualId) === t);
47
- };
48
- function Ft({
49
- visual: t,
50
- isDeleting: p,
51
- isDuplicating: f,
52
- onAddVisual: d,
53
- onOpenVisual: r,
54
- onEditDetails: N,
55
- onDeleteClick: C,
56
- onDuplicateVisual: x,
57
- // onTogglePrivacy,
58
- onShareVisual: S,
59
- formatDate: l
60
- }) {
61
- var P, v, z, j;
62
- const { selectVisual: c } = ve(), T = ke(t.id), D = zt(t.id), { isConsoleMode: V } = et(), i = Pt.useRef(null), [y, A] = m(!1), [w, g] = m(!1);
63
- De(() => {
64
- f ? (A(!0), g(!0)) : w && (A(!1), g(!1));
65
- }, [f, w]), De(() => {
66
- D && i.current && i.current.scrollIntoView({
67
- behavior: "smooth",
68
- block: "center"
69
- });
70
- }, [D]);
71
- const b = () => /* @__PURE__ */ e(Re, { className: "h-4 w-4" }), R = () => {
72
- c(t), r == null || r(t);
73
- };
74
- return /* @__PURE__ */ e(
75
- Pe,
76
- {
77
- ref: i,
78
- className: Y(
79
- "group cursor-pointer border border-border/50 p-3 transition-colors hover:bg-accent/50",
80
- D ? "border-purple-500" : T && "border-primary"
81
- ),
82
- onClick: R,
83
- children: /* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
84
- /* @__PURE__ */ e("div", { className: "mt-0.5 rounded bg-muted p-1.5", children: b() }),
85
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1 flex flex-col", children: [
86
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
87
- /* @__PURE__ */ e(
88
- "p",
89
- {
90
- className: "text-sm font-medium text-foreground truncate",
91
- title: t.title || "Untitled Visual",
92
- children: t.title || "Untitled Visual"
93
- }
94
- ),
95
- t.ownership.status === "shared" && /* @__PURE__ */ s(Ue, { variant: "outline", className: "text-xs", children: [
96
- /* @__PURE__ */ e(Ne, { className: "mr-1 h-2.5 w-2.5" }),
97
- "Shared"
98
- ] })
99
- ] }),
100
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-2", children: [
101
- /* @__PURE__ */ e(
102
- "p",
103
- {
104
- className: "text-xs text-muted-foreground line-clamp-2 flex-1",
105
- title: t.description || "No description",
106
- children: (P = t.description) != null && P.trim() ? t.description : "No description"
107
- }
108
- ),
109
- /* @__PURE__ */ s(
110
- "div",
111
- {
112
- className: Y(
113
- "invisible flex flex-shrink-0 items-center gap-1 transition-opacity duration-150 group-hover:visible",
114
- T && "visible"
115
- ),
116
- onClick: (u) => u.stopPropagation(),
117
- children: [
118
- /* @__PURE__ */ e(
119
- O,
120
- {
121
- size: "sm",
122
- variant: "ghost",
123
- className: "h-6 w-6 p-0",
124
- onClick: (u) => {
125
- u.stopPropagation(), d(t);
126
- },
127
- title: "Add to dashboard",
128
- children: /* @__PURE__ */ e(_, { className: "h-3.5 w-3.5" })
129
- }
130
- ),
131
- t.ownership.isOwner && /* @__PURE__ */ e(
132
- O,
133
- {
134
- size: "sm",
135
- variant: "ghost",
136
- className: "h-6 w-6 p-0",
137
- onClick: (u) => {
138
- u.stopPropagation(), N == null || N(t);
139
- },
140
- title: "Edit details",
141
- children: /* @__PURE__ */ e(Te, { className: "h-3 w-3" })
142
- }
143
- ),
144
- /* @__PURE__ */ s(
145
- tt,
146
- {
147
- modal: !1,
148
- open: y,
149
- onOpenChange: A,
150
- children: [
151
- /* @__PURE__ */ e(at, { asChild: !0, children: /* @__PURE__ */ e(O, { size: "sm", variant: "ghost", className: "h-6 w-6 p-0", children: /* @__PURE__ */ e(st, { className: "h-3 w-3" }) }) }),
152
- /* @__PURE__ */ s(nt, { align: "end", className: "z-[51] w-40", children: [
153
- /* @__PURE__ */ s(
154
- H,
155
- {
156
- onClick: (u) => {
157
- u.stopPropagation(), d(t);
158
- },
159
- children: [
160
- /* @__PURE__ */ e(_, { className: "mr-2 h-3 w-3" }),
161
- "Add"
162
- ]
163
- }
164
- ),
165
- /* @__PURE__ */ s(
166
- H,
167
- {
168
- onClick: (u) => {
169
- u.stopPropagation(), r == null || r(t);
170
- },
171
- children: [
172
- /* @__PURE__ */ e(jt, { className: "mr-2 h-3 w-3" }),
173
- "Open"
174
- ]
175
- }
176
- ),
177
- /* @__PURE__ */ s(
178
- H,
179
- {
180
- onClick: (u) => {
181
- u.preventDefault(), u.stopPropagation(), x(t.id);
182
- },
183
- disabled: f,
184
- children: [
185
- f ? /* @__PURE__ */ e(se, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(rt, { className: "mr-2 h-3 w-3" }),
186
- f ? "Duplicating..." : "Duplicate"
187
- ]
188
- }
189
- ),
190
- t.ownership.isOwner && /* @__PURE__ */ s(xe, { children: [
191
- /* @__PURE__ */ s(
192
- H,
193
- {
194
- onClick: (u) => {
195
- u.stopPropagation(), N == null || N(t);
196
- },
197
- children: [
198
- /* @__PURE__ */ e(Te, { className: "mr-2 h-3 w-3" }),
199
- "Edit details"
200
- ]
201
- }
202
- ),
203
- /* @__PURE__ */ s(
204
- H,
205
- {
206
- onClick: (u) => {
207
- u.stopPropagation(), S(t);
208
- },
209
- children: [
210
- /* @__PURE__ */ e(Ne, { className: "mr-2 h-3 w-3" }),
211
- "Share"
212
- ]
213
- }
214
- ),
215
- /* @__PURE__ */ e(Ve, {}),
216
- /* @__PURE__ */ s(
217
- H,
218
- {
219
- onClick: (u) => {
220
- u.stopPropagation(), C(t);
221
- },
222
- className: "text-destructive",
223
- disabled: p,
224
- children: [
225
- /* @__PURE__ */ e(we, { className: "mr-2 h-3 w-3" }),
226
- p ? "Deleting..." : "Delete"
227
- ]
228
- }
229
- )
230
- ] }),
231
- /* @__PURE__ */ e(Ve, {}),
232
- /* @__PURE__ */ s("div", { className: "space-y-1 px-2 py-2 text-xs text-slate-500 dark:text-slate-400", children: [
233
- (((v = t.ownership.createdBy) == null ? void 0 : v.type) === "tenant" || ((z = t.ownership.createdBy) == null ? void 0 : z.type) === "organization" && V) && /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
234
- /* @__PURE__ */ e(it, { className: "h-3 w-3" }),
235
- /* @__PURE__ */ e("span", { children: ((j = t.ownership.createdBy) == null ? void 0 : j.name) || "Unknown" })
236
- ] }),
237
- /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
238
- /* @__PURE__ */ e(ot, { className: "h-3 w-3" }),
239
- /* @__PURE__ */ e("span", { children: l(t.lastModified) })
240
- ] })
241
- ] })
242
- ] })
243
- ]
244
- }
245
- )
246
- ]
247
- }
248
- )
249
- ] })
250
- ] })
251
- ] })
252
- },
253
- t.id
254
- );
255
- }
256
- function Bt({
257
- open: t,
258
- onOpenChange: p,
259
- onSubmit: f,
260
- isCreating: d
261
- }) {
262
- const [r, N] = m(""), [C, x] = m("");
263
- De(() => {
264
- t || (N(""), x(""));
265
- }, [t]);
266
- const S = () => {
267
- r.trim() && f({ title: r, description: C });
268
- }, l = (c) => {
269
- p(c);
270
- };
271
- return /* @__PURE__ */ e(lt, { open: t, onOpenChange: l, children: /* @__PURE__ */ s(dt, { children: [
272
- /* @__PURE__ */ s(ct, { children: [
273
- /* @__PURE__ */ e(ht, { children: "Create New Visual" }),
274
- /* @__PURE__ */ e(ut, { children: "Add a new visual to your library. You can configure it after creation." })
275
- ] }),
276
- /* @__PURE__ */ s("div", { className: "space-y-4 py-4", children: [
277
- /* @__PURE__ */ s("div", { className: "space-y-2", children: [
278
- /* @__PURE__ */ e(Le, { htmlFor: "title", children: "Visual Title" }),
279
- /* @__PURE__ */ e(
280
- ae,
281
- {
282
- id: "title",
283
- placeholder: "Enter visual title...",
284
- value: r,
285
- onChange: (c) => N(c.target.value),
286
- disabled: d,
287
- onKeyDown: (c) => {
288
- c.key === "Enter" && !c.shiftKey && (c.preventDefault(), S());
289
- }
290
- }
291
- )
292
- ] }),
293
- /* @__PURE__ */ s("div", { className: "space-y-2", children: [
294
- /* @__PURE__ */ e(Le, { htmlFor: "description", children: "Description (optional)" }),
295
- /* @__PURE__ */ e(
296
- ae,
297
- {
298
- id: "description",
299
- placeholder: "Enter visual description...",
300
- value: C,
301
- onChange: (c) => x(c.target.value),
302
- disabled: d
303
- }
304
- )
305
- ] })
306
- ] }),
307
- /* @__PURE__ */ s(mt, { children: [
308
- /* @__PURE__ */ e(
309
- O,
310
- {
311
- variant: "outline",
312
- onClick: () => l(!1),
313
- disabled: d,
314
- children: "Cancel"
315
- }
316
- ),
317
- /* @__PURE__ */ e(
318
- O,
319
- {
320
- onClick: S,
321
- disabled: !r.trim() || d,
322
- children: d ? /* @__PURE__ */ s(xe, { children: [
323
- /* @__PURE__ */ e(se, { className: "mr-2 h-4 w-4 animate-spin" }),
324
- "Creating..."
325
- ] }) : "Create Visual"
326
- }
327
- )
328
- ] })
329
- ] }) });
330
- }
331
- function Ht() {
332
- const [t, p] = m(""), [f, d] = m(!1), [r, N] = m(!1), [C, x] = m(
333
- null
334
- ), [S, l] = m(!1), [c, T] = m(null), [D, V] = m(null), [i, y] = m(
335
- null
336
- ), { selectVisual: A } = ve(), { handleEditLibraryVisual: w, handleAddLibraryVisual: g } = Ut(), {
337
- resources: b,
338
- isLoading: R,
339
- isError: P,
340
- createResource: v,
341
- updateResource: z,
342
- deleteResource: j,
343
- duplicateResource: u,
344
- isCreating: re,
345
- isDeleting: E
346
- } = pt(
347
- () => {
348
- l(!1), T(null);
349
- },
350
- (n) => {
351
- d(!1), n && (A(n), w(n));
352
- }
353
- );
354
- ne();
355
- const X = b.filter(
356
- (n) => {
357
- var L, o;
358
- return ((L = n == null ? void 0 : n.title) == null ? void 0 : L.toLowerCase().includes(t.toLowerCase())) || ((o = n == null ? void 0 : n.description) == null ? void 0 : o.toLowerCase().includes(t.toLowerCase()));
359
- }
360
- ), ie = (n) => new Date(n).toLocaleDateString("en-US", {
361
- month: "short",
362
- day: "numeric",
363
- year: "numeric"
364
- }), oe = (n) => {
365
- v({
366
- title: n.title,
367
- description: n.description,
368
- isPrivate: !1
369
- });
370
- }, Z = (n) => {
371
- T(n), l(!0);
372
- }, le = () => {
373
- c && j(c.id);
374
- }, {
375
- startUpdating: de,
376
- stopUpdating: $,
377
- isUpdating: M
378
- } = Ie(), ce = (n, L, o) => {
379
- var ee;
380
- const B = Object.fromEntries(
381
- Object.entries(L).filter(([, I]) => I !== void 0)
382
- );
383
- if (Object.keys(B).length === 0) {
384
- (ee = o == null ? void 0 : o.onSuccess) == null || ee.call(o);
385
- return;
386
- }
387
- const k = Object.keys(B), G = k.length === 1 ? k[0] : void 0;
388
- de(n, G), z(
389
- {
390
- resourceId: n,
391
- data: B
392
- },
393
- {
394
- onSuccess: () => {
395
- var I;
396
- $(n, G), (I = o == null ? void 0 : o.onSuccess) == null || I.call(o);
397
- },
398
- onError: () => {
399
- var I;
400
- $(n, G), (I = o == null ? void 0 : o.onError) == null || I.call(o);
401
- }
402
- }
403
- );
404
- }, Q = (n) => {
405
- V(n), u(n, {
406
- onSettled: () => V(null)
407
- });
408
- }, q = (n) => {
409
- w(n);
410
- }, W = (n) => {
411
- g(n);
412
- }, J = (n) => {
413
- const L = b.find((o) => o.id === n);
414
- L && z({
415
- resourceId: n,
416
- data: {
417
- isPrivate: !L.isPrivate
418
- }
419
- });
420
- }, he = (n) => {
421
- x(n), N(!0);
422
- }, ue = (n) => {
423
- y(n);
424
- }, me = () => {
425
- y(null);
426
- }, pe = ({
427
- title: n,
428
- description: L
429
- }) => {
430
- if (!i)
431
- return;
432
- const o = {};
433
- n !== i.title && (o.title = n), (i.description || "") !== L && (o.description = L), ce(i.id, o, {
434
- onSuccess: () => {
435
- y(null);
436
- }
437
- });
438
- };
439
- return R ? /* @__PURE__ */ e(Ye, {}) : P ? /* @__PURE__ */ e(be, { className: "w-full flex-1 pr-2", children: /* @__PURE__ */ s("div", { className: "py-8 text-center text-muted-foreground", children: [
440
- /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Failed to load visuals" }),
441
- /* @__PURE__ */ e(
442
- O,
443
- {
444
- variant: "outline",
445
- size: "sm",
446
- className: "mt-2",
447
- onClick: () => window.location.reload(),
448
- children: "Retry"
449
- }
450
- )
451
- ] }) }) : /* @__PURE__ */ s("div", { className: "relative flex h-full flex-1 flex-col gap-4", children: [
452
- b && b.length > 5 && /* @__PURE__ */ e("div", { className: "space-y-2", children: /* @__PURE__ */ e(
453
- ae,
454
- {
455
- id: "search",
456
- placeholder: "Search by title or description...",
457
- value: t,
458
- onChange: (n) => p(n.target.value),
459
- className: "h-9"
460
- }
461
- ) }),
462
- /* @__PURE__ */ e("div", { className: "flex flex-1 flex-col", children: /* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-3 overflow-y-auto", children: X.length === 0 ? /* @__PURE__ */ s("div", { className: "py-8 text-center", children: [
463
- /* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(Re, { className: "mx-auto h-12 w-12 text-muted-foreground/50" }) }),
464
- /* @__PURE__ */ e("h3", { className: "mb-1 font-medium text-foreground", children: t ? "No visuals found" : "No visuals yet" }),
465
- /* @__PURE__ */ e("p", { className: "mb-4 text-sm text-muted-foreground", children: t ? "Try adjusting your search" : "Create your first visual component to get started" }),
466
- !t && /* @__PURE__ */ s(
467
- O,
468
- {
469
- size: "sm",
470
- className: "bg-primary hover:bg-primary/90",
471
- onClick: () => d(!0),
472
- children: [
473
- /* @__PURE__ */ e(_, { className: "mr-2 h-4 w-4" }),
474
- "Create Visual"
475
- ]
476
- }
477
- )
478
- ] }) : X.map((n) => /* @__PURE__ */ e(
479
- Ft,
480
- {
481
- visual: n,
482
- onAddVisual: W,
483
- onOpenVisual: q,
484
- onEditDetails: ue,
485
- onDeleteClick: Z,
486
- onDuplicateVisual: Q,
487
- onTogglePrivacy: J,
488
- onShareVisual: he,
489
- isDeleting: E,
490
- isDuplicating: D === n.id,
491
- formatDate: ie
492
- },
493
- n.id
494
- )) }) }),
495
- r && C && /* @__PURE__ */ e(
496
- je,
497
- {
498
- resource: C,
499
- resourceType: Me.VISUAL,
500
- onClose: () => {
501
- N(!1), x(null);
502
- }
503
- }
504
- ),
505
- i && /* @__PURE__ */ e(
506
- ze,
507
- {
508
- open: !!i,
509
- resourceLabel: "Visual",
510
- initialTitle: i.title || "",
511
- initialDescription: i.description || "",
512
- onClose: me,
513
- onSave: pe,
514
- isSaving: M(i.id)
515
- }
516
- ),
517
- /* @__PURE__ */ e(
518
- Fe,
519
- {
520
- open: S,
521
- onOpenChange: (n) => {
522
- !n && E || (l(n), n || T(null));
523
- },
524
- children: /* @__PURE__ */ s(Be, { children: [
525
- /* @__PURE__ */ s(He, { children: [
526
- /* @__PURE__ */ e(_e, { children: "Delete Visual" }),
527
- /* @__PURE__ */ s(Qe, { children: [
528
- 'Are you sure you want to delete "',
529
- c == null ? void 0 : c.title,
530
- '"? This action cannot be undone.'
531
- ] })
532
- ] }),
533
- /* @__PURE__ */ s(qe, { children: [
534
- /* @__PURE__ */ e(We, { disabled: E, children: "Cancel" }),
535
- /* @__PURE__ */ s(
536
- Ge,
537
- {
538
- onClick: (n) => {
539
- n.preventDefault(), n.stopPropagation(), le();
540
- },
541
- className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
542
- disabled: E,
543
- children: [
544
- E ? /* @__PURE__ */ e(se, { className: "mr-2 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(we, { className: "mr-2 h-3.5 w-3.5" }),
545
- E ? "Deleting..." : "Delete"
546
- ]
547
- }
548
- )
549
- ] })
550
- ] })
551
- }
552
- ),
553
- /* @__PURE__ */ e(
554
- Bt,
555
- {
556
- open: f,
557
- onOpenChange: d,
558
- onSubmit: oe,
559
- isCreating: re
560
- }
561
- ),
562
- /* @__PURE__ */ e(
563
- O,
564
- {
565
- size: "icon",
566
- className: "absolute bottom-2 left-2 h-11 w-11 rounded-full shadow-lg shadow-black/15",
567
- onClick: () => d(!0),
568
- "aria-label": "Create visual",
569
- children: /* @__PURE__ */ e(_, { className: "h-5 w-5" })
570
- }
571
- )
572
- ] });
573
- }
574
- function _t({
575
- dashboard: t,
576
- isDeleting: p,
577
- isDuplicating: f,
578
- onLoadDashboard: d,
579
- onEditDetails: r,
580
- onDeleteClick: N,
581
- onDuplicateDashboard: C,
582
- onShareDashboard: x,
583
- formatDate: S,
584
- onDashboardItemClick: l
585
- }) {
586
- var g, b;
587
- const { selectDashboard: c } = ve(), T = ft(t.id), { userContext: D, isLoading: V } = ne(), i = ((g = D == null ? void 0 : D.permissions) == null ? void 0 : g.canEdit) ?? !1, y = V || !i, A = () => /* @__PURE__ */ e(Nt, { className: "h-4 w-4" }), w = () => {
588
- c(t), d(t.id), l == null || l(t.id);
589
- };
590
- return /* @__PURE__ */ e(
591
- Pe,
592
- {
593
- className: Y(
594
- "group cursor-pointer border border-border/50 p-3 transition-colors hover:bg-accent/50",
595
- T && "border-primary"
596
- ),
597
- onClick: w,
598
- children: /* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
599
- /* @__PURE__ */ e("div", { className: "mt-0.5 rounded bg-muted p-1.5", children: A() }),
600
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1 flex flex-col", children: [
601
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
602
- /* @__PURE__ */ e(
603
- "p",
604
- {
605
- className: "text-sm font-medium text-foreground truncate",
606
- title: t.title || "Untitled Dashboard",
607
- children: t.title || "Untitled Dashboard"
608
- }
609
- ),
610
- t.ownership.status === "shared" && /* @__PURE__ */ s(Ue, { variant: "outline", className: "text-xs", children: [
611
- /* @__PURE__ */ e(Ne, { className: "mr-1 h-2.5 w-2.5" }),
612
- "Shared"
613
- ] })
614
- ] }),
615
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-2", children: [
616
- /* @__PURE__ */ e(
617
- "p",
618
- {
619
- className: "text-xs text-muted-foreground line-clamp-2 flex-1",
620
- title: t.description || "No description",
621
- children: (b = t.description) != null && b.trim() ? t.description : "No description"
622
- }
623
- ),
624
- /* @__PURE__ */ e(
625
- gt,
626
- {
627
- dashboard: t,
628
- isDeleting: p,
629
- isDuplicating: f,
630
- shouldHideActions: y,
631
- onEditDetails: r,
632
- onDeleteClick: N,
633
- onDuplicateDashboard: C,
634
- onShareDashboard: x,
635
- formatDate: S
636
- }
637
- )
638
- ] })
639
- ] })
640
- ] })
641
- },
642
- t.id
643
- );
644
- }
645
- function Qt({ onRetry: t }) {
646
- return /* @__PURE__ */ e(be, { className: "w-full flex-1 pr-2", children: /* @__PURE__ */ s("div", { className: "py-8 text-center text-muted-foreground", children: [
647
- /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Failed to load dashboards" }),
648
- /* @__PURE__ */ e(O, { variant: "outline", size: "sm", className: "mt-2", onClick: t, children: "Retry" })
649
- ] }) });
650
- }
651
- function qt(t) {
652
- var ye;
653
- const { onLoadDashboard: p, onEditDashboard: f, onDashboardItemClick: d } = t, [r, N] = m(""), [C, x] = m(!1), [S, l] = m(!1), [c, T] = m(
654
- null
655
- ), [D, V] = m(!1), [i, y] = m(null), [A, w] = m(null), [g, b] = m(null), R = te(
656
- (a) => a.lastSelectedDashboard
657
- ), P = te(
658
- (a) => a.selectedDashboard
659
- ), v = te(
660
- (a) => a.actions.selectDashboard
661
- ), z = te(
662
- (a) => a.actions.clearSelectedDashboard
663
- ), { tokenProps: j, id: u } = Dt();
664
- Ke();
665
- const { onCreateSuccess: re } = xt({
666
- onDashboardSelect: d
667
- }), {
668
- resources: E,
669
- isLoading: X,
670
- isError: ie,
671
- createResource: oe,
672
- updateResource: Z,
673
- deleteResource: le,
674
- duplicateResource: de,
675
- isCreating: $,
676
- isDeleting: M,
677
- refetch: ce
678
- } = bt(
679
- () => {
680
- V(!1);
681
- const a = i == null ? void 0 : i.id;
682
- y(null), (P == null ? void 0 : P.id) === a && (!(j != null && j.dashboard_id) && !u ? z() : R && R.id !== a && v(R));
683
- },
684
- (a) => {
685
- x(!1), re(a, ce);
686
- }
687
- ), { currentUser: Q, userContext: q } = ne(), W = ((ye = q == null ? void 0 : q.permissions) == null ? void 0 : ye.canCreateDashboard) ?? !1, J = E.filter(
688
- (a) => {
689
- var U, h;
690
- return ((U = a == null ? void 0 : a.title) == null ? void 0 : U.toLowerCase().includes(r.toLowerCase())) || ((h = a == null ? void 0 : a.description) == null ? void 0 : h.toLowerCase().includes(r.toLowerCase()));
691
- }
692
- ), he = (a) => new Date(a).toLocaleDateString("en-US", {
693
- month: "short",
694
- day: "numeric",
695
- year: "numeric"
696
- }), ue = (a) => {
697
- oe({
698
- title: a.title,
699
- description: a.description,
700
- isPrivate: !1
701
- });
702
- }, me = (a) => {
703
- p == null || p(a);
704
- }, pe = (a) => {
705
- y(a), V(!0);
706
- }, n = () => {
707
- i && le(i.id);
708
- }, L = (a) => {
709
- w(a), de(a, {
710
- onSettled: () => w(null)
711
- });
712
- }, {
713
- startUpdating: o,
714
- stopUpdating: B,
715
- isUpdating: k
716
- } = Ie(), G = (a, U, h) => {
717
- var Se;
718
- const fe = Object.fromEntries(
719
- Object.entries(U).filter(([, F]) => F !== void 0)
720
- );
721
- if (Object.keys(fe).length === 0) {
722
- (Se = h == null ? void 0 : h.onSuccess) == null || Se.call(h);
723
- return;
724
- }
725
- const Ce = Object.keys(fe), ge = Ce.length === 1 ? Ce[0] : void 0;
726
- o(a, ge), Z(
727
- {
728
- resourceId: a,
729
- data: fe
730
- },
731
- {
732
- onSuccess: () => {
733
- var F;
734
- B(a, ge), (F = h == null ? void 0 : h.onSuccess) == null || F.call(h);
735
- },
736
- onError: () => {
737
- var F;
738
- B(a, ge), (F = h == null ? void 0 : h.onError) == null || F.call(h);
739
- }
740
- }
741
- );
742
- }, ee = (a) => {
743
- const U = E.find(
744
- (h) => h.id === a
745
- );
746
- U && Z({
747
- resourceId: a,
748
- data: {
749
- isPrivate: !U.isPrivate
750
- }
751
- });
752
- }, I = (a) => {
753
- T(a), Q == null || Q.type, l(!0);
754
- }, Xe = (a) => {
755
- f == null || f(a.id), b(a);
756
- }, Ze = () => {
757
- b(null);
758
- }, $e = ({
759
- title: a,
760
- description: U
761
- }) => {
762
- if (!g)
763
- return;
764
- const h = {};
765
- a !== g.title && (h.title = a), (g.description || "") !== U && (h.description = U), G(g.id, h, {
766
- onSuccess: () => {
767
- b(null);
768
- }
769
- });
770
- };
771
- return X ? /* @__PURE__ */ e(Ye, {}) : ie ? /* @__PURE__ */ e(Qt, { onRetry: () => window.location.reload() }) : /* @__PURE__ */ s("div", { className: "relative flex h-full flex-1 flex-col gap-4", children: [
772
- E && E.length > 5 && /* @__PURE__ */ e("div", { className: "space-y-2", children: /* @__PURE__ */ e(
773
- ae,
774
- {
775
- id: "search",
776
- placeholder: "Search by title or description...",
777
- value: r,
778
- onChange: (a) => N(a.target.value),
779
- className: "h-9"
780
- }
781
- ) }),
782
- /* @__PURE__ */ e("div", { className: "flex flex-1 flex-col", children: /* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-3 overflow-y-auto", children: J.length === 0 ? /* @__PURE__ */ s("div", { className: "py-8 text-center", children: [
783
- /* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(vt, { className: "mx-auto h-12 w-12 text-muted-foreground/50" }) }),
784
- /* @__PURE__ */ e("h3", { className: "mb-1 font-medium text-foreground", children: r ? "No dashboards found" : "No dashboards yet" }),
785
- /* @__PURE__ */ e("p", { className: "mb-4 text-sm text-muted-foreground", children: r ? "Try adjusting your search" : W ? "Create your first dashboard to get started" : "No dashboards have been shared with you yet" }),
786
- W && !r && /* @__PURE__ */ s(
787
- O,
788
- {
789
- size: "sm",
790
- className: "bg-primary hover:bg-primary/90",
791
- onClick: () => x(!0),
792
- children: [
793
- /* @__PURE__ */ e(_, { className: "mr-2 h-4 w-4" }),
794
- "Create Dashboard"
795
- ]
796
- }
797
- )
798
- ] }) : J.map((a) => /* @__PURE__ */ e(
799
- _t,
800
- {
801
- dashboard: a,
802
- isDeleting: M,
803
- isDuplicating: A === a.id,
804
- onLoadDashboard: me,
805
- onEditDetails: Xe,
806
- onDeleteClick: pe,
807
- onDuplicateDashboard: L,
808
- onTogglePrivacy: ee,
809
- onShareDashboard: I,
810
- formatDate: he,
811
- onDashboardItemClick: d
812
- },
813
- a.id
814
- )) }) }),
815
- S && c && /* @__PURE__ */ e(
816
- je,
817
- {
818
- resource: c,
819
- resourceType: Me.DASHBOARD,
820
- onClose: () => {
821
- l(!1), T(null);
822
- }
823
- }
824
- ),
825
- /* @__PURE__ */ e(
826
- Fe,
827
- {
828
- open: D,
829
- onOpenChange: (a) => {
830
- !a && M || (V(a), a || y(null));
831
- },
832
- children: /* @__PURE__ */ s(Be, { children: [
833
- /* @__PURE__ */ s(He, { children: [
834
- /* @__PURE__ */ e(_e, { children: "Delete Dashboard" }),
835
- /* @__PURE__ */ s(Qe, { children: [
836
- 'Are you sure you want to delete "',
837
- i == null ? void 0 : i.title,
838
- '"? This action cannot be undone.'
839
- ] })
840
- ] }),
841
- /* @__PURE__ */ s(qe, { children: [
842
- /* @__PURE__ */ e(We, { disabled: M, children: "Cancel" }),
843
- /* @__PURE__ */ s(
844
- Ge,
845
- {
846
- onClick: (a) => {
847
- a.preventDefault(), a.stopPropagation(), n();
848
- },
849
- className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
850
- disabled: M,
851
- children: [
852
- M ? /* @__PURE__ */ e(se, { className: "mr-2 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(we, { className: "mr-2 h-3.5 w-3.5" }),
853
- M ? "Deleting..." : "Delete"
854
- ]
855
- }
856
- )
857
- ] })
858
- ] })
859
- }
860
- ),
861
- g && /* @__PURE__ */ e(
862
- ze,
863
- {
864
- open: !!g,
865
- resourceLabel: "Dashboard",
866
- initialTitle: g.title || "",
867
- initialDescription: g.description || "",
868
- onClose: Ze,
869
- onSave: $e,
870
- isSaving: k(g.id)
871
- }
872
- ),
873
- /* @__PURE__ */ e(
874
- wt,
875
- {
876
- open: C,
877
- onOpenChange: x,
878
- onSubmit: ue,
879
- isCreating: $
880
- }
881
- ),
882
- W && /* @__PURE__ */ e(
883
- O,
884
- {
885
- size: "icon",
886
- className: "absolute bottom-2 left-2 h-11 w-11 rounded-full shadow-lg shadow-black/15",
887
- onClick: () => x(!0),
888
- "aria-label": "Create dashboard",
889
- children: /* @__PURE__ */ e(_, { className: "h-5 w-5" })
890
- }
891
- )
892
- ] });
893
- }
894
- function Zt({
895
- isOpen: t,
896
- onClose: p,
897
- className: f,
898
- onDashboardItemClick: d,
899
- variant: r = "inline"
900
- }) {
901
- K((v) => v.dashboard);
902
- const N = K((v) => v.isDashboardEditing), { setDashboard: C, addSheet: x } = K(
903
- (v) => v.actions
904
- ), {
905
- currentUser: S
906
- } = ne(), l = S, { permissions: c } = Ke(), D = yt() && c.canAccessVisuals && N, V = "dashboards", [i, y] = Rt(
907
- "resource-management-active-tab",
908
- V
909
- ), A = D ? i : "dashboards", w = r === "overlay", g = It(p, {
910
- enabled: t && w
911
- }), b = Y(
912
- "flex h-full flex-col border-r bg-background",
913
- w ? Y(
914
- "absolute inset-y-0 left-0 z-[51] w-96 shadow-lg transition-transform duration-300 ease-in-out",
915
- t ? "translate-x-0" : "pointer-events-none -translate-x-full"
916
- ) : "w-full max-w-[28rem] min-w-[18rem] overflow-hidden shadow-sm",
917
- f
918
- ), R = (v) => {
919
- }, P = (v) => {
920
- console.log("Editing dashboard:", v);
921
- };
922
- return /* @__PURE__ */ e(Ct, { children: (!w || t) && /* @__PURE__ */ s("div", { ref: g, className: b, children: [
923
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between border-b border-border p-4", children: [
924
- /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: l && /* @__PURE__ */ s(xe, { children: [
925
- /* @__PURE__ */ s(St, { children: [
926
- /* @__PURE__ */ e(Tt, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "flex h-8 w-8 cursor-default items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ e("span", { className: "text-sm font-medium text-primary", children: l.name.charAt(0).toUpperCase() }) }) }),
927
- /* @__PURE__ */ e(Vt, { side: "bottom", className: "ml-2 max-w-xs", children: /* @__PURE__ */ s("div", { className: "space-y-1", children: [
928
- /* @__PURE__ */ e("div", { className: "font-medium", children: l.name }),
929
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: l.email }),
930
- l.role && /* @__PURE__ */ s("div", { className: "text-xs text-muted-foreground", children: [
931
- "Role:",
932
- " ",
933
- Lt(
934
- l.role.replace(/_/g, " ")
935
- )
936
- ] }),
937
- /* @__PURE__ */ s("div", { className: "text-xs text-muted-foreground", children: [
938
- "ID: ",
939
- l.id
940
- ] })
941
- ] }) })
942
- ] }),
943
- /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e("span", { className: "text-sm font-medium text-foreground", children: l.name }) })
944
- ] }) }),
945
- /* @__PURE__ */ e(
946
- At,
947
- {
948
- className: "h-8 w-8 p-0 text-muted-foreground hover:text-foreground",
949
- onClick: p,
950
- tooltip: "Close Sidebar",
951
- children: /* @__PURE__ */ e(Mt, { className: "h-4 w-4" })
952
- }
953
- )
954
- ] }),
955
- /* @__PURE__ */ e("div", { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ s(
956
- Et,
957
- {
958
- value: A,
959
- onValueChange: D ? y : void 0,
960
- className: "flex h-9 grow flex-col",
961
- children: [
962
- D && /* @__PURE__ */ e("div", { className: "px-4 pt-4", children: /* @__PURE__ */ s(Ot, { className: "grid w-full grid-cols-2", children: [
963
- /* @__PURE__ */ e(Ae, { value: "dashboards", className: "text-sm", children: "Dashboards" }),
964
- /* @__PURE__ */ e(Ae, { value: "visuals", className: "text-sm", children: "Visuals" })
965
- ] }) }),
966
- /* @__PURE__ */ e(Ee, { value: "dashboards", className: "flex-1 px-4 py-4", children: /* @__PURE__ */ e(
967
- qt,
968
- {
969
- onLoadDashboard: R,
970
- onEditDashboard: P,
971
- onDashboardItemClick: d
972
- }
973
- ) }),
974
- D && /* @__PURE__ */ e(Ee, { value: "visuals", className: "flex-1 px-4 py-4", children: /* @__PURE__ */ e(Ht, {}) })
975
- ]
976
- }
977
- ) })
978
- ] }) });
979
- }
980
- export {
981
- Zt as ResourceManagementPanel
982
- };