react-semaphor 0.1.228 → 0.1.230
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/dist/chunks/dashboard-controls-CIGGC81u.js +47 -0
- package/dist/chunks/dashboard-controls-uZZf2_Ms.js +1837 -0
- package/dist/chunks/{dashboard-json-CIXKhNAd.js → dashboard-json-BPOoq2o2.js} +1 -1
- package/dist/chunks/{dashboard-json-BIuKyo5Q.js → dashboard-json-BSpSg-pF.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-BN1SlS2f.js → dashboard-summary-settings-dialog-BBOnX1vh.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-eHzsX-Qu.js → dashboard-summary-settings-dialog-Dd-wAZsI.js} +23 -23
- package/dist/chunks/{edit-dashboard-visual-q2sqCojJ.js → edit-dashboard-visual-CmKLavr8.js} +2115 -2091
- package/dist/chunks/{edit-dashboard-visual-DYgod5dM.js → edit-dashboard-visual-D0myN7lC.js} +18 -18
- package/dist/chunks/{editor-action-buttons-C7BPnMbF.js → editor-action-buttons-DicV0M4e.js} +1 -1
- package/dist/chunks/{editor-action-buttons-iNXXLdep.js → editor-action-buttons-ujerALSP.js} +42 -42
- package/dist/chunks/{index-DAK3Chqv.js → index-BKtY-D8Y.js} +161 -161
- package/dist/chunks/{index-CCPiaTlA.js → index-SLQXKi01.js} +5658 -5645
- package/dist/chunks/{notification-bell-C1ds6KBh.js → notification-bell-BlKABlIE.js} +1 -1
- package/dist/chunks/{notification-bell-jUNpjlLi.js → notification-bell-D83sUTTI.js} +60 -60
- package/dist/chunks/resource-management-panel-CJXZMjqO.js +920 -0
- package/dist/chunks/resource-management-panel-TqjX5FH0.js +6 -0
- package/dist/chunks/{use-visual-utils-D-Z7L3fG.js → use-visual-utils-CjUf9Xns.js} +1 -1
- package/dist/chunks/{use-visual-utils-CmNSBat8.js → use-visual-utils-DNfxkGiH.js} +33 -33
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +44 -44
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-DBYFd2CJ.js +0 -1764
- package/dist/chunks/dashboard-controls-nOlG4ZgU.js +0 -47
- package/dist/chunks/resource-management-panel-0zLiCZGO.js +0 -913
- package/dist/chunks/resource-management-panel-8lnUNPf1.js +0 -6
- package/dist/chunks/use-role-aware-display-preferences-CPLw3mxL.js +0 -1
- package/dist/chunks/use-role-aware-display-preferences-qy2jrDtd.js +0 -29
|
@@ -0,0 +1,920 @@
|
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as le } from "react/jsx-runtime";
|
|
2
|
+
import { bK as Pe, u as re, U as je, K as ce, bZ as Fe, b_ as ze, c as J, B as P, b$ as ie, c0 as Be, c1 as He, c2 as Ke, c3 as _e, c4 as Z, w as oe, c5 as $e, c6 as qe, c7 as Ge, c8 as ge, c9 as ue, ca as We, cb as Ye, cc as xe, cd as De, ce as we, cf as Ze, af as Ne, ab as ve, cg as ye, ch as Ce, ci as Se, cj as Ee, ck as Ve, cl as Le, cm as Ae, cn as Oe, co as Re, cp as Je, cq as he, cr as Qe, a9 as te, b as Xe, cs as Te, ct as ke, e as et, f as tt, g as rt, h as nt, i as ot, L as be, cu as de, v as st, cv as at, cw as it, cx as dt, bR as lt, bS as ct, bT as ut, bV as ht, cy as mt, cz as pt } from "./index-SLQXKi01.js";
|
|
3
|
+
import ft, { useRef as gt, useEffect as ne, useState as x } from "react";
|
|
4
|
+
import { a as Ue } from "./use-visual-utils-DNfxkGiH.js";
|
|
5
|
+
/**
|
|
6
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the ISC license.
|
|
9
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/
|
|
11
|
+
const bt = Pe("FolderOpen", [
|
|
12
|
+
[
|
|
13
|
+
"path",
|
|
14
|
+
{
|
|
15
|
+
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",
|
|
16
|
+
key: "usdka0"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
]);
|
|
20
|
+
function xt(t, f = {}) {
|
|
21
|
+
const { enabled: p = !0, eventType: d = "mousedown" } = f, a = gt(null);
|
|
22
|
+
return ne(() => {
|
|
23
|
+
const h = (D) => {
|
|
24
|
+
const s = D.target;
|
|
25
|
+
a.current && a.current.contains(s) || s instanceof Element && (s.closest("[data-radix-popper-content-wrapper]") || s.closest("[data-radix-select-content]") || s.closest("[data-radix-popover-content]") || s.closest("[data-radix-dropdown-menu-content]") || s.closest("[data-radix-tooltip-content]") || s.closest('[role="listbox"]') || s.closest('[role="option"]') || s.closest('[role="combobox"]')) || s instanceof Element && s.hasAttribute("data-radix-") || t();
|
|
26
|
+
};
|
|
27
|
+
return p && document.addEventListener(d, h), () => {
|
|
28
|
+
document.removeEventListener(d, h);
|
|
29
|
+
};
|
|
30
|
+
}, [t, p, d]), a;
|
|
31
|
+
}
|
|
32
|
+
function Ie() {
|
|
33
|
+
return /* @__PURE__ */ e("div", { className: "space-y-1.5 py-1", children: [...Array(5)].map((t, f) => /* @__PURE__ */ r(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: "flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ e("div", { className: "mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60" }),
|
|
39
|
+
/* @__PURE__ */ r("div", { className: "flex-1 space-y-1.5", children: [
|
|
40
|
+
/* @__PURE__ */ e("div", { className: "h-4 w-3/5 rounded bg-muted/60" }),
|
|
41
|
+
/* @__PURE__ */ e("div", { className: "h-3 w-4/5 rounded bg-muted/40" })
|
|
42
|
+
] })
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
f
|
|
46
|
+
)) });
|
|
47
|
+
}
|
|
48
|
+
const Dt = (t) => {
|
|
49
|
+
const f = re((a) => a.isVisualEditing), p = re((a) => a.selectedFrameId), d = je((a) => a.frame);
|
|
50
|
+
return !!(f && p && (d == null ? void 0 : d.visualId) === t);
|
|
51
|
+
};
|
|
52
|
+
function wt({
|
|
53
|
+
visual: t,
|
|
54
|
+
isDeleting: f,
|
|
55
|
+
isDuplicating: p,
|
|
56
|
+
onAddVisual: d,
|
|
57
|
+
onOpenVisual: a,
|
|
58
|
+
onEditDetails: h,
|
|
59
|
+
onDeleteClick: D,
|
|
60
|
+
onDuplicateVisual: s,
|
|
61
|
+
onShareVisual: w,
|
|
62
|
+
formatDate: v
|
|
63
|
+
}) {
|
|
64
|
+
var I, U, j, F;
|
|
65
|
+
const { selectVisual: m } = ce(), c = Fe(t.id), u = Dt(t.id), A = re((i) => i.isVisualEditing), { isConsoleMode: T } = ze(), b = ft.useRef(null), [S, E] = x(!1), [V, O] = x(!1);
|
|
66
|
+
ne(() => {
|
|
67
|
+
p ? (E(!0), O(!0)) : V && (E(!1), O(!1));
|
|
68
|
+
}, [p, V]), ne(() => {
|
|
69
|
+
u && b.current && b.current.scrollIntoView({
|
|
70
|
+
behavior: "smooth",
|
|
71
|
+
block: "center"
|
|
72
|
+
});
|
|
73
|
+
}, [u]);
|
|
74
|
+
const y = () => {
|
|
75
|
+
m(t), a == null || a(t);
|
|
76
|
+
}, C = (i) => {
|
|
77
|
+
i.currentTarget === i.target && (i.key === "Enter" || i.key === " ") && (i.preventDefault(), y());
|
|
78
|
+
};
|
|
79
|
+
return /* @__PURE__ */ r(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
ref: b,
|
|
83
|
+
className: J(
|
|
84
|
+
"group flex cursor-pointer items-start gap-2 rounded-xl border border-transparent px-2.5 py-2.5 transition-[background-color,border-color,box-shadow] hover:border-border/50 hover:bg-muted/35 focus-within:ring-2 focus-within:ring-inset focus-within:ring-ring/40",
|
|
85
|
+
u ? "border-primary/30 bg-primary/10" : c && "border-border/60 bg-muted/50"
|
|
86
|
+
),
|
|
87
|
+
onClick: y,
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ r(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
role: "button",
|
|
93
|
+
tabIndex: 0,
|
|
94
|
+
className: "min-w-0 flex-1 cursor-pointer focus-visible:outline-none",
|
|
95
|
+
onKeyDown: C,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ e(
|
|
98
|
+
"p",
|
|
99
|
+
{
|
|
100
|
+
className: "truncate text-sm font-medium text-foreground",
|
|
101
|
+
title: t.title || "Untitled Visual",
|
|
102
|
+
children: t.title || "Untitled Visual"
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ e(
|
|
106
|
+
"p",
|
|
107
|
+
{
|
|
108
|
+
className: "truncate text-xs text-muted-foreground",
|
|
109
|
+
title: t.description || "No description",
|
|
110
|
+
children: (I = t.description) != null && I.trim() ? t.description : "No description"
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ e(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
className: J(
|
|
120
|
+
"flex flex-shrink-0 items-center gap-1 transition-opacity",
|
|
121
|
+
c || u || S ? "pointer-events-auto opacity-100" : "pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100"
|
|
122
|
+
),
|
|
123
|
+
onClick: (i) => i.stopPropagation(),
|
|
124
|
+
children: /* @__PURE__ */ r("div", { className: "inline-flex items-center overflow-hidden rounded-lg border border-border/60 bg-background/95 shadow-sm", children: [
|
|
125
|
+
/* @__PURE__ */ r(
|
|
126
|
+
P,
|
|
127
|
+
{
|
|
128
|
+
size: "sm",
|
|
129
|
+
variant: "ghost",
|
|
130
|
+
className: "h-7 gap-1 rounded-none border-0 px-2 text-xs font-medium shadow-none hover:bg-muted/50",
|
|
131
|
+
disabled: A,
|
|
132
|
+
onClick: (i) => {
|
|
133
|
+
i.stopPropagation(), d(t);
|
|
134
|
+
},
|
|
135
|
+
"aria-label": `Add ${t.title || "visual"}`,
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ e(ie, { className: "h-3.5 w-3.5" }),
|
|
138
|
+
"Add"
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ r(
|
|
143
|
+
Be,
|
|
144
|
+
{
|
|
145
|
+
modal: !1,
|
|
146
|
+
open: S,
|
|
147
|
+
onOpenChange: E,
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ e(He, { asChild: !0, children: /* @__PURE__ */ e(
|
|
150
|
+
P,
|
|
151
|
+
{
|
|
152
|
+
size: "sm",
|
|
153
|
+
variant: "ghost",
|
|
154
|
+
className: "h-7 w-7 rounded-none border-0 border-l border-border/60 p-0 shadow-none hover:bg-muted/50",
|
|
155
|
+
"aria-label": "Open visual actions",
|
|
156
|
+
children: /* @__PURE__ */ e(Ke, { className: "h-3 w-3" })
|
|
157
|
+
}
|
|
158
|
+
) }),
|
|
159
|
+
/* @__PURE__ */ r(
|
|
160
|
+
_e,
|
|
161
|
+
{
|
|
162
|
+
align: "end",
|
|
163
|
+
className: "z-[51] w-44 rounded-xl border border-border/60 p-1 shadow-sm",
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ r(
|
|
166
|
+
Z,
|
|
167
|
+
{
|
|
168
|
+
onClick: (i) => {
|
|
169
|
+
i.stopPropagation(), d(t);
|
|
170
|
+
},
|
|
171
|
+
disabled: A,
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ e(ie, { className: "mr-2 h-3 w-3" }),
|
|
174
|
+
"Add"
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
/* @__PURE__ */ r(
|
|
179
|
+
Z,
|
|
180
|
+
{
|
|
181
|
+
onClick: (i) => {
|
|
182
|
+
i.stopPropagation(), a == null || a(t);
|
|
183
|
+
},
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ e(bt, { className: "mr-2 h-3 w-3" }),
|
|
186
|
+
"Open"
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ r(
|
|
191
|
+
Z,
|
|
192
|
+
{
|
|
193
|
+
onClick: (i) => {
|
|
194
|
+
i.preventDefault(), i.stopPropagation(), s(t.id);
|
|
195
|
+
},
|
|
196
|
+
disabled: p,
|
|
197
|
+
children: [
|
|
198
|
+
p ? /* @__PURE__ */ e(oe, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ e($e, { className: "mr-2 h-3 w-3" }),
|
|
199
|
+
p ? "Duplicating..." : "Duplicate"
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
t.ownership.isOwner && /* @__PURE__ */ r(le, { children: [
|
|
204
|
+
/* @__PURE__ */ r(
|
|
205
|
+
Z,
|
|
206
|
+
{
|
|
207
|
+
onClick: (i) => {
|
|
208
|
+
i.stopPropagation(), h == null || h(t);
|
|
209
|
+
},
|
|
210
|
+
children: [
|
|
211
|
+
/* @__PURE__ */ e(qe, { className: "mr-2 h-3 w-3" }),
|
|
212
|
+
"Edit details"
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
/* @__PURE__ */ r(
|
|
217
|
+
Z,
|
|
218
|
+
{
|
|
219
|
+
onClick: (i) => {
|
|
220
|
+
i.stopPropagation(), w(t);
|
|
221
|
+
},
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ e(Ge, { className: "mr-2 h-3 w-3" }),
|
|
224
|
+
"Share"
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
),
|
|
228
|
+
/* @__PURE__ */ e(ge, {}),
|
|
229
|
+
/* @__PURE__ */ r(
|
|
230
|
+
Z,
|
|
231
|
+
{
|
|
232
|
+
onClick: (i) => {
|
|
233
|
+
i.stopPropagation(), D(t);
|
|
234
|
+
},
|
|
235
|
+
className: "text-destructive",
|
|
236
|
+
disabled: f,
|
|
237
|
+
children: [
|
|
238
|
+
/* @__PURE__ */ e(ue, { className: "mr-2 h-3 w-3" }),
|
|
239
|
+
f ? "Deleting..." : "Delete"
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
)
|
|
243
|
+
] }),
|
|
244
|
+
/* @__PURE__ */ e(ge, {}),
|
|
245
|
+
/* @__PURE__ */ r("div", { className: "space-y-1 px-2 py-2 text-xs text-muted-foreground", children: [
|
|
246
|
+
(((U = t.ownership.createdBy) == null ? void 0 : U.type) === "tenant" || ((j = t.ownership.createdBy) == null ? void 0 : j.type) === "organization" && T) && /* @__PURE__ */ r("div", { className: "flex items-center gap-1", children: [
|
|
247
|
+
/* @__PURE__ */ e(We, { className: "h-3 w-3" }),
|
|
248
|
+
/* @__PURE__ */ e("span", { children: ((F = t.ownership.createdBy) == null ? void 0 : F.name) || "Unknown" })
|
|
249
|
+
] }),
|
|
250
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-1", children: [
|
|
251
|
+
/* @__PURE__ */ e(Ye, { className: "h-3 w-3" }),
|
|
252
|
+
/* @__PURE__ */ e("span", { children: v(t.lastModified) })
|
|
253
|
+
] })
|
|
254
|
+
] })
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
] })
|
|
262
|
+
}
|
|
263
|
+
)
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
function Nt({ searchQuery: t }) {
|
|
269
|
+
const [f, p] = x(!1), [d, a] = x(
|
|
270
|
+
null
|
|
271
|
+
), [h, D] = x(!1), [s, w] = x(null), [v, m] = x(null), [c, u] = x(
|
|
272
|
+
null
|
|
273
|
+
), { handleEditLibraryVisual: A, handleAddLibraryVisual: T } = Ue(), {
|
|
274
|
+
resources: b,
|
|
275
|
+
isLoading: S,
|
|
276
|
+
isError: E,
|
|
277
|
+
updateResource: V,
|
|
278
|
+
deleteResource: O,
|
|
279
|
+
duplicateResource: y,
|
|
280
|
+
isDeleting: C
|
|
281
|
+
} = xe(() => {
|
|
282
|
+
D(!1), w(null);
|
|
283
|
+
}), I = b.filter(
|
|
284
|
+
(o) => {
|
|
285
|
+
var R, l;
|
|
286
|
+
return ((R = o == null ? void 0 : o.title) == null ? void 0 : R.toLowerCase().includes(t.toLowerCase())) || ((l = o == null ? void 0 : o.description) == null ? void 0 : l.toLowerCase().includes(t.toLowerCase()));
|
|
287
|
+
}
|
|
288
|
+
), U = (o) => new Date(o).toLocaleDateString("en-US", {
|
|
289
|
+
month: "short",
|
|
290
|
+
day: "numeric",
|
|
291
|
+
year: "numeric"
|
|
292
|
+
}), j = (o) => {
|
|
293
|
+
w(o), D(!0);
|
|
294
|
+
}, F = () => {
|
|
295
|
+
s && O(s.id);
|
|
296
|
+
}, {
|
|
297
|
+
startUpdating: i,
|
|
298
|
+
stopUpdating: q,
|
|
299
|
+
isUpdating: B
|
|
300
|
+
} = De(), L = (o, R, l) => {
|
|
301
|
+
var ee;
|
|
302
|
+
const z = Object.fromEntries(
|
|
303
|
+
Object.entries(R).filter(([, M]) => M !== void 0)
|
|
304
|
+
);
|
|
305
|
+
if (Object.keys(z).length === 0) {
|
|
306
|
+
(ee = l == null ? void 0 : l.onSuccess) == null || ee.call(l);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const N = Object.keys(z), K = N.length === 1 ? N[0] : void 0;
|
|
310
|
+
i(o, K), V(
|
|
311
|
+
{
|
|
312
|
+
resourceId: o,
|
|
313
|
+
data: z
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
onSuccess: () => {
|
|
317
|
+
var M;
|
|
318
|
+
q(o, K), (M = l == null ? void 0 : l.onSuccess) == null || M.call(l);
|
|
319
|
+
},
|
|
320
|
+
onError: () => {
|
|
321
|
+
var M;
|
|
322
|
+
q(o, K), (M = l == null ? void 0 : l.onError) == null || M.call(l);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
}, G = (o) => {
|
|
327
|
+
m(o), y(o, {
|
|
328
|
+
onSettled: () => m(null)
|
|
329
|
+
});
|
|
330
|
+
}, H = (o) => {
|
|
331
|
+
A(o);
|
|
332
|
+
}, W = (o) => {
|
|
333
|
+
T(o);
|
|
334
|
+
}, Y = (o) => {
|
|
335
|
+
a(o), p(!0);
|
|
336
|
+
}, Q = (o) => {
|
|
337
|
+
u(o);
|
|
338
|
+
}, X = () => {
|
|
339
|
+
u(null);
|
|
340
|
+
}, k = ({
|
|
341
|
+
title: o,
|
|
342
|
+
description: R
|
|
343
|
+
}) => {
|
|
344
|
+
if (!c)
|
|
345
|
+
return;
|
|
346
|
+
const l = {};
|
|
347
|
+
o !== c.title && (l.title = o), (c.description || "") !== R && (l.description = R), L(c.id, l, {
|
|
348
|
+
onSuccess: () => {
|
|
349
|
+
u(null);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
return S ? /* @__PURE__ */ e(Ie, {}) : E ? /* @__PURE__ */ e(we, { className: "w-full flex-1 pr-2", children: /* @__PURE__ */ r("div", { className: "rounded-xl border border-dashed border-border/60 bg-muted/20 px-4 py-8 text-center text-muted-foreground", children: [
|
|
354
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Failed to load visuals" }),
|
|
355
|
+
/* @__PURE__ */ e(
|
|
356
|
+
P,
|
|
357
|
+
{
|
|
358
|
+
variant: "outline",
|
|
359
|
+
size: "sm",
|
|
360
|
+
className: "mt-2",
|
|
361
|
+
onClick: () => window.location.reload(),
|
|
362
|
+
children: "Retry"
|
|
363
|
+
}
|
|
364
|
+
)
|
|
365
|
+
] }) }) : /* @__PURE__ */ r("div", { className: "flex h-full flex-1 flex-col", children: [
|
|
366
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-1.5 overflow-y-auto px-0.5", children: I.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-xl border border-dashed border-border/60 bg-muted/20 px-4 py-8 text-center", children: [
|
|
367
|
+
/* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(Ze, { className: "mx-auto h-12 w-12 text-muted-foreground/50" }) }),
|
|
368
|
+
/* @__PURE__ */ e("h3", { className: "mb-1 font-medium text-foreground", children: t ? "No visuals found" : "No visuals yet" }),
|
|
369
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t ? "Try adjusting your search" : 'Click "New" above to add your first visual' })
|
|
370
|
+
] }) : I.map((o) => /* @__PURE__ */ e(
|
|
371
|
+
wt,
|
|
372
|
+
{
|
|
373
|
+
visual: o,
|
|
374
|
+
onAddVisual: W,
|
|
375
|
+
onOpenVisual: H,
|
|
376
|
+
onEditDetails: Q,
|
|
377
|
+
onDeleteClick: j,
|
|
378
|
+
onDuplicateVisual: G,
|
|
379
|
+
onShareVisual: Y,
|
|
380
|
+
isDeleting: C,
|
|
381
|
+
isDuplicating: v === o.id,
|
|
382
|
+
formatDate: U
|
|
383
|
+
},
|
|
384
|
+
o.id
|
|
385
|
+
)) }),
|
|
386
|
+
f && d && /* @__PURE__ */ e(
|
|
387
|
+
Ne,
|
|
388
|
+
{
|
|
389
|
+
resource: d,
|
|
390
|
+
resourceType: ve.VISUAL,
|
|
391
|
+
onClose: () => {
|
|
392
|
+
p(!1), a(null);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
),
|
|
396
|
+
c && /* @__PURE__ */ e(
|
|
397
|
+
ye,
|
|
398
|
+
{
|
|
399
|
+
open: !!c,
|
|
400
|
+
resourceLabel: "Visual",
|
|
401
|
+
initialTitle: c.title || "",
|
|
402
|
+
initialDescription: c.description || "",
|
|
403
|
+
onClose: X,
|
|
404
|
+
onSave: k,
|
|
405
|
+
isSaving: B(c.id)
|
|
406
|
+
}
|
|
407
|
+
),
|
|
408
|
+
/* @__PURE__ */ e(
|
|
409
|
+
Ce,
|
|
410
|
+
{
|
|
411
|
+
open: h,
|
|
412
|
+
onOpenChange: (o) => {
|
|
413
|
+
!o && C || (D(o), o || w(null));
|
|
414
|
+
},
|
|
415
|
+
children: /* @__PURE__ */ r(Se, { children: [
|
|
416
|
+
/* @__PURE__ */ r(Ee, { children: [
|
|
417
|
+
/* @__PURE__ */ e(Ve, { children: "Delete Visual" }),
|
|
418
|
+
/* @__PURE__ */ r(Le, { children: [
|
|
419
|
+
'Are you sure you want to delete "',
|
|
420
|
+
s == null ? void 0 : s.title,
|
|
421
|
+
'"? This action cannot be undone.'
|
|
422
|
+
] })
|
|
423
|
+
] }),
|
|
424
|
+
/* @__PURE__ */ r(Ae, { children: [
|
|
425
|
+
/* @__PURE__ */ e(Oe, { disabled: C, children: "Cancel" }),
|
|
426
|
+
/* @__PURE__ */ r(
|
|
427
|
+
Re,
|
|
428
|
+
{
|
|
429
|
+
onClick: (o) => {
|
|
430
|
+
o.preventDefault(), o.stopPropagation(), F();
|
|
431
|
+
},
|
|
432
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
433
|
+
disabled: C,
|
|
434
|
+
children: [
|
|
435
|
+
C ? /* @__PURE__ */ e(oe, { className: "mr-2 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(ue, { className: "mr-2 h-3.5 w-3.5" }),
|
|
436
|
+
C ? "Deleting..." : "Delete"
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
] })
|
|
441
|
+
] })
|
|
442
|
+
}
|
|
443
|
+
)
|
|
444
|
+
] });
|
|
445
|
+
}
|
|
446
|
+
function vt({
|
|
447
|
+
dashboard: t,
|
|
448
|
+
isDeleting: f,
|
|
449
|
+
isDuplicating: p,
|
|
450
|
+
onLoadDashboard: d,
|
|
451
|
+
onEditDetails: a,
|
|
452
|
+
onDeleteClick: h,
|
|
453
|
+
onDuplicateDashboard: D,
|
|
454
|
+
onShareDashboard: s,
|
|
455
|
+
formatDate: w,
|
|
456
|
+
onDashboardItemClick: v
|
|
457
|
+
}) {
|
|
458
|
+
var V, O;
|
|
459
|
+
const { selectDashboard: m } = ce(), c = Je(t.id), { userContext: u, isLoading: A } = he(), T = ((V = u == null ? void 0 : u.permissions) == null ? void 0 : V.canEdit) ?? !1, b = A || !T, S = () => {
|
|
460
|
+
m(t), d(t.id), v == null || v(t.id);
|
|
461
|
+
}, E = (y) => {
|
|
462
|
+
y.currentTarget === y.target && (y.key === "Enter" || y.key === " ") && (y.preventDefault(), S());
|
|
463
|
+
};
|
|
464
|
+
return /* @__PURE__ */ r(
|
|
465
|
+
"div",
|
|
466
|
+
{
|
|
467
|
+
className: J(
|
|
468
|
+
"group flex cursor-pointer items-start gap-2 rounded-xl border border-transparent px-2.5 py-2.5 transition-[background-color,border-color,box-shadow] hover:border-border/50 hover:bg-muted/35 focus-within:ring-2 focus-within:ring-inset focus-within:ring-ring/40",
|
|
469
|
+
c && "border-border/60 bg-muted/50"
|
|
470
|
+
),
|
|
471
|
+
onClick: S,
|
|
472
|
+
children: [
|
|
473
|
+
/* @__PURE__ */ r(
|
|
474
|
+
"div",
|
|
475
|
+
{
|
|
476
|
+
role: "button",
|
|
477
|
+
tabIndex: 0,
|
|
478
|
+
className: "min-w-0 flex-1 cursor-pointer focus-visible:outline-none",
|
|
479
|
+
onKeyDown: E,
|
|
480
|
+
children: [
|
|
481
|
+
/* @__PURE__ */ e(
|
|
482
|
+
"p",
|
|
483
|
+
{
|
|
484
|
+
className: "truncate text-sm font-medium text-foreground",
|
|
485
|
+
title: t.title || "Untitled Dashboard",
|
|
486
|
+
children: t.title || "Untitled Dashboard"
|
|
487
|
+
}
|
|
488
|
+
),
|
|
489
|
+
/* @__PURE__ */ e(
|
|
490
|
+
"p",
|
|
491
|
+
{
|
|
492
|
+
className: "truncate text-xs text-muted-foreground",
|
|
493
|
+
title: t.description || "No description",
|
|
494
|
+
children: (O = t.description) != null && O.trim() ? t.description : "No description"
|
|
495
|
+
}
|
|
496
|
+
)
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
),
|
|
500
|
+
/* @__PURE__ */ e(
|
|
501
|
+
"div",
|
|
502
|
+
{
|
|
503
|
+
className: J(
|
|
504
|
+
"flex-shrink-0 transition-opacity",
|
|
505
|
+
c ? "opacity-100" : "opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"
|
|
506
|
+
),
|
|
507
|
+
children: /* @__PURE__ */ e(
|
|
508
|
+
Qe,
|
|
509
|
+
{
|
|
510
|
+
dashboard: t,
|
|
511
|
+
isDeleting: f,
|
|
512
|
+
isDuplicating: p,
|
|
513
|
+
shouldHideActions: b,
|
|
514
|
+
onEditDetails: a,
|
|
515
|
+
onDeleteClick: h,
|
|
516
|
+
onDuplicateDashboard: D,
|
|
517
|
+
onShareDashboard: s,
|
|
518
|
+
formatDate: w
|
|
519
|
+
}
|
|
520
|
+
)
|
|
521
|
+
}
|
|
522
|
+
)
|
|
523
|
+
]
|
|
524
|
+
}
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
function yt({ onRetry: t }) {
|
|
528
|
+
return /* @__PURE__ */ e(we, { className: "w-full flex-1 pr-2", children: /* @__PURE__ */ r("div", { className: "rounded-xl border border-dashed border-border/60 bg-muted/20 px-4 py-8 text-center text-muted-foreground", children: [
|
|
529
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Failed to load dashboards" }),
|
|
530
|
+
/* @__PURE__ */ e(P, { variant: "outline", size: "sm", className: "mt-2", onClick: t, children: "Retry" })
|
|
531
|
+
] }) });
|
|
532
|
+
}
|
|
533
|
+
function Ct(t) {
|
|
534
|
+
var me;
|
|
535
|
+
const { searchQuery: f, onLoadDashboard: p, onEditDashboard: d, onDashboardItemClick: a } = t, [h, D] = x(!1), [s, w] = x(
|
|
536
|
+
null
|
|
537
|
+
), [v, m] = x(!1), [c, u] = x(null), [A, T] = x(null), [b, S] = x(null), E = te(
|
|
538
|
+
(n) => n.lastSelectedDashboard
|
|
539
|
+
), V = te(
|
|
540
|
+
(n) => n.selectedDashboard
|
|
541
|
+
), O = te(
|
|
542
|
+
(n) => n.actions.selectDashboard
|
|
543
|
+
), y = te(
|
|
544
|
+
(n) => n.actions.clearSelectedDashboard
|
|
545
|
+
), { tokenProps: C, id: I } = Xe(), {
|
|
546
|
+
resources: U,
|
|
547
|
+
isLoading: j,
|
|
548
|
+
isError: F,
|
|
549
|
+
updateResource: i,
|
|
550
|
+
deleteResource: q,
|
|
551
|
+
duplicateResource: B,
|
|
552
|
+
isDeleting: L
|
|
553
|
+
} = Te(() => {
|
|
554
|
+
m(!1);
|
|
555
|
+
const n = c == null ? void 0 : c.id;
|
|
556
|
+
u(null), (V == null ? void 0 : V.id) === n && (!(C != null && C.dashboard_id) && !I ? y() : E && E.id !== n && O(E));
|
|
557
|
+
}), { userContext: G } = he(), H = ((me = G == null ? void 0 : G.permissions) == null ? void 0 : me.canCreateDashboard) ?? !1, W = U.filter(
|
|
558
|
+
(n) => {
|
|
559
|
+
var _, g;
|
|
560
|
+
return ((_ = n == null ? void 0 : n.title) == null ? void 0 : _.toLowerCase().includes(f.toLowerCase())) || ((g = n == null ? void 0 : n.description) == null ? void 0 : g.toLowerCase().includes(f.toLowerCase()));
|
|
561
|
+
}
|
|
562
|
+
), Y = (n) => new Date(n).toLocaleDateString("en-US", {
|
|
563
|
+
month: "short",
|
|
564
|
+
day: "numeric",
|
|
565
|
+
year: "numeric"
|
|
566
|
+
}), Q = (n) => {
|
|
567
|
+
p == null || p(n);
|
|
568
|
+
}, X = (n) => {
|
|
569
|
+
u(n), m(!0);
|
|
570
|
+
}, k = () => {
|
|
571
|
+
c && q(c.id);
|
|
572
|
+
}, o = (n) => {
|
|
573
|
+
T(n), B(n, {
|
|
574
|
+
onSettled: () => T(null)
|
|
575
|
+
});
|
|
576
|
+
}, {
|
|
577
|
+
startUpdating: R,
|
|
578
|
+
stopUpdating: l,
|
|
579
|
+
isUpdating: z
|
|
580
|
+
} = De(), N = (n, _, g) => {
|
|
581
|
+
var fe;
|
|
582
|
+
const se = Object.fromEntries(
|
|
583
|
+
Object.entries(_).filter(([, $]) => $ !== void 0)
|
|
584
|
+
);
|
|
585
|
+
if (Object.keys(se).length === 0) {
|
|
586
|
+
(fe = g == null ? void 0 : g.onSuccess) == null || fe.call(g);
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
const pe = Object.keys(se), ae = pe.length === 1 ? pe[0] : void 0;
|
|
590
|
+
R(n, ae), i(
|
|
591
|
+
{
|
|
592
|
+
resourceId: n,
|
|
593
|
+
data: se
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
onSuccess: () => {
|
|
597
|
+
var $;
|
|
598
|
+
l(n, ae), ($ = g == null ? void 0 : g.onSuccess) == null || $.call(g);
|
|
599
|
+
},
|
|
600
|
+
onError: () => {
|
|
601
|
+
var $;
|
|
602
|
+
l(n, ae), ($ = g == null ? void 0 : g.onError) == null || $.call(g);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
);
|
|
606
|
+
}, K = (n) => {
|
|
607
|
+
w(n), D(!0);
|
|
608
|
+
}, ee = (n) => {
|
|
609
|
+
d == null || d(n.id), S(n);
|
|
610
|
+
}, M = () => {
|
|
611
|
+
S(null);
|
|
612
|
+
}, Me = ({
|
|
613
|
+
title: n,
|
|
614
|
+
description: _
|
|
615
|
+
}) => {
|
|
616
|
+
if (!b)
|
|
617
|
+
return;
|
|
618
|
+
const g = {};
|
|
619
|
+
n !== b.title && (g.title = n), (b.description || "") !== _ && (g.description = _), N(b.id, g, {
|
|
620
|
+
onSuccess: () => {
|
|
621
|
+
S(null);
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
};
|
|
625
|
+
return j ? /* @__PURE__ */ e(Ie, {}) : F ? /* @__PURE__ */ e(yt, { onRetry: () => window.location.reload() }) : /* @__PURE__ */ r("div", { className: "flex h-full flex-1 flex-col", children: [
|
|
626
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-1.5 overflow-y-auto px-0.5", children: W.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-xl border border-dashed border-border/60 bg-muted/20 px-4 py-8 text-center", children: [
|
|
627
|
+
/* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(ke, { className: "mx-auto h-12 w-12 text-muted-foreground/50" }) }),
|
|
628
|
+
/* @__PURE__ */ e("h3", { className: "mb-1 font-medium text-foreground", children: f ? "No dashboards found" : "No dashboards yet" }),
|
|
629
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: f ? "Try adjusting your search" : H ? 'Click "New" above to add your first dashboard' : "No dashboards have been shared with you yet" })
|
|
630
|
+
] }) : W.map((n) => /* @__PURE__ */ e(
|
|
631
|
+
vt,
|
|
632
|
+
{
|
|
633
|
+
dashboard: n,
|
|
634
|
+
isDeleting: L,
|
|
635
|
+
isDuplicating: A === n.id,
|
|
636
|
+
onLoadDashboard: Q,
|
|
637
|
+
onEditDetails: ee,
|
|
638
|
+
onDeleteClick: X,
|
|
639
|
+
onDuplicateDashboard: o,
|
|
640
|
+
onShareDashboard: K,
|
|
641
|
+
formatDate: Y,
|
|
642
|
+
onDashboardItemClick: a
|
|
643
|
+
},
|
|
644
|
+
n.id
|
|
645
|
+
)) }),
|
|
646
|
+
h && s && /* @__PURE__ */ e(
|
|
647
|
+
Ne,
|
|
648
|
+
{
|
|
649
|
+
resource: s,
|
|
650
|
+
resourceType: ve.DASHBOARD,
|
|
651
|
+
onClose: () => {
|
|
652
|
+
D(!1), w(null);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
),
|
|
656
|
+
/* @__PURE__ */ e(
|
|
657
|
+
Ce,
|
|
658
|
+
{
|
|
659
|
+
open: v,
|
|
660
|
+
onOpenChange: (n) => {
|
|
661
|
+
!n && L || (m(n), n || u(null));
|
|
662
|
+
},
|
|
663
|
+
children: /* @__PURE__ */ r(Se, { children: [
|
|
664
|
+
/* @__PURE__ */ r(Ee, { children: [
|
|
665
|
+
/* @__PURE__ */ e(Ve, { children: "Delete Dashboard" }),
|
|
666
|
+
/* @__PURE__ */ r(Le, { children: [
|
|
667
|
+
'Are you sure you want to delete "',
|
|
668
|
+
c == null ? void 0 : c.title,
|
|
669
|
+
'"? This action cannot be undone.'
|
|
670
|
+
] })
|
|
671
|
+
] }),
|
|
672
|
+
/* @__PURE__ */ r(Ae, { children: [
|
|
673
|
+
/* @__PURE__ */ e(Oe, { disabled: L, children: "Cancel" }),
|
|
674
|
+
/* @__PURE__ */ r(
|
|
675
|
+
Re,
|
|
676
|
+
{
|
|
677
|
+
onClick: (n) => {
|
|
678
|
+
n.preventDefault(), n.stopPropagation(), k();
|
|
679
|
+
},
|
|
680
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
681
|
+
disabled: L,
|
|
682
|
+
children: [
|
|
683
|
+
L ? /* @__PURE__ */ e(oe, { className: "mr-2 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(ue, { className: "mr-2 h-3.5 w-3.5" }),
|
|
684
|
+
L ? "Deleting..." : "Delete"
|
|
685
|
+
]
|
|
686
|
+
}
|
|
687
|
+
)
|
|
688
|
+
] })
|
|
689
|
+
] })
|
|
690
|
+
}
|
|
691
|
+
),
|
|
692
|
+
b && /* @__PURE__ */ e(
|
|
693
|
+
ye,
|
|
694
|
+
{
|
|
695
|
+
open: !!b,
|
|
696
|
+
resourceLabel: "Dashboard",
|
|
697
|
+
initialTitle: b.title || "",
|
|
698
|
+
initialDescription: b.description || "",
|
|
699
|
+
onClose: M,
|
|
700
|
+
onSave: Me,
|
|
701
|
+
isSaving: z(b.id)
|
|
702
|
+
}
|
|
703
|
+
)
|
|
704
|
+
] });
|
|
705
|
+
}
|
|
706
|
+
function St({
|
|
707
|
+
open: t,
|
|
708
|
+
onOpenChange: f,
|
|
709
|
+
onSubmit: p,
|
|
710
|
+
isCreating: d
|
|
711
|
+
}) {
|
|
712
|
+
const [a, h] = x(""), [D, s] = x("");
|
|
713
|
+
ne(() => {
|
|
714
|
+
t || (h(""), s(""));
|
|
715
|
+
}, [t]);
|
|
716
|
+
const w = () => {
|
|
717
|
+
a.trim() && p({ title: a, description: D });
|
|
718
|
+
}, v = (m) => {
|
|
719
|
+
f(m);
|
|
720
|
+
};
|
|
721
|
+
return /* @__PURE__ */ e(et, { open: t, onOpenChange: v, children: /* @__PURE__ */ r(tt, { children: [
|
|
722
|
+
/* @__PURE__ */ r(rt, { children: [
|
|
723
|
+
/* @__PURE__ */ e(nt, { children: "Create New Visual" }),
|
|
724
|
+
/* @__PURE__ */ e(ot, { children: "Add a new visual to your library. You can configure it after creation." })
|
|
725
|
+
] }),
|
|
726
|
+
/* @__PURE__ */ r("div", { className: "space-y-4 py-4", children: [
|
|
727
|
+
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
728
|
+
/* @__PURE__ */ e(be, { htmlFor: "title", children: "Visual Title" }),
|
|
729
|
+
/* @__PURE__ */ e(
|
|
730
|
+
de,
|
|
731
|
+
{
|
|
732
|
+
id: "title",
|
|
733
|
+
placeholder: "Enter visual title...",
|
|
734
|
+
value: a,
|
|
735
|
+
onChange: (m) => h(m.target.value),
|
|
736
|
+
disabled: d,
|
|
737
|
+
onKeyDown: (m) => {
|
|
738
|
+
m.key === "Enter" && !m.shiftKey && (m.preventDefault(), w());
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
)
|
|
742
|
+
] }),
|
|
743
|
+
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
744
|
+
/* @__PURE__ */ e(be, { htmlFor: "description", children: "Description (optional)" }),
|
|
745
|
+
/* @__PURE__ */ e(
|
|
746
|
+
de,
|
|
747
|
+
{
|
|
748
|
+
id: "description",
|
|
749
|
+
placeholder: "Enter visual description...",
|
|
750
|
+
value: D,
|
|
751
|
+
onChange: (m) => s(m.target.value),
|
|
752
|
+
disabled: d
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
] })
|
|
756
|
+
] }),
|
|
757
|
+
/* @__PURE__ */ r(st, { children: [
|
|
758
|
+
/* @__PURE__ */ e(
|
|
759
|
+
P,
|
|
760
|
+
{
|
|
761
|
+
variant: "outline",
|
|
762
|
+
onClick: () => v(!1),
|
|
763
|
+
disabled: d,
|
|
764
|
+
children: "Cancel"
|
|
765
|
+
}
|
|
766
|
+
),
|
|
767
|
+
/* @__PURE__ */ e(
|
|
768
|
+
P,
|
|
769
|
+
{
|
|
770
|
+
onClick: w,
|
|
771
|
+
disabled: !a.trim() || d,
|
|
772
|
+
children: d ? /* @__PURE__ */ r(le, { children: [
|
|
773
|
+
/* @__PURE__ */ e(oe, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
774
|
+
"Creating..."
|
|
775
|
+
] }) : "Create Visual"
|
|
776
|
+
}
|
|
777
|
+
)
|
|
778
|
+
] })
|
|
779
|
+
] }) });
|
|
780
|
+
}
|
|
781
|
+
function Ot({
|
|
782
|
+
isOpen: t,
|
|
783
|
+
onClose: f,
|
|
784
|
+
className: p,
|
|
785
|
+
onDashboardItemClick: d,
|
|
786
|
+
variant: a = "inline"
|
|
787
|
+
}) {
|
|
788
|
+
var l, z;
|
|
789
|
+
const h = re(
|
|
790
|
+
(N) => N.isDashboardEditing
|
|
791
|
+
), [D, s] = x(!1), [w, v] = x(""), [m, c] = x(!1), { currentUser: u, userContext: A } = he(), T = ((l = A == null ? void 0 : A.permissions) == null ? void 0 : l.canCreateDashboard) ?? !1, { onCreateSuccess: b } = at({
|
|
792
|
+
onDashboardSelect: d
|
|
793
|
+
}), { selectVisual: S } = ce(), { handleEditLibraryVisual: E } = Ue(), {
|
|
794
|
+
createResource: V,
|
|
795
|
+
isCreating: O,
|
|
796
|
+
refetch: y
|
|
797
|
+
} = Te(), { createResource: C, isCreating: I } = xe(
|
|
798
|
+
void 0,
|
|
799
|
+
// onDeleteSuccess (not needed here)
|
|
800
|
+
(N) => {
|
|
801
|
+
s(!1), N && (S(N), E(N));
|
|
802
|
+
}
|
|
803
|
+
), U = a === "overlay", j = h ? "New Visual" : "New", F = h ? "New Visual" : "New Dashboard", i = h ? "Search visuals..." : "Search dashboards...", q = h ? "Collapse visuals panel" : "Collapse dashboard panel", B = ((u == null ? void 0 : u.name) ?? "").trim(), L = ((u == null ? void 0 : u.email) ?? "").trim(), H = B && B.toLowerCase() !== "undefined" ? B : L || "Current user", W = ((z = H.charAt(0)) == null ? void 0 : z.toUpperCase()) || "?", Y = L && L.toLowerCase() !== "undefined" ? L : "", Q = xt(f, {
|
|
804
|
+
enabled: t && U
|
|
805
|
+
}), X = J(
|
|
806
|
+
"flex h-full flex-col border-r border-border/60 bg-background",
|
|
807
|
+
U ? J(
|
|
808
|
+
"absolute inset-y-0 left-0 z-[51] w-60 overflow-hidden shadow-lg transition-transform duration-300 ease-in-out",
|
|
809
|
+
t ? "translate-x-0" : "pointer-events-none -translate-x-full"
|
|
810
|
+
) : "w-full max-w-[17rem] min-w-[11rem] overflow-hidden",
|
|
811
|
+
p
|
|
812
|
+
), k = (N) => {
|
|
813
|
+
}, o = (N) => {
|
|
814
|
+
console.log("Editing dashboard:", N);
|
|
815
|
+
}, R = (N) => {
|
|
816
|
+
V(N, {
|
|
817
|
+
onSuccess: (K) => {
|
|
818
|
+
s(!1), b(K, y);
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
};
|
|
822
|
+
return /* @__PURE__ */ e(le, { children: (!U || t) && /* @__PURE__ */ r("div", { ref: Q, className: X, children: [
|
|
823
|
+
/* @__PURE__ */ r("div", { className: "border-b border-border/60 bg-background", children: [
|
|
824
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-between px-3 py-2", children: [
|
|
825
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e("h2", { className: "whitespace-nowrap text-sm font-semibold", children: h ? "Visuals" : "Dashboards" }) }),
|
|
826
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-1", children: [
|
|
827
|
+
/* @__PURE__ */ e(
|
|
828
|
+
P,
|
|
829
|
+
{
|
|
830
|
+
size: "sm",
|
|
831
|
+
variant: "ghost",
|
|
832
|
+
onClick: () => c(!m),
|
|
833
|
+
className: "h-8 w-8 rounded-md p-0 text-muted-foreground hover:bg-muted/50 hover:text-foreground",
|
|
834
|
+
"aria-label": m ? "Hide search" : "Show search",
|
|
835
|
+
children: /* @__PURE__ */ e(it, { className: "h-3.5 w-3.5" })
|
|
836
|
+
}
|
|
837
|
+
),
|
|
838
|
+
(h || T) && /* @__PURE__ */ r(
|
|
839
|
+
P,
|
|
840
|
+
{
|
|
841
|
+
size: "sm",
|
|
842
|
+
variant: "secondary",
|
|
843
|
+
className: "h-8 gap-1.5 whitespace-nowrap rounded-md border border-border/60 bg-muted/30 px-2 text-xs font-medium hover:bg-muted/55",
|
|
844
|
+
onClick: () => s(!0),
|
|
845
|
+
"aria-label": F,
|
|
846
|
+
children: [
|
|
847
|
+
/* @__PURE__ */ e(ie, { className: "h-3.5 w-3.5" }),
|
|
848
|
+
j
|
|
849
|
+
]
|
|
850
|
+
}
|
|
851
|
+
),
|
|
852
|
+
/* @__PURE__ */ e(
|
|
853
|
+
P,
|
|
854
|
+
{
|
|
855
|
+
size: "sm",
|
|
856
|
+
variant: "outline",
|
|
857
|
+
className: "h-8 w-8 rounded-md border-border/60 bg-background p-0.5 text-muted-foreground hover:bg-muted/35 hover:text-foreground",
|
|
858
|
+
onClick: f,
|
|
859
|
+
"aria-label": q,
|
|
860
|
+
children: /* @__PURE__ */ e(dt, { className: "h-3.5 w-3.5" })
|
|
861
|
+
}
|
|
862
|
+
)
|
|
863
|
+
] })
|
|
864
|
+
] }),
|
|
865
|
+
m && /* @__PURE__ */ e("div", { className: "border-t border-border/50 bg-muted/20 px-3 pb-3 pt-2", children: /* @__PURE__ */ e(
|
|
866
|
+
de,
|
|
867
|
+
{
|
|
868
|
+
placeholder: i,
|
|
869
|
+
value: w,
|
|
870
|
+
onChange: (N) => v(N.target.value),
|
|
871
|
+
className: "h-9 border-border/60 bg-background text-sm focus-visible:border-ring/40 focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
872
|
+
autoFocus: !0
|
|
873
|
+
}
|
|
874
|
+
) })
|
|
875
|
+
] }),
|
|
876
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 flex-col overflow-auto px-2.5 py-2.5", children: h ? /* @__PURE__ */ e(Nt, { searchQuery: w }) : /* @__PURE__ */ e(
|
|
877
|
+
Ct,
|
|
878
|
+
{
|
|
879
|
+
searchQuery: w,
|
|
880
|
+
onLoadDashboard: k,
|
|
881
|
+
onEditDashboard: o,
|
|
882
|
+
onDashboardItemClick: d
|
|
883
|
+
}
|
|
884
|
+
) }),
|
|
885
|
+
u && /* @__PURE__ */ e(lt, { children: /* @__PURE__ */ e("div", { className: "border-t border-border/60 bg-muted/20 px-3 py-2.5", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
886
|
+
/* @__PURE__ */ r(ct, { children: [
|
|
887
|
+
/* @__PURE__ */ e(ut, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "flex h-7 w-7 cursor-default items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ e("span", { className: "text-xs font-medium text-primary", children: W }) }) }),
|
|
888
|
+
/* @__PURE__ */ e(ht, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
889
|
+
/* @__PURE__ */ e("div", { className: "font-medium", children: H }),
|
|
890
|
+
Y && /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: Y }),
|
|
891
|
+
u.role && /* @__PURE__ */ r("div", { className: "text-xs text-muted-foreground", children: [
|
|
892
|
+
"Role: ",
|
|
893
|
+
mt(u.role.replace(/_/g, " "))
|
|
894
|
+
] })
|
|
895
|
+
] }) })
|
|
896
|
+
] }),
|
|
897
|
+
/* @__PURE__ */ e("span", { className: "truncate text-xs font-medium text-muted-foreground", children: H })
|
|
898
|
+
] }) }) }),
|
|
899
|
+
h ? /* @__PURE__ */ e(
|
|
900
|
+
St,
|
|
901
|
+
{
|
|
902
|
+
open: D,
|
|
903
|
+
onOpenChange: s,
|
|
904
|
+
onSubmit: C,
|
|
905
|
+
isCreating: I
|
|
906
|
+
}
|
|
907
|
+
) : /* @__PURE__ */ e(
|
|
908
|
+
pt,
|
|
909
|
+
{
|
|
910
|
+
open: D,
|
|
911
|
+
onOpenChange: s,
|
|
912
|
+
onSubmit: R,
|
|
913
|
+
isCreating: O
|
|
914
|
+
}
|
|
915
|
+
)
|
|
916
|
+
] }) });
|
|
917
|
+
}
|
|
918
|
+
export {
|
|
919
|
+
Ot as ResourceManagementPanel
|
|
920
|
+
};
|