@selfcommunity/react-ui 0.7.9-alpha.34 → 0.7.9-alpha.36
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/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +4 -1
- package/lib/cjs/components/Notification/Group/Group.js +6 -7
- package/lib/cjs/components/Notification/Notification.js +4 -5
- package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +4 -1
- package/lib/esm/components/Notification/Group/Group.js +7 -8
- package/lib/esm/components/Notification/Notification.js +4 -5
- package/lib/umd/react-ui.js +1 -1
- package/package.json +3 -3
|
@@ -77,7 +77,10 @@ function GroupSubscribeButton(inProps) {
|
|
|
77
77
|
scGroupsManager
|
|
78
78
|
.subscribe(scGroup, userId)
|
|
79
79
|
.then(() => {
|
|
80
|
-
onSubscribe &&
|
|
80
|
+
onSubscribe &&
|
|
81
|
+
onSubscribe(scGroup, scGroup.privacy === types_1.SCGroupPrivacyType.PRIVATE && scGroup.subscription_status !== types_1.SCGroupSubscriptionStatusType.INVITED
|
|
82
|
+
? types_1.SCGroupSubscriptionStatusType.REQUESTED
|
|
83
|
+
: types_1.SCGroupSubscriptionStatusType.SUBSCRIBED);
|
|
81
84
|
})
|
|
82
85
|
.catch((e) => {
|
|
83
86
|
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
|
|
@@ -19,7 +19,7 @@ const classes = {
|
|
|
19
19
|
root: `${constants_1.PREFIX}-group-root`,
|
|
20
20
|
avatar: `${constants_1.PREFIX}-avatar`,
|
|
21
21
|
actions: `${constants_1.PREFIX}-actions`,
|
|
22
|
-
|
|
22
|
+
acceptButton: `${constants_1.PREFIX}-reply-button`,
|
|
23
23
|
activeAt: `${constants_1.PREFIX}-active-at`,
|
|
24
24
|
username: `${constants_1.PREFIX}-username`
|
|
25
25
|
};
|
|
@@ -55,11 +55,10 @@ function GroupNotification(props) {
|
|
|
55
55
|
}), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null }),
|
|
56
56
|
react_1.default.createElement(UserAvatar_1.default, { hide: !notificationObject.user.community_badge, smaller: true },
|
|
57
57
|
react_1.default.createElement(material_1.Avatar, { alt: notificationObject.user.username, variant: "circular", src: notificationObject.user.avatar, classes: { root: classes.avatar } }))), primary: react_1.default.createElement(material_1.Box, null,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
' ')),
|
|
58
|
+
react_1.default.createElement(react_core_1.Link, Object.assign({}, (!notificationObject.user.deleted && {
|
|
59
|
+
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
|
|
60
|
+
}), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), notificationObject.user.username),
|
|
61
|
+
' ',
|
|
63
62
|
react_1.default.createElement(react_intl_1.FormattedMessage, { id: `ui.notification.${notificationObject.type}`, defaultMessage: `ui.notification.${notificationObject.type}`, values: {
|
|
64
63
|
group: notificationObject.group.name,
|
|
65
64
|
link: (...chunks) => react_1.default.createElement(react_core_1.Link, { to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, notificationObject.group) }, chunks)
|
|
@@ -72,7 +71,7 @@ function GroupNotification(props) {
|
|
|
72
71
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
73
72
|
react_1.default.createElement(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className, `${constants_1.PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, actions: react_1.default.createElement(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 },
|
|
74
73
|
react_1.default.createElement(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.activeAt }),
|
|
75
|
-
status && status !== types_1.SCGroupSubscriptionStatusType.SUBSCRIBED && (react_1.default.createElement(lab_1.LoadingButton, { color: 'primary', variant: "outlined", size: "small", classes: { root: classes.
|
|
74
|
+
status && status !== types_1.SCGroupSubscriptionStatusType.SUBSCRIBED && (react_1.default.createElement(lab_1.LoadingButton, { color: 'primary', variant: "outlined", size: "small", classes: { root: classes.acceptButton }, component: react_core_1.Link, loading: scUserContext.user ? status === null || manager.isLoading(notificationObject.group) : null, to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, notificationObject.group) },
|
|
76
75
|
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.groupSubscribeButton.accept", defaultMessage: "ui.groupSubscribeButton.accept" })))) }, rest)),
|
|
77
76
|
openAlert && react_1.default.createElement(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })));
|
|
78
77
|
}
|
|
@@ -211,11 +211,10 @@ function UserNotification(inProps) {
|
|
|
211
211
|
}), { onClick: groupNotification.user.deleted ? () => setOpenAlert(true) : null }),
|
|
212
212
|
react_1.default.createElement(UserAvatar_1.default, { hide: !groupNotification.user.community_badge, smaller: true },
|
|
213
213
|
react_1.default.createElement(material_1.Avatar, { className: classes.avatar, alt: groupNotification.user.username, variant: "circular", src: groupNotification.user.avatar }))), titleTypographyProps: { className: classes.title, variant: 'subtitle1' }, title: react_1.default.createElement(react_1.default.Fragment, null,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
' ')),
|
|
214
|
+
react_1.default.createElement(react_core_1.Link, Object.assign({}, (!groupNotification.user.deleted && {
|
|
215
|
+
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, groupNotification.user)
|
|
216
|
+
}), { onClick: groupNotification.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), groupNotification.user.username),
|
|
217
|
+
' ',
|
|
219
218
|
react_1.default.createElement(react_intl_1.FormattedMessage, { id: `ui.notification.${notificationObject.aggregated[0].type}`, defaultMessage: `ui.notification.${notificationObject.aggregated[0].type}`, values: {
|
|
220
219
|
group: groupNotification.group.name,
|
|
221
220
|
link: (...chunks) => react_1.default.createElement(react_core_1.Link, { to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, groupNotification.group) }, chunks)
|
|
@@ -75,7 +75,10 @@ export default function GroupSubscribeButton(inProps) {
|
|
|
75
75
|
scGroupsManager
|
|
76
76
|
.subscribe(scGroup, userId)
|
|
77
77
|
.then(() => {
|
|
78
|
-
onSubscribe &&
|
|
78
|
+
onSubscribe &&
|
|
79
|
+
onSubscribe(scGroup, scGroup.privacy === SCGroupPrivacyType.PRIVATE && scGroup.subscription_status !== SCGroupSubscriptionStatusType.INVITED
|
|
80
|
+
? SCGroupSubscriptionStatusType.REQUESTED
|
|
81
|
+
: SCGroupSubscriptionStatusType.SUBSCRIBED);
|
|
79
82
|
})
|
|
80
83
|
.catch((e) => {
|
|
81
84
|
Logger.error(SCOPE_SC_UI, e);
|
|
@@ -3,7 +3,7 @@ import React, { useContext, useEffect, useState } from 'react';
|
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { Avatar, Box, Stack, Typography } from '@mui/material';
|
|
5
5
|
import { Link, SCRoutes, SCUserContext, useSCRouting } from '@selfcommunity/react-core';
|
|
6
|
-
import { SCGroupSubscriptionStatusType
|
|
6
|
+
import { SCGroupSubscriptionStatusType } from '@selfcommunity/types';
|
|
7
7
|
import { FormattedMessage } from 'react-intl';
|
|
8
8
|
import DateTimeAgo from '../../../shared/DateTimeAgo';
|
|
9
9
|
import classNames from 'classnames';
|
|
@@ -17,7 +17,7 @@ const classes = {
|
|
|
17
17
|
root: `${PREFIX}-group-root`,
|
|
18
18
|
avatar: `${PREFIX}-avatar`,
|
|
19
19
|
actions: `${PREFIX}-actions`,
|
|
20
|
-
|
|
20
|
+
acceptButton: `${PREFIX}-reply-button`,
|
|
21
21
|
activeAt: `${PREFIX}-active-at`,
|
|
22
22
|
username: `${PREFIX}-username`
|
|
23
23
|
};
|
|
@@ -53,11 +53,10 @@ export default function GroupNotification(props) {
|
|
|
53
53
|
}), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null }),
|
|
54
54
|
React.createElement(UserAvatar, { hide: !notificationObject.user.community_badge, smaller: true },
|
|
55
55
|
React.createElement(Avatar, { alt: notificationObject.user.username, variant: "circular", src: notificationObject.user.avatar, classes: { root: classes.avatar } }))), primary: React.createElement(Box, null,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
' ')),
|
|
56
|
+
React.createElement(Link, Object.assign({}, (!notificationObject.user.deleted && {
|
|
57
|
+
to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
|
|
58
|
+
}), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), notificationObject.user.username),
|
|
59
|
+
' ',
|
|
61
60
|
React.createElement(FormattedMessage, { id: `ui.notification.${notificationObject.type}`, defaultMessage: `ui.notification.${notificationObject.type}`, values: {
|
|
62
61
|
group: notificationObject.group.name,
|
|
63
62
|
link: (...chunks) => React.createElement(Link, { to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, notificationObject.group) }, chunks)
|
|
@@ -70,7 +69,7 @@ export default function GroupNotification(props) {
|
|
|
70
69
|
return (React.createElement(React.Fragment, null,
|
|
71
70
|
React.createElement(Root, Object.assign({ id: id, className: classNames(classes.root, className, `${PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, actions: React.createElement(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 },
|
|
72
71
|
React.createElement(DateTimeAgo, { date: notificationObject.active_at, className: classes.activeAt }),
|
|
73
|
-
status && status !== SCGroupSubscriptionStatusType.SUBSCRIBED && (React.createElement(LoadingButton, { color: 'primary', variant: "outlined", size: "small", classes: { root: classes.
|
|
72
|
+
status && status !== SCGroupSubscriptionStatusType.SUBSCRIBED && (React.createElement(LoadingButton, { color: 'primary', variant: "outlined", size: "small", classes: { root: classes.acceptButton }, component: Link, loading: scUserContext.user ? status === null || manager.isLoading(notificationObject.group) : null, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, notificationObject.group) },
|
|
74
73
|
React.createElement(FormattedMessage, { id: "ui.groupSubscribeButton.accept", defaultMessage: "ui.groupSubscribeButton.accept" })))) }, rest)),
|
|
75
74
|
openAlert && React.createElement(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })));
|
|
76
75
|
}
|
|
@@ -209,11 +209,10 @@ export default function UserNotification(inProps) {
|
|
|
209
209
|
}), { onClick: groupNotification.user.deleted ? () => setOpenAlert(true) : null }),
|
|
210
210
|
React.createElement(UserAvatar, { hide: !groupNotification.user.community_badge, smaller: true },
|
|
211
211
|
React.createElement(Avatar, { className: classes.avatar, alt: groupNotification.user.username, variant: "circular", src: groupNotification.user.avatar }))), titleTypographyProps: { className: classes.title, variant: 'subtitle1' }, title: React.createElement(React.Fragment, null,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
' ')),
|
|
212
|
+
React.createElement(Link, Object.assign({}, (!groupNotification.user.deleted && {
|
|
213
|
+
to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, groupNotification.user)
|
|
214
|
+
}), { onClick: groupNotification.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), groupNotification.user.username),
|
|
215
|
+
' ',
|
|
217
216
|
React.createElement(FormattedMessage, { id: `ui.notification.${notificationObject.aggregated[0].type}`, defaultMessage: `ui.notification.${notificationObject.aggregated[0].type}`, values: {
|
|
218
217
|
group: groupNotification.group.name,
|
|
219
218
|
link: (...chunks) => React.createElement(Link, { to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, groupNotification.group) }, chunks)
|