@trops/dash-core 0.1.116 → 0.1.118

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/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import * as DashReact from '@trops/dash-react';
3
- import { isObject, ThemeContext, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, FontAwesomeIcon, Tag, Modal, Panel, Stepper, Paragraph, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, CodeEditorInline, Sidebar, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, DropdownPanel, MenuItem2, ButtonIcon2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, colorTypes, getCSSStyleForClassname, Panel2, Heading2, SubHeading, Paragraph2, Paragraph3, Button2, Button3, MenuItem, Tag2, Tag3, ButtonIcon3, DashPanel, colorNames, shades, themeVariants, Tabs3, DataList, Checkbox, StatCard, Card, Tabs, Accordion, Alert, Toast, ProgressBar, Toggle, Breadcrumbs, Card2, Tabs2, Accordion2, Alert2, Toast2, ProgressBar2, Toggle2, Breadcrumbs2, Card3, Accordion3, Alert3, Toast3, ProgressBar3, Toggle3, Breadcrumbs3, TextArea, SelectInput, Icon2, AlgoliaSearchBox, CommandPalette, EmptyState, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
3
+ import { isObject, ThemeContext, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, FontAwesomeIcon, Tag, Sidebar, Paragraph, Modal, Panel, Stepper, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, CodeEditorInline, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, DropdownPanel, MenuItem2, ButtonIcon2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, colorTypes, getCSSStyleForClassname, Panel2, Heading2, SubHeading, Paragraph2, Paragraph3, Button2, Button3, MenuItem, Tag2, Tag3, ButtonIcon3, DashPanel, colorNames, shades, themeVariants, Tabs3, DataList, Checkbox, StatCard, Card, Tabs, Accordion, Alert, Toast, ProgressBar, Toggle, Breadcrumbs, Card2, Tabs2, Accordion2, Alert2, Toast2, ProgressBar2, Toggle2, Breadcrumbs2, Card3, Accordion3, Alert3, Toast3, ProgressBar3, Toggle3, Breadcrumbs3, TextArea, SelectInput, Icon2, AlgoliaSearchBox, CommandPalette, EmptyState, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
4
4
  export * from '@trops/dash-react';
5
5
  export { ThemeContext } from '@trops/dash-react';
6
6
  import _typeof from '@babel/runtime/helpers/typeof';
@@ -13,18 +13,19 @@ import _createClass from '@babel/runtime/helpers/createClass';
13
13
  import * as jsxRuntime from 'react/jsx-runtime';
14
14
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
15
15
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
16
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
17
+ import _regeneratorRuntime from '@babel/runtime/regenerator';
16
18
  import { Menu, Transition, Popover, Dialog, Disclosure } from '@headlessui/react';
17
19
  import { EllipsisVerticalIcon } from '@heroicons/react/20/solid';
18
20
  import clsx from 'clsx';
19
21
  import { DndProvider, useDrag, useDrop } from 'react-dnd';
20
22
  import { HTML5Backend } from 'react-dnd-html5-backend';
21
- import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
22
- import _regeneratorRuntime from '@babel/runtime/regenerator';
23
23
  import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
24
24
  import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
25
25
  import _inherits from '@babel/runtime/helpers/inherits';
26
26
  import colors from 'tailwindcss/colors';
27
27
  import * as ReactDOM from 'react-dom';
28
+ import { createPortal } from 'react-dom';
28
29
  import { findIconDefinition } from '@fortawesome/fontawesome-svg-core';
29
30
  import algoliasearch from 'algoliasearch';
30
31
  import { InstantSearch, Hits } from 'react-instantsearch-hooks-web';
@@ -3272,6 +3273,642 @@ var FolderDetail = function FolderDetail(_ref) {
3272
3273
  });
3273
3274
  };
3274
3275
 
