awing-library 2.1.39-beta → 2.1.41-beta

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.
@@ -6,65 +6,69 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var jsx_runtime_1 = require("react/jsx-runtime");
7
7
  var react_i18next_1 = require("react-i18next");
8
8
  var material_1 = require("@mui/material");
9
- var react_router_dom_1 = require("react-router-dom");
10
9
  var NotificationAvatar_1 = __importDefault(require("./NotificationAvatar"));
11
10
  var NotificationContent_1 = __importDefault(require("./NotificationContent"));
12
11
  var notSeen_svg_1 = __importDefault(require("../../../../../Assets/Images/notSeen.svg"));
13
12
  var watched_svg_1 = __importDefault(require("../../../../../Assets/Images/watched.svg"));
14
13
  var Types_1 = require("../../../Types");
15
14
  var Message_1 = require("./Message");
15
+ var Router_1 = require("../../../../../AWING/Router");
16
16
  var NotificationItem = function (props) {
17
17
  var t = (0, react_i18next_1.useTranslation)().t;
18
- var notificationMessage = props.notificationMessage, _a = props.onUpdateStatus, onUpdateStatus = _a === void 0 ? function () { return null; } : _a;
18
+ var navigate = (0, Router_1.useNavigate)();
19
+ var notificationMessage = props.notificationMessage, onUpdateStatus = props.onUpdateStatus;
19
20
  var sagaTransactionType = notificationMessage.sagaTransactionType, fields = notificationMessage.fields, status = notificationMessage.status, id = notificationMessage.id;
20
21
  var handleUpdateStatus = function (event) {
21
22
  event.preventDefault();
22
23
  event.stopPropagation();
23
24
  onUpdateStatus({ id: id, status: status });
24
25
  };
26
+ var handleClickNotification = function () {
27
+ navigate((0, Message_1.getFullDescription)(sagaTransactionType, t, fields).url);
28
+ status === Types_1.NotificationMessageStatus.Read &&
29
+ onUpdateStatus({ id: id, status: status });
30
+ };
25
31
  var itemStatus = status === Types_1.NotificationMessageStatus.Read;
26
- return ((0, jsx_runtime_1.jsx)(react_router_dom_1.NavLink, { to: (0, Message_1.getFullDescription)(sagaTransactionType, t, fields).url, style: {
27
- color: 'inherit',
28
- textDecoration: 'none',
29
- }, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { color: "inherit", sx: [
30
- {
31
- display: 'flex',
32
- flexDirection: 'row',
33
- alignItems: 'center',
34
- justifyContent: 'space-between',
35
- padding: '8px',
36
- borderRadius: '8px',
37
- position: 'relative',
38
- },
39
- {
40
- '&:hover': {
41
- backgroundColor: '#03030312',
42
- '& .wrapBtnStatus': {
43
- display: 'flex',
44
- alignItems: 'center',
45
- position: 'absolute',
46
- right: '32px',
47
- padding: '4px',
48
- cursor: 'pointer',
49
- borderRadius: '50%',
50
- backgroundColor: '#EBEDF0',
51
- boxShadow: 'rgba(14, 30, 37, 0.12) 0 2px 4px 0, rgba(14, 30, 37, 0.32) 0 2px 16px 0',
52
- },
53
- },
54
- },
55
- ], children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { content: "div", sx: {
32
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { color: "inherit", onClick: handleClickNotification, sx: [
33
+ {
34
+ display: 'flex',
35
+ flexDirection: 'row',
36
+ alignItems: 'center',
37
+ justifyContent: 'space-between',
38
+ padding: '8px',
39
+ borderRadius: '8px',
40
+ position: 'relative',
41
+ cursor: 'pointer',
42
+ },
43
+ {
44
+ '&:hover': {
45
+ backgroundColor: '#03030312',
46
+ '& .wrapBtnStatus': {
56
47
  display: 'flex',
57
- flexDirection: 'row',
58
48
  alignItems: 'center',
59
- }, children: [(0, jsx_runtime_1.jsx)(NotificationAvatar_1.default, { url: '', name: '' }), (0, jsx_runtime_1.jsx)(NotificationContent_1.default, { status: itemStatus, notificationMessage: notificationMessage })] }), (0, jsx_runtime_1.jsx)(material_1.Paper, { variant: "outlined", sx: { display: 'none' }, className: "wrapBtnStatus", onClick: handleUpdateStatus, title: itemStatus
60
- ? t('Notifications.TitleMarkRead')
61
- : t('Notifications.TitleMarkUnread'), children: (0, jsx_runtime_1.jsx)("img", { src: (itemStatus
62
- ? notSeen_svg_1.default
63
- : watched_svg_1.default), alt: itemStatus ? 'iconNotSeen' : 'iconWatched', style: { width: '25px', height: '25px' } }) }), itemStatus && ((0, jsx_runtime_1.jsx)(material_1.Paper, { "data-testid": "iconStatus", variant: "outlined", sx: {
64
- padding: '5px',
65
- marginLeft: '8px',
49
+ position: 'absolute',
50
+ right: '32px',
51
+ padding: '4px',
52
+ cursor: 'pointer',
66
53
  borderRadius: '50%',
67
- backgroundColor: '#ed1d25',
68
- } }))] }) }));
54
+ backgroundColor: '#EBEDF0',
55
+ boxShadow: 'rgba(14, 30, 37, 0.12) 0 2px 4px 0, rgba(14, 30, 37, 0.32) 0 2px 16px 0',
56
+ },
57
+ },
58
+ },
59
+ ], children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { content: "div", sx: {
60
+ display: 'flex',
61
+ flexDirection: 'row',
62
+ alignItems: 'center',
63
+ }, children: [(0, jsx_runtime_1.jsx)(NotificationAvatar_1.default, { url: '', name: '' }), (0, jsx_runtime_1.jsx)(NotificationContent_1.default, { status: itemStatus, notificationMessage: notificationMessage })] }), (0, jsx_runtime_1.jsx)(material_1.Paper, { variant: "outlined", sx: { display: 'none' }, className: "wrapBtnStatus", onClick: handleUpdateStatus, title: itemStatus
64
+ ? t('Notifications.TitleMarkRead')
65
+ : t('Notifications.TitleMarkUnread'), children: (0, jsx_runtime_1.jsx)("img", { src: (itemStatus
66
+ ? notSeen_svg_1.default
67
+ : watched_svg_1.default), alt: itemStatus ? 'iconNotSeen' : 'iconWatched', style: { width: '25px', height: '25px' } }) }), itemStatus && ((0, jsx_runtime_1.jsx)(material_1.Paper, { "data-testid": "iconStatus", variant: "outlined", sx: {
68
+ padding: '5px',
69
+ marginLeft: '8px',
70
+ borderRadius: '50%',
71
+ backgroundColor: '#ed1d25',
72
+ } }))] }));
69
73
  };
70
74
  exports.default = NotificationItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.39-beta",
3
+ "version": "2.1.41-beta",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",