@stack-spot/portal-components 1.3.1-rc → 1.3.3-rc
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/components/AsyncContent.d.ts +7 -0
- package/dist/components/AsyncContent.d.ts.map +1 -1
- package/dist/components/AsyncContent.js +7 -0
- package/dist/components/AsyncContent.js.map +1 -1
- package/dist/components/InfiniteScroll.d.ts +8 -0
- package/dist/components/InfiniteScroll.d.ts.map +1 -1
- package/dist/components/InfiniteScroll.js +8 -0
- package/dist/components/InfiniteScroll.js.map +1 -1
- package/dist/components/Notifications/NotificationComponent.d.ts +2 -2
- package/dist/components/Notifications/NotificationComponent.d.ts.map +1 -1
- package/dist/components/Notifications/NotificationComponent.js +12 -5
- package/dist/components/Notifications/NotificationComponent.js.map +1 -1
- package/dist/components/Notifications/NotificationItem.d.ts +2 -2
- package/dist/components/Notifications/NotificationItem.d.ts.map +1 -1
- package/dist/components/Notifications/NotificationItem.js +21 -7
- package/dist/components/Notifications/NotificationItem.js.map +1 -1
- package/dist/components/ScrollView.d.ts +5 -0
- package/dist/components/ScrollView.d.ts.map +1 -1
- package/dist/components/ScrollView.js +5 -0
- package/dist/components/ScrollView.js.map +1 -1
- package/dist/components/StatusCircle.d.ts +12 -0
- package/dist/components/StatusCircle.d.ts.map +1 -1
- package/dist/components/StatusCircle.js +20 -0
- package/dist/components/StatusCircle.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AsyncContent.tsx +8 -0
- package/src/components/InfiniteScroll.tsx +8 -0
- package/src/components/Notifications/NotificationComponent.tsx +28 -18
- package/src/components/Notifications/NotificationItem.tsx +45 -23
- package/src/components/ScrollView.tsx +6 -0
- package/src/components/StatusCircle.tsx +25 -0
|
@@ -34,6 +34,13 @@ interface Props {
|
|
|
34
34
|
*/
|
|
35
35
|
errorDetails: ErrorProps;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Renders a component that provides user feedback on async requests.
|
|
39
|
+
* It renders either a loading component, an error component (which is received as prop)
|
|
40
|
+
* or the received children props.
|
|
41
|
+
*
|
|
42
|
+
* @param options the props for rendering the component: {@link Props}.
|
|
43
|
+
*/
|
|
37
44
|
export declare const AsyncContent: ({ loading, error, autofocus, children, errorDetails }: Props) => string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
38
45
|
export {};
|
|
39
46
|
//# sourceMappingURL=AsyncContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncContent.d.ts","sourceRoot":"","sources":["../../src/components/AsyncContent.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAA8B,MAAM,OAAO,CAAA;AAEpE,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,cAAc,EAAG,KAAK,CAAC,EAAE,CAAC;QAAE,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAC1C;;OAEG;IACH,WAAW,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CACnC;AAED,UAAU,KAAK;IACb;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;MAEE;IACF,YAAY,EAAE,UAAU,CAAC;CAC1B;AAED,eAAO,MAAM,YAAY,0DAA2D,KAAK,iIA8BxF,CAAA"}
|
|
1
|
+
{"version":3,"file":"AsyncContent.d.ts","sourceRoot":"","sources":["../../src/components/AsyncContent.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAA8B,MAAM,OAAO,CAAA;AAEpE,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,cAAc,EAAG,KAAK,CAAC,EAAE,CAAC;QAAE,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAC1C;;OAEG;IACH,WAAW,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CACnC;AAED,UAAU,KAAK;IACb;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;MAEE;IACF,YAAY,EAAE,UAAU,CAAC;CAC1B;AAED;;;;;;GAMG;AAEH,eAAO,MAAM,YAAY,0DAA2D,KAAK,iIA8BxF,CAAA"}
|
|
@@ -2,6 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Flex } from '@citric/core';
|
|
3
3
|
import { LoadingCircular } from '@citric/ui';
|
|
4
4
|
import { useEffect, useLayoutEffect } from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Renders a component that provides user feedback on async requests.
|
|
7
|
+
* It renders either a loading component, an error component (which is received as prop)
|
|
8
|
+
* or the received children props.
|
|
9
|
+
*
|
|
10
|
+
* @param options the props for rendering the component: {@link Props}.
|
|
11
|
+
*/
|
|
5
12
|
export const AsyncContent = ({ loading, error, autofocus, children, errorDetails }) => {
|
|
6
13
|
const ErrorComponent = errorDetails.errorComponent;
|
|
7
14
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncContent.js","sourceRoot":"","sources":["../../src/components/AsyncContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAoB,SAAS,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAqCpE,MAAM,CAAC,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AAA;AACjB,CAAC,CAAA"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { Props as ReactInfiniteScrollProps } from 'react-infinite-scroll-component';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a component that provides infinite scroll.
|
|
4
|
+
*
|
|
5
|
+
* The component wraps around the ReactInfiniteScroll component.
|
|
6
|
+
* It provides a loading indicator using citric loading circular and custom styles.
|
|
7
|
+
*
|
|
8
|
+
* By default, it adds the scrollable target as page and overflow hidden.
|
|
9
|
+
*/
|
|
2
10
|
export declare const InfiniteScroll: ({ style, children, scrollableTarget, ...props }: Omit<ReactInfiniteScrollProps, 'loader'>) => import("react/jsx-runtime").JSX.Element;
|
|
3
11
|
//# sourceMappingURL=InfiniteScroll.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfiniteScroll.d.ts","sourceRoot":"","sources":["../../src/components/InfiniteScroll.tsx"],"names":[],"mappings":"AACA,OAA4B,EAAE,KAAK,IAAI,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAExG,eAAO,MAAM,cAAc,oDAAqD,KAAK,wBAAwB,EAAE,QAAQ,CAAC,4CASvH,CAAA"}
|
|
1
|
+
{"version":3,"file":"InfiniteScroll.d.ts","sourceRoot":"","sources":["../../src/components/InfiniteScroll.tsx"],"names":[],"mappings":"AACA,OAA4B,EAAE,KAAK,IAAI,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAExG;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,oDAAqD,KAAK,wBAAwB,EAAE,QAAQ,CAAC,4CASvH,CAAA"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { LoadingCircular } from '@citric/ui';
|
|
3
3
|
import ReactInfiniteScroll from 'react-infinite-scroll-component';
|
|
4
|
+
/**
|
|
5
|
+
* Renders a component that provides infinite scroll.
|
|
6
|
+
*
|
|
7
|
+
* The component wraps around the ReactInfiniteScroll component.
|
|
8
|
+
* It provides a loading indicator using citric loading circular and custom styles.
|
|
9
|
+
*
|
|
10
|
+
* By default, it adds the scrollable target as page and overflow hidden.
|
|
11
|
+
*/
|
|
4
12
|
export const InfiniteScroll = ({ style, children, scrollableTarget, ...props }) => (_jsx(ReactInfiniteScroll, { loader: _jsx(LoadingCircular, {}), scrollableTarget: scrollableTarget || 'page', style: { overflow: 'hidden', ...style }, ...props, children: children }));
|
|
5
13
|
//# sourceMappingURL=InfiniteScroll.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfiniteScroll.js","sourceRoot":"","sources":["../../src/components/InfiniteScroll.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,mBAA0D,MAAM,iCAAiC,CAAA;AAExG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,KAAK,EAA4C,EAAE,EAAE,CAAC,CAC3H,KAAC,mBAAmB,IAClB,MAAM,EAAE,KAAC,eAAe,KAAG,EAC3B,gBAAgB,EAAE,gBAAgB,IAAI,MAAM,EAC5C,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,KACnC,KAAK,YAER,QAAQ,GACW,CACvB,CAAA"}
|
|
1
|
+
{"version":3,"file":"InfiniteScroll.js","sourceRoot":"","sources":["../../src/components/InfiniteScroll.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,mBAA0D,MAAM,iCAAiC,CAAA;AAExG;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,KAAK,EAA4C,EAAE,EAAE,CAAC,CAC3H,KAAC,mBAAmB,IAClB,MAAM,EAAE,KAAC,eAAe,KAAG,EAC3B,gBAAgB,EAAE,gBAAgB,IAAI,MAAM,EAC5C,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,KACnC,KAAK,YAER,QAAQ,GACW,CACvB,CAAA"}
|
|
@@ -5,7 +5,7 @@ interface Props {
|
|
|
5
5
|
hasUnreadNotification?: boolean;
|
|
6
6
|
}
|
|
7
7
|
interface Props {
|
|
8
|
-
|
|
8
|
+
onMarkAsReadUnread: (notificationId: string, read: boolean, type: 'callToAction' | 'icon') => void;
|
|
9
9
|
notifications?: StackspotNotification[];
|
|
10
10
|
isLoading: boolean;
|
|
11
11
|
error?: any;
|
|
@@ -19,6 +19,6 @@ interface Props {
|
|
|
19
19
|
placeholderComponent: ReactElement;
|
|
20
20
|
isSummary: boolean;
|
|
21
21
|
}
|
|
22
|
-
export declare const NotificationComponent: ({ hasUnreadNotification,
|
|
22
|
+
export declare const NotificationComponent: ({ hasUnreadNotification, onMarkAsReadUnread, notifications, isLoading, error, type, onUpdateType, onClickViewNotifications, onClickViewAll, errorDetails, fetchNextPage, hasNextPage, placeholderComponent, isSummary, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
export {};
|
|
24
24
|
//# sourceMappingURL=NotificationComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationComponent.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"NotificationComponent.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAA;AAG9C,OAAO,EAAgB,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAK1D,OAAO,EAAoB,uBAAuB,EAAE,qBAAqB,EAAc,MAAM,SAAS,CAAA;AAEtG,UAAU,KAAK;IACb,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAkHD,UAAU,KAAK;IACb,kBAAkB,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,KAAK,IAAI,CAAC;IACnG,aAAa,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACxC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,YAAY,EAAE,UAAU,CAAC;IACzB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,uBAAuB,CAAC;IAC/B,YAAY,EAAE,CAAC,WAAW,CAAC,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAC9D,oBAAoB,EAAE,YAAY,CAAC;IACnC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,qBAAqB,6NAK/B,KAAK,4CAqFP,CAAA"}
|
|
@@ -5,6 +5,7 @@ import { listToClass, theme } from '@stack-spot/portal-theme';
|
|
|
5
5
|
import { useTranslate } from '@stack-spot/portal-translate';
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
+
import { IconButton } from '@citric/ui';
|
|
8
9
|
import { AsyncContent } from '../AsyncContent.js';
|
|
9
10
|
import { InfiniteScroll } from '../InfiniteScroll.js';
|
|
10
11
|
import { ScrollView } from '../ScrollView.js';
|
|
@@ -18,7 +19,7 @@ const NotificationsComponent = styled(Flex) `
|
|
|
18
19
|
z-index: 1;
|
|
19
20
|
visibility: hidden;
|
|
20
21
|
position: absolute;
|
|
21
|
-
top: calc(var(--header-height)
|
|
22
|
+
top: calc(var(--header-height) + 4px);
|
|
22
23
|
right: -270%;
|
|
23
24
|
width: 400px;
|
|
24
25
|
|
|
@@ -41,7 +42,7 @@ const NotificationsComponent = styled(Flex) `
|
|
|
41
42
|
&::after {
|
|
42
43
|
content: '';
|
|
43
44
|
position: absolute;
|
|
44
|
-
border-width:
|
|
45
|
+
border-width: 8px 32px;
|
|
45
46
|
border-style: solid;
|
|
46
47
|
border-color: transparent;
|
|
47
48
|
bottom: 100%;
|
|
@@ -65,16 +66,16 @@ const NotificationsFilter = ({ type, onChangeFilterType }) => {
|
|
|
65
66
|
const t = useTranslate(dictionary);
|
|
66
67
|
return (_jsxs(Flex, { alignItems: "center", sx: { gap: '4px' }, my: "5", children: [_jsx(Button, { "aria-pressed": !type, appearance: "text", role: "button", "aria-label": t.filterAll, onClick: () => onChangeFilterType(), sx: { borderColor: !type ? 'primary' : 'transparent' }, children: _jsx(Text, { colorScheme: "inverse", appearance: "microtext1", children: t.all }) }), _jsx(NotificationFilterButton, { type: type, onChangeFilterType: onChangeFilterType, ariaLabel: t.filterUnread, label: t.unread, enumType: UnreadType.Unread }), _jsx(NotificationFilterButton, { type: type, onChangeFilterType: onChangeFilterType, ariaLabel: t.filterHigh, label: t.high, enumType: NotificationType.High }), _jsx(NotificationFilterButton, { type: type, onChangeFilterType: onChangeFilterType, ariaLabel: t.filterMedium, label: t.medium, enumType: NotificationType.Medium }), _jsx(NotificationFilterButton, { type: type, onChangeFilterType: onChangeFilterType, ariaLabel: t.filterLow, label: t.low, enumType: NotificationType.Low })] }));
|
|
67
68
|
};
|
|
68
|
-
export const NotificationComponent = ({ hasUnreadNotification,
|
|
69
|
+
export const NotificationComponent = ({ hasUnreadNotification, onMarkAsReadUnread, notifications, isLoading, error, type, onUpdateType, onClickViewNotifications, onClickViewAll, errorDetails, fetchNextPage, hasNextPage, placeholderComponent, isSummary = false, }) => {
|
|
69
70
|
const t = useTranslate(dictionary);
|
|
70
71
|
const [visible, setVisible] = useState(false);
|
|
71
72
|
const updateType = (updatedType) => {
|
|
72
73
|
onUpdateType(updatedType);
|
|
73
74
|
};
|
|
74
|
-
return (_jsxs(Flex, { sx: { position: 'relative' }, children: [_jsx(
|
|
75
|
+
return (_jsxs(Flex, { sx: { position: 'relative' }, children: [_jsx(IconButton, { "aria-label": t.openNotifications, onClick: () => {
|
|
75
76
|
onClickViewNotifications();
|
|
76
77
|
setVisible(true);
|
|
77
|
-
}, className: "notificationsTour", children: _jsx(Bell, {}) }), hasUnreadNotification && _jsx(Box, { sx: { position: 'absolute', right: '2px' }, children: _jsx(StatusCircle, { status: 'danger' }) }), _jsx(NotificationsComponent, { className: listToClass(['selection-list', visible ? 'visible' : undefined]), "$scroll": true, "aria-hidden": !visible, children: _jsxs(Flex, { className: "content", p: 5, flexDirection: "column", justifyContent: "space-between", children: [_jsxs(Flex, { children: [_jsxs(Flex, { justifyContent: "space-between", w: "100%", children: [_jsx(Text, { appearance: "h4", children: t.notifications }), _jsx(
|
|
78
|
+
}, sx: { border: 'none', bg: 'transparent' }, children: _jsx(IconBox, { size: "md", className: "notificationsTour", children: _jsx(Bell, {}) }) }), hasUnreadNotification && _jsx(Box, { sx: { position: 'absolute', right: '2px' }, "aria-label": t.hasUnread, children: _jsx(StatusCircle, { status: 'danger' }) }), _jsx(NotificationsComponent, { className: listToClass(['selection-list', visible ? 'visible' : undefined]), "$scroll": true, "aria-hidden": !visible, children: _jsxs(Flex, { className: "content", p: 5, flexDirection: "column", justifyContent: "space-between", children: [_jsxs(Flex, { w: "100%", children: [_jsxs(Flex, { justifyContent: "space-between", w: "100%", children: [_jsx(Text, { appearance: "h4", children: t.notifications }), _jsx(IconButton, { onClick: () => setVisible(false), "aria-label": t.close, children: _jsx(IconBox, { size: "xs", children: _jsx(TimesMini, {}) }) })] }), _jsx(NotificationsFilter, { type: type, onChangeFilterType: updateType }), _jsx(AsyncContent, { error: error, errorDetails: errorDetails, loading: isLoading, children: notifications?.length ? _jsx(StyledBox, { children: _jsx(InfiniteScroll, { dataLength: notifications?.length || 0, next: fetchNextPage, hasMore: hasNextPage, children: _jsx(ScrollView, { direction: "vertical", style: { maxHeight: '630px' }, children: _jsx(Flex, { sx: { gap: '4px' }, mr: "3", children: notifications?.map((item) => (_jsx(NotificationItem, { notification: item, isSummary: isSummary, onClickMarkReadUnread: (read, type) => onMarkAsReadUnread(item.id, read, type) }, item.id))) }) }) }) })
|
|
78
79
|
:
|
|
79
80
|
_jsx(_Fragment, { children: placeholderComponent }) })] }), _jsx(Flex, { w: "100%", pt: 3, children: _jsx(Button, { size: "sm", sx: { width: '100%' }, colorScheme: "inverse", appearance: "text", onClick: () => {
|
|
80
81
|
setVisible(false);
|
|
@@ -95,6 +96,9 @@ const dictionary = {
|
|
|
95
96
|
medium: 'Medium',
|
|
96
97
|
low: 'Low',
|
|
97
98
|
seeAll: 'See all notifications',
|
|
99
|
+
openNotifications: 'View notifications',
|
|
100
|
+
hasUnread: 'Has Unread notifications',
|
|
101
|
+
close: 'Close',
|
|
98
102
|
},
|
|
99
103
|
pt: {
|
|
100
104
|
notifications: 'Notificações',
|
|
@@ -109,6 +113,9 @@ const dictionary = {
|
|
|
109
113
|
medium: 'Médio',
|
|
110
114
|
low: 'Baixo',
|
|
111
115
|
seeAll: 'Ver todas as notificações',
|
|
116
|
+
openNotifications: 'Visualizar notificações',
|
|
117
|
+
hasUnread: 'Existem notificações não lidas',
|
|
118
|
+
close: 'Fechar',
|
|
112
119
|
},
|
|
113
120
|
};
|
|
114
121
|
//# sourceMappingURL=NotificationComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationComponent.js","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC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,EAAE,UAAU,CAAC,MAAM,GACvE,EACF,KAAC,wBAAwB,IACvB,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,kBAAkB,EAClD,SAAS,EAAE,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,gBAAgB,CAAC,IAAI,GACvE,EACF,KAAC,wBAAwB,IACvB,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,kBAAkB,EAClD,SAAS,EAAE,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,gBAAgB,CAAC,MAAM,GAC7E,EACF,KAAC,wBAAwB,IACvB,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,kBAAkB,EAClD,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,gBAAgB,CAAC,GAAG,GACpE,IACG,CAAC,CAAA;AACV,CAAC,CAAA;AAkBD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EACpC,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"NotificationComponent.js","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAgB,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,YA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C,UAAU,EAAE,2BAA2B;QACvC,YAAY,EAAE,6BAA6B;QAC3C,SAAS,EAAE,0BAA0B;QACrC,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;QAChB,GAAG,EAAE,KAAK;QACV,MAAM,EAAE,uBAAuB;QAC/B,iBAAiB,EAAE,oBAAoB;QACvC,SAAS,EAAE,0BAA0B;QACrC,KAAK,EAAE,OAAO;KACf;IACD,EAAE,EAAE;QACF,aAAa,EAAE,cAAc;QAC7B,GAAG,EAAE,OAAO;QACZ,SAAS,EAAE,gCAAgC;QAC3C,YAAY,EAAE,gCAAgC;QAC9C,UAAU,EAAE,uCAAuC;QACnD,YAAY,EAAE,wCAAwC;QACtD,SAAS,EAAE,wCAAwC;QACnD,MAAM,EAAE,WAAW;QACnB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,OAAO;QACf,GAAG,EAAE,OAAO;QACZ,MAAM,EAAE,2BAA2B;QACnC,iBAAiB,EAAE,yBAAyB;QAC5C,SAAS,EAAE,gCAAgC;QAC3C,KAAK,EAAE,QAAQ;KAChB;CACmB,CAAA"}
|
|
@@ -4,8 +4,8 @@ interface Props {
|
|
|
4
4
|
isSummary: boolean;
|
|
5
5
|
}
|
|
6
6
|
interface NotificationItemProps extends Props {
|
|
7
|
-
|
|
7
|
+
onClickMarkReadUnread: (read: boolean, type: 'callToAction' | 'icon') => void;
|
|
8
8
|
}
|
|
9
|
-
export declare const NotificationItem: ({ notification, isSummary,
|
|
9
|
+
export declare const NotificationItem: ({ notification, isSummary, onClickMarkReadUnread }: NotificationItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=NotificationItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationItem.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationItem.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAe/C,UAAU,KAAK;IACb,YAAY,EAAE,qBAAqB,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"NotificationItem.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationItem.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAe/C,UAAU,KAAK;IACb,YAAY,EAAE,qBAAqB,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;CACpB;AAgGD,UAAU,qBAAsB,SAAQ,KAAK;IAC3C,qBAAqB,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,KAAK,IAAI,CAAC;CAC/E;AAED,eAAO,MAAM,gBAAgB,uDAAwD,qBAAqB,4CAQzG,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Flex, IconBox, Text } from '@citric/core';
|
|
3
3
|
import { Envelope, EnvelopeOpen } from '@citric/icons';
|
|
4
|
-
import {
|
|
4
|
+
import { IconButton, Tooltip } from '@citric/ui';
|
|
5
5
|
import { useTranslate } from '@stack-spot/portal-translate';
|
|
6
6
|
import { differenceInDays, parseISO } from 'date-fns';
|
|
7
7
|
import { useAnchorTag } from '../../context/anchor.js';
|
|
@@ -18,9 +18,19 @@ const statusToColor = {
|
|
|
18
18
|
MEDIUM: 'warning.500',
|
|
19
19
|
HIGH: 'danger.500',
|
|
20
20
|
};
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const style = {
|
|
22
|
+
tooltip: {
|
|
23
|
+
'&::after': {
|
|
24
|
+
top: '25%',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const NotificationHeader = ({ notification, isSummary, onClickMarkReadUnread }) => {
|
|
29
|
+
const t = useTranslate(dictionary);
|
|
30
|
+
return (_jsxs(Flex, { justifyContent: "space-between", mb: 2, sx: { maxWidth: isSummary ? '330px' : '100%' }, flexWrap: "nowrap", children: [_jsx(Text, { appearance: isSummary ? 'body2' : 'body1', nowrapEllipsis: true, children: notification.title }), _jsx(Tooltip, { text: notification.committed ? t.markAsUnread : t.markAsRead, position: "left", id: `tooltip-${notification.title}`, role: "tooltip", sx: style.tooltip, children: _jsx(IconButton, { "aria-describedby": `tooltip-${notification.title}`, children: _jsx(IconBox, { size: "xs", onClick: () => {
|
|
31
|
+
onClickMarkReadUnread(!notification.committed, 'icon');
|
|
32
|
+
}, children: notification.committed ? _jsx(Envelope, {}) : _jsx(EnvelopeOpen, {}) }) }) })] }));
|
|
33
|
+
};
|
|
24
34
|
const getDaysAgo = (dateString) => {
|
|
25
35
|
const givenDate = parseISO(dateString);
|
|
26
36
|
const today = new Date();
|
|
@@ -32,12 +42,12 @@ const NotificationContent = ({ notification, isSummary }) => {
|
|
|
32
42
|
const daysAgo = getDaysAgo(notification.trigger_at);
|
|
33
43
|
return (_jsxs(_Fragment, { children: [!isSummary && _jsx(Flex, { mt: 4, mb: 3, children: _jsx(LazyMarkdown, { children: notification.description }) }), _jsxs(Flex, { children: [_jsx(Text, { appearance: "microtext1", colorScheme: "light.700", children: t[notification.context] }), _jsx(Text, { appearance: "microtext1", colorScheme: "light.700", mx: "2", children: "\u2022" }), !isSummary && _jsxs(_Fragment, { children: [_jsx(Text, { appearance: "microtext1", colorScheme: "light.700", children: formatDate(notification.created_at) }), _jsx(Text, { appearance: "microtext1", colorScheme: "light.700", mx: "2", children: "\u2022" })] }), _jsx(Text, { appearance: "microtext1", colorScheme: "light.700", children: daysAgo > 0 ? daysAgo + ' ' + t.daysAgo : t.today })] })] }));
|
|
34
44
|
};
|
|
35
|
-
const NotificationFooter = ({ call_to_action,
|
|
45
|
+
const NotificationFooter = ({ call_to_action, onClickMarkReadUnread }) => {
|
|
36
46
|
const t = useTranslate(dictionary);
|
|
37
47
|
const Link = useAnchorTag();
|
|
38
|
-
return (_jsx(Flex, { mt: "5", children: _jsx(Button, { size: "sm", colorScheme: "inverse", onClick: () =>
|
|
48
|
+
return (_jsx(Flex, { mt: "5", children: _jsx(Button, { size: "sm", colorScheme: "inverse", onClick: () => onClickMarkReadUnread('callToAction'), children: _jsx(Link, { href: call_to_action, children: _jsx(Text, { colorScheme: 'inverse.contrastText', children: t.takeMeThere }) }) }) }));
|
|
39
49
|
};
|
|
40
|
-
export const NotificationItem = ({ notification, isSummary,
|
|
50
|
+
export const NotificationItem = ({ notification, isSummary, onClickMarkReadUnread }) => (_jsxs(Flex, { bg: "light.400", p: "3 3 3 5", r: "xs", flexDirection: "column", w: "100%", sx: styles.item(statusToColor[notification.criticality], notification.committed), children: [_jsx(NotificationHeader, { notification: notification, isSummary: isSummary, onClickMarkReadUnread: onClickMarkReadUnread }), _jsx(NotificationContent, { notification: notification, isSummary: isSummary }), notification.call_to_action && _jsx(NotificationFooter, { call_to_action: notification.call_to_action, onClickMarkReadUnread: (type) => onClickMarkReadUnread(!notification.committed, type) })] }));
|
|
41
51
|
const dictionary = {
|
|
42
52
|
en: {
|
|
43
53
|
takeMeThere: 'Take me there',
|
|
@@ -46,6 +56,8 @@ const dictionary = {
|
|
|
46
56
|
STUDIO: 'Studio',
|
|
47
57
|
daysAgo: 'days ago',
|
|
48
58
|
today: 'today',
|
|
59
|
+
markAsRead: 'Mark as read',
|
|
60
|
+
markAsUnread: 'Mark as unread',
|
|
49
61
|
},
|
|
50
62
|
pt: {
|
|
51
63
|
takeMeThere: 'Leve-me para lá',
|
|
@@ -54,6 +66,8 @@ const dictionary = {
|
|
|
54
66
|
STUDIO: 'Estúdio',
|
|
55
67
|
daysAgo: 'dias atrás',
|
|
56
68
|
today: 'hoje',
|
|
69
|
+
markAsRead: 'Marcar como lido',
|
|
70
|
+
markAsUnread: 'Marcar como não lido',
|
|
57
71
|
},
|
|
58
72
|
};
|
|
59
73
|
//# sourceMappingURL=NotificationItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationItem.js","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"NotificationItem.js","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAiD,IAAI,EAAE,MAAM,cAAc,CAAA;AACzG,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAGpD,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,CAAC,KAAa,EAAE,MAAe,EAAE,EAAE,CAAC,CAAC;QACzC,UAAU,EAAE,aAAa,KAAK,EAAE;QAChC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAC1B,CAAC;CACgD,CAAA;AAEpD,MAAM,aAAa,GAAkD;IACnE,GAAG,EAAE,aAAa;IAClB,MAAM,EAAE,aAAa;IACrB,IAAI,EAAE,YAAY;CACnB,CAAA;AAOD,MAAM,KAAK,GAAW;IACpB,OAAO,EAAE;QACP,UAAU,EAAC;YACT,GAAG,EAAE,KAAK;SACX;KACF;CACF,CAAA;AAED,MAAM,kBAAkB,GAAG,CAAC,EAA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QACF,WAAW,EAAE,eAAe;QAC5B,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,WAAW;QACtB,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,cAAc;QAC1B,YAAY,EAAE,gBAAgB;KAC/B;IACD,EAAE,EAAE;QACF,WAAW,EAAE,iBAAiB;QAC9B,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,WAAW;QACtB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,kBAAkB;QAC9B,YAAY,EAAE,sBAAsB;KACrC;CACmB,CAAA"}
|
|
@@ -22,6 +22,11 @@ interface Props {
|
|
|
22
22
|
*/
|
|
23
23
|
scrollType?: 'auto' | 'scroll';
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Renders a component that provides scrolling.
|
|
27
|
+
*
|
|
28
|
+
* @param options the props for rendering the component: {@link Props}.
|
|
29
|
+
*/
|
|
25
30
|
export declare const ScrollView: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Props>> & string;
|
|
26
31
|
export {};
|
|
27
32
|
//# sourceMappingURL=ScrollView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../src/components/ScrollView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAIvF,KAAK,KAAK,GAAG,6BAA6B,GAAG,yBAAyB,CAAA;AAEtE,UAAU,KAAK;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;IAC/C;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAChC;AAQD,eAAO,MAAM,UAAU,0OAgBtB,CAAA"}
|
|
1
|
+
{"version":3,"file":"ScrollView.d.ts","sourceRoot":"","sources":["../../src/components/ScrollView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAIvF,KAAK,KAAK,GAAG,6BAA6B,GAAG,yBAAyB,CAAA;AAEtE,UAAU,KAAK;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;IAC/C;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAChC;AAQD;;;;GAIG;AAEH,eAAO,MAAM,UAAU,0OAgBtB,CAAA"}
|
|
@@ -5,6 +5,11 @@ function getDirectionStyle({ direction = 'both', scrollType = 'auto' }) {
|
|
|
5
5
|
const y = direction === 'both' || direction === 'vertical' ? `overflow-x: ${scrollType};` : '';
|
|
6
6
|
return `${x}${y}`;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Renders a component that provides scrolling.
|
|
10
|
+
*
|
|
11
|
+
* @param options the props for rendering the component: {@link Props}.
|
|
12
|
+
*/
|
|
8
13
|
export const ScrollView = styled.div `
|
|
9
14
|
${getDirectionStyle}
|
|
10
15
|
&::-webkit-scrollbar {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollView.js","sourceRoot":"","sources":["../../src/components/ScrollView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,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,UAAU,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9F,OAAO,GAAG,CAAC,GAAG,CAAC,EAAE,CAAA;AACnB,CAAC;AAED;;;;GAIG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAO;IACvC,iBAAiB;;;;;;kBAMH,CAAC,EAAE,KAAK,EAAE,UAAU,GAAG,WAAW,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;;;;;;kBAMpE,CAAC,EAAE,KAAK,EAAE,UAAU,GAAG,WAAW,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;;;CAGrF,CAAA"}
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export type Status = 'success' | 'warning' | 'danger' | 'unknown' | 'progress';
|
|
3
3
|
interface Props {
|
|
4
|
+
/** The status of the component which determines its color */
|
|
4
5
|
status?: Status;
|
|
6
|
+
/** Tooltip text to be displayed on hover */
|
|
5
7
|
tooltip?: string;
|
|
6
8
|
}
|
|
7
9
|
interface WithTooltip {
|
|
10
|
+
/** Tooltip text to be displayed on hover */
|
|
8
11
|
tooltip?: string;
|
|
12
|
+
/** Additional class names for the component */
|
|
9
13
|
className?: string;
|
|
14
|
+
/** Inline styles for the component */
|
|
10
15
|
style?: React.CSSProperties;
|
|
11
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* StatusCircle component that displays a colored circle based on the status.
|
|
19
|
+
* It also supports an optional tooltip.
|
|
20
|
+
*
|
|
21
|
+
* @param {Props} props - The props for the StatusCircle component.
|
|
22
|
+
* @returns {JSX.Element} The StatusCircle component.
|
|
23
|
+
*/
|
|
12
24
|
export declare const StatusCircle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<WithTooltip, Props>> & string & Omit<({ tooltip, className, style }: WithTooltip) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
|
|
13
25
|
export {};
|
|
14
26
|
//# sourceMappingURL=StatusCircle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusCircle.d.ts","sourceRoot":"","sources":["../../src/components/StatusCircle.tsx"],"names":[],"mappings":";AAOA,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAA;AAE9E,UAAU,KAAK;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"StatusCircle.d.ts","sourceRoot":"","sources":["../../src/components/StatusCircle.tsx"],"names":[],"mappings":";AAOA,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAA;AAE9E,UAAU,KAAK;IACb,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAsBD,UAAU,WAAW;IACnB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAaD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,4LAZiC,WAAW,4FAiBpE,CAAA"}
|
|
@@ -9,14 +9,34 @@ const statusToColor = {
|
|
|
9
9
|
progress: 'secondary.500',
|
|
10
10
|
unknown: 'light.contrastText',
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Get the color corresponding to the status.
|
|
14
|
+
*
|
|
15
|
+
* @param {Theme} theme - The theme object.
|
|
16
|
+
* @param {Status} [status] - The status of the component.
|
|
17
|
+
* @returns {string} The color corresponding to the status.
|
|
18
|
+
*/
|
|
12
19
|
function getColorFromStatus(theme, status) {
|
|
13
20
|
const colorName = status && status in statusToColor ? statusToColor[status] : statusToColor.unknown;
|
|
14
21
|
return getColor(theme, colorName);
|
|
15
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* CircleWithTooltip component that displays a circle with an optional tooltip.
|
|
25
|
+
*
|
|
26
|
+
* @param {WithTooltip} props - The props for the CircleWithTooltip component.
|
|
27
|
+
* @returns {JSX.Element} The CircleWithTooltip component.
|
|
28
|
+
*/
|
|
16
29
|
const CircleWithTooltip = ({ tooltip, className, style }) => {
|
|
17
30
|
const circle = _jsx("div", { style: style, className: className });
|
|
18
31
|
return tooltip && tooltip.length ? _jsx(Tooltip, { text: tooltip, children: circle }) : circle;
|
|
19
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* StatusCircle component that displays a colored circle based on the status.
|
|
35
|
+
* It also supports an optional tooltip.
|
|
36
|
+
*
|
|
37
|
+
* @param {Props} props - The props for the StatusCircle component.
|
|
38
|
+
* @returns {JSX.Element} The StatusCircle component.
|
|
39
|
+
*/
|
|
20
40
|
export const StatusCircle = styled(CircleWithTooltip) `
|
|
21
41
|
background-color: ${({ status, theme }) => getColorFromStatus(theme, status)};
|
|
22
42
|
width: 12px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusCircle.js","sourceRoot":"","sources":["../../src/components/StatusCircle.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,MAAM,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"StatusCircle.js","sourceRoot":"","sources":["../../src/components/StatusCircle.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAatC,MAAM,aAAa,GAA0B;IAC3C,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;IACtB,MAAM,EAAE,YAAY;IACpB,QAAQ,EAAE,eAAe;IACzB,OAAO,EAAE,oBAAoB;CAC9B,CAAA;AAED;;;;;;GAMG;AACH,SAAS,kBAAkB,CAAC,KAAY,EAAE,MAAe;IACvD,MAAM,SAAS,GAAG,MAAM,IAAI,MAAM,IAAI,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAA;IACnG,OAAO,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;AACnC,CAAC;AAWD;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAe,EAAE,EAAE;IACvE,MAAM,MAAM,GAAG,cAAK,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAQ,CAAA;IAC9D,OAAO,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAE,OAAO,YAAG,MAAM,GAAW,CAAC,CAAC,CAAC,MAAM,CAAA;AACxF,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAO;sBACtC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAY,EAAE,MAAM,CAAC;;;;CAIpF,CAAA"}
|
package/package.json
CHANGED
|
@@ -37,6 +37,14 @@ interface Props {
|
|
|
37
37
|
errorDetails: ErrorProps,
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Renders a component that provides user feedback on async requests.
|
|
42
|
+
* It renders either a loading component, an error component (which is received as prop)
|
|
43
|
+
* or the received children props.
|
|
44
|
+
*
|
|
45
|
+
* @param options the props for rendering the component: {@link Props}.
|
|
46
|
+
*/
|
|
47
|
+
|
|
40
48
|
export const AsyncContent = ({ loading, error, autofocus, children, errorDetails }: Props) => {
|
|
41
49
|
const ErrorComponent = errorDetails.errorComponent
|
|
42
50
|
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { LoadingCircular } from '@citric/ui'
|
|
2
2
|
import ReactInfiniteScroll, { Props as ReactInfiniteScrollProps } from 'react-infinite-scroll-component'
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Renders a component that provides infinite scroll.
|
|
6
|
+
*
|
|
7
|
+
* The component wraps around the ReactInfiniteScroll component.
|
|
8
|
+
* It provides a loading indicator using citric loading circular and custom styles.
|
|
9
|
+
*
|
|
10
|
+
* By default, it adds the scrollable target as page and overflow hidden.
|
|
11
|
+
*/
|
|
4
12
|
export const InfiniteScroll = ({ style, children, scrollableTarget, ...props }: Omit<ReactInfiniteScrollProps, 'loader'>) => (
|
|
5
13
|
<ReactInfiniteScroll
|
|
6
14
|
loader={<LoadingCircular />}
|
|
@@ -4,6 +4,7 @@ import { listToClass, theme } from '@stack-spot/portal-theme'
|
|
|
4
4
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
5
5
|
import { ReactElement, useState } from 'react'
|
|
6
6
|
import styled from 'styled-components'
|
|
7
|
+
import { IconButton } from '@citric/ui'
|
|
7
8
|
import { AsyncContent, ErrorProps } from '../AsyncContent'
|
|
8
9
|
import { InfiniteScroll } from '../InfiniteScroll'
|
|
9
10
|
import { ScrollView } from '../ScrollView'
|
|
@@ -23,7 +24,7 @@ const NotificationsComponent = styled(Flex) <{ $scroll?: boolean }>`
|
|
|
23
24
|
z-index: 1;
|
|
24
25
|
visibility: hidden;
|
|
25
26
|
position: absolute;
|
|
26
|
-
top: calc(var(--header-height)
|
|
27
|
+
top: calc(var(--header-height) + 4px);
|
|
27
28
|
right: -270%;
|
|
28
29
|
width: 400px;
|
|
29
30
|
|
|
@@ -46,7 +47,7 @@ const NotificationsComponent = styled(Flex) <{ $scroll?: boolean }>`
|
|
|
46
47
|
&::after {
|
|
47
48
|
content: '';
|
|
48
49
|
position: absolute;
|
|
49
|
-
border-width:
|
|
50
|
+
border-width: 8px 32px;
|
|
50
51
|
border-style: solid;
|
|
51
52
|
border-color: transparent;
|
|
52
53
|
bottom: 100%;
|
|
@@ -128,7 +129,7 @@ const NotificationsFilter = ({ type, onChangeFilterType }: NotificationsFilterPr
|
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
interface Props {
|
|
131
|
-
|
|
132
|
+
onMarkAsReadUnread: (notificationId: string, read: boolean, type: 'callToAction' | 'icon') => void,
|
|
132
133
|
notifications?: StackspotNotification[],
|
|
133
134
|
isLoading: boolean,
|
|
134
135
|
error?: any,
|
|
@@ -144,7 +145,7 @@ interface Props {
|
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
export const NotificationComponent = ({
|
|
147
|
-
hasUnreadNotification,
|
|
148
|
+
hasUnreadNotification, onMarkAsReadUnread, notifications, isLoading, error,
|
|
148
149
|
type, onUpdateType,
|
|
149
150
|
onClickViewNotifications, onClickViewAll, errorDetails, fetchNextPage, hasNextPage,
|
|
150
151
|
placeholderComponent, isSummary=false,
|
|
@@ -157,14 +158,16 @@ export const NotificationComponent = ({
|
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
return (<Flex sx={{ position: 'relative' }}>
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
161
|
+
<IconButton aria-label={t.openNotifications} onClick={() => {
|
|
162
|
+
onClickViewNotifications()
|
|
163
|
+
setVisible(true)
|
|
164
|
+
}} sx={{ border: 'none', bg: 'transparent' }}>
|
|
165
|
+
<IconBox size="md"
|
|
166
|
+
className="notificationsTour" >
|
|
167
|
+
<Bell />
|
|
168
|
+
</IconBox>
|
|
169
|
+
</IconButton>
|
|
170
|
+
{hasUnreadNotification && <Box sx={{ position: 'absolute', right: '2px' }} aria-label={t.hasUnread}>
|
|
168
171
|
<StatusCircle status={'danger'} />
|
|
169
172
|
</Box>}
|
|
170
173
|
|
|
@@ -174,15 +177,16 @@ export const NotificationComponent = ({
|
|
|
174
177
|
aria-hidden={!visible}
|
|
175
178
|
>
|
|
176
179
|
<Flex className="content" p={5} flexDirection="column" justifyContent="space-between">
|
|
177
|
-
<Flex>
|
|
180
|
+
<Flex w="100%">
|
|
178
181
|
<Flex justifyContent="space-between" w="100%" >
|
|
179
182
|
<Text appearance="h4">
|
|
180
183
|
{t.notifications}
|
|
181
184
|
</Text>
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
<IconButton onClick={() => setVisible(false)} aria-label={t.close}>
|
|
186
|
+
<IconBox size="xs">
|
|
187
|
+
<TimesMini />
|
|
188
|
+
</IconBox>
|
|
189
|
+
</IconButton>
|
|
186
190
|
</Flex>
|
|
187
191
|
|
|
188
192
|
<NotificationsFilter type={type} onChangeFilterType={updateType} />
|
|
@@ -198,7 +202,7 @@ export const NotificationComponent = ({
|
|
|
198
202
|
<Flex sx={{ gap: '4px' }} mr="3">
|
|
199
203
|
{notifications?.map((item) => (
|
|
200
204
|
<NotificationItem key={item.id} notification={item}
|
|
201
|
-
isSummary={isSummary}
|
|
205
|
+
isSummary={isSummary} onClickMarkReadUnread={(read, type) => onMarkAsReadUnread(item.id, read, type)} />
|
|
202
206
|
))}
|
|
203
207
|
</Flex>
|
|
204
208
|
</ScrollView>
|
|
@@ -246,6 +250,9 @@ const dictionary = {
|
|
|
246
250
|
medium: 'Medium',
|
|
247
251
|
low: 'Low',
|
|
248
252
|
seeAll: 'See all notifications',
|
|
253
|
+
openNotifications: 'View notifications',
|
|
254
|
+
hasUnread: 'Has Unread notifications',
|
|
255
|
+
close: 'Close',
|
|
249
256
|
},
|
|
250
257
|
pt: {
|
|
251
258
|
notifications: 'Notificações',
|
|
@@ -260,5 +267,8 @@ const dictionary = {
|
|
|
260
267
|
medium: 'Médio',
|
|
261
268
|
low: 'Baixo',
|
|
262
269
|
seeAll: 'Ver todas as notificações',
|
|
270
|
+
openNotifications: 'Visualizar notificações',
|
|
271
|
+
hasUnread: 'Existem notificações não lidas',
|
|
272
|
+
close: 'Fechar',
|
|
263
273
|
},
|
|
264
274
|
} satisfies Dictionary
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Button, Flex, IconBox, OneOfColorSchemesWithVariants, SxProp, Text } from '@citric/core'
|
|
1
|
+
import { Button, Flex, IconBox, OneOfColorSchemesWithVariants, Styles, SxProp, Text } from '@citric/core'
|
|
2
2
|
import { Envelope, EnvelopeOpen } from '@citric/icons'
|
|
3
|
-
import {
|
|
3
|
+
import { IconButton, Tooltip } from '@citric/ui'
|
|
4
4
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
5
5
|
import { differenceInDays, parseISO } from 'date-fns'
|
|
6
6
|
import { useAnchorTag } from '../../context/anchor'
|
|
@@ -26,20 +26,38 @@ interface Props {
|
|
|
26
26
|
isSummary: boolean,
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
const style: Styles = {
|
|
30
|
+
tooltip: {
|
|
31
|
+
'&::after':{
|
|
32
|
+
top: '25%',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const NotificationHeader = ({ notification, isSummary, onClickMarkReadUnread }: NotificationItemProps) => {
|
|
38
|
+
const t = useTranslate(dictionary)
|
|
39
|
+
return (
|
|
40
|
+
<Flex justifyContent="space-between" mb={2} sx={{ maxWidth: isSummary ? '330px' : '100%' }} flexWrap="nowrap">
|
|
41
|
+
<Text appearance={isSummary ? 'body2' : 'body1'} nowrapEllipsis>
|
|
42
|
+
{notification.title}
|
|
43
|
+
</Text>
|
|
44
|
+
<Tooltip text={notification.committed ? t.markAsUnread : t.markAsRead} position="left"
|
|
45
|
+
id={`tooltip-${notification.title}`} role="tooltip"
|
|
46
|
+
sx={style.tooltip}>
|
|
47
|
+
<IconButton aria-describedby={`tooltip-${notification.title}`}>
|
|
48
|
+
<IconBox
|
|
49
|
+
size="xs"
|
|
50
|
+
onClick={() => {
|
|
51
|
+
onClickMarkReadUnread(!notification.committed, 'icon')
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
{notification.committed ? <Envelope /> : <EnvelopeOpen />}
|
|
55
|
+
</IconBox>
|
|
56
|
+
</IconButton>
|
|
57
|
+
</Tooltip>
|
|
58
|
+
</Flex>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
43
61
|
|
|
44
62
|
const getDaysAgo = (dateString: string): number => {
|
|
45
63
|
const givenDate = parseISO(dateString)
|
|
@@ -82,16 +100,16 @@ const NotificationContent = ({ notification, isSummary }: Props) => {
|
|
|
82
100
|
}
|
|
83
101
|
interface NotificationFooterProps {
|
|
84
102
|
call_to_action: string,
|
|
85
|
-
|
|
103
|
+
onClickMarkReadUnread: (type: 'callToAction' | 'icon') => void,
|
|
86
104
|
}
|
|
87
105
|
|
|
88
|
-
const NotificationFooter = ({ call_to_action,
|
|
106
|
+
const NotificationFooter = ({ call_to_action, onClickMarkReadUnread }: NotificationFooterProps) => {
|
|
89
107
|
const t = useTranslate(dictionary)
|
|
90
108
|
const Link = useAnchorTag()
|
|
91
109
|
|
|
92
110
|
return (
|
|
93
111
|
<Flex mt="5">
|
|
94
|
-
<Button size="sm" colorScheme="inverse" onClick={() =>
|
|
112
|
+
<Button size="sm" colorScheme="inverse" onClick={() => onClickMarkReadUnread('callToAction')}>
|
|
95
113
|
<Link href={call_to_action}>
|
|
96
114
|
<Text colorScheme={'inverse.contrastText'}>
|
|
97
115
|
{t.takeMeThere}
|
|
@@ -103,16 +121,16 @@ const NotificationFooter = ({ call_to_action, onClickMarkRead }: NotificationFoo
|
|
|
103
121
|
}
|
|
104
122
|
|
|
105
123
|
interface NotificationItemProps extends Props {
|
|
106
|
-
|
|
124
|
+
onClickMarkReadUnread: (read: boolean, type: 'callToAction' | 'icon') => void,
|
|
107
125
|
}
|
|
108
126
|
|
|
109
|
-
export const NotificationItem = ({ notification, isSummary,
|
|
127
|
+
export const NotificationItem = ({ notification, isSummary, onClickMarkReadUnread }: NotificationItemProps) => (
|
|
110
128
|
<Flex bg="light.400" p="3 3 3 5" r="xs"
|
|
111
129
|
flexDirection="column" w="100%" sx={styles.item(statusToColor[notification.criticality], notification.committed)}>
|
|
112
|
-
<NotificationHeader notification={notification} isSummary={isSummary}
|
|
130
|
+
<NotificationHeader notification={notification} isSummary={isSummary} onClickMarkReadUnread={onClickMarkReadUnread}/>
|
|
113
131
|
<NotificationContent notification={notification} isSummary={isSummary} />
|
|
114
132
|
{notification.call_to_action && <NotificationFooter call_to_action={notification.call_to_action}
|
|
115
|
-
|
|
133
|
+
onClickMarkReadUnread={(type) => onClickMarkReadUnread(!notification.committed, type)} />}
|
|
116
134
|
</Flex>
|
|
117
135
|
)
|
|
118
136
|
|
|
@@ -124,6 +142,8 @@ const dictionary = {
|
|
|
124
142
|
STUDIO: 'Studio',
|
|
125
143
|
daysAgo: 'days ago',
|
|
126
144
|
today: 'today',
|
|
145
|
+
markAsRead: 'Mark as read',
|
|
146
|
+
markAsUnread: 'Mark as unread',
|
|
127
147
|
},
|
|
128
148
|
pt: {
|
|
129
149
|
takeMeThere: 'Leve-me para lá',
|
|
@@ -132,5 +152,7 @@ const dictionary = {
|
|
|
132
152
|
STUDIO: 'Estúdio',
|
|
133
153
|
daysAgo: 'dias atrás',
|
|
134
154
|
today: 'hoje',
|
|
155
|
+
markAsRead: 'Marcar como lido',
|
|
156
|
+
markAsUnread: 'Marcar como não lido',
|
|
135
157
|
},
|
|
136
158
|
} satisfies Dictionary
|
|
@@ -32,6 +32,12 @@ function getDirectionStyle({ direction = 'both', scrollType = 'auto' }: Props) {
|
|
|
32
32
|
return `${x}${y}`
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Renders a component that provides scrolling.
|
|
37
|
+
*
|
|
38
|
+
* @param options the props for rendering the component: {@link Props}.
|
|
39
|
+
*/
|
|
40
|
+
|
|
35
41
|
export const ScrollView = styled.div<Props>`
|
|
36
42
|
${getDirectionStyle}
|
|
37
43
|
&::-webkit-scrollbar {
|
|
@@ -8,7 +8,9 @@ type Color = OneOfColorSchemesWithVariants | OneOfPalettesWithVariants
|
|
|
8
8
|
export type Status = 'success' | 'warning' | 'danger' | 'unknown' | 'progress'
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
|
+
/** The status of the component which determines its color */
|
|
11
12
|
status?: Status,
|
|
13
|
+
/** Tooltip text to be displayed on hover */
|
|
12
14
|
tooltip?: string,
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -20,22 +22,45 @@ const statusToColor: Record<Status, Color> = {
|
|
|
20
22
|
unknown: 'light.contrastText',
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Get the color corresponding to the status.
|
|
27
|
+
*
|
|
28
|
+
* @param {Theme} theme - The theme object.
|
|
29
|
+
* @param {Status} [status] - The status of the component.
|
|
30
|
+
* @returns {string} The color corresponding to the status.
|
|
31
|
+
*/
|
|
23
32
|
function getColorFromStatus(theme: Theme, status?: Status) {
|
|
24
33
|
const colorName = status && status in statusToColor ? statusToColor[status] : statusToColor.unknown
|
|
25
34
|
return getColor(theme, colorName)
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
interface WithTooltip {
|
|
38
|
+
/** Tooltip text to be displayed on hover */
|
|
29
39
|
tooltip?: string,
|
|
40
|
+
/** Additional class names for the component */
|
|
30
41
|
className?: string,
|
|
42
|
+
/** Inline styles for the component */
|
|
31
43
|
style?: React.CSSProperties,
|
|
32
44
|
}
|
|
33
45
|
|
|
46
|
+
/**
|
|
47
|
+
* CircleWithTooltip component that displays a circle with an optional tooltip.
|
|
48
|
+
*
|
|
49
|
+
* @param {WithTooltip} props - The props for the CircleWithTooltip component.
|
|
50
|
+
* @returns {JSX.Element} The CircleWithTooltip component.
|
|
51
|
+
*/
|
|
34
52
|
const CircleWithTooltip = ({ tooltip, className, style }: WithTooltip) => {
|
|
35
53
|
const circle = <div style={style} className={className}></div>
|
|
36
54
|
return tooltip && tooltip.length ? <Tooltip text={tooltip}>{circle}</Tooltip> : circle
|
|
37
55
|
}
|
|
38
56
|
|
|
57
|
+
/**
|
|
58
|
+
* StatusCircle component that displays a colored circle based on the status.
|
|
59
|
+
* It also supports an optional tooltip.
|
|
60
|
+
*
|
|
61
|
+
* @param {Props} props - The props for the StatusCircle component.
|
|
62
|
+
* @returns {JSX.Element} The StatusCircle component.
|
|
63
|
+
*/
|
|
39
64
|
export const StatusCircle = styled(CircleWithTooltip)<Props>`
|
|
40
65
|
background-color: ${({ status, theme }) => getColorFromStatus(theme as any, status)};
|
|
41
66
|
width: 12px;
|