3276
+ var OptionCard$1 = function OptionCard(_ref) {
3277
+ var icon = _ref.icon,
3278
+ title = _ref.title,
3279
+ description = _ref.description,
3280
+ onClick = _ref.onClick;
3281
+ return /*#__PURE__*/jsxs("button", {
3282
+ type: "button",
3283
+ onClick: onClick,
3284
+ className: "w-full flex flex-row items-center gap-4 p-4 rounded-lg text-left transition-all bg-gray-700/50 hover:bg-gray-700 hover:ring-1 hover:ring-gray-600",
3285
+ children: [/*#__PURE__*/jsx("div", {
3286
+ className: "flex-shrink-0 h-8 w-8 flex items-center justify-center text-gray-400",
3287
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
3288
+ icon: icon,
3289
+ className: "h-5 w-5"
3290
+ })
3291
+ }), /*#__PURE__*/jsxs("div", {
3292
+ className: "flex flex-col min-w-0",
3293
+ children: [/*#__PURE__*/jsx("span", {
3294
+ className: "text-sm font-medium text-gray-200",
3295
+ children: title
3296
+ }), /*#__PURE__*/jsx("span", {
3297
+ className: "text-xs text-gray-500 mt-0.5",
3298
+ children: description
3299
+ })]
3300
+ }), /*#__PURE__*/jsx("div", {
3301
+ className: "flex-shrink-0 ml-auto text-gray-600",
3302
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
3303
+ icon: "chevron-right",
3304
+ className: "h-3 w-3"
3305
+ })
3306
+ })]
3307
+ });
3308
+ };
3309
+ var CreationMethodPicker = function CreationMethodPicker(_ref2) {
3310
+ var onSelect = _ref2.onSelect;
3311
+ return /*#__PURE__*/jsxs("div", {
3312
+ className: "flex flex-row w-full h-full",
3313
+ children: [/*#__PURE__*/jsxs("div", {
3314
+ className: "flex flex-col w-1/3 p-6 py-10 space-y-4 justify-start",
3315
+ children: [/*#__PURE__*/jsx(Heading, {
3316
+ title: "New Dashboard",
3317
+ padding: false,
3318
+ textColor: "text-gray-300"
3319
+ }), /*#__PURE__*/jsx("p", {
3320
+ className: "text-base font-normal text-gray-400",
3321
+ children: "Choose how you'd like to create your new dashboard."
3322
+ })]
3323
+ }), /*#__PURE__*/jsxs("div", {
3324
+ className: "flex flex-col w-2/3 p-6 pt-10 space-y-3",
3325
+ children: [/*#__PURE__*/jsx(OptionCard$1, {
3326
+ icon: "plus",
3327
+ title: "New Dashboard",
3328
+ description: "Start from a blank template and customize your layout",
3329
+ onClick: function onClick() {
3330
+ return onSelect("template");
3331
+ }
3332
+ }), /*#__PURE__*/jsx(OptionCard$1, {
3333
+ icon: "file-zipper",
3334
+ title: "Import from File",
3335
+ description: "Import a dashboard from a .zip file on your computer",
3336
+ onClick: function onClick() {
3337
+ return onSelect("import");
3338
+ }
3339
+ }), /*#__PURE__*/jsx(OptionCard$1, {
3340
+ icon: "compass",
3341
+ title: "Search Registry",
3342
+ description: "Browse and install dashboards from the online registry",
3343
+ onClick: function onClick() {
3344
+ return onSelect("registry");
3345
+ }
3346
+ })]
3347
+ })]
3348
+ });
3349
+ };
3350
+
3351
+ var StarRating = function StarRating(_ref) {
3352
+ var appId = _ref.appId,
3353
+ packageName = _ref.packageName,
3354
+ _ref$interactive = _ref.interactive,
3355
+ interactive = _ref$interactive === void 0 ? true : _ref$interactive;
3356
+ var _useContext = useContext(ThemeContext),
3357
+ currentTheme = _useContext.currentTheme;
3358
+ var _useState = useState(0),
3359
+ _useState2 = _slicedToArray(_useState, 2),
3360
+ rating = _useState2[0],
3361
+ setRating = _useState2[1];
3362
+ var _useState3 = useState(0),
3363
+ _useState4 = _slicedToArray(_useState3, 2),
3364
+ hoverRating = _useState4[0],
3365
+ setHoverRating = _useState4[1];
3366
+ var _useState5 = useState(true),
3367
+ _useState6 = _slicedToArray(_useState5, 2),
3368
+ loading = _useState6[0],
3369
+ setLoading = _useState6[1];
3370
+ useEffect(function () {
3371
+ var _window$mainApi;
3372
+ if (!appId || !packageName) return;
3373
+ var cancelled = false;
3374
+ setLoading(true);
3375
+ (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.dashboardRatings) === null || _window$mainApi === void 0 || _window$mainApi.getDashboardRating(appId, packageName).then(function (result) {
3376
+ if (!cancelled && result !== null && result !== void 0 && result.rating) {
3377
+ setRating(result.rating);
3378
+ }
3379
+ })["catch"](function () {})["finally"](function () {
3380
+ if (!cancelled) setLoading(false);
3381
+ });
3382
+ return function () {
3383
+ cancelled = true;
3384
+ };
3385
+ }, [appId, packageName]);
3386
+ function handleClick(_x) {
3387
+ return _handleClick.apply(this, arguments);
3388
+ }
3389
+ function _handleClick() {
3390
+ _handleClick = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
3391
+ var newRating, _window$mainApi2;
3392
+ return _regeneratorRuntime.wrap(function (_context) {
3393
+ while (1) switch (_context.prev = _context.next) {
3394
+ case 0:
3395
+ if (!(!interactive || !appId || !packageName)) {
3396
+ _context.next = 1;
3397
+ break;
3398
+ }
3399
+ return _context.abrupt("return");
3400
+ case 1:
3401
+ newRating = value === rating ? 0 : value;
3402
+ setRating(newRating);
3403
+ _context.prev = 2;
3404
+ _context.next = 3;
3405
+ return (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.dashboardRatings) === null || _window$mainApi2 === void 0 ? void 0 : _window$mainApi2.saveDashboardRating(appId, packageName, newRating);
3406
+ case 3:
3407
+ _context.next = 5;
3408
+ break;
3409
+ case 4:
3410
+ _context.prev = 4;
3411
+ _context["catch"](2);
3412
+ case 5:
3413
+ case "end":
3414
+ return _context.stop();
3415
+ }
3416
+ }, _callee, null, [[2, 4]]);
3417
+ }));
3418
+ return _handleClick.apply(this, arguments);
3419
+ }
3420
+ if (loading) return null;
3421
+ var displayRating = hoverRating || rating;
3422
+ return /*#__PURE__*/jsx("div", {
3423
+ className: "flex items-center gap-0.5",
3424
+ onMouseLeave: function onMouseLeave() {
3425
+ return setHoverRating(0);
3426
+ },
3427
+ children: [1, 2, 3, 4, 5].map(function (star) {
3428
+ return /*#__PURE__*/jsx("button", {
3429
+ type: "button",
3430
+ disabled: !interactive,
3431
+ onClick: function onClick() {
3432
+ return handleClick(star);
3433
+ },
3434
+ onMouseEnter: function onMouseEnter() {
3435
+ return interactive && setHoverRating(star);
3436
+ },
3437
+ className: "p-0.5 transition-colors ".concat(interactive ? "cursor-pointer hover:scale-110" : "cursor-default"),
3438
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
3439
+ icon: star <= displayRating ? "star" : ["far", "star"],
3440
+ className: "h-3.5 w-3.5 ".concat(star <= displayRating ? "text-yellow-400" : currentTheme["text-primary-medium"] || "text-gray-500")
3441
+ })
3442
+ }, star);
3443
+ })
3444
+ });
3445
+ };
3446
+
3447
+ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
3448
+ var dashboardPackage = _ref.dashboardPackage,
3449
+ appId = _ref.appId;
3450
+ var _useContext = useContext(ThemeContext),
3451
+ currentTheme = _useContext.currentTheme;
3452
+ var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
3453
+ grow: false
3454
+ });
3455
+ var _useState = useState(null),
3456
+ _useState2 = _slicedToArray(_useState, 2),
3457
+ preview = _useState2[0],
3458
+ setPreview = _useState2[1];
3459
+ var _useState3 = useState(false),
3460
+ _useState4 = _slicedToArray(_useState3, 2),
3461
+ previewLoading = _useState4[0],
3462
+ setPreviewLoading = _useState4[1];
3463
+ var _useState5 = useState(false),
3464
+ _useState6 = _slicedToArray(_useState5, 2),
3465
+ isInstalling = _useState6[0],
3466
+ setIsInstalling = _useState6[1];
3467
+ var _useState7 = useState(null),
3468
+ _useState8 = _slicedToArray(_useState7, 2),
3469
+ installResult = _useState8[0],
3470
+ setInstallResult = _useState8[1];
3471
+ var pkg = dashboardPackage;
3472
+ if (!pkg) return null;
3473
+
3474
+ // Load preview data on mount
3475
+ // eslint-disable-next-line react-hooks/rules-of-hooks
3476
+ useEffect(function () {
3477
+ var _window$mainApi;
3478
+ if (!pkg.name) return;
3479
+ var cancelled = false;
3480
+ setPreviewLoading(true);
3481
+ setPreview(null);
3482
+ setInstallResult(null);
3483
+ (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.dashboardConfig) === null || _window$mainApi === void 0 || _window$mainApi.getDashboardPreview(pkg.name).then(function (result) {
3484
+ if (!cancelled) setPreview(result);
3485
+ })["catch"](function (err) {
3486
+ })["finally"](function () {
3487
+ if (!cancelled) setPreviewLoading(false);
3488
+ });
3489
+ return function () {
3490
+ cancelled = true;
3491
+ };
3492
+ }, [pkg.name]);
3493
+ function handleInstall() {
3494
+ return _handleInstall.apply(this, arguments);
3495
+ }
3496
+ function _handleInstall() {
3497
+ _handleInstall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
3498
+ var _result$workspace, result, _t;
3499
+ return _regeneratorRuntime.wrap(function (_context) {
3500
+ while (1) switch (_context.prev = _context.next) {
3501
+ case 0:
3502
+ if (!(!appId || !pkg.name)) {
3503
+ _context.next = 1;
3504
+ break;
3505
+ }
3506
+ return _context.abrupt("return");
3507
+ case 1:
3508
+ setIsInstalling(true);
3509
+ setInstallResult(null);
3510
+ _context.prev = 2;
3511
+ _context.next = 3;
3512
+ return window.mainApi.dashboardConfig.installDashboardFromRegistry(appId, pkg.name);
3513
+ case 3:
3514
+ result = _context.sent;
3515
+ setInstallResult({
3516
+ status: result !== null && result !== void 0 && result.success ? "success" : "error",
3517
+ message: result !== null && result !== void 0 && result.success ? "Dashboard \"".concat(((_result$workspace = result.workspace) === null || _result$workspace === void 0 ? void 0 : _result$workspace.name) || pkg.name, "\" installed successfully.") : (result === null || result === void 0 ? void 0 : result.error) || "Installation failed."
3518
+ });
3519
+ _context.next = 5;
3520
+ break;
3521
+ case 4:
3522
+ _context.prev = 4;
3523
+ _t = _context["catch"](2);
3524
+ setInstallResult({
3525
+ status: "error",
3526
+ message: _t.message || "Failed to install dashboard."
3527
+ });
3528
+ case 5:
3529
+ _context.prev = 5;
3530
+ setIsInstalling(false);
3531
+ return _context.finish(5);
3532
+ case 6:
3533
+ case "end":
3534
+ return _context.stop();
3535
+ }
3536
+ }, _callee, null, [[2, 4, 5, 6]]);
3537
+ }));
3538
+ return _handleInstall.apply(this, arguments);
3539
+ }
3540
+ var compatibility = preview === null || preview === void 0 ? void 0 : preview.compatibility;
3541
+ var widgetDeps = (preview === null || preview === void 0 ? void 0 : preview.widgets) || pkg.widgets || [];
3542
+ var providers = (preview === null || preview === void 0 ? void 0 : preview.providers) || [];
3543
+ var wiring = (preview === null || preview === void 0 ? void 0 : preview.wiring) || [];
3544
+ function getCompatIcon(status) {
3545
+ if (status === "installed") return {
3546
+ icon: "circle-check",
3547
+ color: "text-green-400"
3548
+ };
3549
+ if (status === "available") return {
3550
+ icon: "circle-down",
3551
+ color: "text-blue-400"
3552
+ };
3553
+ return {
3554
+ icon: "circle-xmark",
3555
+ color: "text-red-400"
3556
+ };
3557
+ }
3558
+ return /*#__PURE__*/jsxs("div", {
3559
+ className: "flex flex-col flex-1 min-h-0",
3560
+ children: [/*#__PURE__*/jsxs("div", {
3561
+ className: "flex-1 min-h-0 overflow-y-auto p-6 space-y-6 ".concat(panelStyles.textColor || "text-gray-200"),
3562
+ children: [/*#__PURE__*/jsxs("div", {
3563
+ className: "flex flex-row items-center gap-3",
3564
+ children: [/*#__PURE__*/jsx("div", {
3565
+ className: "h-5 w-5 flex-shrink-0 flex items-center justify-center",
3566
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
3567
+ icon: pkg.icon || "clone",
3568
+ className: "h-5 w-5"
3569
+ })
3570
+ }), /*#__PURE__*/jsxs("div", {
3571
+ children: [/*#__PURE__*/jsx(SubHeading3, {
3572
+ title: pkg.displayName || pkg.name,
3573
+ padding: false
3574
+ }), /*#__PURE__*/jsxs("div", {
3575
+ className: "flex items-center gap-2 mt-0.5",
3576
+ children: [/*#__PURE__*/jsxs("span", {
3577
+ className: "text-sm opacity-60",
3578
+ children: ["by ", pkg.author || "Unknown"]
3579
+ }), pkg.version && /*#__PURE__*/jsxs("span", {
3580
+ className: "text-xs px-2 py-0.5 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-70"),
3581
+ children: ["v", pkg.version]
3582
+ })]
3583
+ })]
3584
+ })]
3585
+ }), appId && /*#__PURE__*/jsx(StarRating, {
3586
+ appId: appId,
3587
+ packageName: pkg.name,
3588
+ interactive: false
3589
+ }), /*#__PURE__*/jsx("hr", {
3590
+ className: currentTheme["border-primary-medium"]
3591
+ }), pkg.description && /*#__PURE__*/jsx("p", {
3592
+ className: "text-sm",
3593
+ children: pkg.description
3594
+ }), pkg.tags && pkg.tags.length > 0 && /*#__PURE__*/jsx("div", {
3595
+ className: "flex flex-wrap gap-1",
3596
+ children: pkg.tags.map(function (tag) {
3597
+ return /*#__PURE__*/jsx("span", {
3598
+ className: "text-xs px-2 py-0.5 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-60"),
3599
+ children: tag
3600
+ }, tag);
3601
+ })
3602
+ }), /*#__PURE__*/jsxs("div", {
3603
+ children: [/*#__PURE__*/jsx("span", {
3604
+ className: "text-xs font-semibold opacity-50 mb-1 block",
3605
+ children: "REQUIRED WIDGETS"
3606
+ }), previewLoading ? /*#__PURE__*/jsxs("div", {
3607
+ className: "flex items-center gap-2 py-2",
3608
+ children: [/*#__PURE__*/jsx("div", {
3609
+ className: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500"
3610
+ }), /*#__PURE__*/jsx("span", {
3611
+ className: "text-xs opacity-50",
3612
+ children: "Checking compatibility..."
3613
+ })]
3614
+ }) : /*#__PURE__*/jsx("div", {
3615
+ className: "space-y-1.5",
3616
+ children: widgetDeps.map(function (w, idx) {
3617
+ var _compatibility$widget;
3618
+ var status = (compatibility === null || compatibility === void 0 || (_compatibility$widget = compatibility.widgets) === null || _compatibility$widget === void 0 ? void 0 : _compatibility$widget[w.name || w.packageName]) || "unknown";
3619
+ var compat = getCompatIcon(status);
3620
+ return /*#__PURE__*/jsxs("div", {
3621
+ className: "p-2 rounded ".concat(currentTheme["bg-primary-medium"], " flex items-center gap-2"),
3622
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
3623
+ icon: compat.icon,
3624
+ className: "h-3.5 w-3.5 ".concat(compat.color)
3625
+ }), /*#__PURE__*/jsx("span", {
3626
+ className: "text-sm",
3627
+ children: w.displayName || w.name || w.packageName
3628
+ }), /*#__PURE__*/jsx("span", {
3629
+ className: "text-xs opacity-40 ml-auto",
3630
+ children: status === "installed" ? "Installed" : status === "available" ? "Will install" : "Unavailable"
3631
+ })]
3632
+ }, idx);
3633
+ })
3634
+ })]
3635
+ }), providers.length > 0 && /*#__PURE__*/jsxs("div", {
3636
+ children: [/*#__PURE__*/jsx("span", {
3637
+ className: "text-xs font-semibold opacity-50 mb-1 block",
3638
+ children: "REQUIRED PROVIDERS"
3639
+ }), /*#__PURE__*/jsx("div", {
3640
+ className: "space-y-1",
3641
+ children: providers.map(function (p, idx) {
3642
+ return /*#__PURE__*/jsxs("div", {
3643
+ className: "flex items-center gap-2",
3644
+ children: [/*#__PURE__*/jsx("span", {
3645
+ className: "text-xs px-1.5 py-0.5 rounded bg-blue-900/30 text-blue-400",
3646
+ children: p.type
3647
+ }), p.required && /*#__PURE__*/jsx("span", {
3648
+ className: "text-[10px] opacity-40",
3649
+ children: "Required"
3650
+ })]
3651
+ }, idx);
3652
+ })
3653
+ })]
3654
+ }), wiring.length > 0 && /*#__PURE__*/jsxs("div", {
3655
+ children: [/*#__PURE__*/jsx("span", {
3656
+ className: "text-xs font-semibold opacity-50 mb-1 block",
3657
+ children: "EVENT WIRING"
3658
+ }), /*#__PURE__*/jsx("div", {
3659
+ className: "space-y-1",
3660
+ children: wiring.map(function (w, idx) {
3661
+ return /*#__PURE__*/jsxs("div", {
3662
+ className: "text-xs p-2 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-70"),
3663
+ children: [/*#__PURE__*/jsx("span", {
3664
+ className: "font-medium",
3665
+ children: w.from || "Source"
3666
+ }), /*#__PURE__*/jsx(FontAwesomeIcon, {
3667
+ icon: "arrow-right",
3668
+ className: "h-2.5 w-2.5 mx-1.5 opacity-50"
3669
+ }), /*#__PURE__*/jsx("span", {
3670
+ className: "font-medium",
3671
+ children: w.to || "Target"
3672
+ }), w.event && /*#__PURE__*/jsxs("span", {
3673
+ className: "opacity-50 ml-1.5",
3674
+ children: ["(", w.event, ")"]
3675
+ })]
3676
+ }, idx);
3677
+ })
3678
+ })]
3679
+ }), installResult && /*#__PURE__*/jsx("div", {
3680
+ className: "p-2 rounded border ".concat(installResult.status === "success" ? "bg-green-900/20 border-green-700" : "bg-red-900/30 border-red-700"),
3681
+ children: /*#__PURE__*/jsxs("div", {
3682
+ className: "flex items-center gap-2",
3683
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
3684
+ icon: installResult.status === "success" ? "circle-check" : "circle-xmark",
3685
+ className: "h-4 w-4 ".concat(installResult.status === "success" ? "text-green-400" : "text-red-400")
3686
+ }), /*#__PURE__*/jsx("span", {
3687
+ className: "text-sm ".concat(installResult.status === "error" ? "text-red-400" : ""),
3688
+ children: installResult.message
3689
+ })]
3690
+ })
3691
+ })]
3692
+ }), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && /*#__PURE__*/jsx("div", {
3693
+ className: "flex items-center justify-end px-6 py-3 border-t ".concat(currentTheme["border-primary-medium"]),
3694
+ children: /*#__PURE__*/jsx(Button, {
3695
+ title: isInstalling ? "Installing..." : "Install Dashboard",
3696
+ bgColor: "bg-blue-600",
3697
+ hoverBackgroundColor: isInstalling ? "" : "hover:bg-blue-700",
3698
+ textSize: "text-sm",
3699
+ padding: "py-1.5 px-4",
3700
+ onClick: handleInstall,
3701
+ disabled: isInstalling
3702
+ })
3703
+ })]
3704
+ });
3705
+ };
3706
+
3707
+ var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
3708
+ var onBack = _ref.onBack,
3709
+ appId = _ref.appId;
3710
+ var _useContext = useContext(ThemeContext),
3711
+ currentTheme = _useContext.currentTheme;
3712
+ var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
3713
+ grow: false
3714
+ });
3715
+ var _useState = useState([]),
3716
+ _useState2 = _slicedToArray(_useState, 2),
3717
+ packages = _useState2[0],
3718
+ setPackages = _useState2[1];
3719
+ var _useState3 = useState(false),
3720
+ _useState4 = _slicedToArray(_useState3, 2),
3721
+ isLoading = _useState4[0],
3722
+ setIsLoading = _useState4[1];
3723
+ var _useState5 = useState(null),
3724
+ _useState6 = _slicedToArray(_useState5, 2),
3725
+ error = _useState6[0],
3726
+ setError = _useState6[1];
3727
+ var _useState7 = useState(""),
3728
+ _useState8 = _slicedToArray(_useState7, 2),
3729
+ searchQuery = _useState8[0],
3730
+ setSearchQuery = _useState8[1];
3731
+ var _useState9 = useState(null),
3732
+ _useState0 = _slicedToArray(_useState9, 2),
3733
+ selectedPackageName = _useState0[0],
3734
+ setSelectedPackageName = _useState0[1];
3735
+ var search = useCallback(/*#__PURE__*/function () {
3736
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(query) {
3737
+ var _window$mainApi;
3738
+ var result, _t;
3739
+ return _regeneratorRuntime.wrap(function (_context) {
3740
+ while (1) switch (_context.prev = _context.next) {
3741
+ case 0:
3742
+ if ((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && (_window$mainApi = _window$mainApi.registry) !== null && _window$mainApi !== void 0 && _window$mainApi.searchDashboards) {
3743
+ _context.next = 1;
3744
+ break;
3745
+ }
3746
+ setPackages([]);
3747
+ return _context.abrupt("return");
3748
+ case 1:
3749
+ setIsLoading(true);
3750
+ setError(null);
3751
+ _context.prev = 2;
3752
+ _context.next = 3;
3753
+ return window.mainApi.registry.searchDashboards(query || "", {});
3754
+ case 3:
3755
+ result = _context.sent;
3756
+ setPackages((result === null || result === void 0 ? void 0 : result.packages) || []);
3757
+ _context.next = 5;
3758
+ break;
3759
+ case 4:
3760
+ _context.prev = 4;
3761
+ _t = _context["catch"](2);
3762
+ setError(_t.message || "Failed to search dashboard registry");
3763
+ setPackages([]);
3764
+ case 5:
3765
+ _context.prev = 5;
3766
+ setIsLoading(false);
3767
+ return _context.finish(5);
3768
+ case 6:
3769
+ case "end":
3770
+ return _context.stop();
3771
+ }
3772
+ }, _callee, null, [[2, 4, 5, 6]]);
3773
+ }));
3774
+ return function (_x) {
3775
+ return _ref2.apply(this, arguments);
3776
+ };
3777
+ }(), []);
3778
+
3779
+ // Debounce search on query changes
3780
+ useEffect(function () {
3781
+ var timer = setTimeout(function () {
3782
+ search(searchQuery);
3783
+ }, 300);
3784
+ return function () {
3785
+ return clearTimeout(timer);
3786
+ };
3787
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3788
+ }, [searchQuery]);
3789
+ var retry = function retry() {
3790
+ return search(searchQuery);
3791
+ };
3792
+ var selectedPackage = selectedPackageName ? packages.find(function (p) {
3793
+ return p.name === selectedPackageName;
3794
+ }) : null;
3795
+
3796
+ // If a package is selected, show its detail inline
3797
+ if (selectedPackage) {
3798
+ return /*#__PURE__*/jsxs("div", {
3799
+ className: "flex flex-col flex-1 min-h-0",
3800
+ children: [/*#__PURE__*/jsx("div", {
3801
+ className: "flex-shrink-0 px-4 pt-4",
3802
+ children: /*#__PURE__*/jsxs("button", {
3803
+ type: "button",
3804
+ onClick: function onClick() {
3805
+ return setSelectedPackageName(null);
3806
+ },
3807
+ className: "flex items-center gap-1.5 text-sm opacity-60 hover:opacity-100 transition-opacity",
3808
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
3809
+ icon: "arrow-left",
3810
+ className: "h-3 w-3"
3811
+ }), /*#__PURE__*/jsx("span", {
3812
+ children: "Back"
3813
+ })]
3814
+ })
3815
+ }), /*#__PURE__*/jsx(RegistryDashboardDetail, {
3816
+ dashboardPackage: selectedPackage,
3817
+ appId: appId
3818
+ })]
3819
+ });
3820
+ }
3821
+
3822
+ // Package list view
3823
+ var listBody;
3824
+ if (isLoading) {
3825
+ listBody = /*#__PURE__*/jsx("div", {
3826
+ className: "flex items-center justify-center py-12",
3827
+ children: /*#__PURE__*/jsxs("div", {
3828
+ className: "text-center",
3829
+ children: [/*#__PURE__*/jsx("div", {
3830
+ className: "animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500 mx-auto mb-3"
3831
+ }), /*#__PURE__*/jsx(Paragraph, {
3832
+ className: "text-sm opacity-50",
3833
+ children: "Loading dashboards..."
3834
+ })]
3835
+ })
3836
+ });
3837
+ } else if (error) {
3838
+ listBody = /*#__PURE__*/jsxs("div", {
3839
+ className: "px-4 py-8 text-center",
3840
+ children: [/*#__PURE__*/jsx(Paragraph, {
3841
+ className: "text-sm text-red-400 mb-3",
3842
+ children: error
3843
+ }), /*#__PURE__*/jsx(Button, {
3844
+ title: "Retry",
3845
+ bgColor: "bg-gray-700",
3846
+ hoverBackgroundColor: "hover:bg-gray-600",
3847
+ textSize: "text-sm",
3848
+ padding: "py-1 px-3",
3849
+ onClick: retry
3850
+ })]
3851
+ });
3852
+ } else if (packages.length === 0) {
3853
+ listBody = /*#__PURE__*/jsx("div", {
3854
+ className: "px-4 py-8 text-center",
3855
+ children: /*#__PURE__*/jsx(Paragraph, {
3856
+ className: "text-sm opacity-50",
3857
+ children: searchQuery ? "No dashboards match your search." : "No dashboard packages available."
3858
+ })
3859
+ });
3860
+ } else {
3861
+ listBody = /*#__PURE__*/jsx("div", {
3862
+ className: "space-y-1",
3863
+ children: packages.map(function (pkg) {
3864
+ var widgetCount = (pkg.widgets || []).length;
3865
+ return /*#__PURE__*/jsx(Sidebar.Item, {
3866
+ icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
3867
+ icon: pkg.icon || "clone",
3868
+ className: "h-3.5 w-3.5"
3869
+ }),
3870
+ onClick: function onClick() {
3871
+ return setSelectedPackageName(pkg.name);
3872
+ },
3873
+ badge: widgetCount > 0 ? "".concat(widgetCount) : undefined,
3874
+ children: pkg.displayName || pkg.name
3875
+ }, pkg.name);
3876
+ })
3877
+ });
3878
+ }
3879
+ return /*#__PURE__*/jsxs("div", {
3880
+ className: "flex flex-col flex-1 min-h-0 ".concat(panelStyles.textColor || "text-gray-200"),
3881
+ children: [/*#__PURE__*/jsx("div", {
3882
+ className: "flex-shrink-0 px-4 pt-4",
3883
+ children: /*#__PURE__*/jsxs("button", {
3884
+ type: "button",
3885
+ onClick: onBack,
3886
+ className: "flex items-center gap-1.5 text-sm opacity-60 hover:opacity-100 transition-opacity",
3887
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
3888
+ icon: "arrow-left",
3889
+ className: "h-3 w-3"
3890
+ }), /*#__PURE__*/jsx("span", {
3891
+ children: "Back"
3892
+ })]
3893
+ })
3894
+ }), /*#__PURE__*/jsx("div", {
3895
+ className: "flex-shrink-0 px-4 py-3",
3896
+ children: /*#__PURE__*/jsx(SearchInput, {
3897
+ value: searchQuery,
3898
+ onChange: setSearchQuery,
3899
+ placeholder: "Search dashboards...",
3900
+ inputClassName: "py-1.5 text-xs"
3901
+ })
3902
+ }), /*#__PURE__*/jsx("div", {
3903
+ className: "flex-1 min-h-0 overflow-y-auto px-2",
3904
+ children: listBody
3905
+ }), !isLoading && !error && packages.length > 0 && /*#__PURE__*/jsxs("div", {
3906
+ className: "flex-shrink-0 px-4 py-2 text-[10px] opacity-40 border-t border-white/10",
3907
+ children: [packages.length, " dashboard", packages.length !== 1 ? "s" : ""]
3908
+ })]
3909
+ });
3910
+ };
3911
+
3275
3912
  var LayoutManagerModal = function LayoutManagerModal(_ref) {
3276
3913
  var open = _ref.open,
3277
3914
  setIsOpen = _ref.setIsOpen,
@@ -3279,52 +3916,59 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
3279
3916
  _ref$menuItems = _ref.menuItems,
3280
3917
  menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
3281
3918
  _ref$onSaveMenuItem = _ref.onSaveMenuItem,
3282
- onSaveMenuItem = _ref$onSaveMenuItem === void 0 ? null : _ref$onSaveMenuItem;
3919
+ onSaveMenuItem = _ref$onSaveMenuItem === void 0 ? null : _ref$onSaveMenuItem,
3920
+ appId = _ref.appId,
3921
+ onReloadWorkspaces = _ref.onReloadWorkspaces;
3283
3922
  var _useContext = useContext(ThemeContext),
3284
3923
  themes = _useContext.themes,
3285
3924
  appThemeKey = _useContext.themeKey;
3286
- var _useState = useState(""),
3925
+ var _useState = useState(null),
3287
3926
  _useState2 = _slicedToArray(_useState, 2),
3288
- dashboardName = _useState2[0],
3289
- setDashboardName = _useState2[1];
3290
- var _useState3 = useState(layoutTemplates[0]),
3927
+ creationMethod = _useState2[0],
3928
+ setCreationMethod = _useState2[1];
3929
+ var _useState3 = useState(""),
3291
3930
  _useState4 = _slicedToArray(_useState3, 2),
3292
- selectedTemplate = _useState4[0],
3293
- setSelectedTemplate = _useState4[1];
3294
- var _useState5 = useState(0),
3931
+ dashboardName = _useState4[0],
3932
+ setDashboardName = _useState4[1];
3933
+ var _useState5 = useState(layoutTemplates[0]),
3295
3934
  _useState6 = _slicedToArray(_useState5, 2),
3296
- activeStep = _useState6[0],
3297
- setActiveStep = _useState6[1];
3298
- var _useState7 = useState(null),
3935
+ selectedTemplate = _useState6[0],
3936
+ setSelectedTemplate = _useState6[1];
3937
+ var _useState7 = useState(0),
3299
3938
  _useState8 = _slicedToArray(_useState7, 2),
3300
- selectedMenuId = _useState8[0],
3301
- setSelectedMenuId = _useState8[1];
3939
+ activeStep = _useState8[0],
3940
+ setActiveStep = _useState8[1];
3302
3941
  var _useState9 = useState(null),
3303
3942
  _useState0 = _slicedToArray(_useState9, 2),
3304
- selectedThemeKey = _useState0[0],
3305
- setSelectedThemeKey = _useState0[1];
3306
- var _useState1 = useState([]),
3943
+ selectedMenuId = _useState0[0],
3944
+ setSelectedMenuId = _useState0[1];
3945
+ var _useState1 = useState(null),
3307
3946
  _useState10 = _slicedToArray(_useState1, 2),
3308
- localMenuItems = _useState10[0],
3309
- setLocalMenuItems = _useState10[1];
3947
+ selectedThemeKey = _useState10[0],
3948
+ setSelectedThemeKey = _useState10[1];
3949
+ var _useState11 = useState([]),
3950
+ _useState12 = _slicedToArray(_useState11, 2),
3951
+ localMenuItems = _useState12[0],
3952
+ setLocalMenuItems = _useState12[1];
3310
3953
 
3311
3954
  // Inline new-folder form state
3312
- var _useState11 = useState(false),
3313
- _useState12 = _slicedToArray(_useState11, 2),
3314
- isCreatingFolder = _useState12[0],
3315
- setIsCreatingFolder = _useState12[1];
3316
- var _useState13 = useState(""),
3955
+ var _useState13 = useState(false),
3317
3956
  _useState14 = _slicedToArray(_useState13, 2),
3318
- newFolderName = _useState14[0],
3319
- setNewFolderName = _useState14[1];
3320
- var _useState15 = useState(null),
3957
+ isCreatingFolder = _useState14[0],
3958
+ setIsCreatingFolder = _useState14[1];
3959
+ var _useState15 = useState(""),
3321
3960
  _useState16 = _slicedToArray(_useState15, 2),
3322
- newFolderIcon = _useState16[0],
3323
- setNewFolderIcon = _useState16[1];
3961
+ newFolderName = _useState16[0],
3962
+ setNewFolderName = _useState16[1];
3963
+ var _useState17 = useState(null),
3964
+ _useState18 = _slicedToArray(_useState17, 2),
3965
+ newFolderIcon = _useState18[0],
3966
+ setNewFolderIcon = _useState18[1];
3324
3967
 
3325
3968
  // Reset state when modal opens
3326
3969
  useEffect(function () {
3327
3970
  if (open) {
3971
+ setCreationMethod(null);
3328
3972
  setDashboardName("");
3329
3973
  setActiveStep(0);
3330
3974
  setLocalMenuItems(menuItems || []);
@@ -3372,16 +4016,85 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
3372
4016
  setSelectedTemplate(template);
3373
4017
  setActiveStep(2);
3374
4018
  }
4019
+ function handleMethodSelect(method) {
4020
+ if (method === "import") {
4021
+ handleImportFromFile();
4022
+ } else {
4023
+ setCreationMethod(method);
4024
+ }
4025
+ }
4026
+ function handleImportFromFile() {
4027
+ return _handleImportFromFile.apply(this, arguments);
4028
+ }
4029
+ function _handleImportFromFile() {
4030
+ _handleImportFromFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
4031
+ var result;
4032
+ return _regeneratorRuntime.wrap(function (_context) {
4033
+ while (1) switch (_context.prev = _context.next) {
4034
+ case 0:
4035
+ handleClose();
4036
+ _context.prev = 1;
4037
+ _context.next = 2;
4038
+ return window.mainApi.dashboardConfig.importDashboardConfig(appId);
4039
+ case 2:
4040
+ result = _context.sent;
4041
+ if (result && !result.canceled && result.success) {
4042
+ onReloadWorkspaces && onReloadWorkspaces();
4043
+ }
4044
+ _context.next = 4;
4045
+ break;
4046
+ case 3:
4047
+ _context.prev = 3;
4048
+ _context["catch"](1);
4049
+ case 4:
4050
+ case "end":
4051
+ return _context.stop();
4052
+ }
4053
+ }, _callee, null, [[1, 3]]);
4054
+ }));
4055
+ return _handleImportFromFile.apply(this, arguments);
4056
+ }
3375
4057
  var selectedFolder = localMenuItems.find(function (item) {
3376
4058
  return item.id === selectedMenuId;
3377
4059
  });
