@finsemble/finsemble-ui 6.6.1 → 6.6.4
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/package.json +2 -2
- package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js +14 -10
- package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js.map +1 -1
- package/react/components/toolbar/advancedAppLauncher/components/AppDefinition.js +7 -10
- package/react/components/toolbar/advancedAppLauncher/components/AppDefinition.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finsemble/finsemble-ui",
|
|
3
|
-
"version": "6.6.
|
|
3
|
+
"version": "6.6.4",
|
|
4
4
|
"description": "Ready-made React components to give you a head-start building your SmartDesktop.",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build-storybook": "build-storybook"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@finsemble/finsemble-api": "6.6.
|
|
30
|
+
"@finsemble/finsemble-api": "6.6.4",
|
|
31
31
|
"@q42/floating-focus-a11y": "^1.3.3",
|
|
32
32
|
"@reduxjs/toolkit": "^1.5.0",
|
|
33
33
|
"@svgr/webpack": "^5.5.0",
|
package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js
CHANGED
|
@@ -4,13 +4,22 @@ import { NotificationCardShell } from "../shared/NotificationCardShell";
|
|
|
4
4
|
import { CSSTransition } from "react-transition-group";
|
|
5
5
|
import "../../../../assets/css/notificationsCenter.css";
|
|
6
6
|
const ToastCard = (props) => {
|
|
7
|
-
const notificationRef = useRef();
|
|
8
7
|
const { notification, informationalNotificationTimeout, removeFunction, isActiveFunction, actionableTimeoutEnabled } = props;
|
|
8
|
+
const notificationRef = useRef(notification);
|
|
9
9
|
const [slideIn, setSlideIn] = useState(isActiveFunction(notification));
|
|
10
10
|
const [showNotification] = useState(isActiveFunction(notification));
|
|
11
|
+
const [timeoutId, setTimeoutId] = useState();
|
|
11
12
|
useEffect(() => {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
return () => {
|
|
14
|
+
if (timeoutId) {
|
|
15
|
+
clearInterval(timeoutId);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}, []);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (timeoutId) {
|
|
21
|
+
clearInterval(timeoutId);
|
|
22
|
+
}
|
|
14
23
|
if (!notification.actions || notification.actions.length == 0 || actionableTimeoutEnabled) {
|
|
15
24
|
let timeoutLength;
|
|
16
25
|
if (informationalNotificationTimeout !== false) {
|
|
@@ -20,16 +29,11 @@ const ToastCard = (props) => {
|
|
|
20
29
|
}
|
|
21
30
|
}
|
|
22
31
|
if (timeoutLength) {
|
|
23
|
-
|
|
32
|
+
setTimeoutId(setTimeout(() => {
|
|
24
33
|
setSlideIn(false);
|
|
25
|
-
}, timeoutLength);
|
|
34
|
+
}, timeoutLength));
|
|
26
35
|
}
|
|
27
36
|
}
|
|
28
|
-
return () => {
|
|
29
|
-
clearInterval(timeoutId);
|
|
30
|
-
};
|
|
31
|
-
}, []);
|
|
32
|
-
useEffect(() => {
|
|
33
37
|
if (!isActiveFunction(notificationRef.current)) {
|
|
34
38
|
removeFunction(notification);
|
|
35
39
|
}
|
package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsToasts.js","sourceRoot":"","sources":["../../../../../src/components/notifications/components/notificationsToasts/NotificationsToasts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,gBAAgB,EAAE,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,GACL,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,qB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G,CAAC,CAAC;wBACnB,OAAO;qBACP;oBAED,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,SAAS,EAAE,CAAC;oBAC3D,MAAM,KAAK,GAAG,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,mCAAI,CAAC,CAAC,CAAC;oBACzD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAgB,CAAC,GAAG,CAAC,CAAC;oBAEtD,MAAM,eAAe,CAAC,SAAS,CAAC;wBAC/B,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC;4BACjC,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,GAAG,KAAK;4BAC5C,MAAM,EAAE,MAAM,GAAG,EAAE;4BACnB,KAAK,EAAE,KAAK;yBACZ;qBACD,CAAC,CAAC;iBACH;aACD;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,CACN,iCACE,aAAa,CAAC,GAAG,CAAC,CAAC,YAA2B,EAAE,EAAE,CAAC,CACnD,oBAAC,SAAS,kBACT,GAAG,EAAE,cAAc,YAAY,CAAC,EAAE,EAAE,EACpC,YAAY,EAAE,YAAY,EAC1B,gCAAgC,EAAE,oBAAoB,EACtD,wBAAwB,EAAE,wBAAwB,EAClD,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,IAClC,KAAK,EACR,CACF,CAAC,CACG,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport useNotifications, {\n\tuseNotificationUI,\n\tmoveToToolbarMonitor,\n\tgetNotificationConfig,\n\tgetOS,\n} from \"../../../../hooks/useNotifications\";\nimport { NotificationCardShell } from \"../shared/NotificationCardShell\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { INotificationToastsProps } from \"../../types\";\nimport \"../../../../assets/css/notificationsCenter.css\";\nimport { services } from \"@finsemble/finsemble-api\";\n\ntype INotification = services.notification.types.INotification;\n\ntype ToastCardProps = {\n\tnotification: INotification;\n\tremoveFunction: Function;\n\tisActiveFunction: Function;\n\tinformationalNotificationTimeout: number | false;\n\tactionableTimeoutEnabled: boolean;\n\tnotificationCard?: React.ComponentType<any>;\n};\n\nconst ToastCard = (props: ToastCardProps) => {\n\tconst notificationRef = useRef<INotification>();\n\tconst { notification, informationalNotificationTimeout, removeFunction, isActiveFunction, actionableTimeoutEnabled } =\n\t\tprops;\n\tconst [slideIn, setSlideIn] = useState(isActiveFunction(notification));\n\tconst [showNotification] = useState(isActiveFunction(notification));\n\n\tuseEffect(() => {\n\t\tnotificationRef.current = notification;\n\t\tlet timeoutId: any;\n\n\t\tif (!notification.actions || notification.actions.length == 0 || actionableTimeoutEnabled) {\n\t\t\t// Is an informational notification or timeout enabled actionable notifications\n\t\t\tlet timeoutLength;\n\n\t\t\tif (informationalNotificationTimeout !== false) {\n\t\t\t\t// Convert to milliseconds\n\t\t\t\ttimeoutLength = informationalNotificationTimeout * 1000;\n\t\t\t\tif (notification.timeout && Number.isInteger(notification.timeout)) {\n\t\t\t\t\ttimeoutLength = notification.timeout;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (timeoutLength) {\n\t\t\t\ttimeoutId = setTimeout(() => {\n\t\t\t\t\tsetSlideIn(false);\n\t\t\t\t}, timeoutLength);\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tclearInterval(timeoutId);\n\t\t};\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!isActiveFunction(notificationRef.current)) {\n\t\t\tremoveFunction(notification);\n\t\t}\n\t\tsetSlideIn(isActiveFunction(notification));\n\t}, [notification]);\n\n\tconst onExited = () => {\n\t\tremoveFunction(notification);\n\t};\n\n\tconst Card = props.notificationCard ? props.notificationCard : NotificationCardShell;\n\n\treturn (\n\t\tshowNotification && (\n\t\t\t<CSSTransition in={slideIn} timeout={500} onExited={onExited} classNames=\"notifications-toast\">\n\t\t\t\t<div className=\"notifications-toast__offscreen\">\n\t\t\t\t\t<Card\n\t\t\t\t\t\tnotification={notification}\n\t\t\t\t\t\tuiContext=\"toasts\"\n\t\t\t\t\t\tremoveNotification={() => {\n\t\t\t\t\t\t\tsetSlideIn(false);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"divider\"> </div>\n\t\t\t\t</div>\n\t\t\t</CSSTransition>\n\t\t)\n\t);\n};\n\nexport const NotificationsToasts: React.FunctionComponent<INotificationToastsProps> = (props) => {\n\tconst { notifications, notificationIsActive, setOpaqueClassName, removeNotification, activeNotifications } =\n\t\tuseNotifications({ config: { notificationsHistory: { options: { sentAfter: \"startup\" } } } });\n\tconst notificationsRef = useRef<INotification[]>(notifications);\n\tconst [uiState] = useNotificationUI();\n\n\tconst isNotificationActive = (notification: INotification): boolean => {\n\t\tconst notificationCenterNotActive = !uiState.showCenter || uiState.poppedOut;\n\t\treturn notificationIsActive(notification) && notificationCenterNotActive;\n\t};\n\n\tconst config = getNotificationConfig();\n\tconst [isMac] = useState(getOS() === \"Mac\");\n\n\tconst [informationalTimeout, setInformationalTimeout] = useState<number | false>(false);\n\tconst [actionableTimeoutEnabled, setActionableTimeoutEnabled] = useState<boolean>(true);\n\n\tuseEffect(() => {\n\t\tasync function listenForPreferenceChange(error: any, response: any) {\n\t\t\tif (error) {\n\t\t\t\tconsole.error(\"FinsembleUserPreferencesChannel: \", error);\n\t\t\t} else {\n\t\t\t\tconst { data } = response;\n\t\t\t\tif (data.notificationPreferences) {\n\t\t\t\t\tconst { informationalNotificationToastPeriodSeconds, toastTimeoutOnActionableNotifications } =\n\t\t\t\t\t\tdata.notificationPreferences;\n\n\t\t\t\t\tif (informationalNotificationToastPeriodSeconds) {\n\t\t\t\t\t\tsetInformationalTimeout(informationalNotificationToastPeriodSeconds);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (typeof toastTimeoutOnActionableNotifications !== \"undefined\") {\n\t\t\t\t\t\tsetActionableTimeoutEnabled(toastTimeoutOnActionableNotifications);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tFSBL.Clients.RouterClient.addListener(\"FinsembleUserPreferencesChannel\", listenForPreferenceChange);\n\t\treturn () => {\n\t\t\tFSBL.Clients.RouterClient.removeListener(\"FinsembleUserPreferencesChannel\", listenForPreferenceChange);\n\t\t};\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst transparencySupported = config.isTransparent;\n\n\t\tsetOpaqueClassName(!transparencySupported);\n\n\t\tif (transparencySupported) {\n\t\t\tfinsembleWindow.show();\n\t\t}\n\n\t\tasync function getNotificationsPreferences() {\n\t\t\treturn await FSBL.Clients.NotificationClient.getPreferences();\n\t\t}\n\n\t\tgetNotificationsPreferences().then((preferences: any) => {\n\t\t\tsetInformationalTimeout(preferences.informationalNotificationToastPeriodSeconds);\n\t\t});\n\t}, []);\n\n\tuseEffect(() => {\n\t\tmoveToToolbarMonitor().then(async () => {\n\t\t\tlet forceHide = false;\n\t\t\tif (\n\t\t\t\tactiveNotifications(notifications).length === 0 &&\n\t\t\t\tactiveNotifications(notificationsRef.current).length === 0\n\t\t\t) {\n\t\t\t\t// Bug fix: Toasts flash when inActive components (partially caused by allowing notifications to animate out)\n\t\t\t\tforceHide = true;\n\t\t\t}\n\n\t\t\tnotificationsRef.current = notifications;\n\t\t\tconst rect = document.getElementById(\"notifications-toasts\")?.getBoundingClientRect();\n\t\t\tif (notifications.length === 0 || forceHide) {\n\t\t\t\tif (config.isTransparent && !isMac) {\n\t\t\t\t\tconst roundedRect = {\n\t\t\t\t\t\tx: Math.round(rect?.x as number),\n\t\t\t\t\t\ty: Math.round(rect?.y as number),\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\theight: 1,\n\t\t\t\t\t};\n\n\t\t\t\t\tfinsembleWindow.setShape([roundedRect]);\n\t\t\t\t}\n\n\t\t\t\tfinsembleWindow.hide();\n\t\t\t} else {\n\t\t\t\tfinsembleWindow.bringToFront();\n\t\t\t\tif (config.isTransparent && !isMac) {\n\t\t\t\t\tconst roundedRect = {\n\t\t\t\t\t\tx: Math.round(rect?.x as number),\n\t\t\t\t\t\ty: Math.round(rect?.y as number),\n\t\t\t\t\t\twidth: Math.round(rect?.width as number),\n\t\t\t\t\t\theight: Math.round(rect?.height as number),\n\t\t\t\t\t};\n\n\t\t\t\t\tawait finsembleWindow.show();\n\t\t\t\t\tfinsembleWindow.setShape([roundedRect]);\n\t\t\t\t} else {\n\t\t\t\t\tawait finsembleWindow.show();\n\t\t\t\t\tconst { err, data } = await FSBL.Clients.LauncherClient.getMonitorInfo({ monitor: \"mine\" });\n\t\t\t\t\tif (err || !data) {\n\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst { data: bounds } = await finsembleWindow.getBounds();\n\t\t\t\t\tconst width = (bounds?.right ?? 0) - (bounds?.left ?? 0);\n\t\t\t\t\tconst height = Math.round(rect?.height as number) + 6;\n\n\t\t\t\t\tawait finsembleWindow.setBounds({\n\t\t\t\t\t\tbounds: {\n\t\t\t\t\t\t\ttop: data[\"availableRect\"][\"top\"],\n\t\t\t\t\t\t\tleft: data[\"availableRect\"][\"right\"] - width,\n\t\t\t\t\t\t\theight: height + 10,\n\t\t\t\t\t\t\twidth: width,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}, [notifications]);\n\n\treturn (\n\t\t<div>\n\t\t\t{notifications.map((notification: INotification) => (\n\t\t\t\t<ToastCard\n\t\t\t\t\tkey={`toast-card-${notification.id}`}\n\t\t\t\t\tnotification={notification}\n\t\t\t\t\tinformationalNotificationTimeout={informationalTimeout}\n\t\t\t\t\tactionableTimeoutEnabled={actionableTimeoutEnabled}\n\t\t\t\t\tremoveFunction={removeNotification}\n\t\t\t\t\tisActiveFunction={isNotificationActive}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</div>\n\t);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"NotificationsToasts.js","sourceRoot":"","sources":["../../../../../src/components/notifications/components/notificationsToasts/NotificationsToasts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,gBAAgB,EAAE,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,GACL,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,gDAAgD,CAAC;AAcxD,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE,EAAE;IAC3C,MAAM,EAAE,YAAY,EAAE,gCAAgC,EAAE,cAAc,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,GACnH,KAAK,CAAC;IACP,MAAM,eAAe,GAAG,MAAM,CAAgB,YAAY,CAAC,CAAC;IAC5D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC;IACvE,MAAM,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC;IACpE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAU,CAAC;IAErD,SAAS,CAAC,GAAG,EAAE;QACd,OAAO,GAAG,EAAE;YACX,IAAI,SAAS,EAAE;gBACd,aAAa,CAAC,SAAS,CAAC,CAAC;a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C,CAAC,OAAO,CAAC,GAAG,KAAK;4BAC5C,MAAM,EAAE,MAAM,GAAG,EAAE;4BACnB,KAAK,EAAE,KAAK;yBACZ;qBACD,CAAC,CAAC;iBACH;aACD;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,CACN,iCACE,aAAa,CAAC,GAAG,CAAC,CAAC,YAA2B,EAAE,EAAE,CAAC,CACnD,oBAAC,SAAS,kBACT,GAAG,EAAE,cAAc,YAAY,CAAC,EAAE,EAAE,EACpC,YAAY,EAAE,YAAY,EAC1B,gCAAgC,EAAE,oBAAoB,EACtD,wBAAwB,EAAE,wBAAwB,EAClD,cAAc,EAAE,kBAAkB,EAClC,gBAAgB,EAAE,oBAAoB,IAClC,KAAK,EACR,CACF,CAAC,CACG,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport useNotifications, {\n\tuseNotificationUI,\n\tmoveToToolbarMonitor,\n\tgetNotificationConfig,\n\tgetOS,\n} from \"../../../../hooks/useNotifications\";\nimport { NotificationCardShell } from \"../shared/NotificationCardShell\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { INotificationToastsProps } from \"../../types\";\nimport \"../../../../assets/css/notificationsCenter.css\";\nimport { services } from \"@finsemble/finsemble-api\";\n\ntype INotification = services.notification.types.INotification;\n\ntype ToastCardProps = {\n\tnotification: INotification;\n\tremoveFunction: Function;\n\tisActiveFunction: Function;\n\tinformationalNotificationTimeout: number | false;\n\tactionableTimeoutEnabled: boolean;\n\tnotificationCard?: React.ComponentType<any>;\n};\n\nconst ToastCard = (props: ToastCardProps) => {\n\tconst { notification, informationalNotificationTimeout, removeFunction, isActiveFunction, actionableTimeoutEnabled } =\n\t\tprops;\n\tconst notificationRef = useRef<INotification>(notification);\n\tconst [slideIn, setSlideIn] = useState(isActiveFunction(notification));\n\tconst [showNotification] = useState(isActiveFunction(notification));\n\tconst [timeoutId, setTimeoutId] = useState<number>();\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tif (timeoutId) {\n\t\t\t\tclearInterval(timeoutId);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (timeoutId) {\n\t\t\tclearInterval(timeoutId);\n\t\t}\n\n\t\tif (!notification.actions || notification.actions.length == 0 || actionableTimeoutEnabled) {\n\t\t\t// Is an informational notification or timeout enabled actionable notifications\n\t\t\tlet timeoutLength;\n\n\t\t\tif (informationalNotificationTimeout !== false) {\n\t\t\t\t// Convert to milliseconds\n\t\t\t\ttimeoutLength = informationalNotificationTimeout * 1000;\n\t\t\t\tif (notification.timeout && Number.isInteger(notification.timeout)) {\n\t\t\t\t\ttimeoutLength = notification.timeout;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (timeoutLength) {\n\t\t\t\tsetTimeoutId(\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tsetSlideIn(false);\n\t\t\t\t\t}, timeoutLength) as any\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (!isActiveFunction(notificationRef.current)) {\n\t\t\tremoveFunction(notification);\n\t\t}\n\t\tsetSlideIn(isActiveFunction(notification));\n\t}, [notification]);\n\n\tconst onExited = () => {\n\t\tremoveFunction(notification);\n\t};\n\n\tconst Card = props.notificationCard ? props.notificationCard : NotificationCardShell;\n\n\treturn (\n\t\tshowNotification && (\n\t\t\t<CSSTransition in={slideIn} timeout={500} onExited={onExited} classNames=\"notifications-toast\">\n\t\t\t\t<div className=\"notifications-toast__offscreen\">\n\t\t\t\t\t<Card\n\t\t\t\t\t\tnotification={notification}\n\t\t\t\t\t\tuiContext=\"toasts\"\n\t\t\t\t\t\tremoveNotification={() => {\n\t\t\t\t\t\t\tsetSlideIn(false);\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"divider\"> </div>\n\t\t\t\t</div>\n\t\t\t</CSSTransition>\n\t\t)\n\t);\n};\n\nexport const NotificationsToasts: React.FunctionComponent<INotificationToastsProps> = (props) => {\n\tconst { notifications, notificationIsActive, setOpaqueClassName, removeNotification, activeNotifications } =\n\t\tuseNotifications({ config: { notificationsHistory: { options: { sentAfter: \"startup\" } } } });\n\tconst notificationsRef = useRef<INotification[]>(notifications);\n\tconst [uiState] = useNotificationUI();\n\n\tconst isNotificationActive = (notification: INotification): boolean => {\n\t\tconst notificationCenterNotActive = !uiState.showCenter || uiState.poppedOut;\n\t\treturn notificationIsActive(notification) && notificationCenterNotActive;\n\t};\n\n\tconst config = getNotificationConfig();\n\tconst [isMac] = useState(getOS() === \"Mac\");\n\n\tconst [informationalTimeout, setInformationalTimeout] = useState<number | false>(false);\n\tconst [actionableTimeoutEnabled, setActionableTimeoutEnabled] = useState<boolean>(true);\n\n\tuseEffect(() => {\n\t\tasync function listenForPreferenceChange(error: any, response: any) {\n\t\t\tif (error) {\n\t\t\t\tconsole.error(\"FinsembleUserPreferencesChannel: \", error);\n\t\t\t} else {\n\t\t\t\tconst { data } = response;\n\t\t\t\tif (data.notificationPreferences) {\n\t\t\t\t\tconst { informationalNotificationToastPeriodSeconds, toastTimeoutOnActionableNotifications } =\n\t\t\t\t\t\tdata.notificationPreferences;\n\n\t\t\t\t\tif (informationalNotificationToastPeriodSeconds) {\n\t\t\t\t\t\tsetInformationalTimeout(informationalNotificationToastPeriodSeconds);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (typeof toastTimeoutOnActionableNotifications !== \"undefined\") {\n\t\t\t\t\t\tsetActionableTimeoutEnabled(toastTimeoutOnActionableNotifications);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tFSBL.Clients.RouterClient.addListener(\"FinsembleUserPreferencesChannel\", listenForPreferenceChange);\n\t\treturn () => {\n\t\t\tFSBL.Clients.RouterClient.removeListener(\"FinsembleUserPreferencesChannel\", listenForPreferenceChange);\n\t\t};\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst transparencySupported = config.isTransparent;\n\n\t\tsetOpaqueClassName(!transparencySupported);\n\n\t\tif (transparencySupported) {\n\t\t\tfinsembleWindow.show();\n\t\t}\n\n\t\tasync function getNotificationsPreferences() {\n\t\t\treturn await FSBL.Clients.NotificationClient.getPreferences();\n\t\t}\n\n\t\tgetNotificationsPreferences().then((preferences: any) => {\n\t\t\tsetInformationalTimeout(preferences.informationalNotificationToastPeriodSeconds);\n\t\t});\n\t}, []);\n\n\tuseEffect(() => {\n\t\tmoveToToolbarMonitor().then(async () => {\n\t\t\tlet forceHide = false;\n\t\t\tif (\n\t\t\t\tactiveNotifications(notifications).length === 0 &&\n\t\t\t\tactiveNotifications(notificationsRef.current).length === 0\n\t\t\t) {\n\t\t\t\t// Bug fix: Toasts flash when inActive components (partially caused by allowing notifications to animate out)\n\t\t\t\tforceHide = true;\n\t\t\t}\n\n\t\t\tnotificationsRef.current = notifications;\n\t\t\tconst rect = document.getElementById(\"notifications-toasts\")?.getBoundingClientRect();\n\t\t\tif (notifications.length === 0 || forceHide) {\n\t\t\t\tif (config.isTransparent && !isMac) {\n\t\t\t\t\tconst roundedRect = {\n\t\t\t\t\t\tx: Math.round(rect?.x as number),\n\t\t\t\t\t\ty: Math.round(rect?.y as number),\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\theight: 1,\n\t\t\t\t\t};\n\n\t\t\t\t\tfinsembleWindow.setShape([roundedRect]);\n\t\t\t\t}\n\n\t\t\t\tfinsembleWindow.hide();\n\t\t\t} else {\n\t\t\t\tfinsembleWindow.bringToFront();\n\t\t\t\tif (config.isTransparent && !isMac) {\n\t\t\t\t\tconst roundedRect = {\n\t\t\t\t\t\tx: Math.round(rect?.x as number),\n\t\t\t\t\t\ty: Math.round(rect?.y as number),\n\t\t\t\t\t\twidth: Math.round(rect?.width as number),\n\t\t\t\t\t\theight: Math.round(rect?.height as number),\n\t\t\t\t\t};\n\n\t\t\t\t\tawait finsembleWindow.show();\n\t\t\t\t\tfinsembleWindow.setShape([roundedRect]);\n\t\t\t\t} else {\n\t\t\t\t\tawait finsembleWindow.show();\n\t\t\t\t\tconst { err, data } = await FSBL.Clients.LauncherClient.getMonitorInfo({ monitor: \"mine\" });\n\t\t\t\t\tif (err || !data) {\n\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst { data: bounds } = await finsembleWindow.getBounds();\n\t\t\t\t\tconst width = (bounds?.right ?? 0) - (bounds?.left ?? 0);\n\t\t\t\t\tconst height = Math.round(rect?.height as number) + 6;\n\n\t\t\t\t\tawait finsembleWindow.setBounds({\n\t\t\t\t\t\tbounds: {\n\t\t\t\t\t\t\ttop: data[\"availableRect\"][\"top\"],\n\t\t\t\t\t\t\tleft: data[\"availableRect\"][\"right\"] - width,\n\t\t\t\t\t\t\theight: height + 10,\n\t\t\t\t\t\t\twidth: width,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}, [notifications]);\n\n\treturn (\n\t\t<div>\n\t\t\t{notifications.map((notification: INotification) => (\n\t\t\t\t<ToastCard\n\t\t\t\t\tkey={`toast-card-${notification.id}`}\n\t\t\t\t\tnotification={notification}\n\t\t\t\t\tinformationalNotificationTimeout={informationalTimeout}\n\t\t\t\t\tactionableTimeoutEnabled={actionableTimeoutEnabled}\n\t\t\t\t\tremoveFunction={removeNotification}\n\t\t\t\t\tisActiveFunction={isNotificationActive}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</div>\n\t);\n};\n"]}
|
|
@@ -14,20 +14,17 @@ export default class AppDefinition extends React.Component {
|
|
|
14
14
|
event.dataTransfer.setData("app", JSON.stringify(this.props.app));
|
|
15
15
|
}
|
|
16
16
|
onItemClick() {
|
|
17
|
+
var _a;
|
|
17
18
|
const name = this.props.app.title || this.props.app.name;
|
|
18
19
|
FSBL.Clients.LauncherClient.spawn(name.trim(), {
|
|
19
20
|
addToWorkspace: true,
|
|
20
21
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
value: null,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}, 500);
|
|
22
|
+
if (storeActions.getSearchText()) {
|
|
23
|
+
(_a = getStore()) === null || _a === void 0 ? void 0 : _a.setValue({
|
|
24
|
+
field: "filterText",
|
|
25
|
+
value: null,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
31
28
|
}
|
|
32
29
|
render() {
|
|
33
30
|
const { app } = this.props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppDefinition.js","sourceRoot":"","sources":["../../../../../src/components/toolbar/advancedAppLauncher/components/AppDefinition.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAsBlD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAyB;IACzE,YAAY,KAAa;QACxB,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAKD,cAAc,CAAC,KAAsB;QACpC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC;IAOD,WAAW
|
|
1
|
+
{"version":3,"file":"AppDefinition.js","sourceRoot":"","sources":["../../../../../src/components/toolbar/advancedAppLauncher/components/AppDefinition.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAsBlD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAyB;IACzE,YAAY,KAAa;QACxB,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAKD,cAAc,CAAC,KAAsB;QACpC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC;IAOD,WAAW;;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;QACzD,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE;YAC9C,cAAc,EAAE,IAAI;SACpB,CAAC,CAAC;QAEH,IAAI,YAAY,CAAC,aAAa,EAAE,EAAE;YACjC,MAAA,QAAQ,EAAE,0CAAE,QAAQ,CAAC;gBACpB,KAAK,EAAE,YAAY;gBACnB,KAAK,EAAE,IAAI;aACX,CAAC,CAAC;SACH;IACF,CAAC;IAED,MAAM;QACL,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC3B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC;QACpC,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,IAAI,CAAC;QAChD,MAAM,IAAI,GAAG,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,KAAI,EAAE,CAAC;QAC7B,OAAO,CACN,6BAAK,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,EAAC,eAAe,EAAC,SAAS,EAAC,MAAM,EAAC,WAAW,EAAE,IAAI,CAAC,cAAc;YAC1G,8BAAM,SAAS,EAAC,gBAAgB;gBAC/B,oBAAC,aAAa,IAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAC,aAAa,EAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,GAAI;gBACtF,8BAAM,SAAS,EAAC,UAAU,EAAC,KAAK,EAAE,WAAW,IAC3C,WAAW,CACN,CACD;YACN,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,oBAAC,WAAW,IAAC,IAAI,EAAE,IAAI,GAAI;YAC/C,oBAAC,cAAc,IAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAI,CAClD,CACN,CAAC;IACH,CAAC;CACD","sourcesContent":["import React from \"react\";\nimport AppActionsMenu from \"./AppActionsMenu\";\nimport AppTagsList from \"./AppTagsList\";\nimport { FavoriteMaker } from \"../../../favorites/FavoriteMaker\";\nimport { getStore } from \"../stores/LauncherStore\";\nimport storeActions from \"../stores/StoreActions\";\nimport { FolderAppType, FolderType } from \"../../../../types/advancedAppLauncherTypes\";\nimport { services } from \"@finsemble/finsemble-api\";\n\ntype IconDescriptor = services.window.types.IconDescriptor;\n\ntype App = FolderAppType & {\n\ttitle?: string;\n\ticon?: IconDescriptor;\n};\ninterface IProps {\n\tfolder: FolderType;\n\tapp: App;\n}\n\ninterface IState {}\n\n/**\n * Used to make sure that a user is not waiting for component\n * to spawn after a double click, helps us prevent multiple\n * spawns for the same app.\n */\nexport default class AppDefinition extends React.Component<IProps, IState> {\n\tconstructor(props: IProps) {\n\t\tsuper(props);\n\t\tthis.onDragToFolder = this.onDragToFolder.bind(this);\n\t\tthis.onItemClick = this.onItemClick.bind(this);\n\t}\n\n\t/**\n\t * Native HTML5 drag and drop\n\t **/\n\tonDragToFolder(event: React.DragEvent) {\n\t\tevent.dataTransfer.setData(\"app\", JSON.stringify(this.props.app));\n\t}\n\n\t/**\n\t * Spawns a component on click\n\t * @param {object} e The Synthetic React event\n\t *\n\t */\n\tonItemClick() {\n\t\tconst name = this.props.app.title || this.props.app.name;\n\t\tFSBL.Clients.LauncherClient.spawn(name.trim(), {\n\t\t\taddToWorkspace: true,\n\t\t});\n\t\t// Clear search text so it doesn't persist after app is opened\n\t\tif (storeActions.getSearchText()) {\n\t\t\tgetStore()?.setValue({\n\t\t\t\tfield: \"filterText\",\n\t\t\t\tvalue: null,\n\t\t\t});\n\t\t}\n\t}\n\n\trender() {\n\t\tconst { app } = this.props;\n\t\tconst appId = app.title || app.name;\n\t\tconst displayName = app.displayName || app.name;\n\t\tconst tags = app?.tags || [];\n\t\treturn (\n\t\t\t<div onClick={this.onItemClick} className=\"app-item link\" draggable=\"true\" onDragStart={this.onDragToFolder}>\n\t\t\t\t<span className=\"app-item-title\">\n\t\t\t\t\t<FavoriteMaker id={appId} category=\"Application\" name={displayName} icon={app.icon} />\n\t\t\t\t\t<span className=\"app-name\" title={displayName}>\n\t\t\t\t\t\t{displayName}\n\t\t\t\t\t</span>\n\t\t\t\t</span>\n\t\t\t\t{tags.length > 0 && <AppTagsList tags={tags} />}\n\t\t\t\t<AppActionsMenu app={app} folder={this.props.folder} />\n\t\t\t</div>\n\t\t);\n\t}\n}\n"]}
|