@leav/ui 1.7.0-e23db3d5 → 1.7.0-e4c50c50
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/_gqlTypes/index.d.ts +1 -0
- package/dist/_gqlTypes/index.js +1 -0
- package/dist/_gqlTypes/index.js.map +1 -1
- package/dist/components/Notifications/hooks/useNotificationSubscription.js +3 -3
- package/dist/components/Notifications/hooks/useNotificationSubscription.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,12 +3,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
// This file is released under LGPL V3
|
|
4
4
|
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
|
|
5
5
|
import { useNotificationSubscription } from '../../../_gqlTypes';
|
|
6
|
-
import { SUBSCRIPTION_NOTIFICATION_DURATION } from '../../../constants';
|
|
7
6
|
import { useSharedTranslation } from '../../../hooks/useSharedTranslation';
|
|
8
7
|
import { KitButton, KitSpace, KitNotification, KitTypography } from 'aristid-ds';
|
|
9
8
|
import dayjs from 'dayjs';
|
|
10
9
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
11
10
|
import { faDownload } from '@fortawesome/free-solid-svg-icons';
|
|
11
|
+
import { SUBSCRIPTION_NOTIFICATION_DURATION } from '../../../constants';
|
|
12
12
|
export const useNotificationsSubscription = () => {
|
|
13
13
|
const { t } = useSharedTranslation();
|
|
14
14
|
return useNotificationSubscription({
|
|
@@ -16,14 +16,14 @@ export const useNotificationsSubscription = () => {
|
|
|
16
16
|
if (!data?.data?.notification?.title) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const { level, title, message, attachments, relatedEntities, date } = data.data.notification;
|
|
19
|
+
const { level, title, message, attachments, relatedEntities, date, displayDuration } = data.data.notification;
|
|
20
20
|
const kitNotificationLevel = typeof KitNotification[level] === 'function' ? level : 'info';
|
|
21
21
|
KitNotification[kitNotificationLevel]({
|
|
22
22
|
closable: true,
|
|
23
23
|
message: title,
|
|
24
24
|
description: message,
|
|
25
25
|
messageExtra: (_jsx(KitTypography.Text, { size: "fontSize7", children: dayjs.unix(date).format('HH:mm DD/MM/YYYY') })),
|
|
26
|
-
duration: SUBSCRIPTION_NOTIFICATION_DURATION,
|
|
26
|
+
duration: displayDuration === 0 ? undefined : (displayDuration ?? SUBSCRIPTION_NOTIFICATION_DURATION),
|
|
27
27
|
footer: (_jsxs(KitSpace, { direction: "horizontal", size: "xs", children: [attachments?.map(attachment => (_jsx(KitButton, { type: "secondary", onClick: () => window.open(attachment.url, '_blank'), icon: _jsx(FontAwesomeIcon, { icon: faDownload }), children: t('global.download') }, attachment.url))), relatedEntities?.map(relatedEntity => (_jsx(KitButton, { type: "secondary", onClick: () => {
|
|
28
28
|
window.location.href = relatedEntity.url;
|
|
29
29
|
}, children: relatedEntity.label ?? t('global.show') }, relatedEntity.url)))] })),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotificationSubscription.js","sourceRoot":"","sources":["../../../../src/components/Notifications/hooks/useNotificationSubscription.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,2BAA2B,EAAC,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"useNotificationSubscription.js","sourceRoot":"","sources":["../../../../src/components/Notifications/hooks/useNotificationSubscription.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,2BAA2B,EAAC,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAC/E,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,eAAe,EAAC,MAAM,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AAC,WAAW,EAChB,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,EACpD,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,UAAU,GAAI,YAE1C,CAAC,CAAC,iBAAiB,CAAC,IALhB,UAAU,CAAC,GAAG,CAMX,CACf,CAAC,EACD,eAAe,EAAE,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,CACnC,KAAC,SAAS,IAEN,IAAI,EAAC,WAAW,EAChB,OAAO,EAAE,GAAG,EAAE;gCACV,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC;4BAC7C,CAAC,YAEA,aAAa,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,CAAC,IANnC,aAAa,CAAC,GAAG,CAOd,CACf,CAAC,IACK,CACd;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,eAAe,4BAA4B,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useNotificationSubscription} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitButton, KitSpace, KitNotification, KitTypography} from 'aristid-ds';\nimport dayjs from 'dayjs';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faDownload} from '@fortawesome/free-solid-svg-icons';\nimport {SUBSCRIPTION_NOTIFICATION_DURATION} from '_ui/constants';\n\nexport const useNotificationsSubscription = () => {\n const {t} = useSharedTranslation();\n return useNotificationSubscription({\n onData: ({data}) => {\n if (!data?.data?.notification?.title) {\n return;\n }\n const {level, title, message, attachments, relatedEntities, date, displayDuration} = data.data.notification;\n const kitNotificationLevel = typeof KitNotification[level] === 'function' ? level : 'info';\n\n KitNotification[kitNotificationLevel]({\n closable: true,\n message: title,\n description: message,\n messageExtra: (\n <KitTypography.Text size=\"fontSize7\">\n {dayjs.unix(date).format('HH:mm DD/MM/YYYY')}\n </KitTypography.Text>\n ),\n duration: displayDuration === 0 ? undefined : (displayDuration ?? SUBSCRIPTION_NOTIFICATION_DURATION),\n footer: (\n <KitSpace direction=\"horizontal\" size=\"xs\">\n {attachments?.map(attachment => (\n <KitButton\n key={attachment.url}\n type=\"secondary\"\n onClick={() => window.open(attachment.url, '_blank')}\n icon={<FontAwesomeIcon icon={faDownload} />}\n >\n {t('global.download')}\n </KitButton>\n ))}\n {relatedEntities?.map(relatedEntity => (\n <KitButton\n key={relatedEntity.url}\n type=\"secondary\"\n onClick={() => {\n window.location.href = relatedEntity.url;\n }}\n >\n {relatedEntity.label ?? t('global.show')}\n </KitButton>\n ))}\n </KitSpace>\n ),\n });\n },\n });\n};\n\nexport default useNotificationsSubscription;\n"]}
|