3378
- return /*#__PURE__*/jsxs(Modal, {
3379
- isOpen: open,
3380
- setIsOpen: setIsOpen,
3381
- width: "w-11/12 xl:w-5/6",
3382
- height: "h-5/6",
3383
- scrollable: false,
3384
- children: [/*#__PURE__*/jsx(Panel, {
4060
+
4061
+ // ─── Render body based on creationMethod ─────────────────────────
4062
+ function renderBody() {
4063
+ if (creationMethod === null) {
4064
+ return /*#__PURE__*/jsx(Panel, {
4065
+ backgroundColor: "bg-slate-800",
4066
+ padding: false,
4067
+ children: /*#__PURE__*/jsx(Panel.Body, {
4068
+ scrollable: false,
4069
+ className: "h-full",
4070
+ children: /*#__PURE__*/jsx("div", {
4071
+ className: "h-full p-6 pb-0",
4072
+ children: /*#__PURE__*/jsx(CreationMethodPicker, {
4073
+ onSelect: handleMethodSelect
4074
+ })
4075
+ })
4076
+ })
4077
+ });
4078
+ }
4079
+ if (creationMethod === "registry") {
4080
+ return /*#__PURE__*/jsx(Panel, {
4081
+ backgroundColor: "bg-slate-800",
4082
+ padding: false,
4083
+ children: /*#__PURE__*/jsx(Panel.Body, {
4084
+ scrollable: false,
4085
+ className: "h-full",
4086
+ children: /*#__PURE__*/jsx(DiscoverDashboardsDetail, {
4087
+ onBack: function onBack() {
4088
+ return setCreationMethod(null);
4089
+ },
4090
+ appId: appId
4091
+ })
4092
+ })
4093
+ });
4094
+ }
4095
+
4096
+ // creationMethod === "template" — existing 4-step wizard
4097
+ return /*#__PURE__*/jsx(Panel, {
3385
4098
  backgroundColor: "bg-slate-800",
3386
4099
  padding: false,
3387
4100
  children: /*#__PURE__*/jsx(Panel.Body, {
@@ -3639,13 +4352,45 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
3639
4352
  })]
3640
4353
  })
3641
4354
  })
3642
- }), /*#__PURE__*/jsx(Modal.Footer, {
4355
+ });
4356
+ }
4357
+
4358
+ // ─── Render footer based on creationMethod ───────────────────────
4359
+ function renderFooter() {
4360
+ // Picker screen: just Cancel
4361
+ if (creationMethod === null) {
4362
+ return /*#__PURE__*/jsx(Modal.Footer, {
4363
+ children: /*#__PURE__*/jsx("div", {
4364
+ className: "flex flex-row space-x-2",
4365
+ children: /*#__PURE__*/jsx(Button, {
4366
+ onClick: handleClose,
4367
+ title: "Cancel",
4368
+ textSize: "text-base xl:text-lg",
4369
+ padding: "py-2 px-4",
4370
+ backgroundColor: "bg-gray-700",
4371
+ textColor: "text-gray-300",
4372
+ hoverTextColor: "hover:text-gray-100",
4373
+ hoverBackgroundColor: "hover:bg-gray-600"
4374
+ })
4375
+ })
4376
+ });
4377
+ }
4378
+
4379
+ // Registry screen: no footer (DiscoverDashboardsDetail has its own back button)
4380
+ if (creationMethod === "registry") {
4381
+ return null;
4382
+ }
4383
+
4384
+ // Template wizard footer
4385
+ return /*#__PURE__*/jsx(Modal.Footer, {
3643
4386
  children: /*#__PURE__*/jsxs("div", {
3644
4387
  className: "flex flex-row space-x-2",
3645
4388
  children: [activeStep === 0 && /*#__PURE__*/jsxs(Fragment, {
3646
4389
  children: [/*#__PURE__*/jsx(Button, {
3647
- onClick: handleClose,
3648
- title: "Cancel",
4390
+ onClick: function onClick() {
4391
+ return setCreationMethod(null);
4392
+ },
4393
+ title: "Back",
3649
4394
  textSize: "text-base xl:text-lg",
3650
4395
  padding: "py-2 px-4",
3651
4396
  backgroundColor: "bg-gray-700",
@@ -3738,7 +4483,15 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
3738
4483
  })]
3739
4484
  })]
3740
4485
  })
3741
- })]
4486
+ });
4487
+ }
4488
+ return /*#__PURE__*/jsxs(Modal, {
4489
+ isOpen: open,
4490
+ setIsOpen: setIsOpen,
4491
+ width: "w-11/12 xl:w-5/6",
4492
+ height: "h-5/6",
4493
+ scrollable: false,
4494
+ children: [renderBody(), renderFooter()]
3742
4495
  });
