@ludo.ninja/components 2.3.26 → 2.3.27
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.
|
@@ -35,7 +35,8 @@ const Notifications = (0, dynamic_1.default)(() => Promise.resolve().then(() =>
|
|
|
35
35
|
const CreatorNotifications = () => {
|
|
36
36
|
const notifications = (0, ui_1.useUiStore)((state) => state.notifications);
|
|
37
37
|
const removeNotification = (0, ui_1.useUiStore)((state) => state.removeNotification);
|
|
38
|
+
const removeAllNotifications = (0, ui_1.useUiStore)((state) => state.removeAllNotifications);
|
|
38
39
|
const isOpen = (0, useIsOpenNotifications_1.useIsOpenNotifications)({ notifications });
|
|
39
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isOpen && ((0, jsx_runtime_1.jsx)(Notifications, { notifications: notifications, removeNotification: removeNotification })) }));
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isOpen && ((0, jsx_runtime_1.jsx)(Notifications, { notifications: notifications, removeNotification: removeNotification, removeAllNotifications: removeAllNotifications })) }));
|
|
40
41
|
};
|
|
41
42
|
exports.CreatorNotifications = CreatorNotifications;
|
package/build/store/ui/index.js
CHANGED
|
@@ -51,6 +51,12 @@ exports.useUiStore = (0, traditional_1.createWithEqualityFn)()((setState) => ({
|
|
|
51
51
|
notifications: prev.notifications.filter((el) => el.id !== id),
|
|
52
52
|
}));
|
|
53
53
|
},
|
|
54
|
+
removeAllNotifications: () => {
|
|
55
|
+
setState((prev) => ({
|
|
56
|
+
...prev,
|
|
57
|
+
notifications: [],
|
|
58
|
+
}));
|
|
59
|
+
},
|
|
54
60
|
//overlay
|
|
55
61
|
isOverlayActive: false,
|
|
56
62
|
openOverLay: () => {
|
|
@@ -9,6 +9,7 @@ export interface IUiStore {
|
|
|
9
9
|
notifications: TNotifications;
|
|
10
10
|
addNotification: (content: TNotificationData['content']) => Promise<void>;
|
|
11
11
|
removeNotification: (id: number) => void;
|
|
12
|
+
removeAllNotifications: () => void;
|
|
12
13
|
isOverlayActive: boolean;
|
|
13
14
|
openOverLay: () => void;
|
|
14
15
|
closeOverlay: () => void;
|
|
@@ -7,4 +7,4 @@ export declare enum ServerErrorType {
|
|
|
7
7
|
NOT_FOUND = "NOT_FOUND",
|
|
8
8
|
INTERNAL_ERROR = "INTERNAL_ERROR"
|
|
9
9
|
}
|
|
10
|
-
export declare const getErrorAlertProps: (error: ApolloError) => alertTypeProps
|
|
10
|
+
export declare const getErrorAlertProps: (error: ApolloError) => alertTypeProps;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getErrorAlertProps = exports.ServerErrorType = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
5
|
const type_1 = require("../../system/Alert/type");
|
|
5
6
|
const env_1 = require("../env");
|
|
6
7
|
var ServerErrorType;
|
|
@@ -27,7 +28,13 @@ const getErrorAlertProps = (error) => {
|
|
|
27
28
|
return !(0, env_1.isProdFromEnvForServer)() ? {
|
|
28
29
|
type: type_1.alertVariants.error,
|
|
29
30
|
caption: error.cause?.message || error.message,
|
|
30
|
-
} :
|
|
31
|
+
} : {
|
|
32
|
+
type: type_1.alertVariants.error,
|
|
33
|
+
caption: 'Internal server error',
|
|
34
|
+
text: '',
|
|
35
|
+
icon: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}),
|
|
36
|
+
small: true
|
|
37
|
+
};
|
|
31
38
|
}
|
|
32
39
|
};
|
|
33
40
|
exports.getErrorAlertProps = getErrorAlertProps;
|