@stack-spot/portal-components 1.4.1 → 1.5.1
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/CHANGELOG.md +20 -0
- package/dist/components/InfiniteScroll.d.ts.map +1 -1
- package/dist/components/InfiniteScroll.js +2 -1
- package/dist/components/InfiniteScroll.js.map +1 -1
- package/dist/components/Notifications/NotificationComponent.d.ts.map +1 -1
- package/dist/components/Notifications/NotificationComponent.js +3 -3
- package/dist/components/Notifications/NotificationComponent.js.map +1 -1
- package/dist/components/{ErrorFeedback.d.ts → error/ErrorFeedback.d.ts} +17 -2
- package/dist/components/error/ErrorFeedback.d.ts.map +1 -0
- package/dist/components/{ErrorFeedback.js → error/ErrorFeedback.js} +8 -7
- package/dist/components/error/ErrorFeedback.js.map +1 -0
- package/dist/components/error/NotFound.d.ts +4 -0
- package/dist/components/error/NotFound.d.ts.map +1 -0
- package/dist/components/error/NotFound.js +19 -0
- package/dist/components/error/NotFound.js.map +1 -0
- package/dist/components/error/UnderMaintenance.d.ts +4 -0
- package/dist/components/error/UnderMaintenance.d.ts.map +1 -0
- package/dist/components/error/UnderMaintenance.js +25 -0
- package/dist/components/error/UnderMaintenance.js.map +1 -0
- package/dist/components/error/index.d.ts +4 -0
- package/dist/components/error/index.d.ts.map +1 -0
- package/dist/components/error/index.js +4 -0
- package/dist/components/error/index.js.map +1 -0
- package/package.json +4 -3
- package/src/components/InfiniteScroll.tsx +4 -1
- package/src/components/Notifications/NotificationComponent.tsx +27 -26
- package/src/components/{ErrorFeedback.tsx → error/ErrorFeedback.tsx} +35 -13
- package/src/components/error/NotFound.tsx +24 -0
- package/src/components/error/UnderMaintenance.tsx +30 -0
- package/src/components/error/index.ts +3 -0
- package/dist/components/ErrorFeedback.d.ts.map +0 -1
- package/dist/components/ErrorFeedback.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.5.1](https://github.com/stack-spot/portal-commons/compare/portal-components@v1.5.0...portal-components@v1.5.1) (2024-06-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* notifications infinite scroll ([d752d3f](https://github.com/stack-spot/portal-commons/commit/d752d3f1a1c5b9d792aa622ff31185be29249faf))
|
|
9
|
+
|
|
10
|
+
## [1.5.0](https://github.com/stack-spot/portal-commons/compare/portal-components@v1.4.1...portal-components@v1.5.0) (2024-06-26)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* more customization to ErrorFeedback and more error components ([12361b9](https://github.com/stack-spot/portal-commons/commit/12361b9e9a924a9590dcb0cc2eca75f860f0ca8b))
|
|
16
|
+
* more error customization and components ([12361b9](https://github.com/stack-spot/portal-commons/commit/12361b9e9a924a9590dcb0cc2eca75f860f0ca8b))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* notification tooltip for small screens ([0574dd7](https://github.com/stack-spot/portal-commons/commit/0574dd740dc9c60f3a206a920b3ba018827fc4b0))
|
|
22
|
+
|
|
3
23
|
## [1.4.1](https://github.com/stack-spot/portal-commons/compare/portal-components@v1.4.0...portal-components@v1.4.1) (2024-06-26)
|
|
4
24
|
|
|
5
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfiniteScroll.d.ts","sourceRoot":"","sources":["../../src/components/InfiniteScroll.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InfiniteScroll.d.ts","sourceRoot":"","sources":["../../src/components/InfiniteScroll.tsx"],"names":[],"mappings":"AAEA,OAA4B,EAAE,KAAK,IAAI,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAExG;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,oDAAqD,KAAK,wBAAwB,EAAE,QAAQ,CAAC,4CAWvH,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Flex } from '@citric/core';
|
|
2
3
|
import { LoadingCircular } from '@citric/ui';
|
|
3
4
|
import ReactInfiniteScroll from 'react-infinite-scroll-component';
|
|
4
5
|
/**
|
|
@@ -9,5 +10,5 @@ import ReactInfiniteScroll from 'react-infinite-scroll-component';
|
|
|
9
10
|
*
|
|
10
11
|
* By default, it adds the scrollable target as page and overflow hidden.
|
|
11
12
|
*/
|
|
12
|
-
export const InfiniteScroll = ({ style, children, scrollableTarget, ...props }) => (_jsx(ReactInfiniteScroll, { loader: _jsx(LoadingCircular, {}), scrollableTarget: scrollableTarget || 'page', style: { overflow: 'hidden', ...style }, ...props, children: children }));
|
|
13
|
+
export const InfiniteScroll = ({ style, children, scrollableTarget, ...props }) => (_jsx(ReactInfiniteScroll, { loader: _jsx(Flex, { alignItems: "center", justifyContent: "center", p: 4, flex: 1, "data-test-hint": "loading", children: _jsx(LoadingCircular, {}) }), scrollableTarget: scrollableTarget || 'page', style: { overflow: 'hidden', ...style }, ...props, children: children }));
|
|
13
14
|
//# 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;;;;;;;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,
|
|
1
|
+
{"version":3,"file":"InfiniteScroll.js","sourceRoot":"","sources":["../../src/components/InfiniteScroll.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,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,IAAI,IAAC,UAAU,EAAC,QAAQ,EAAC,cAAc,EAAC,QAAQ,EAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,oBAAiB,SAAS,YAC/F,KAAC,eAAe,KAAG,GACd,EACP,gBAAgB,EAAE,gBAAgB,IAAI,MAAM,EAC5C,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,KACnC,KAAK,YAER,QAAQ,GACW,CACvB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationComponent.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NotificationComponent.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/NotificationComponent.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAA;AAE9C,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;AAkID,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;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,6NAK/B,KAAK,4CAwFP,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Button, Flex, IconBox, Text } from '@citric/core';
|
|
3
3
|
import { Bell, TimesMini } from '@citric/icons';
|
|
4
|
+
import { IconButton } from '@citric/ui';
|
|
4
5
|
import { listToClass, theme } from '@stack-spot/portal-theme';
|
|
5
6
|
import { useTranslate } from '@stack-spot/portal-translate';
|
|
6
7
|
import { useState } from 'react';
|
|
7
8
|
import styled from 'styled-components';
|
|
8
|
-
import { IconButton } from '@citric/ui';
|
|
9
9
|
import { AsyncContent } from '../AsyncContent.js';
|
|
10
10
|
import { InfiniteScroll } from '../InfiniteScroll.js';
|
|
11
11
|
import { ScrollView } from '../ScrollView.js';
|
|
@@ -22,7 +22,7 @@ const NotificationsComponent = styled(Flex) `
|
|
|
22
22
|
width: 400px;
|
|
23
23
|
|
|
24
24
|
&.visible {
|
|
25
|
-
min-height:
|
|
25
|
+
min-height: 400px;
|
|
26
26
|
visibility: visible;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -97,7 +97,7 @@ export const NotificationComponent = ({ hasUnreadNotification, onMarkAsReadUnrea
|
|
|
97
97
|
return (_jsxs(Flex, { sx: { position: 'relative' }, children: [_jsx(IconButton, { "aria-label": t.openNotifications, onClick: () => {
|
|
98
98
|
onClickViewNotifications();
|
|
99
99
|
setVisible(true);
|
|
100
|
-
}, 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' }) }), visible && _jsx(Overlay, {}), _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(
|
|
100
|
+
}, 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' }) }), visible && _jsx(Overlay, {}), _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(ScrollView, { id: "scrollableNotifications", direction: "vertical", style: { maxHeight: 'calc(100vh - 300px)' }, children: _jsx(InfiniteScroll, { dataLength: notifications?.length || 0, next: fetchNextPage, hasMore: hasNextPage, scrollableTarget: "scrollableNotifications", children: _jsx(Flex, { sx: { gap: '4px' }, mr: "3", flexDirection: "column", children: notifications?.map((item) => (_jsx(NotificationItem, { notification: item, isSummary: isSummary, onClickMarkReadUnread: (read, type) => onMarkAsReadUnread(item.id, read, type) }, item.id))) }) }) }) })
|
|
101
101
|
:
|
|
102
102
|
_jsx(_Fragment, { children: placeholderComponent }) })] }), _jsx(Flex, { w: "100%", pt: 3, children: _jsx(Button, { size: "sm", sx: { width: '100%' }, colorScheme: "inverse", appearance: "text", onClick: () => {
|
|
103
103
|
setVisible(false);
|
|
@@ -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;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,
|
|
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,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,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,YAAY,EAAc,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAkD,UAAU,EAAE,MAAM,SAAS,CAAA;AAMtG,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAwB;;;;;;;;;;;;;;;;wBAgB3C,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;+BACf,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY;wBACtC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;kBAC5B,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;;;;;;;;;;;;;;wBActC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;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A2B;QACnC,iBAAiB,EAAE,yBAAyB;QAC5C,SAAS,EAAE,gCAAgC;QAC3C,KAAK,EAAE,QAAQ;KAChB;CACmB,CAAA"}
|
|
@@ -17,7 +17,22 @@ export interface ErrorDescription {
|
|
|
17
17
|
*/
|
|
18
18
|
title?: string;
|
|
19
19
|
/**
|
|
20
|
-
* The
|
|
20
|
+
* The error description. Overwrites anything preset by "code".
|
|
21
|
+
*/
|
|
22
|
+
description?: string;
|
|
23
|
+
/**
|
|
24
|
+
* A help text to aid the user. Overwrites anything preset by "code".
|
|
25
|
+
*/
|
|
26
|
+
help?: string;
|
|
27
|
+
/**
|
|
28
|
+
* A button so the user can take some action.
|
|
29
|
+
*/
|
|
30
|
+
action?: {
|
|
31
|
+
label: string;
|
|
32
|
+
onClick: () => void;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The content for this error. Overwrites anything preset by "code", "description", "help" or "button".
|
|
21
36
|
*/
|
|
22
37
|
body?: React.ReactNode;
|
|
23
38
|
/**
|
|
@@ -32,5 +47,5 @@ export interface ErrorDescription {
|
|
|
32
47
|
*
|
|
33
48
|
* @param options the error code, the error message and whether or not the application is in debug mode.
|
|
34
49
|
*/
|
|
35
|
-
export declare const ErrorFeedback: ({ code, message, debug, title, body, image }: ErrorDescription) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
export declare const ErrorFeedback: ({ code, message, debug, title, body, image, action, description, help }: ErrorDescription) => import("react/jsx-runtime").JSX.Element;
|
|
36
51
|
//# sourceMappingURL=ErrorFeedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorFeedback.d.ts","sourceRoot":"","sources":["../../../src/components/error/ErrorFeedback.tsx"],"names":[],"mappings":";AAoBA,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,4EAAiF,gBAAgB,4CAmE1H,CAAA"}
|
|
@@ -2,11 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Box, Button, Container, Flex, LinkBox, Text } from '@citric/core';
|
|
3
3
|
import { useTranslate } from '@stack-spot/portal-translate';
|
|
4
4
|
import { useState } from 'react';
|
|
5
|
-
import { Forbidden } from '
|
|
6
|
-
import { Logo } from '
|
|
7
|
-
import { NotFound } from '
|
|
8
|
-
import { ServerError } from '
|
|
9
|
-
import { Unauthenticated } from '
|
|
5
|
+
import { Forbidden } from '../../svg/Forbidden.js';
|
|
6
|
+
import { Logo } from '../../svg/Logo.js';
|
|
7
|
+
import { NotFound } from '../../svg/NotFound.js';
|
|
8
|
+
import { ServerError } from '../../svg/ServerError.js';
|
|
9
|
+
import { Unauthenticated } from '../../svg/Unauthenticated.js';
|
|
10
10
|
const imageStyle = {
|
|
11
11
|
width: '200px',
|
|
12
12
|
height: '200px',
|
|
@@ -23,13 +23,14 @@ const imageMap = {
|
|
|
23
23
|
*
|
|
24
24
|
* @param options the error code, the error message and whether or not the application is in debug mode.
|
|
25
25
|
*/
|
|
26
|
-
export const ErrorFeedback = ({ code = 0, message, debug, title, body, image }) => {
|
|
26
|
+
export const ErrorFeedback = ({ code = 0, message, debug, title, body, image, action, description, help }) => {
|
|
27
27
|
const t = useTranslate(dictionary);
|
|
28
28
|
const [showDetails, setShowDetails] = useState(false);
|
|
29
|
+
const shouldShowButtons = !!(action || (debug && message));
|
|
29
30
|
function renderBody() {
|
|
30
31
|
return typeof body === 'string' ? _jsx(Text, { appearance: "body1", mt: 5, colorScheme: "inverse", children: body }) : body;
|
|
31
32
|
}
|
|
32
|
-
return (_jsx(Box, { bg: "light.400", children: _jsx(Container, { children: _jsxs(Flex, { alignItems: "center", sx: { padding: 12 }, children: [_jsx(Box, { width: 5, sx: { display: ['block', 'none'] }, children: _jsx(Flex, { justifyContent: "flex-end", pr: 20, children: image ?? imageMap[code] ?? _jsx(ServerError, { style: imageStyle }) }) }), _jsxs(Box, { width: [7, 12], children: [_jsx(LinkBox, { href: "/", children: _jsx(Logo, { style: { width: '130px', height: '30px' } }) }), _jsxs(Box, { w: [7, 12], children: [_jsxs(Text, { appearance: "h4", mt: 5, colorScheme: "inverse", children: [(code && !title) ? `${code}. ` : '', _jsx(Text, { appearance: "h4", as: "span", colorScheme: "light.700", children: title ?? t[`${code}.title`] })] }), body ? renderBody() : (_jsxs(_Fragment, { children: [_jsx(Text, { appearance: "body1", mt: 5, colorScheme: "inverse", children: t[`${code}.description`] }), _jsx(Text, { appearance: "body1", colorScheme: "light.700", mt: 1, children: t[`${code}.help`] })] })), debug && message && (_jsx(Button, { appearance: "outlined", colorScheme: "inverse", onClick: () => setShowDetails(v => !v), children: showDetails ? t.hideDetails : t.showDetails })), showDetails && (_jsx(Box, { bg: "danger", mt: 8, p: 4, sx: { borderRadius: '5px' }, children: _jsx(Text, { appearance: "microtext1", colorScheme: "danger.contrastText", children: message }) }))] })] })] }) }) }));
|
|
33
|
+
return (_jsx(Box, { bg: "light.400", children: _jsx(Container, { children: _jsxs(Flex, { alignItems: "center", sx: { padding: 12 }, children: [_jsx(Box, { width: 5, sx: { display: ['block', 'none'] }, children: _jsx(Flex, { justifyContent: "flex-end", pr: 20, children: image ?? imageMap[code] ?? _jsx(ServerError, { style: imageStyle }) }) }), _jsxs(Box, { width: [7, 12], children: [_jsx(LinkBox, { href: "/", children: _jsx(Logo, { style: { width: '130px', height: '30px' } }) }), _jsxs(Box, { w: [7, 12], children: [_jsxs(Text, { appearance: "h4", mt: 5, colorScheme: "inverse", children: [(code && !title) ? `${code}. ` : '', _jsx(Text, { appearance: "h4", as: "span", colorScheme: "light.700", children: title ?? t[`${code}.title`] })] }), body ? renderBody() : (_jsxs(_Fragment, { children: [_jsx(Text, { appearance: "body1", mt: 5, colorScheme: "inverse", children: description ?? t[`${code}.description`] }), _jsx(Text, { appearance: "body1", colorScheme: "light.700", mt: 1, children: help ?? t[`${code}.help`] })] })), shouldShowButtons && (_jsxs(Flex, { flexDirection: "row", style: { gap: '10px', marginTop: '12px' }, children: [action && (_jsx(Button, { colorScheme: "inverse", onClick: action.onClick, children: action.label })), debug && message && (_jsx(Button, { appearance: "outlined", colorScheme: "inverse", onClick: () => setShowDetails(v => !v), children: showDetails ? t.hideDetails : t.showDetails }))] })), showDetails && (_jsx(Box, { bg: "danger", mt: 8, p: 4, sx: { borderRadius: '5px' }, children: _jsx(Text, { appearance: "microtext1", colorScheme: "danger.contrastText", children: message }) }))] })] })] }) }) }));
|
|
33
34
|
};
|
|
34
35
|
const dictionary = {
|
|
35
36
|
en: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorFeedback.js","sourceRoot":"","sources":["../../../src/components/error/ErrorFeedback.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,qBA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,UAAU,EAAE,8FAA8F;QAC1G,WAAW,EAAE,gBAAgB;QAC7B,iBAAiB,EAAE,8CAA8C;QACjE,UAAU,EAAE,8FAA8F;QAC1G,WAAW,EAAE,oBAAoB;QACjC,iBAAiB,EAAE,iCAAiC;QACpD,UAAU,EAAE,sFAAsF;QAClG,WAAW,EAAE,cAAc;QAC3B,iBAAiB,EACf,4GAA4G;QAC9G,UAAU,EAAE,uCAAuC;QACnD,WAAW,EAAE,cAAc;QAC3B,WAAW,EAAE,cAAc;KAC5B;IACD,EAAE,EAAE;QACF,OAAO,EAAE,gBAAgB;QACzB,SAAS,EAAE,6BAA6B;QACxC,eAAe,EAAE,sDAAsD;QACvE,QAAQ,EAAE,6FAA6F;QACvG,WAAW,EAAE,gBAAgB;QAC7B,iBAAiB,EAAE,8DAA8D;QACjF,UAAU,EAAE,mGAAmG;QAC/G,WAAW,EAAE,gBAAgB;QAC7B,iBAAiB,EAAE,qDAAqD;QACxE,UAAU,EAAE,yDAAyD;QACrE,WAAW,EAAE,wBAAwB;QACrC,iBAAiB,EAAE,+BAA+B;QAClD,UAAU,EAAE,iEAAiE;QAC7E,WAAW,EAAE,0BAA0B;QACvC,iBAAiB,EAAE,+DAA+D;QAClF,UAAU,EAAE,sCAAsC;QAClD,WAAW,EAAE,cAAc;QAC3B,WAAW,EAAE,mBAAmB;KACjC;CACmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotFound.d.ts","sourceRoot":"","sources":["../../../src/components/error/NotFound.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,eAAgB;IAAE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,4CAW/D,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
3
|
+
import { ErrorFeedback } from './ErrorFeedback.js';
|
|
4
|
+
export const PageNotFound = ({ goHome }) => {
|
|
5
|
+
const t = useTranslate(dictionary);
|
|
6
|
+
return (_jsx(ErrorFeedback, { code: 404, action: goHome ? {
|
|
7
|
+
label: t.homePage,
|
|
8
|
+
onClick: goHome,
|
|
9
|
+
} : undefined }));
|
|
10
|
+
};
|
|
11
|
+
const dictionary = {
|
|
12
|
+
en: {
|
|
13
|
+
homePage: 'Home Page',
|
|
14
|
+
},
|
|
15
|
+
pt: {
|
|
16
|
+
homePage: 'Página Inicial',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=NotFound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotFound.js","sourceRoot":"","sources":["../../../src/components/error/NotFound.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,MAAM,EAA2B,EAAE,EAAE;IAClE,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,OAAO,CACL,KAAC,aAAa,IACZ,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;YACf,KAAK,EAAE,CAAC,CAAC,QAAQ;YACjB,OAAO,EAAE,MAAM;SAChB,CAAC,CAAC,CAAC,SAAS,GACb,CACH,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,QAAQ,EAAE,WAAW;KACtB;IACD,EAAE,EAAE;QACF,QAAQ,EAAE,gBAAgB;KAC3B;CACmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnderMaintenance.d.ts","sourceRoot":"","sources":["../../../src/components/error/UnderMaintenance.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,gBAAiB;IAAE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,4CAWrE,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
3
|
+
import { ErrorFeedback } from './ErrorFeedback.js';
|
|
4
|
+
export const UnderMaintenance = ({ refresh }) => {
|
|
5
|
+
const t = useTranslate(dictionary);
|
|
6
|
+
return _jsx(ErrorFeedback, { title: t.underMaintenance, description: t.underMaintenanceDescription, help: t.underMaintenanceHelp, action: refresh ? {
|
|
7
|
+
label: t.refresh,
|
|
8
|
+
onClick: refresh,
|
|
9
|
+
} : undefined });
|
|
10
|
+
};
|
|
11
|
+
const dictionary = {
|
|
12
|
+
en: {
|
|
13
|
+
underMaintenance: 'Under maintenance',
|
|
14
|
+
underMaintenanceDescription: 'The site is currently undergoing maintenance.',
|
|
15
|
+
underMaintenanceHelp: 'Please, try again in a few minutes.',
|
|
16
|
+
refresh: 'Refresh page',
|
|
17
|
+
},
|
|
18
|
+
pt: {
|
|
19
|
+
underMaintenance: 'Em manutenção',
|
|
20
|
+
underMaintenanceDescription: 'O site está em manutenção.',
|
|
21
|
+
underMaintenanceHelp: 'Por favor, tente novamente em alguns minutos.',
|
|
22
|
+
refresh: 'Atualizar página',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=UnderMaintenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnderMaintenance.js","sourceRoot":"","sources":["../../../src/components/error/UnderMaintenance.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,OAAO,EAA4B,EAAE,EAAE;IACxE,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,OAAO,KAAC,aAAa,IACnB,KAAK,EAAE,CAAC,CAAC,gBAAgB,EACzB,WAAW,EAAE,CAAC,CAAC,2BAA2B,EAC1C,IAAI,EAAE,CAAC,CAAC,oBAAoB,EAC5B,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YAChB,KAAK,EAAE,CAAC,CAAC,OAAO;YAChB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC,CAAC,SAAS,GACb,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,gBAAgB,EAAE,mBAAmB;QACrC,2BAA2B,EAAE,+CAA+C;QAC5E,oBAAoB,EAAE,qCAAqC;QAC3D,OAAO,EAAE,cAAc;KACxB;IACD,EAAE,EAAE;QACF,gBAAgB,EAAE,eAAe;QACjC,2BAA2B,EAAE,4BAA4B;QACzD,oBAAoB,EAAE,+CAA+C;QACrE,OAAO,EAAE,kBAAkB;KAC5B;CACmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/portal-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./dist/index.js",
|
|
9
9
|
"./Breadcrumb": "./dist/components/Breadcrumb/index.js",
|
|
10
|
-
"./ErrorFeedback": "./dist/components/ErrorFeedback.js",
|
|
10
|
+
"./ErrorFeedback": "./dist/components/error/ErrorFeedback.js",
|
|
11
11
|
"./SelectionList": "./dist/components/SelectionList.js",
|
|
12
12
|
"./Tour": "./dist/components/Tour/index.js",
|
|
13
13
|
"./LazyMarkdown": "./dist/components/LazyMarkdown/index.js",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"./InfiniteScroll": "./dist/components/InfiniteScroll.js",
|
|
17
17
|
"./ScrollView": "./dist/components/ScrollView.js",
|
|
18
18
|
"./svg": "./dist/svg/index.js",
|
|
19
|
-
"./anchor": "./dist/context/anchor.js"
|
|
19
|
+
"./anchor": "./dist/context/anchor.js",
|
|
20
|
+
"./error": "./dist/components/error/index.js"
|
|
20
21
|
},
|
|
21
22
|
"scripts": {
|
|
22
23
|
"build": "rimraf dist && tsc && tsc-esm-fix --target='dist'",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Flex } from '@citric/core'
|
|
1
2
|
import { LoadingCircular } from '@citric/ui'
|
|
2
3
|
import ReactInfiniteScroll, { Props as ReactInfiniteScrollProps } from 'react-infinite-scroll-component'
|
|
3
4
|
|
|
@@ -11,7 +12,9 @@ import ReactInfiniteScroll, { Props as ReactInfiniteScrollProps } from 'react-in
|
|
|
11
12
|
*/
|
|
12
13
|
export const InfiniteScroll = ({ style, children, scrollableTarget, ...props }: Omit<ReactInfiniteScrollProps, 'loader'>) => (
|
|
13
14
|
<ReactInfiniteScroll
|
|
14
|
-
loader={<
|
|
15
|
+
loader={<Flex alignItems="center" justifyContent="center" p={4} flex={1} data-test-hint="loading">
|
|
16
|
+
<LoadingCircular />
|
|
17
|
+
</Flex>}
|
|
15
18
|
scrollableTarget={scrollableTarget || 'page'}
|
|
16
19
|
style={{ overflow: 'hidden', ...style }}
|
|
17
20
|
{...props}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Box, Button, Flex, IconBox, Text } from '@citric/core'
|
|
2
2
|
import { Bell, TimesMini } from '@citric/icons'
|
|
3
|
+
import { IconButton } from '@citric/ui'
|
|
3
4
|
import { listToClass, theme } from '@stack-spot/portal-theme'
|
|
4
5
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
5
6
|
import { ReactElement, useState } from 'react'
|
|
6
7
|
import styled from 'styled-components'
|
|
7
|
-
import { IconButton } from '@citric/ui'
|
|
8
8
|
import { AsyncContent, ErrorProps } from '../AsyncContent'
|
|
9
9
|
import { InfiniteScroll } from '../InfiniteScroll'
|
|
10
10
|
import { ScrollView } from '../ScrollView'
|
|
@@ -26,7 +26,7 @@ const NotificationsComponent = styled(Flex) <{ $scroll?: boolean }>`
|
|
|
26
26
|
width: 400px;
|
|
27
27
|
|
|
28
28
|
&.visible {
|
|
29
|
-
min-height:
|
|
29
|
+
min-height: 400px;
|
|
30
30
|
visibility: visible;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -145,10 +145,10 @@ const NotificationsFilter = ({ type, onChangeFilterType }: NotificationsFilterPr
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
interface Props {
|
|
148
|
-
onMarkAsReadUnread: (notificationId: string, read: boolean, type: 'callToAction' | 'icon') => void,
|
|
148
|
+
onMarkAsReadUnread: (notificationId: string, read: boolean, type: 'callToAction' | 'icon') => void,
|
|
149
149
|
notifications?: StackspotNotification[],
|
|
150
|
-
isLoading: boolean,
|
|
151
|
-
error?: any,
|
|
150
|
+
isLoading: boolean,
|
|
151
|
+
error?: any,
|
|
152
152
|
onClickViewNotifications: () => void,
|
|
153
153
|
onClickViewAll: () => void,
|
|
154
154
|
errorDetails: ErrorProps,
|
|
@@ -166,21 +166,21 @@ interface Props {
|
|
|
166
166
|
*
|
|
167
167
|
* @param props the component's props {@link Props}.
|
|
168
168
|
*/
|
|
169
|
-
export const NotificationComponent = ({
|
|
170
|
-
hasUnreadNotification, onMarkAsReadUnread, notifications, isLoading, error,
|
|
169
|
+
export const NotificationComponent = ({
|
|
170
|
+
hasUnreadNotification, onMarkAsReadUnread, notifications, isLoading, error,
|
|
171
171
|
type, onUpdateType,
|
|
172
172
|
onClickViewNotifications, onClickViewAll, errorDetails, fetchNextPage, hasNextPage,
|
|
173
|
-
placeholderComponent, isSummary=false,
|
|
173
|
+
placeholderComponent, isSummary = false,
|
|
174
174
|
}: Props) => {
|
|
175
175
|
const t = useTranslate(dictionary)
|
|
176
176
|
const [visible, setVisible] = useState(false)
|
|
177
177
|
|
|
178
|
-
const updateType = (updatedType?: NotificationTypeFilters) =>{
|
|
178
|
+
const updateType = (updatedType?: NotificationTypeFilters) => {
|
|
179
179
|
onUpdateType(updatedType)
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
return (<Flex sx={{ position: 'relative' }}>
|
|
183
|
-
<IconButton aria-label={t.openNotifications}
|
|
183
|
+
<IconButton aria-label={t.openNotifications} onClick={() => {
|
|
184
184
|
onClickViewNotifications()
|
|
185
185
|
setVisible(true)
|
|
186
186
|
}} sx={{ border: 'none', bg: 'transparent' }}>
|
|
@@ -217,22 +217,23 @@ export const NotificationComponent = ({
|
|
|
217
217
|
|
|
218
218
|
<AsyncContent error={error} errorDetails={errorDetails} loading={isLoading}>
|
|
219
219
|
{notifications?.length ? <StyledBox>
|
|
220
|
-
<
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
220
|
+
<ScrollView id="scrollableNotifications" direction="vertical" style={{ maxHeight: 'calc(100vh - 300px)' }}>
|
|
221
|
+
<InfiniteScroll
|
|
222
|
+
dataLength={notifications?.length || 0}
|
|
223
|
+
next={fetchNextPage}
|
|
224
|
+
hasMore={hasNextPage}
|
|
225
|
+
scrollableTarget="scrollableNotifications"
|
|
226
|
+
>
|
|
226
227
|
<Flex sx={{ gap: '4px' }} mr="3" flexDirection="column">
|
|
227
228
|
{notifications?.map((item) => (
|
|
228
|
-
<NotificationItem key={item.id} notification={item}
|
|
229
|
+
<NotificationItem key={item.id} notification={item}
|
|
229
230
|
isSummary={isSummary} onClickMarkReadUnread={(read, type) => onMarkAsReadUnread(item.id, read, type)} />
|
|
230
231
|
))}
|
|
231
232
|
</Flex>
|
|
232
|
-
</
|
|
233
|
-
</
|
|
233
|
+
</InfiniteScroll>
|
|
234
|
+
</ScrollView>
|
|
234
235
|
</StyledBox>
|
|
235
|
-
:
|
|
236
|
+
:
|
|
236
237
|
<>
|
|
237
238
|
{placeholderComponent}
|
|
238
239
|
</>
|
|
@@ -241,23 +242,23 @@ export const NotificationComponent = ({
|
|
|
241
242
|
</Flex>
|
|
242
243
|
|
|
243
244
|
<Flex w="100%" pt={3}>
|
|
244
|
-
<Button
|
|
245
|
+
<Button
|
|
245
246
|
size="sm"
|
|
246
247
|
sx={{ width: '100%' }} colorScheme="inverse" appearance="text"
|
|
247
248
|
onClick={() => {
|
|
248
249
|
setVisible(false)
|
|
249
250
|
onClickViewAll()
|
|
250
|
-
}}>
|
|
251
|
+
}}>
|
|
251
252
|
<Text appearance="microtext1">
|
|
252
253
|
{t.seeAll}
|
|
253
254
|
</Text>
|
|
254
255
|
</Button>
|
|
255
256
|
</Flex>
|
|
256
257
|
</Flex>
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
</NotificationsComponent>
|
|
260
|
-
</Flex>)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
</NotificationsComponent >
|
|
261
|
+
</Flex >)
|
|
261
262
|
}
|
|
262
263
|
|
|
263
264
|
const dictionary = {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Box, Button, Container, Flex, LinkBox, Text } from '@citric/core'
|
|
2
2
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
3
3
|
import { useState } from 'react'
|
|
4
|
-
import { Forbidden } from '
|
|
5
|
-
import { Logo } from '
|
|
6
|
-
import { NotFound } from '
|
|
7
|
-
import { ServerError } from '
|
|
8
|
-
import { Unauthenticated } from '
|
|
4
|
+
import { Forbidden } from '../../svg/Forbidden'
|
|
5
|
+
import { Logo } from '../../svg/Logo'
|
|
6
|
+
import { NotFound } from '../../svg/NotFound'
|
|
7
|
+
import { ServerError } from '../../svg/ServerError'
|
|
8
|
+
import { Unauthenticated } from '../../svg/Unauthenticated'
|
|
9
9
|
|
|
10
10
|
const imageStyle: React.CSSProperties = {
|
|
11
11
|
width: '200px',
|
|
@@ -36,7 +36,19 @@ export interface ErrorDescription {
|
|
|
36
36
|
*/
|
|
37
37
|
title?: string,
|
|
38
38
|
/**
|
|
39
|
-
* The
|
|
39
|
+
* The error description. Overwrites anything preset by "code".
|
|
40
|
+
*/
|
|
41
|
+
description?: string,
|
|
42
|
+
/**
|
|
43
|
+
* A help text to aid the user. Overwrites anything preset by "code".
|
|
44
|
+
*/
|
|
45
|
+
help?: string,
|
|
46
|
+
/**
|
|
47
|
+
* A button so the user can take some action.
|
|
48
|
+
*/
|
|
49
|
+
action?: { label: string, onClick: () => void },
|
|
50
|
+
/**
|
|
51
|
+
* The content for this error. Overwrites anything preset by "code", "description", "help" or "button".
|
|
40
52
|
*/
|
|
41
53
|
body?: React.ReactNode,
|
|
42
54
|
/**
|
|
@@ -52,9 +64,10 @@ export interface ErrorDescription {
|
|
|
52
64
|
*
|
|
53
65
|
* @param options the error code, the error message and whether or not the application is in debug mode.
|
|
54
66
|
*/
|
|
55
|
-
export const ErrorFeedback = ({ code = 0, message, debug, title, body, image }: ErrorDescription) => {
|
|
67
|
+
export const ErrorFeedback = ({ code = 0, message, debug, title, body, image, action, description, help }: ErrorDescription) => {
|
|
56
68
|
const t = useTranslate(dictionary) as Record<string, string>
|
|
57
69
|
const [showDetails, setShowDetails] = useState(false)
|
|
70
|
+
const shouldShowButtons = !!(action || (debug && message))
|
|
58
71
|
|
|
59
72
|
function renderBody() {
|
|
60
73
|
return typeof body === 'string' ? <Text appearance="body1" mt={5} colorScheme="inverse">{body}</Text> : body
|
|
@@ -84,19 +97,28 @@ export const ErrorFeedback = ({ code = 0, message, debug, title, body, image }:
|
|
|
84
97
|
{body ? renderBody() : (
|
|
85
98
|
<>
|
|
86
99
|
<Text appearance="body1" mt={5} colorScheme="inverse">
|
|
87
|
-
{t[`${code}.description`]}
|
|
100
|
+
{description ?? t[`${code}.description`]}
|
|
88
101
|
</Text>
|
|
89
102
|
|
|
90
103
|
<Text appearance="body1" colorScheme="light.700" mt={1}>
|
|
91
|
-
{t[`${code}.help`]}
|
|
104
|
+
{help ?? t[`${code}.help`]}
|
|
92
105
|
</Text>
|
|
93
106
|
</>
|
|
94
107
|
)}
|
|
95
108
|
|
|
96
|
-
{
|
|
97
|
-
<
|
|
98
|
-
{
|
|
99
|
-
|
|
109
|
+
{shouldShowButtons && (
|
|
110
|
+
<Flex flexDirection="row" style={{ gap: '10px', marginTop: '12px' }}>
|
|
111
|
+
{action && (
|
|
112
|
+
<Button colorScheme="inverse" onClick={action.onClick}>
|
|
113
|
+
{action.label}
|
|
114
|
+
</Button>
|
|
115
|
+
)}
|
|
116
|
+
{debug && message && (
|
|
117
|
+
<Button appearance="outlined" colorScheme="inverse" onClick={() => setShowDetails(v => !v)}>
|
|
118
|
+
{showDetails ? t.hideDetails : t.showDetails}
|
|
119
|
+
</Button>
|
|
120
|
+
)}
|
|
121
|
+
</Flex>
|
|
100
122
|
)}
|
|
101
123
|
{showDetails && (
|
|
102
124
|
<Box bg="danger" mt={8} p={4} sx={{ borderRadius: '5px' }}>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
2
|
+
import { ErrorFeedback } from './ErrorFeedback'
|
|
3
|
+
|
|
4
|
+
export const PageNotFound = ({ goHome }: { goHome?: () => void }) => {
|
|
5
|
+
const t = useTranslate(dictionary)
|
|
6
|
+
return (
|
|
7
|
+
<ErrorFeedback
|
|
8
|
+
code={404}
|
|
9
|
+
action={goHome ? {
|
|
10
|
+
label: t.homePage,
|
|
11
|
+
onClick: goHome,
|
|
12
|
+
} : undefined}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const dictionary = {
|
|
18
|
+
en: {
|
|
19
|
+
homePage: 'Home Page',
|
|
20
|
+
},
|
|
21
|
+
pt: {
|
|
22
|
+
homePage: 'Página Inicial',
|
|
23
|
+
},
|
|
24
|
+
} satisfies Dictionary
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
2
|
+
import { ErrorFeedback } from './ErrorFeedback'
|
|
3
|
+
|
|
4
|
+
export const UnderMaintenance = ({ refresh }: { refresh?: () => void }) => {
|
|
5
|
+
const t = useTranslate(dictionary)
|
|
6
|
+
return <ErrorFeedback
|
|
7
|
+
title={t.underMaintenance}
|
|
8
|
+
description={t.underMaintenanceDescription}
|
|
9
|
+
help={t.underMaintenanceHelp}
|
|
10
|
+
action={refresh ? {
|
|
11
|
+
label: t.refresh,
|
|
12
|
+
onClick: refresh,
|
|
13
|
+
} : undefined}
|
|
14
|
+
/>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const dictionary = {
|
|
18
|
+
en: {
|
|
19
|
+
underMaintenance: 'Under maintenance',
|
|
20
|
+
underMaintenanceDescription: 'The site is currently undergoing maintenance.',
|
|
21
|
+
underMaintenanceHelp: 'Please, try again in a few minutes.',
|
|
22
|
+
refresh: 'Refresh page',
|
|
23
|
+
},
|
|
24
|
+
pt: {
|
|
25
|
+
underMaintenance: 'Em manutenção',
|
|
26
|
+
underMaintenanceDescription: 'O site está em manutenção.',
|
|
27
|
+
underMaintenanceHelp: 'Por favor, tente novamente em alguns minutos.',
|
|
28
|
+
refresh: 'Atualizar página',
|
|
29
|
+
},
|
|
30
|
+
} satisfies Dictionary
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorFeedback.d.ts","sourceRoot":"","sources":["../../src/components/ErrorFeedback.tsx"],"names":[],"mappings":";AAoBA,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,iDAAsD,gBAAgB,4CAyD/F,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorFeedback.js","sourceRoot":"","sources":["../../src/components/ErrorFeedback.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,MAAM,UAAU,GAAwB;IACtC,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,OAAO;CAChB,CA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