3743
4496
  };
3744
4497
 
@@ -30641,102 +31394,6 @@ var ThemeManagerModal = function ThemeManagerModal(_ref) {
30641
31394
  });
30642
31395
  };
30643
31396
 
30644
- var StarRating = function StarRating(_ref) {
30645
- var appId = _ref.appId,
30646
- packageName = _ref.packageName,
30647
- _ref$interactive = _ref.interactive,
30648
- interactive = _ref$interactive === void 0 ? true : _ref$interactive;
30649
- var _useContext = useContext(ThemeContext),
30650
- currentTheme = _useContext.currentTheme;
30651
- var _useState = useState(0),
30652
- _useState2 = _slicedToArray(_useState, 2),
30653
- rating = _useState2[0],
30654
- setRating = _useState2[1];
30655
- var _useState3 = useState(0),
30656
- _useState4 = _slicedToArray(_useState3, 2),
30657
- hoverRating = _useState4[0],
30658
- setHoverRating = _useState4[1];
30659
- var _useState5 = useState(true),
30660
- _useState6 = _slicedToArray(_useState5, 2),
30661
- loading = _useState6[0],
30662
- setLoading = _useState6[1];
30663
- useEffect(function () {
30664
- var _window$mainApi;
30665
- if (!appId || !packageName) return;
30666
- var cancelled = false;
30667
- setLoading(true);
30668
- (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.dashboardRatings) === null || _window$mainApi === void 0 || _window$mainApi.getDashboardRating(appId, packageName).then(function (result) {
30669
- if (!cancelled && result !== null && result !== void 0 && result.rating) {
30670
- setRating(result.rating);
30671
- }
30672
- })["catch"](function () {})["finally"](function () {
30673
- if (!cancelled) setLoading(false);
30674
- });
30675
- return function () {
30676
- cancelled = true;
30677
- };
30678
- }, [appId, packageName]);
30679
- function handleClick(_x) {
30680
- return _handleClick.apply(this, arguments);
30681
- }
30682
- function _handleClick() {
30683
- _handleClick = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
30684
- var newRating, _window$mainApi2;
30685
- return _regeneratorRuntime.wrap(function (_context) {
30686
- while (1) switch (_context.prev = _context.next) {
30687
- case 0:
30688
- if (!(!interactive || !appId || !packageName)) {
30689
- _context.next = 1;
30690
- break;
30691
- }
30692
- return _context.abrupt("return");
30693
- case 1:
30694
- newRating = value === rating ? 0 : value;
30695
- setRating(newRating);
30696
- _context.prev = 2;
30697
- _context.next = 3;
30698
- return (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.dashboardRatings) === null || _window$mainApi2 === void 0 ? void 0 : _window$mainApi2.saveDashboardRating(appId, packageName, newRating);
30699
- case 3:
30700
- _context.next = 5;
30701
- break;
30702
- case 4:
30703
- _context.prev = 4;
30704
- _context["catch"](2);
30705
- case 5:
30706
- case "end":
30707
- return _context.stop();
30708
- }
30709
- }, _callee, null, [[2, 4]]);
30710
- }));
30711
- return _handleClick.apply(this, arguments);
30712
- }
30713
- if (loading) return null;
30714
- var displayRating = hoverRating || rating;
30715
- return /*#__PURE__*/jsx("div", {
30716
- className: "flex items-center gap-0.5",
30717
- onMouseLeave: function onMouseLeave() {
30718
- return setHoverRating(0);
30719
- },
30720
- children: [1, 2, 3, 4, 5].map(function (star) {
30721
- return /*#__PURE__*/jsx("button", {
30722
- type: "button",
30723
- disabled: !interactive,
30724
- onClick: function onClick() {
30725
- return handleClick(star);
30726
- },
30727
- onMouseEnter: function onMouseEnter() {
30728
- return interactive && setHoverRating(star);
30729
- },
30730
- className: "p-0.5 transition-colors ".concat(interactive ? "cursor-pointer hover:scale-110" : "cursor-default"),
30731
- children: /*#__PURE__*/jsx(FontAwesomeIcon, {
30732
- icon: star <= displayRating ? "star" : ["far", "star"],
30733
- className: "h-3.5 w-3.5 ".concat(star <= displayRating ? "text-yellow-400" : currentTheme["text-primary-medium"] || "text-gray-500")
30734
- })
30735
- }, star);
30736
- })
30737
- });
30738
- };
30739
-
30740
31397
  var DASHBOARD_TAGS = ["productivity", "monitoring", "analytics", "communication", "developer", "sales", "marketing", "finance", "project-management", "social", "news", "utilities"];
