@trops/dash-core 0.1.117 → 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/electron/index.js +17 -0
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +76 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +75 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -25,6 +25,7 @@ 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';
|
|
@@ -39775,13 +39776,57 @@ var FooterPopover = function FooterPopover(_ref2) {
|
|
|
39775
39776
|
onOpenSettings = _ref2.onOpenSettings,
|
|
39776
39777
|
onSignIn = _ref2.onSignIn,
|
|
39777
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];
|
|
39778
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
|
+
}
|
|
39779
39820
|
return /*#__PURE__*/jsx(Popover, {
|
|
39780
39821
|
className: "relative",
|
|
39781
39822
|
children: function children(_ref3) {
|
|
39782
|
-
var
|
|
39823
|
+
var _rect$left;
|
|
39824
|
+
var open = _ref3.open,
|
|
39825
|
+
close = _ref3.close;
|
|
39826
|
+
var rect = open && buttonRef.current ? buttonRef.current.getBoundingClientRect() : null;
|
|
39783
39827
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
39784
39828
|
children: [/*#__PURE__*/jsxs(Popover.Button, {
|
|
39829
|
+
ref: buttonRef,
|
|
39785
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",
|
|
39786
39831
|
title: collapsed ? displayName : undefined,
|
|
39787
39832
|
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
@@ -39791,15 +39836,28 @@ var FooterPopover = function FooterPopover(_ref2) {
|
|
|
39791
39836
|
className: "flex-1 text-left truncate",
|
|
39792
39837
|
children: displayName
|
|
39793
39838
|
})]
|
|
39794
|
-
}), /*#__PURE__*/
|
|
39839
|
+
}), /*#__PURE__*/createPortal(/*#__PURE__*/jsxs(Transition, {
|
|
39840
|
+
show: open,
|
|
39795
39841
|
enter: "transition ease-out duration-100",
|
|
39796
39842
|
enterFrom: "transform opacity-0 scale-95",
|
|
39797
39843
|
enterTo: "transform opacity-100 scale-100",
|
|
39798
39844
|
leave: "transition ease-in duration-75",
|
|
39799
39845
|
leaveFrom: "transform opacity-100 scale-100",
|
|
39800
39846
|
leaveTo: "transform opacity-0 scale-95",
|
|
39801
|
-
children: /*#__PURE__*/jsx(
|
|
39802
|
-
className: "
|
|
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
|
+
},
|
|
39803
39861
|
children: /*#__PURE__*/jsxs("div", {
|
|
39804
39862
|
className: "p-1.5 space-y-0.5",
|
|
39805
39863
|
children: [/*#__PURE__*/jsx(PopoverItem, {
|
|
@@ -39816,6 +39874,11 @@ var FooterPopover = function FooterPopover(_ref2) {
|
|
|
39816
39874
|
changeThemeVariant(themeVariant === "dark" ? "light" : "dark");
|
|
39817
39875
|
close();
|
|
39818
39876
|
}
|
|
39877
|
+
}), /*#__PURE__*/jsx(PopoverItem, {
|
|
39878
|
+
icon: doNotDisturb ? "bell-slash" : "bell",
|
|
39879
|
+
label: "Do Not Disturb",
|
|
39880
|
+
onClick: handleToggleDnd,
|
|
39881
|
+
active: doNotDisturb
|
|
39819
39882
|
}), /*#__PURE__*/jsx("div", {
|
|
39820
39883
|
className: "border-t border-white/10 my-1"
|
|
39821
39884
|
}), authStatus === "authenticated" ? /*#__PURE__*/jsx(PopoverItem, {
|
|
@@ -39834,8 +39897,8 @@ var FooterPopover = function FooterPopover(_ref2) {
|
|
|
39834
39897
|
}
|
|
39835
39898
|
})]
|
|
39836
39899
|
})
|
|
39837
|
-
})
|
|
39838
|
-
})]
|
|
39900
|
+
})]
|
|
39901
|
+
}), document.body)]
|
|
39839
39902
|
});
|
|
39840
39903
|
}
|
|
39841
39904
|
});
|
|
@@ -39843,16 +39906,21 @@ var FooterPopover = function FooterPopover(_ref2) {
|
|
|
39843
39906
|
var PopoverItem = function PopoverItem(_ref4) {
|
|
39844
39907
|
var icon = _ref4.icon,
|
|
39845
39908
|
label = _ref4.label,
|
|
39846
|
-
onClick = _ref4.onClick
|
|
39909
|
+
onClick = _ref4.onClick,
|
|
39910
|
+
_ref4$active = _ref4.active,
|
|
39911
|
+
active = _ref4$active === void 0 ? false : _ref4$active;
|
|
39847
39912
|
return /*#__PURE__*/jsxs("button", {
|
|
39848
39913
|
type: "button",
|
|
39849
39914
|
onClick: onClick,
|
|
39850
|
-
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"),
|
|
39851
39916
|
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
39852
39917
|
icon: icon,
|
|
39853
39918
|
className: "h-3.5 w-3.5 flex-shrink-0"
|
|
39854
39919
|
}), /*#__PURE__*/jsx("span", {
|
|
39920
|
+
className: "flex-1 text-left",
|
|
39855
39921
|
children: label
|
|
39922
|
+
}), active && /*#__PURE__*/jsx("span", {
|
|
39923
|
+
className: "h-1.5 w-1.5 rounded-full bg-amber-400 flex-shrink-0"
|
|
39856
39924
|
})]
|
|
39857
39925
|
});
|
|
39858
39926
|
};
|