30741
31398
 
30742
31399
  /**
@@ -31826,471 +32483,6 @@ var DashboardDetail = function DashboardDetail(_ref2) {
31826
32483
  });
31827
32484
  };
31828
32485
 
31829
- var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
31830
- var dashboardPackage = _ref.dashboardPackage,
31831
- appId = _ref.appId;
31832
- var _useContext = useContext(ThemeContext),
31833
- currentTheme = _useContext.currentTheme;
31834
- var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
31835
- grow: false
31836
- });
31837
- var _useState = useState(null),
31838
- _useState2 = _slicedToArray(_useState, 2),
31839
- preview = _useState2[0],
31840
- setPreview = _useState2[1];
31841
- var _useState3 = useState(false),
31842
- _useState4 = _slicedToArray(_useState3, 2),
31843
- previewLoading = _useState4[0],
31844
- setPreviewLoading = _useState4[1];
31845
- var _useState5 = useState(false),
31846
- _useState6 = _slicedToArray(_useState5, 2),
31847
- isInstalling = _useState6[0],
31848
- setIsInstalling = _useState6[1];
31849
- var _useState7 = useState(null),
31850
- _useState8 = _slicedToArray(_useState7, 2),
31851
- installResult = _useState8[0],
31852
- setInstallResult = _useState8[1];
31853
- var pkg = dashboardPackage;
31854
- if (!pkg) return null;
31855
-
31856
- // Load preview data on mount
31857
- // eslint-disable-next-line react-hooks/rules-of-hooks
31858
- useEffect(function () {
31859
- var _window$mainApi;
31860
- if (!pkg.name) return;
31861
- var cancelled = false;
31862
- setPreviewLoading(true);
31863
- setPreview(null);
31864
- setInstallResult(null);
31865
- (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.dashboardConfig) === null || _window$mainApi === void 0 || _window$mainApi.getDashboardPreview(pkg.name).then(function (result) {
31866
- if (!cancelled) setPreview(result);
31867
- })["catch"](function (err) {
31868
- })["finally"](function () {
31869
- if (!cancelled) setPreviewLoading(false);
31870
- });
31871
- return function () {
31872
- cancelled = true;
31873
- };
31874
- }, [pkg.name]);
31875
- function handleInstall() {
31876
- return _handleInstall.apply(this, arguments);
31877
- }
31878
- function _handleInstall() {
31879
- _handleInstall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
31880
- var _result$workspace, result, _t;
31881
- return _regeneratorRuntime.wrap(function (_context) {
31882
- while (1) switch (_context.prev = _context.next) {
31883
- case 0:
31884
- if (!(!appId || !pkg.name)) {
31885
- _context.next = 1;
31886
- break;
31887
- }
31888
- return _context.abrupt("return");
31889
- case 1:
31890
- setIsInstalling(true);
31891
- setInstallResult(null);
31892
- _context.prev = 2;
31893
- _context.next = 3;
31894
- return window.mainApi.dashboardConfig.installDashboardFromRegistry(appId, pkg.name);
31895
- case 3:
31896
- result = _context.sent;
31897
- setInstallResult({
31898
- status: result !== null && result !== void 0 && result.success ? "success" : "error",
31899
- message: result !== null && result !== void 0 && result.success ? "Dashboard \"".concat(((_result$workspace = result.workspace) === null || _result$workspace === void 0 ? void 0 : _result$workspace.name) || pkg.name, "\" installed successfully.") : (result === null || result === void 0 ? void 0 : result.error) || "Installation failed."
31900
- });
31901
- _context.next = 5;
31902
- break;
31903
- case 4:
31904
- _context.prev = 4;
31905
- _t = _context["catch"](2);
31906
- setInstallResult({
31907
- status: "error",
31908
- message: _t.message || "Failed to install dashboard."
31909
- });
31910
- case 5:
31911
- _context.prev = 5;
31912
- setIsInstalling(false);
31913
- return _context.finish(5);
31914
- case 6:
31915
- case "end":
31916
- return _context.stop();
31917
- }
31918
- }, _callee, null, [[2, 4, 5, 6]]);
31919
- }));
31920
- return _handleInstall.apply(this, arguments);
31921
- }
31922
- var compatibility = preview === null || preview === void 0 ? void 0 : preview.compatibility;
31923
- var widgetDeps = (preview === null || preview === void 0 ? void 0 : preview.widgets) || pkg.widgets || [];
31924
- var providers = (preview === null || preview === void 0 ? void 0 : preview.providers) || [];
31925
- var wiring = (preview === null || preview === void 0 ? void 0 : preview.wiring) || [];
31926
- function getCompatIcon(status) {
31927
- if (status === "installed") return {
31928
- icon: "circle-check",
31929
- color: "text-green-400"
31930
- };
31931
- if (status === "available") return {
31932
- icon: "circle-down",
31933
- color: "text-blue-400"
31934
- };
31935
- return {
31936
- icon: "circle-xmark",
31937
- color: "text-red-400"
31938
- };
31939
- }
31940
- return /*#__PURE__*/jsxs("div", {
31941
- className: "flex flex-col flex-1 min-h-0",
31942
- children: [/*#__PURE__*/jsxs("div", {
31943
- className: "flex-1 min-h-0 overflow-y-auto p-6 space-y-6 ".concat(panelStyles.textColor || "text-gray-200"),
31944
- children: [/*#__PURE__*/jsxs("div", {
31945
- className: "flex flex-row items-center gap-3",
31946
- children: [/*#__PURE__*/jsx("div", {
31947
- className: "h-5 w-5 flex-shrink-0 flex items-center justify-center",
31948
- children: /*#__PURE__*/jsx(FontAwesomeIcon, {
31949
- icon: pkg.icon || "clone",
31950
- className: "h-5 w-5"
31951
- })
31952
- }), /*#__PURE__*/jsxs("div", {
31953
- children: [/*#__PURE__*/jsx(SubHeading3, {
31954
- title: pkg.displayName || pkg.name,
31955
- padding: false
31956
- }), /*#__PURE__*/jsxs("div", {
31957
- className: "flex items-center gap-2 mt-0.5",
31958
- children: [/*#__PURE__*/jsxs("span", {
31959
- className: "text-sm opacity-60",
31960
- children: ["by ", pkg.author || "Unknown"]
31961
- }), pkg.version && /*#__PURE__*/jsxs("span", {
31962
- className: "text-xs px-2 py-0.5 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-70"),
31963
- children: ["v", pkg.version]
31964
- })]
31965
- })]
31966
- })]
31967
- }), appId && /*#__PURE__*/jsx(StarRating, {
31968
- appId: appId,
31969
- packageName: pkg.name,
31970
- interactive: false
31971
- }), /*#__PURE__*/jsx("hr", {
31972
- className: currentTheme["border-primary-medium"]
31973
- }), pkg.description && /*#__PURE__*/jsx("p", {
31974
- className: "text-sm",
31975
- children: pkg.description
31976
- }), pkg.tags && pkg.tags.length > 0 && /*#__PURE__*/jsx("div", {
31977
- className: "flex flex-wrap gap-1",
31978
- children: pkg.tags.map(function (tag) {
31979
- return /*#__PURE__*/jsx("span", {
31980
- className: "text-xs px-2 py-0.5 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-60"),
31981
- children: tag
31982
- }, tag);
31983
- })
31984
- }), /*#__PURE__*/jsxs("div", {
31985
- children: [/*#__PURE__*/jsx("span", {
31986
- className: "text-xs font-semibold opacity-50 mb-1 block",
31987
- children: "REQUIRED WIDGETS"
31988
- }), previewLoading ? /*#__PURE__*/jsxs("div", {
31989
- className: "flex items-center gap-2 py-2",
31990
- children: [/*#__PURE__*/jsx("div", {
31991
- className: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500"
31992
- }), /*#__PURE__*/jsx("span", {
31993
- className: "text-xs opacity-50",
31994
- children: "Checking compatibility..."
31995
- })]
31996
- }) : /*#__PURE__*/jsx("div", {
31997
- className: "space-y-1.5",
31998
- children: widgetDeps.map(function (w, idx) {
31999
- var _compatibility$widget;
32000
- var status = (compatibility === null || compatibility === void 0 || (_compatibility$widget = compatibility.widgets) === null || _compatibility$widget === void 0 ? void 0 : _compatibility$widget[w.name || w.packageName]) || "unknown";
32001
- var compat = getCompatIcon(status);
32002
- return /*#__PURE__*/jsxs("div", {
32003
- className: "p-2 rounded ".concat(currentTheme["bg-primary-medium"], " flex items-center gap-2"),
32004
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
32005
- icon: compat.icon,
32006
- className: "h-3.5 w-3.5 ".concat(compat.color)
32007
- }), /*#__PURE__*/jsx("span", {
32008
- className: "text-sm",
32009
- children: w.displayName || w.name || w.packageName
32010
- }), /*#__PURE__*/jsx("span", {
32011
- className: "text-xs opacity-40 ml-auto",
32012
- children: status === "installed" ? "Installed" : status === "available" ? "Will install" : "Unavailable"
32013
- })]
32014
- }, idx);
32015
- })
32016
- })]
32017
- }), providers.length > 0 && /*#__PURE__*/jsxs("div", {
32018
- children: [/*#__PURE__*/jsx("span", {
32019
- className: "text-xs font-semibold opacity-50 mb-1 block",
32020
- children: "REQUIRED PROVIDERS"
32021
- }), /*#__PURE__*/jsx("div", {
32022
- className: "space-y-1",
32023
- children: providers.map(function (p, idx) {
32024
- return /*#__PURE__*/jsxs("div", {
32025
- className: "flex items-center gap-2",
32026
- children: [/*#__PURE__*/jsx("span", {
32027
- className: "text-xs px-1.5 py-0.5 rounded bg-blue-900/30 text-blue-400",
32028
- children: p.type
32029
- }), p.required && /*#__PURE__*/jsx("span", {
32030
- className: "text-[10px] opacity-40",
32031
- children: "Required"
32032
- })]
32033
- }, idx);
32034
- })
32035
- })]
32036
- }), wiring.length > 0 && /*#__PURE__*/jsxs("div", {
32037
- children: [/*#__PURE__*/jsx("span", {
32038
- className: "text-xs font-semibold opacity-50 mb-1 block",
32039
- children: "EVENT WIRING"
32040
- }), /*#__PURE__*/jsx("div", {
32041
- className: "space-y-1",
32042
- children: wiring.map(function (w, idx) {
32043
- return /*#__PURE__*/jsxs("div", {
32044
- className: "text-xs p-2 rounded ".concat(currentTheme["bg-primary-medium"], " opacity-70"),
32045
- children: [/*#__PURE__*/jsx("span", {
32046
- className: "font-medium",
32047
- children: w.from || "Source"
32048
- }), /*#__PURE__*/jsx(FontAwesomeIcon, {
32049
- icon: "arrow-right",
32050
- className: "h-2.5 w-2.5 mx-1.5 opacity-50"
32051
- }), /*#__PURE__*/jsx("span", {
32052
- className: "font-medium",
32053
- children: w.to || "Target"
32054
- }), w.event && /*#__PURE__*/jsxs("span", {
32055
- className: "opacity-50 ml-1.5",
32056
- children: ["(", w.event, ")"]
32057
- })]
32058
- }, idx);
32059
- })
32060
- })]
32061
- }), installResult && /*#__PURE__*/jsx("div", {
32062
- className: "p-2 rounded border ".concat(installResult.status === "success" ? "bg-green-900/20 border-green-700" : "bg-red-900/30 border-red-700"),
32063
- children: /*#__PURE__*/jsxs("div", {
32064
- className: "flex items-center gap-2",
32065
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
32066
- icon: installResult.status === "success" ? "circle-check" : "circle-xmark",
32067
- className: "h-4 w-4 ".concat(installResult.status === "success" ? "text-green-400" : "text-red-400")
32068
- }), /*#__PURE__*/jsx("span", {
32069
- className: "text-sm ".concat(installResult.status === "error" ? "text-red-400" : ""),
32070
- children: installResult.message
32071
- })]
32072
- })
32073
- })]
32074
- }), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && /*#__PURE__*/jsx("div", {
32075
- className: "flex items-center justify-end px-6 py-3 border-t ".concat(currentTheme["border-primary-medium"]),
32076
- children: /*#__PURE__*/jsx(Button, {
32077
- title: isInstalling ? "Installing..." : "Install Dashboard",
32078
- bgColor: "bg-blue-600",
32079
- hoverBackgroundColor: isInstalling ? "" : "hover:bg-blue-700",
32080
- textSize: "text-sm",
32081
- padding: "py-1.5 px-4",
32082
- onClick: handleInstall,
32083
- disabled: isInstalling
32084
- })
32085
- })]
32086
- });
32087
- };
32088
-
32089
- var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
32090
- var onBack = _ref.onBack,
32091
- appId = _ref.appId;
32092
- var _useContext = useContext(ThemeContext),
32093
- currentTheme = _useContext.currentTheme;
32094
- var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
32095
- grow: false
32096
- });
32097
- var _useState = useState([]),
32098
- _useState2 = _slicedToArray(_useState, 2),
32099
- packages = _useState2[0],
32100
- setPackages = _useState2[1];
32101
- var _useState3 = useState(false),
32102
- _useState4 = _slicedToArray(_useState3, 2),
32103
- isLoading = _useState4[0],
32104
- setIsLoading = _useState4[1];
32105
- var _useState5 = useState(null),
32106
- _useState6 = _slicedToArray(_useState5, 2),
32107
- error = _useState6[0],
32108
- setError = _useState6[1];
32109
- var _useState7 = useState(""),
32110
- _useState8 = _slicedToArray(_useState7, 2),
32111
- searchQuery = _useState8[0],
32112
- setSearchQuery = _useState8[1];
32113
- var _useState9 = useState(null),
32114
- _useState0 = _slicedToArray(_useState9, 2),
32115
- selectedPackageName = _useState0[0],
32116
- setSelectedPackageName = _useState0[1];
32117
- var search = useCallback(/*#__PURE__*/function () {
32118
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(query) {
32119
- var _window$mainApi;
32120
- var result, _t;
32121
- return _regeneratorRuntime.wrap(function (_context) {
32122
- while (1) switch (_context.prev = _context.next) {
32123
- case 0:
32124
- if ((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && (_window$mainApi = _window$mainApi.registry) !== null && _window$mainApi !== void 0 && _window$mainApi.searchDashboards) {
32125
- _context.next = 1;
32126
- break;
32127
- }
32128
- setPackages([]);
32129
- return _context.abrupt("return");
32130
- case 1:
32131
- setIsLoading(true);
32132
- setError(null);
32133
- _context.prev = 2;
32134
- _context.next = 3;
32135
- return window.mainApi.registry.searchDashboards(query || "", {});
32136
- case 3:
32137
- result = _context.sent;
32138
- setPackages((result === null || result === void 0 ? void 0 : result.packages) || []);
32139
- _context.next = 5;
32140
- break;
32141
- case 4:
32142
- _context.prev = 4;
32143
- _t = _context["catch"](2);
32144
- setError(_t.message || "Failed to search dashboard registry");
32145
- setPackages([]);
32146
- case 5:
32147
- _context.prev = 5;
32148
- setIsLoading(false);
32149
- return _context.finish(5);
32150
- case 6:
32151
- case "end":
32152
- return _context.stop();
32153
- }
32154
- }, _callee, null, [[2, 4, 5, 6]]);
32155
- }));
32156
- return function (_x) {
32157
- return _ref2.apply(this, arguments);
32158
- };
32159
- }(), []);
32160
-
32161
- // Debounce search on query changes
32162
- useEffect(function () {
32163
- var timer = setTimeout(function () {
32164
- search(searchQuery);
32165
- }, 300);
32166
- return function () {
32167
- return clearTimeout(timer);
32168
- };
32169
- // eslint-disable-next-line react-hooks/exhaustive-deps
32170
- }, [searchQuery]);
32171
- var retry = function retry() {
32172
- return search(searchQuery);
32173
- };
32174
- var selectedPackage = selectedPackageName ? packages.find(function (p) {
32175
- return p.name === selectedPackageName;
32176
- }) : null;
32177
-
32178
- // If a package is selected, show its detail inline
32179
- if (selectedPackage) {
32180
- return /*#__PURE__*/jsxs("div", {
32181
- className: "flex flex-col flex-1 min-h-0",
32182
- children: [/*#__PURE__*/jsx("div", {
32183
- className: "flex-shrink-0 px-4 pt-4",
32184
- children: /*#__PURE__*/jsxs("button", {
32185
- type: "button",
32186
- onClick: function onClick() {
32187
- return setSelectedPackageName(null);
32188
- },
32189
- className: "flex items-center gap-1.5 text-sm opacity-60 hover:opacity-100 transition-opacity",
32190
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
32191
- icon: "arrow-left",
32192
- className: "h-3 w-3"
32193
- }), /*#__PURE__*/jsx("span", {
32194
- children: "Back"
32195
- })]
32196
- })
32197
- }), /*#__PURE__*/jsx(RegistryDashboardDetail, {
32198
- dashboardPackage: selectedPackage,
32199
- appId: appId
32200
- })]
32201
- });
32202
- }
32203
-
32204
- // Package list view
32205
- var listBody;
32206
- if (isLoading) {
32207
- listBody = /*#__PURE__*/jsx("div", {
32208
- className: "flex items-center justify-center py-12",
32209
- children: /*#__PURE__*/jsxs("div", {
32210
- className: "text-center",
32211
- children: [/*#__PURE__*/jsx("div", {
32212
- className: "animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500 mx-auto mb-3"
32213
- }), /*#__PURE__*/jsx(Paragraph, {
32214
- className: "text-sm opacity-50",
32215
- children: "Loading dashboards..."
32216
- })]
32217
- })
32218
- });
32219
- } else if (error) {
32220
- listBody = /*#__PURE__*/jsxs("div", {
32221
- className: "px-4 py-8 text-center",
32222
- children: [/*#__PURE__*/jsx(Paragraph, {
32223
- className: "text-sm text-red-400 mb-3",
32224
- children: error
32225
- }), /*#__PURE__*/jsx(Button, {
32226
- title: "Retry",
32227
- bgColor: "bg-gray-700",
32228
- hoverBackgroundColor: "hover:bg-gray-600",
32229
- textSize: "text-sm",
32230
- padding: "py-1 px-3",
32231
- onClick: retry
32232
- })]
32233
- });
32234
- } else if (packages.length === 0) {
32235
- listBody = /*#__PURE__*/jsx("div", {
32236
- className: "px-4 py-8 text-center",
32237
- children: /*#__PURE__*/jsx(Paragraph, {
32238
- className: "text-sm opacity-50",
32239
- children: searchQuery ? "No dashboards match your search." : "No dashboard packages available."
32240
- })
32241
- });
32242
- } else {
32243
- listBody = /*#__PURE__*/jsx("div", {
32244
- className: "space-y-1",
32245
- children: packages.map(function (pkg) {
32246
- var widgetCount = (pkg.widgets || []).length;
32247
- return /*#__PURE__*/jsx(Sidebar.Item, {
32248
- icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
32249
- icon: pkg.icon || "clone",
32250
- className: "h-3.5 w-3.5"
32251
- }),
32252
- onClick: function onClick() {
32253
- return setSelectedPackageName(pkg.name);
32254
- },
32255
- badge: widgetCount > 0 ? "".concat(widgetCount) : undefined,
32256
- children: pkg.displayName || pkg.name
32257
- }, pkg.name);
32258
- })
32259
- });
32260
- }
32261
- return /*#__PURE__*/jsxs("div", {
32262
- className: "flex flex-col flex-1 min-h-0 ".concat(panelStyles.textColor || "text-gray-200"),
32263
- children: [/*#__PURE__*/jsx("div", {
32264
- className: "flex-shrink-0 px-4 pt-4",
32265
- children: /*#__PURE__*/jsxs("button", {
32266
- type: "button",
32267
- onClick: onBack,
32268
- className: "flex items-center gap-1.5 text-sm opacity-60 hover:opacity-100 transition-opacity",
32269
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
32270
- icon: "arrow-left",
32271
- className: "h-3 w-3"
32272
- }), /*#__PURE__*/jsx("span", {
32273
- children: "Back"
32274
- })]
32275
- })
32276
- }), /*#__PURE__*/jsx("div", {
32277
- className: "flex-shrink-0 px-4 py-3",
32278
- children: /*#__PURE__*/jsx(SearchInput, {
32279
- value: searchQuery,
32280
- onChange: setSearchQuery,
32281
- placeholder: "Search dashboards...",
32282
- inputClassName: "py-1.5 text-xs"
32283
- })
32284
- }), /*#__PURE__*/jsx("div", {
32285
- className: "flex-1 min-h-0 overflow-y-auto px-2",
32286
- children: listBody
32287
- }), !isLoading && !error && packages.length > 0 && /*#__PURE__*/jsxs("div", {
32288
- className: "flex-shrink-0 px-4 py-2 text-[10px] opacity-40 border-t border-white/10",
32289
- children: [packages.length, " dashboard", packages.length !== 1 ? "s" : ""]
32290
- })]
32291
- });
32292
- };
32293
-
32294
32486
  function ownKeys$9(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
32295
32487
  function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
32296
32488
  var DashboardsSection = function DashboardsSection(_ref) {
@@ -39584,13 +39776,57 @@ var FooterPopover = function FooterPopover(_ref2) {
39584
39776
  onOpenSettings = _ref2.onOpenSettings,
39585
39777
  onSignIn = _ref2.onSignIn,
39586
39778
  onSignOut = _ref2.onSignOut;
39779
+ var buttonRef = useRef(null);
39780
+ var _useState = useState(false),
39781
+ _useState2 = _slicedToArray(_useState, 2),
39782
+ doNotDisturb = _useState2[0],
39783
+ setDoNotDisturb = _useState2[1];
39587
39784
  var displayName = authStatus === "authenticated" && authProfile ? authProfile.displayName || authProfile.username : "Account";
39785
+
39786
+ // Load initial DND state
39787
+ useEffect(function () {
39788
+ var _window$mainApi;
39789
+ var timeout = new Promise(function (_, reject) {
39790
+ return setTimeout(function () {
39791
+ return reject(new Error("timeout"));
39792
+ }, 2000);
39793
+ });
39794
+ var fetch = (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.notifications) === null || _window$mainApi === void 0 ? void 0 : _window$mainApi.getPreferences();
39795
+ if (fetch) {
39796
+ Promise.race([fetch, timeout]).then(function (prefs) {
39797
+ if (prefs) setDoNotDisturb(prefs.doNotDisturb);
39798
+ })["catch"](function () {});
39799
+ }
39800
+ }, []);
39801
+
39802
+ // Sync when toggled from macOS menu
39803
+ useEffect(function () {
39804
+ var _window$mainApi2, _window$mainApi2$onDn;
39805
+ var cleanup = (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.notifications) === null || _window$mainApi2 === void 0 || (_window$mainApi2$onDn = _window$mainApi2.onDndChanged) === null || _window$mainApi2$onDn === void 0 ? void 0 : _window$mainApi2$onDn.call(_window$mainApi2, function (dnd) {
39806
+ setDoNotDisturb(dnd);
39807
+ });
39808
+ return function () {
39809
+ if (cleanup) cleanup();
39810
+ };
39811
+ }, []);
39812
+ function handleToggleDnd() {
39813
+ var _window$mainApi3;
39814
+ var newValue = !doNotDisturb;
39815
+ setDoNotDisturb(newValue);
39816
+ (_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.notifications) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.setGlobal({
39817
+ doNotDisturb: newValue
39818
+ })) === null || _window$mainApi3 === void 0 || _window$mainApi3["catch"](function () {});
39819
+ }
39588
39820
  return /*#__PURE__*/jsx(Popover, {
39589
39821
  className: "relative",
39590
39822
  children: function children(_ref3) {
39591
- var close = _ref3.close;
39823
+ var _rect$left;
39824
+ var open = _ref3.open,
39825
+ close = _ref3.close;
39826
+ var rect = open && buttonRef.current ? buttonRef.current.getBoundingClientRect() : null;
39592
39827
  return /*#__PURE__*/jsxs(Fragment, {
39593
39828
  children: [/*#__PURE__*/jsxs(Popover.Button, {
39829
+ ref: buttonRef,
39594
39830
  className: "flex items-center w-full gap-2 px-3 py-2 rounded-md text-sm opacity-80 hover:opacity-100 transition-colors duration-150 cursor-pointer hover:bg-white/5 focus:outline-none",
39595
39831
  title: collapsed ? displayName : undefined,
39596
39832
  children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
@@ -39600,15 +39836,28 @@ var FooterPopover = function FooterPopover(_ref2) {
39600
39836
  className: "flex-1 text-left truncate",
39601
39837
  children: displayName
39602
39838
  })]
39603
- }), /*#__PURE__*/jsx(Transition, {
39839
+ }), /*#__PURE__*/createPortal(/*#__PURE__*/jsxs(Transition, {
39840
+ show: open,
39604
39841
  enter: "transition ease-out duration-100",
39605
39842
  enterFrom: "transform opacity-0 scale-95",
39606
39843
  enterTo: "transform opacity-100 scale-100",
39607
39844
  leave: "transition ease-in duration-75",
39608
39845
  leaveFrom: "transform opacity-100 scale-100",
39609
39846
  leaveTo: "transform opacity-0 scale-95",
39610
- children: /*#__PURE__*/jsx(Popover.Panel, {
39611
- className: "absolute bottom-full left-0 mb-2 w-52 rounded-lg border border-white/10 bg-neutral-900 shadow-xl z-50",
39847
+ children: [/*#__PURE__*/jsx("div", {
39848
+ className: "fixed inset-0",
39849
+ style: {
39850
+ zIndex: 9998
39851
+ },
39852
+ onClick: close
39853
+ }), /*#__PURE__*/jsx(Popover.Panel, {
39854
+ "static": true,
39855
+ className: "fixed w-52 rounded-lg border border-white/10 bg-neutral-900 shadow-xl",
39856
+ style: {
39857
+ zIndex: 9999,
39858
+ left: (_rect$left = rect === null || rect === void 0 ? void 0 : rect.left) !== null && _rect$left !== void 0 ? _rect$left : 0,
39859
+ bottom: rect ? window.innerHeight - rect.top + 8 : 0
39860
+ },
39612
39861
  children: /*#__PURE__*/jsxs("div", {
39613
39862
  className: "p-1.5 space-y-0.5",
39614
39863
  children: [/*#__PURE__*/jsx(PopoverItem, {
@@ -39625,6 +39874,11 @@ var FooterPopover = function FooterPopover(_ref2) {
39625
39874
  changeThemeVariant(themeVariant === "dark" ? "light" : "dark");
39626
39875
  close();
39627
39876
  }
39877
+ }), /*#__PURE__*/jsx(PopoverItem, {
39878
+ icon: doNotDisturb ? "bell-slash" : "bell",
39879
+ label: "Do Not Disturb",
39880
+ onClick: handleToggleDnd,
39881
+ active: doNotDisturb
39628
39882
  }), /*#__PURE__*/jsx("div", {
39629
39883
  className: "border-t border-white/10 my-1"
39630
39884
  }), authStatus === "authenticated" ? /*#__PURE__*/jsx(PopoverItem, {
@@ -39643,8 +39897,8 @@ var FooterPopover = function FooterPopover(_ref2) {
39643
39897
  }
39644
39898
  })]
39645
39899
  })
39646
- })
39647
- })]
39900
+ })]
39901
+ }), document.body)]
39648
39902
  });
39649
39903
  }
39650
39904
  });
@@ -39652,16 +39906,21 @@ var FooterPopover = function FooterPopover(_ref2) {
39652
39906
  var PopoverItem = function PopoverItem(_ref4) {
39653
39907
  var icon = _ref4.icon,
39654
39908
  label = _ref4.label,
39655
- onClick = _ref4.onClick;
39909
+ onClick = _ref4.onClick,
39910
+ _ref4$active = _ref4.active,
39911
+ active = _ref4$active === void 0 ? false : _ref4$active;
39656
39912
  return /*#__PURE__*/jsxs("button", {
39657
39913
  type: "button",
39658
39914
  onClick: onClick,
39659
- className: "flex items-center w-full gap-2 px-3 py-2 rounded-md text-sm text-white/80 hover:text-white hover:bg-white/10 transition-colors duration-150 cursor-pointer",
39915
+ className: "flex items-center w-full gap-2 px-3 py-2 rounded-md text-sm ".concat(active ? "text-white bg-white/10" : "text-white/80 hover:text-white hover:bg-white/10", " transition-colors duration-150 cursor-pointer"),
39660
39916
  children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
39661
39917
  icon: icon,
39662
39918
  className: "h-3.5 w-3.5 flex-shrink-0"
39663
39919
  }), /*#__PURE__*/jsx("span", {
39920
+ className: "flex-1 text-left",
39664
39921
  children: label
39922
+ }), active && /*#__PURE__*/jsx("span", {
39923
+ className: "h-1.5 w-1.5 rounded-full bg-amber-400 flex-shrink-0"
39665
39924
  })]
39666
39925
  });
39667
39926
  };
@@ -40494,9 +40753,21 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
40494
40753
  _useState36 = _slicedToArray(_useState35, 2),
40495
40754
  appSettingsInitialSection = _useState36[0],
40496
40755
  setAppSettingsInitialSection = _useState36[1];
40756
+ var _useState37 = useState(null),
40757
+ _useState38 = _slicedToArray(_useState37, 2),
40758
+ appSettingsInitialProvider = _useState38[0],
40759
+ setAppSettingsInitialProvider = _useState38[1];
40760
+ var _useState39 = useState(false),
40761
+ _useState40 = _slicedToArray(_useState39, 2),
40762
+ appSettingsCreateProvider = _useState40[0],
40763
+ setAppSettingsCreateProvider = _useState40[1];
40497
40764
  function openAppSettings() {
40498
40765
  var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "general";
40766
+ var providerName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
40767
+ var createProvider = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
40499
40768
  setAppSettingsInitialSection(section);
40769
+ setAppSettingsInitialProvider(providerName);
40770
+ setAppSettingsCreateProvider(createProvider);
40500
40771
  setIsAppSettingsOpen(true);
40501
40772
  }
40502
40773
  function handleProfileUpdated() {
@@ -41277,8 +41548,16 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
41277
41548
  }), !popout && /*#__PURE__*/jsxs(Fragment, {
41278
41549
  children: [/*#__PURE__*/jsx(AppSettingsModal, {
41279
41550
  isOpen: isAppSettingsOpen,
41280
- setIsOpen: setIsAppSettingsOpen,
41551
+ setIsOpen: function setIsOpen(open) {
41552
+ setIsAppSettingsOpen(open);
41553
+ if (!open) {
41554
+ setAppSettingsInitialProvider(null);
41555
+ setAppSettingsCreateProvider(false);
41556
+ }
41557
+ },
41281
41558
  initialSection: appSettingsInitialSection,
41559
+ initialProviderName: appSettingsInitialProvider,
41560
+ initialCreateProvider: appSettingsCreateProvider,
41282
41561
  workspaces: workspaceConfig,
41283
41562
  menuItems: menuItems,
41284
41563
  dashApi: dashApi,
@@ -41318,7 +41597,9 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
41318
41597
  setIsOpen: setIsLayoutPickerOpen,
41319
41598
  onCreateWorkspace: handleCreateFromTemplate,
41320
41599
  menuItems: menuItems,
41321
- onSaveMenuItem: handleSaveNewMenuItem
41600
+ onSaveMenuItem: handleSaveNewMenuItem,
41601
+ appId: credentials === null || credentials === void 0 ? void 0 : credentials.appId,
41602
+ onReloadWorkspaces: loadWorkspaces
41322
41603
  })]
41323
41604
  })]
41324
41605
  }), !popout && /*#__PURE__*/jsx(DashCommandPalette, {
@@ -41337,7 +41618,10 @@ var DashboardStageInner = function DashboardStageInner(_ref2) {
41337
41618
  },
41338
41619
  providers: (appContext === null || appContext === void 0 ? void 0 : appContext.providers) || {},
41339
41620
  onCreateNewProvider: function onCreateNewProvider() {
41340
- return openAppSettings("providers");
41621
+ return openAppSettings("providers", null, true);
41622
+ },
41623
+ onOpenProviderDetail: function onOpenProviderDetail(name) {
41624
+ return openAppSettings("providers", name);
41341
41625
  },
41342
41626
  themes: themes || {},
41343
41627
  currentThemeKey: themeKey,