@selfcommunity/react-ui 1.2.5-alpha.1 → 1.2.5-alpha.2
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/CustomAdv/CustomAdv.js +2 -1
- package/lib/cjs/components/Editor/plugins/ImagePlugin.js +3 -1
- package/lib/cjs/components/FeedObject/Actions/Comment/Comment.js +6 -2
- package/lib/cjs/components/FeedObject/Actions/Share/Share.js +1 -1
- package/lib/cjs/components/FeedObject/Contributors/Contributors.js +1 -1
- package/lib/cjs/components/FeedObject/FeedObject.js +1 -1
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.js +2 -1
- package/lib/cjs/components/SearchAutocomplete/SearchAutocomplete.js +21 -7
- package/lib/cjs/components/User/User.js +1 -1
- package/lib/cjs/components/VoteAudienceButton/VoteAudienceButton.js +1 -1
- package/lib/cjs/components/VoteButton/VoteButton.js +1 -1
- package/lib/esm/components/CustomAdv/CustomAdv.js +3 -2
- package/lib/esm/components/Editor/plugins/ImagePlugin.js +3 -1
- package/lib/esm/components/FeedObject/Actions/Comment/Comment.js +6 -2
- package/lib/esm/components/FeedObject/Actions/Share/Share.js +1 -1
- package/lib/esm/components/FeedObject/Contributors/Contributors.js +1 -1
- package/lib/esm/components/FeedObject/FeedObject.js +1 -1
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.js +3 -2
- package/lib/esm/components/SearchAutocomplete/SearchAutocomplete.js +21 -7
- package/lib/esm/components/User/User.js +1 -1
- package/lib/esm/components/VoteAudienceButton/VoteAudienceButton.js +1 -1
- package/lib/esm/components/VoteButton/VoteButton.js +1 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +5 -5
|
@@ -54,7 +54,8 @@ function CustomAdv(inProps) {
|
|
|
54
54
|
props: inProps,
|
|
55
55
|
name: constants_1.PREFIX
|
|
56
56
|
});
|
|
57
|
-
const
|
|
57
|
+
const _id = (0, react_1.useId)();
|
|
58
|
+
const { id = `custom_adv_${_id}`, className, advId = null, position, categoriesId, prefixedHeight, onStateChange, onHeightChange } = props;
|
|
58
59
|
// REFS
|
|
59
60
|
const isMountedRef = (0, react_core_1.useIsComponentMountedRef)();
|
|
60
61
|
const estimatedHeight = (0, react_1.useRef)(0);
|
|
@@ -16,6 +16,7 @@ const upload_button_1 = require("@rpldy/upload-button");
|
|
|
16
16
|
const notistack_1 = require("notistack");
|
|
17
17
|
const ImageNode_1 = require("../nodes/ImageNode");
|
|
18
18
|
const constants_1 = require("../constants");
|
|
19
|
+
const react_intl_1 = require("react-intl");
|
|
19
20
|
exports.INSERT_IMAGE_COMMAND = (0, lexical_1.createCommand)();
|
|
20
21
|
const UploadButton = (0, upload_button_1.asUploadButton)((0, react_1.forwardRef)((_a, ref) => {
|
|
21
22
|
var { progress = null } = _a, rest = tslib_1.__rest(_a, ["progress"]);
|
|
@@ -76,6 +77,7 @@ const Root = (0, material_1.styled)(Image, {
|
|
|
76
77
|
})(() => ({}));
|
|
77
78
|
function ImagePlugin() {
|
|
78
79
|
const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
|
|
80
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
79
81
|
(0, react_1.useEffect)(() => {
|
|
80
82
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
81
83
|
// @ts-ignore
|
|
@@ -85,7 +87,7 @@ function ImagePlugin() {
|
|
|
85
87
|
return editor.registerCommand(exports.INSERT_IMAGE_COMMAND, (payload) => {
|
|
86
88
|
const imageNode = (0, ImageNode_1.$createImageNode)({
|
|
87
89
|
src: payload.src,
|
|
88
|
-
altText: payload.altText,
|
|
90
|
+
altText: payload.altText || intl.formatMessage({ id: 'ui.editor.imagePlugin.alt', defaultMessage: 'ui.editor.imagePlugin.alt' }),
|
|
89
91
|
maxWidth: '100%',
|
|
90
92
|
width: payload.width,
|
|
91
93
|
height: payload.height
|
|
@@ -53,9 +53,13 @@ function Comment(props) {
|
|
|
53
53
|
audience = ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", size: "small", disabled: true, color: "inherit" }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 18, width: 50 }) })));
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
audience = ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: onViewCommentsAction ? ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", size: "small", onClick: onViewCommentsAction, color: "inherit" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span",
|
|
56
|
+
audience = ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: onViewCommentsAction ? ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", size: "small", onClick: onViewCommentsAction, color: "inherit" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: intl.formatMessage(messages.comments, {
|
|
57
57
|
total: obj.comment_count
|
|
58
|
-
})}
|
|
58
|
+
}) })) }))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: feedObjectTemplate === feedObject_1.SCFeedObjectTemplateType.DETAIL ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: `${intl.formatMessage(messages.comments, {
|
|
59
|
+
total: obj.comment_count
|
|
60
|
+
})}` }))) : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", size: "small", component: react_core_1.Link, to: scRoutingContext.url((0, contribution_1.getContributionRouteName)(obj), (0, contribution_1.getRouteData)(obj)), classes: { root: classes.viewAudienceButton } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: intl.formatMessage(messages.comments, {
|
|
61
|
+
total: obj.comment_count
|
|
62
|
+
}) })) }))) })) }));
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
return audience;
|
|
@@ -182,7 +182,7 @@ function Share(props) {
|
|
|
182
182
|
audience = ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", size: "small", disabled: true, color: "inherit" }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", height: 18, width: 50 }) })));
|
|
183
183
|
}
|
|
184
184
|
else {
|
|
185
|
-
audience = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", size: "small", onClick: handleToggleSharesDialog, disabled: sharesCount < 1, classes: { root: classes.viewAudienceButton } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span",
|
|
185
|
+
audience = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", size: "small", onClick: handleToggleSharesDialog, disabled: sharesCount < 1, classes: { root: classes.viewAudienceButton } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: `${intl.formatMessage(messages.shares, {
|
|
186
186
|
total: sharesCount
|
|
187
187
|
})}` })) })), openSharesDialog && sharesCount > 0 && ((0, jsx_runtime_1.jsx)(SharesDialog_1.default, { feedObject: obj, feedObjectType: obj.type, open: openSharesDialog, onClose: handleToggleSharesDialog }))] }));
|
|
188
188
|
}
|
|
@@ -49,6 +49,6 @@ function ContributorsFeedObject(props) {
|
|
|
49
49
|
if (!contributorsObject.feedObject) {
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { children: contributorsObject.isLoadingNext && !openContributorsDialog ? ((0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({}, ContributorsSkeletonProps))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: contributorsObject.contributors.length > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Button, Object.assign({ variant: "text", onClick: () => setOpenContributorsDialog(true), classes: { root: classes.btnParticipants }, color: "inherit" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ component: "span"
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { children: contributorsObject.isLoadingNext && !openContributorsDialog ? ((0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({}, ContributorsSkeletonProps))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: contributorsObject.contributors.length > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Button, Object.assign({ variant: "text", onClick: () => setOpenContributorsDialog(true), classes: { root: classes.btnParticipants }, color: "inherit" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ component: "span" }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.contributors.participants", defaultMessage: "ui.feedObject.contributors.participants" }), ":"] })), (0, jsx_runtime_1.jsxs)(material_1.AvatarGroup, Object.assign({}, rest, { children: [contributorsObject.contributors.map((c, i) => ((0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: c.username, src: c.avatar }, i))), [...Array(Math.max(contributorsObject.total - contributorsObject.contributors.length, 0))].map((_x, i) => ((0, jsx_runtime_1.jsx)(material_1.Avatar, {}, i)))] }))] })), openContributorsDialog && ((0, jsx_runtime_1.jsx)(BaseDialog_1.default, Object.assign({ title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.feedObject.contributors.title", id: "ui.feedObject.contributors.title", values: { total: contributorsObject.total } }), onClose: () => setOpenContributorsDialog(false), open: openContributorsDialog }, { children: contributorsObject.isLoadingNext ? ((0, jsx_runtime_1.jsx)(CentralProgress_1.default, { size: 50 })) : ((0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ dataLength: contributorsObject.contributors.length, next: contributorsObject.getNextPage(), hasMoreNext: Boolean(contributorsObject.next), loaderNext: (0, jsx_runtime_1.jsx)(CentralProgress_1.default, { size: 30 }), height: 400, endMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", align: "center", fontWeight: "bold" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.contributors.noOtherContributors", defaultMessage: "ui.feedObject.contributors.noOtherContributors" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: contributorsObject.contributors.map((c, i) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(User_1.default, { elevation: 0, user: c, sx: { m: 0 }, onClick: () => setOpenContributorsDialog(false) }, c.id) }, i))) }) }))) })))] })) : null })) }) })));
|
|
53
53
|
}
|
|
54
54
|
exports.default = ContributorsFeedObject;
|
|
@@ -456,7 +456,7 @@ function FeedObject(inProps) {
|
|
|
456
456
|
}, cacheStrategy: cacheStrategy }, ActivitiesProps), selectedActivities) })) }))), composerOpen && ((0, jsx_runtime_1.jsx)(Composer_1.default, { open: composerOpen, feedObject: obj, onClose: handleToggleEdit, onSuccess: handleEditSuccess, maxWidth: "sm", fullWidth: true }))] }))) : ((0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({ template: template }, FeedObjectSkeletonProps))) }));
|
|
457
457
|
}
|
|
458
458
|
else if (template === feedObject_1.SCFeedObjectTemplateType.SHARE) {
|
|
459
|
-
objElement = ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: obj ? ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [obj.categories.length > 0 && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: classes.category }, { children: [(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [obj.group && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.group }, { children: (0, jsx_runtime_1.jsx)(material_1.Chip, { color: "secondary", size: "small", icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "groups" }), component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }, obj.group.id) }))), obj.event && ((0, jsx_runtime_1.jsx)(material_1.Chip, { className: classes.event, color: "secondary", size: "small", icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "CalendarIcon" }), component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, obj.event), clickable: true }, obj.event.id))] }), obj.categories.map((c) => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.CATEGORY_ROUTE_NAME, c) }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "overline" }, { children: c.name })) }), c.id)))] }))), obj.group && !obj.categories.length && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.group }, { children: (0, jsx_runtime_1.jsx)(material_1.Chip, { color: "secondary", size: "small", icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "groups" }), label: obj.group.name, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }, obj.group.id) }))), obj.event && !obj.categories.length && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.event }, { children: (0, jsx_runtime_1.jsx)(material_1.Chip, { color: "secondary", size: "small", icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "groups" }), label: obj.event.name, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, obj.event), clickable: true }, obj.event.id) }))), (0, jsx_runtime_1.jsx)(material_1.CardHeader, { classes: { root: classes.header }, avatar: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !obj.author.community_badge }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({
|
|
459
|
+
objElement = ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: obj ? ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [obj.categories.length > 0 && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: classes.category }, { children: [(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [obj.group && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.group }, { children: (0, jsx_runtime_1.jsx)(material_1.Chip, { color: "secondary", size: "small", icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "groups" }), component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }, obj.group.id) }))), obj.event && ((0, jsx_runtime_1.jsx)(material_1.Chip, { className: classes.event, color: "secondary", size: "small", icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "CalendarIcon" }), component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, obj.event), clickable: true }, obj.event.id))] }), obj.categories.map((c) => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.CATEGORY_ROUTE_NAME, c) }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "overline" }, { children: c.name })) }), c.id)))] }))), obj.group && !obj.categories.length && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.group }, { children: (0, jsx_runtime_1.jsx)(material_1.Chip, { color: "secondary", size: "small", icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "groups" }), label: obj.group.name, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }, obj.group.id) }))), obj.event && !obj.categories.length && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.event }, { children: (0, jsx_runtime_1.jsx)(material_1.Chip, { color: "secondary", size: "small", icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "groups" }), label: obj.event.name, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, obj.event), clickable: true }, obj.event.id) }))), (0, jsx_runtime_1.jsx)(material_1.CardHeader, { classes: { root: classes.header }, avatar: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !obj.author.community_badge }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ alt: obj.author.username, src: obj.author.avatar, className: classes.avatar }, { children: obj.author.username })) })) })), title: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: obj.author.username })), subheader: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url((0, contribution_1.getContributionRouteName)(obj), (0, contribution_1.getRouteData)(obj)), className: classes.activityAt }, { children: (0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: obj.added_at }) })) }), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ classes: { root: classes.content } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.titleSection }, { children: 'title' in obj && ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url((0, contribution_1.getContributionRouteName)(obj), (0, contribution_1.getRouteData)(obj)) }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", gutterBottom: true, className: classes.title }, { children: obj.title })) }))) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.textSection }, { children: getContributionSummary(obj, template) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.mediasSection }, { children: (0, jsx_runtime_1.jsx)(FeedObjectMediaPreview_1.default, Object.assign({ medias: obj.medias }, FeedObjectMediaPreviewProps)) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.pollsSection }, { children: obj['poll'] && ((0, jsx_runtime_1.jsx)(Poll_1.default, Object.assign({ feedObject: obj, pollObject: obj['poll'], onChange: handleChangePoll, visible: Boolean(obj.type !== types_1.SCContributionType.DISCUSSION && !obj.html && !obj.medias.length) }, PollObjectProps))) }))] }))] })) : ((0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({ template: template }, FeedObjectSkeletonProps))) }));
|
|
460
460
|
}
|
|
461
461
|
else {
|
|
462
462
|
objElement = ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: obj ? ((0, jsx_runtime_1.jsx)(BaseItem_1.default, { elevation: 0, className: classes.snippet, image: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !obj.author.community_badge }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: obj.author.username, variant: "circular", src: obj.author.avatar, className: classes.avatar }) })) })), primary: (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: obj.author.username })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", className: classes.snippetContent }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url((0, contribution_1.getContributionRouteName)(obj), (0, contribution_1.getRouteData)(obj)) }, { children: (0, contribution_1.getContributionSnippet)(obj) })) }))] }), disableTypography: true, secondary: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", spacing: 2, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url((0, contribution_1.getContributionRouteName)(obj), (0, contribution_1.getRouteData)(obj)), className: classes.activityAt }, { children: (0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { component: "span", date: obj.added_at }) })), commentsEnabled && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url((0, contribution_1.getContributionRouteName)(obj), (0, contribution_1.getRouteData)(obj)), variant: "text", color: "secondary", size: "small" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feedObject.comment", defaultMessage: "ui.feedObject.comment" }) })))] })) })) : ((0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({}, FeedObjectSkeletonProps))) }));
|
|
@@ -62,6 +62,7 @@ function InlineComposerWidget(inProps) {
|
|
|
62
62
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
63
63
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
64
64
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
65
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
65
66
|
// PREFERENCES
|
|
66
67
|
const preferences = (0, react_core_1.useSCPreferences)();
|
|
67
68
|
const onlyStaffEnabled = (0, react_1.useMemo)(() => preferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value, [preferences.preferences]);
|
|
@@ -103,6 +104,6 @@ function InlineComposerWidget(inProps) {
|
|
|
103
104
|
if (!react_core_1.UserUtils.isStaff(scUserContext.user) && !react_core_1.UserUtils.isPublisher(scUserContext.user) && onlyStaffEnabled) {
|
|
104
105
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
105
106
|
}
|
|
106
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.input }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", disableFocusRipple: true, disableRipple: true, disableElevation: true, onClick: handleOpen, fullWidth: true, color: "inherit" }, { children: label !== null && label !== void 0 ? label : (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.inlineComposerWidget.label", defaultMessage: "ui.inlineComposerWidget.label" }) })) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.avatar }, { children: !scUserContext.user ? ((0, jsx_runtime_1.jsx)(material_1.Avatar, { variant: "circular" })) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUserContext.user.username, variant: "circular", src: scUserContext.user.avatar }) }))) }))] })) })), open && ((0, jsx_runtime_1.jsx)(Composer_1.default, { open: open, mediaObjectTypes: mediaObjectTypes, defaultValue: defaultValue, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess, feedType: feedType }))] }));
|
|
107
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.input }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", disableFocusRipple: true, disableRipple: true, disableElevation: true, onClick: handleOpen, fullWidth: true, color: "inherit" }, { children: label !== null && label !== void 0 ? label : (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.inlineComposerWidget.label", defaultMessage: "ui.inlineComposerWidget.label" }) })) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.avatar }, { children: !scUserContext.user ? ((0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: intl.formatMessage({ id: 'ui.inlineComposerWidget.avatar.alt', defaultMessage: 'ui.inlineComposerWidget.avatar.alt' }), variant: "circular" })) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUserContext.user.username, variant: "circular", src: scUserContext.user.avatar }) }))) }))] })) })), open && ((0, jsx_runtime_1.jsx)(Composer_1.default, { open: open, mediaObjectTypes: mediaObjectTypes, defaultValue: defaultValue, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess, feedType: feedType }))] }));
|
|
107
108
|
}
|
|
108
109
|
exports.default = InlineComposerWidget;
|
|
@@ -118,7 +118,7 @@ function SearchAutocomplete(inProps) {
|
|
|
118
118
|
fetchResults();
|
|
119
119
|
}
|
|
120
120
|
}, [value]);
|
|
121
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id,
|
|
121
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className), blurOnSelect: blurOnSelect, onChange: handleChange, onInputChange: handleInputChange, inputValue: value, freeSolo: true, autoComplete: true, disableClearable: true, loading: isLoading, loadingText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.searchAutocomplete.loading", defaultMessage: "ui.searchAutocomplete.loading" }), noOptionsText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.searchAutocomplete.noOptions", defaultMessage: "ui.searchAutocomplete.noOptions" }), options: options, getOptionLabel: (option) => {
|
|
122
122
|
if (typeof option === 'string') {
|
|
123
123
|
return option;
|
|
124
124
|
}
|
|
@@ -126,12 +126,26 @@ function SearchAutocomplete(inProps) {
|
|
|
126
126
|
}, renderOption: (props, option) => {
|
|
127
127
|
const { key } = props, rest = tslib_1.__rest(props, ["key"]);
|
|
128
128
|
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ component: "li" }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: getOptionData(option).name, src: getOptionData(option).image, variant: getOptionData(option).variant }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ ml: 1 }, { children: getOptionData(option).name }))] }), key));
|
|
129
|
-
}, renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { placeholder:
|
|
129
|
+
}, renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { placeholder: intl.formatMessage(messages.placeholder, {
|
|
130
130
|
community: scPreferences.preferences[react_core_1.SCPreferences.TEXT_APPLICATION_NAME].value
|
|
131
|
-
})
|
|
132
|
-
input: Object.assign(Object.assign({}, params.InputProps), {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
}), slotProps: {
|
|
132
|
+
input: Object.assign(Object.assign({}, params.InputProps), { className: classes.input, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ "aria-label": intl.formatMessage({
|
|
133
|
+
id: 'ui.searchAutocomplete.startAdornment.title',
|
|
134
|
+
defaultMessage: 'ui.searchAutocomplete.startAdornment.title'
|
|
135
|
+
}), className: classes.icon }, { children: "search" }))), endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Fade, Object.assign({ in: value.length > 0 || Boolean(onClear), appear: false }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ "aria-label": intl.formatMessage({
|
|
136
|
+
id: 'ui.searchAutocomplete.endAdornment.title',
|
|
137
|
+
defaultMessage: 'ui.searchAutocomplete.endAdornment.title'
|
|
138
|
+
}), title: intl.formatMessage({
|
|
139
|
+
id: 'ui.searchAutocomplete.endAdornment.title',
|
|
140
|
+
defaultMessage: 'ui.searchAutocomplete.endAdornment.title'
|
|
141
|
+
}), className: classes.clear, onClick: handleClear, size: "small" }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) })) }))) }),
|
|
142
|
+
htmlInput: {
|
|
143
|
+
role: 'search',
|
|
144
|
+
name: 'search-autocomplete',
|
|
145
|
+
title: intl.formatMessage(messages.placeholder, {
|
|
146
|
+
community: scPreferences.preferences[react_core_1.SCPreferences.TEXT_APPLICATION_NAME].value
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
} }))) }, rest)));
|
|
136
150
|
}
|
|
137
151
|
exports.default = SearchAutocomplete;
|
|
@@ -102,6 +102,6 @@ function User(inProps) {
|
|
|
102
102
|
*/
|
|
103
103
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ elevation: elevation }, rest, { className: (0, classnames_1.default)(classes.root, className), ButtonBaseProps: buttonProps !== null && buttonProps !== void 0 ? buttonProps : (scUser.deleted
|
|
104
104
|
? { onClick: () => setOpenAlert(true) }
|
|
105
|
-
: { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUser) }), image: badgeContent ? ((0, jsx_runtime_1.jsx)(material_1.Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: badgeContent }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))) : ((0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !hasBadge }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))), primary: (hasBadge && preferences) || isGroupAdmin ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: scUser.username })), (0, jsx_runtime_1.jsx)(material_1.Chip, { component: "span", className: (0, classnames_1.default)(isGroupAdmin ? classes.groupAdminBadgeLabel : classes.staffBadgeLabel), size: "small", label: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span",
|
|
105
|
+
: { component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUser) }), image: badgeContent ? ((0, jsx_runtime_1.jsx)(material_1.Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: badgeContent }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))) : ((0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !hasBadge }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))), primary: (hasBadge && preferences) || isGroupAdmin ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: scUser.username })), (0, jsx_runtime_1.jsx)(material_1.Chip, { component: "span", className: (0, classnames_1.default)(isGroupAdmin ? classes.groupAdminBadgeLabel : classes.staffBadgeLabel), size: "small", label: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: isGroupAdmin ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.user.group.admin", id: "ui.user.group.admin" })) : (preferences[react_core_1.SCPreferences.STAFF_STAFF_BADGE_LABEL]) })) })] })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: scUser.username }))), secondary: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: secondary || (showFollowers ? `${intl.formatMessage(messages.userFollowers, { total: scUser.followers_counter })}` : scUser.description) })), actions: actions !== null && actions !== void 0 ? actions : renderAuthenticatedActions() })), openAlert && (0, jsx_runtime_1.jsx)(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
106
106
|
}
|
|
107
107
|
exports.default = User;
|
|
@@ -118,6 +118,6 @@ function VoteAudienceButton(inProps) {
|
|
|
118
118
|
return (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.voteAudienceButton.dialog.title", id: "ui.voteAudienceButton.dialog.title" });
|
|
119
119
|
}
|
|
120
120
|
}, [tab, reactions, contributionReactionsCount]);
|
|
121
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.
|
|
121
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ title: intl.formatMessage({ id: 'ui.voteAudienceButton.title', defaultMessage: 'ui.voteAudienceButton.title' }), "aria-label": intl.formatMessage({ id: 'ui.voteAudienceButton.title', defaultMessage: 'ui.voteAudienceButton.title' }), onClick: handleOpen, disabled: isLoading || Boolean(error) || contributionVoteCount === 0, loading: isLoading, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ component: "span" }, { children: [audienceIcon, "\u00A0", scUserContext.user && contributionVoted ? (contributionVoteCount === 1 ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.voteAudienceButton.votedOnlyByMe", defaultMessage: "ui.voteAudienceButton.votedOnlyByMe" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.voteAudienceButton.votedByMe", defaultMessage: "ui.voteAudienceButton.votedByMe", values: { total: contributionVoteCount - 1 } }))) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.voteAudienceButton.votes", defaultMessage: "ui.voteAudienceButton.votes", values: { total: contributionVoteCount } }))] })) })), open && ((0, jsx_runtime_1.jsx)(DialogRoot, Object.assign({ title: dialogTitle, onClose: handleClose, open: open, DialogContentProps: {} }, { children: isLoadingVoteList && !voteList ? ((0, jsx_runtime_1.jsx)(CentralProgress_1.default, { size: 50 })) : ((0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ dataLength: voteList.length, next: () => handleFetchVoteList({}), hasMoreNext: voteListHasNext, loaderNext: (0, jsx_runtime_1.jsx)(CentralProgress_1.default, { size: 30 }), height: 400, endMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", align: "center", fontWeight: "bold" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.voteAudienceButton.dialog.end", defaultMessage: "ui.voteAudienceButton.dialog.end" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: voteList.map((vote) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(User_1.default, { elevation: 0, user: vote.user, badgeContent: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ className: classes.dialogVoteBadge }, { children: vote.reaction ? ((0, jsx_runtime_1.jsx)(material_1.Icon, { children: (0, jsx_runtime_1.jsx)("img", { alt: vote.reaction.label, src: vote.reaction.image, width: "100%", height: "100%" }) })) : ((0, jsx_runtime_1.jsx)(material_1.Icon, { children: "thumb_up" })) })), onClick: handleClose }) }, vote.user.id))) }) }))) })))] }));
|
|
122
122
|
}
|
|
123
123
|
exports.default = VoteAudienceButton;
|
|
@@ -137,7 +137,7 @@ function VoteButton(inProps) {
|
|
|
137
137
|
};
|
|
138
138
|
}, [reactions]);
|
|
139
139
|
// RENDER
|
|
140
|
-
const button = ((0, jsx_runtime_1.jsx)(Root, Object.assign({ title: intl.formatMessage({ id: 'ui.voteButton.title', defaultMessage: 'ui.voteButton.title' }), onClick: isMobile && reactions.reactions
|
|
140
|
+
const button = ((0, jsx_runtime_1.jsx)(Root, Object.assign({ title: intl.formatMessage({ id: 'ui.voteButton.title', defaultMessage: 'ui.voteButton.title' }), "aria-label": intl.formatMessage({ id: 'ui.voteButton.title', defaultMessage: 'ui.voteButton.title' }), onClick: isMobile && reactions.reactions
|
|
141
141
|
? handleMouseEnter
|
|
142
142
|
: () => handleVoteAction(contributionReaction ? contributionReaction : reactions.default ? reactions.default : null), disabled: isLoading || Boolean(error), loading: isVoting, className: (0, classnames_1.default)(classes.root, className, {
|
|
143
143
|
[classes.voted]: scUserContext.user && contributionVoted
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useEffect, useId, useRef } from 'react';
|
|
3
3
|
import { Box, styled } from '@mui/material';
|
|
4
4
|
import { useIsComponentMountedRef, useSCFetchCustomAdv } from '@selfcommunity/react-core';
|
|
5
5
|
import classNames from 'classnames';
|
|
@@ -51,7 +51,8 @@ export default function CustomAdv(inProps) {
|
|
|
51
51
|
props: inProps,
|
|
52
52
|
name: PREFIX
|
|
53
53
|
});
|
|
54
|
-
const
|
|
54
|
+
const _id = useId();
|
|
55
|
+
const { id = `custom_adv_${_id}`, className, advId = null, position, categoriesId, prefixedHeight, onStateChange, onHeightChange } = props;
|
|
55
56
|
// REFS
|
|
56
57
|
const isMountedRef = useIsComponentMountedRef();
|
|
57
58
|
const estimatedHeight = useRef(0);
|
|
@@ -13,6 +13,7 @@ import { asUploadButton } from '@rpldy/upload-button';
|
|
|
13
13
|
import { useSnackbar } from 'notistack';
|
|
14
14
|
import { $createImageNode, ImageNode } from '../nodes/ImageNode';
|
|
15
15
|
import { PREFIX } from '../constants';
|
|
16
|
+
import { useIntl } from 'react-intl';
|
|
16
17
|
export const INSERT_IMAGE_COMMAND = createCommand();
|
|
17
18
|
const UploadButton = asUploadButton(forwardRef((_a, ref) => {
|
|
18
19
|
var { progress = null } = _a, rest = __rest(_a, ["progress"]);
|
|
@@ -73,6 +74,7 @@ const Root = styled(Image, {
|
|
|
73
74
|
})(() => ({}));
|
|
74
75
|
export default function ImagePlugin() {
|
|
75
76
|
const [editor] = useLexicalComposerContext();
|
|
77
|
+
const intl = useIntl();
|
|
76
78
|
useEffect(() => {
|
|
77
79
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
78
80
|
// @ts-ignore
|
|
@@ -82,7 +84,7 @@ export default function ImagePlugin() {
|
|
|
82
84
|
return editor.registerCommand(INSERT_IMAGE_COMMAND, (payload) => {
|
|
83
85
|
const imageNode = $createImageNode({
|
|
84
86
|
src: payload.src,
|
|
85
|
-
altText: payload.altText,
|
|
87
|
+
altText: payload.altText || intl.formatMessage({ id: 'ui.editor.imagePlugin.alt', defaultMessage: 'ui.editor.imagePlugin.alt' }),
|
|
86
88
|
maxWidth: '100%',
|
|
87
89
|
width: payload.width,
|
|
88
90
|
height: payload.height
|
|
@@ -51,9 +51,13 @@ export default function Comment(props) {
|
|
|
51
51
|
audience = (_jsx(Button, Object.assign({ variant: "text", size: "small", disabled: true, color: "inherit" }, { children: _jsx(Skeleton, { animation: "wave", height: 18, width: 50 }) })));
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
|
-
audience = (_jsx(_Fragment, { children: onViewCommentsAction ? (_jsx(Button, Object.assign({ variant: "text", size: "small", onClick: onViewCommentsAction, color: "inherit" }, { children: _jsx(Typography, Object.assign({ component: "span",
|
|
54
|
+
audience = (_jsx(_Fragment, { children: onViewCommentsAction ? (_jsx(Button, Object.assign({ variant: "text", size: "small", onClick: onViewCommentsAction, color: "inherit" }, { children: _jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: intl.formatMessage(messages.comments, {
|
|
55
55
|
total: obj.comment_count
|
|
56
|
-
})}
|
|
56
|
+
}) })) }))) : (_jsx(_Fragment, { children: feedObjectTemplate === SCFeedObjectTemplateType.DETAIL ? (_jsx(Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: `${intl.formatMessage(messages.comments, {
|
|
57
|
+
total: obj.comment_count
|
|
58
|
+
})}` }))) : (_jsx(Button, Object.assign({ variant: "text", size: "small", component: Link, to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)), classes: { root: classes.viewAudienceButton } }, { children: _jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: intl.formatMessage(messages.comments, {
|
|
59
|
+
total: obj.comment_count
|
|
60
|
+
}) })) }))) })) }));
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
63
|
return audience;
|
|
@@ -180,7 +180,7 @@ export default function Share(props) {
|
|
|
180
180
|
audience = (_jsx(Button, Object.assign({ variant: "text", size: "small", disabled: true, color: "inherit" }, { children: _jsx(Skeleton, { animation: "wave", height: 18, width: 50 }) })));
|
|
181
181
|
}
|
|
182
182
|
else {
|
|
183
|
-
audience = (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ variant: "text", size: "small", onClick: handleToggleSharesDialog, disabled: sharesCount < 1, classes: { root: classes.viewAudienceButton } }, { children: _jsx(Typography, Object.assign({ component: "span",
|
|
183
|
+
audience = (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ variant: "text", size: "small", onClick: handleToggleSharesDialog, disabled: sharesCount < 1, classes: { root: classes.viewAudienceButton } }, { children: _jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: `${intl.formatMessage(messages.shares, {
|
|
184
184
|
total: sharesCount
|
|
185
185
|
})}` })) })), openSharesDialog && sharesCount > 0 && (_jsx(SharesDialog, { feedObject: obj, feedObjectType: obj.type, open: openSharesDialog, onClose: handleToggleSharesDialog }))] }));
|
|
186
186
|
}
|
|
@@ -47,5 +47,5 @@ export default function ContributorsFeedObject(props) {
|
|
|
47
47
|
if (!contributorsObject.feedObject) {
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(Box, { children: contributorsObject.isLoadingNext && !openContributorsDialog ? (_jsx(ContributorsSkeleton, Object.assign({}, ContributorsSkeletonProps))) : (_jsx(_Fragment, { children: contributorsObject.contributors.length > 0 ? (_jsxs(_Fragment, { children: [_jsxs(Button, Object.assign({ variant: "text", onClick: () => setOpenContributorsDialog(true), classes: { root: classes.btnParticipants }, color: "inherit" }, { children: [_jsxs(Typography, Object.assign({ component: "span"
|
|
50
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(Box, { children: contributorsObject.isLoadingNext && !openContributorsDialog ? (_jsx(ContributorsSkeleton, Object.assign({}, ContributorsSkeletonProps))) : (_jsx(_Fragment, { children: contributorsObject.contributors.length > 0 ? (_jsxs(_Fragment, { children: [_jsxs(Button, Object.assign({ variant: "text", onClick: () => setOpenContributorsDialog(true), classes: { root: classes.btnParticipants }, color: "inherit" }, { children: [_jsxs(Typography, Object.assign({ component: "span" }, { children: [_jsx(FormattedMessage, { id: "ui.feedObject.contributors.participants", defaultMessage: "ui.feedObject.contributors.participants" }), ":"] })), _jsxs(AvatarGroup, Object.assign({}, rest, { children: [contributorsObject.contributors.map((c, i) => (_jsx(Avatar, { alt: c.username, src: c.avatar }, i))), [...Array(Math.max(contributorsObject.total - contributorsObject.contributors.length, 0))].map((_x, i) => (_jsx(Avatar, {}, i)))] }))] })), openContributorsDialog && (_jsx(BaseDialog, Object.assign({ title: _jsx(FormattedMessage, { defaultMessage: "ui.feedObject.contributors.title", id: "ui.feedObject.contributors.title", values: { total: contributorsObject.total } }), onClose: () => setOpenContributorsDialog(false), open: openContributorsDialog }, { children: contributorsObject.isLoadingNext ? (_jsx(CentralProgress, { size: 50 })) : (_jsx(InfiniteScroll, Object.assign({ dataLength: contributorsObject.contributors.length, next: contributorsObject.getNextPage(), hasMoreNext: Boolean(contributorsObject.next), loaderNext: _jsx(CentralProgress, { size: 30 }), height: 400, endMessage: _jsx(Typography, Object.assign({ variant: "body2", align: "center", fontWeight: "bold" }, { children: _jsx(FormattedMessage, { id: "ui.feedObject.contributors.noOtherContributors", defaultMessage: "ui.feedObject.contributors.noOtherContributors" }) })) }, { children: _jsx(List, { children: contributorsObject.contributors.map((c, i) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: c, sx: { m: 0 }, onClick: () => setOpenContributorsDialog(false) }, c.id) }, i))) }) }))) })))] })) : null })) }) })));
|
|
51
51
|
}
|
|
@@ -454,7 +454,7 @@ export default function FeedObject(inProps) {
|
|
|
454
454
|
}, cacheStrategy: cacheStrategy }, ActivitiesProps), selectedActivities) })) }))), composerOpen && (_jsx(Composer, { open: composerOpen, feedObject: obj, onClose: handleToggleEdit, onSuccess: handleEditSuccess, maxWidth: "sm", fullWidth: true }))] }))) : (_jsx(FeedObjectSkeleton, Object.assign({ template: template }, FeedObjectSkeletonProps))) }));
|
|
455
455
|
}
|
|
456
456
|
else if (template === SCFeedObjectTemplateType.SHARE) {
|
|
457
|
-
objElement = (_jsx(React.Fragment, { children: obj ? (_jsxs(React.Fragment, { children: [obj.categories.length > 0 && (_jsxs("div", Object.assign({ className: classes.category }, { children: [_jsxs(_Fragment, { children: [obj.group && (_jsx("div", Object.assign({ className: classes.group }, { children: _jsx(Chip, { color: "secondary", size: "small", icon: _jsx(Icon, { children: "groups" }), component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }, obj.group.id) }))), obj.event && (_jsx(Chip, { className: classes.event, color: "secondary", size: "small", icon: _jsx(Icon, { children: "CalendarIcon" }), component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, obj.event), clickable: true }, obj.event.id))] }), obj.categories.map((c) => (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c) }, { children: _jsx(Typography, Object.assign({ variant: "overline" }, { children: c.name })) }), c.id)))] }))), obj.group && !obj.categories.length && (_jsx("div", Object.assign({ className: classes.group }, { children: _jsx(Chip, { color: "secondary", size: "small", icon: _jsx(Icon, { children: "groups" }), label: obj.group.name, component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }, obj.group.id) }))), obj.event && !obj.categories.length && (_jsx("div", Object.assign({ className: classes.event }, { children: _jsx(Chip, { color: "secondary", size: "small", icon: _jsx(Icon, { children: "groups" }), label: obj.event.name, component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, obj.event), clickable: true }, obj.event.id) }))), _jsx(CardHeader, { classes: { root: classes.header }, avatar: _jsx(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: _jsx(UserAvatar, Object.assign({ hide: !obj.author.community_badge }, { children: _jsx(Avatar, Object.assign({
|
|
457
|
+
objElement = (_jsx(React.Fragment, { children: obj ? (_jsxs(React.Fragment, { children: [obj.categories.length > 0 && (_jsxs("div", Object.assign({ className: classes.category }, { children: [_jsxs(_Fragment, { children: [obj.group && (_jsx("div", Object.assign({ className: classes.group }, { children: _jsx(Chip, { color: "secondary", size: "small", icon: _jsx(Icon, { children: "groups" }), component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }, obj.group.id) }))), obj.event && (_jsx(Chip, { className: classes.event, color: "secondary", size: "small", icon: _jsx(Icon, { children: "CalendarIcon" }), component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, obj.event), clickable: true }, obj.event.id))] }), obj.categories.map((c) => (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c) }, { children: _jsx(Typography, Object.assign({ variant: "overline" }, { children: c.name })) }), c.id)))] }))), obj.group && !obj.categories.length && (_jsx("div", Object.assign({ className: classes.group }, { children: _jsx(Chip, { color: "secondary", size: "small", icon: _jsx(Icon, { children: "groups" }), label: obj.group.name, component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }, obj.group.id) }))), obj.event && !obj.categories.length && (_jsx("div", Object.assign({ className: classes.event }, { children: _jsx(Chip, { color: "secondary", size: "small", icon: _jsx(Icon, { children: "groups" }), label: obj.event.name, component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, obj.event), clickable: true }, obj.event.id) }))), _jsx(CardHeader, { classes: { root: classes.header }, avatar: _jsx(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: _jsx(UserAvatar, Object.assign({ hide: !obj.author.community_badge }, { children: _jsx(Avatar, Object.assign({ alt: obj.author.username, src: obj.author.avatar, className: classes.avatar }, { children: obj.author.username })) })) })), title: _jsx(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: obj.author.username })), subheader: _jsx(Link, Object.assign({ to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)), className: classes.activityAt }, { children: _jsx(DateTimeAgo, { date: obj.added_at }) })) }), _jsxs(CardContent, Object.assign({ classes: { root: classes.content } }, { children: [_jsx(Box, Object.assign({ className: classes.titleSection }, { children: 'title' in obj && (_jsx(Link, Object.assign({ to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)) }, { children: _jsx(Typography, Object.assign({ variant: "body1", gutterBottom: true, className: classes.title }, { children: obj.title })) }))) })), _jsx(Box, Object.assign({ className: classes.textSection }, { children: getContributionSummary(obj, template) })), _jsx(Box, Object.assign({ className: classes.mediasSection }, { children: _jsx(FeedObjectMediaPreview, Object.assign({ medias: obj.medias }, FeedObjectMediaPreviewProps)) })), _jsx(Box, Object.assign({ className: classes.pollsSection }, { children: obj['poll'] && (_jsx(PollObject, Object.assign({ feedObject: obj, pollObject: obj['poll'], onChange: handleChangePoll, visible: Boolean(obj.type !== SCContributionType.DISCUSSION && !obj.html && !obj.medias.length) }, PollObjectProps))) }))] }))] })) : (_jsx(FeedObjectSkeleton, Object.assign({ template: template }, FeedObjectSkeletonProps))) }));
|
|
458
458
|
}
|
|
459
459
|
else {
|
|
460
460
|
objElement = (_jsx(React.Fragment, { children: obj ? (_jsx(BaseItem, { elevation: 0, className: classes.snippet, image: _jsx(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null }, { children: _jsx(UserAvatar, Object.assign({ hide: !obj.author.community_badge }, { children: _jsx(Avatar, { alt: obj.author.username, variant: "circular", src: obj.author.avatar, className: classes.avatar }) })) })), primary: _jsxs(Box, { children: [_jsx(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: obj.author.username })), _jsx(Typography, Object.assign({ variant: "body2", className: classes.snippetContent }, { children: _jsx(Link, Object.assign({ to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)) }, { children: getContributionSnippet(obj) })) }))] }), disableTypography: true, secondary: _jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", spacing: 2, alignItems: "center" }, { children: [_jsx(Link, Object.assign({ to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)), className: classes.activityAt }, { children: _jsx(DateTimeAgo, { component: "span", date: obj.added_at }) })), commentsEnabled && (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)), variant: "text", color: "secondary", size: "small" }, { children: _jsx(FormattedMessage, { id: "ui.feedObject.comment", defaultMessage: "ui.feedObject.comment" }) })))] })) })) : (_jsx(FeedObjectSkeleton, Object.assign({}, FeedObjectSkeletonProps))) }));
|
|
@@ -4,7 +4,7 @@ import React, { useCallback, useMemo, useState } from 'react';
|
|
|
4
4
|
import { SCFeedTypologyType } from '@selfcommunity/types';
|
|
5
5
|
import { Link, SCPreferences, SCRoutes, UserUtils, useSCContext, useSCPreferences, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
6
6
|
import { Avatar, Box, Button, CardContent, styled } from '@mui/material';
|
|
7
|
-
import { FormattedMessage } from 'react-intl';
|
|
7
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
8
8
|
import { useSnackbar } from 'notistack';
|
|
9
9
|
import Widget from '../Widget';
|
|
10
10
|
import { useThemeProps } from '@mui/system';
|
|
@@ -60,6 +60,7 @@ export default function InlineComposerWidget(inProps) {
|
|
|
60
60
|
const scUserContext = useSCUser();
|
|
61
61
|
const scRoutingContext = useSCRouting();
|
|
62
62
|
const { enqueueSnackbar } = useSnackbar();
|
|
63
|
+
const intl = useIntl();
|
|
63
64
|
// PREFERENCES
|
|
64
65
|
const preferences = useSCPreferences();
|
|
65
66
|
const onlyStaffEnabled = useMemo(() => preferences.preferences[SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value, [preferences.preferences]);
|
|
@@ -101,5 +102,5 @@ export default function InlineComposerWidget(inProps) {
|
|
|
101
102
|
if (!UserUtils.isStaff(scUserContext.user) && !UserUtils.isPublisher(scUserContext.user) && onlyStaffEnabled) {
|
|
102
103
|
return _jsx(HiddenPlaceholder, {});
|
|
103
104
|
}
|
|
104
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Root, Object.assign({ className: classes.root }, rest, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Box, Object.assign({ className: classes.input }, { children: _jsx(Button, Object.assign({ variant: "text", disableFocusRipple: true, disableRipple: true, disableElevation: true, onClick: handleOpen, fullWidth: true, color: "inherit" }, { children: label !== null && label !== void 0 ? label : _jsx(FormattedMessage, { id: "ui.inlineComposerWidget.label", defaultMessage: "ui.inlineComposerWidget.label" }) })) })), _jsx(Box, Object.assign({ className: classes.avatar }, { children: !scUserContext.user ? (_jsx(Avatar, { variant: "circular" })) : (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user) }, { children: _jsx(Avatar, { alt: scUserContext.user.username, variant: "circular", src: scUserContext.user.avatar }) }))) }))] })) })), open && (_jsx(Composer, { open: open, mediaObjectTypes: mediaObjectTypes, defaultValue: defaultValue, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess, feedType: feedType }))] }));
|
|
105
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Root, Object.assign({ className: classes.root }, rest, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Box, Object.assign({ className: classes.input }, { children: _jsx(Button, Object.assign({ variant: "text", disableFocusRipple: true, disableRipple: true, disableElevation: true, onClick: handleOpen, fullWidth: true, color: "inherit" }, { children: label !== null && label !== void 0 ? label : _jsx(FormattedMessage, { id: "ui.inlineComposerWidget.label", defaultMessage: "ui.inlineComposerWidget.label" }) })) })), _jsx(Box, Object.assign({ className: classes.avatar }, { children: !scUserContext.user ? (_jsx(Avatar, { alt: intl.formatMessage({ id: 'ui.inlineComposerWidget.avatar.alt', defaultMessage: 'ui.inlineComposerWidget.avatar.alt' }), variant: "circular" })) : (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user) }, { children: _jsx(Avatar, { alt: scUserContext.user.username, variant: "circular", src: scUserContext.user.avatar }) }))) }))] })) })), open && (_jsx(Composer, { open: open, mediaObjectTypes: mediaObjectTypes, defaultValue: defaultValue, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess, feedType: feedType }))] }));
|
|
105
106
|
}
|
|
@@ -116,7 +116,7 @@ export default function SearchAutocomplete(inProps) {
|
|
|
116
116
|
fetchResults();
|
|
117
117
|
}
|
|
118
118
|
}, [value]);
|
|
119
|
-
return (_jsx(Root, Object.assign({ id: id,
|
|
119
|
+
return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className), blurOnSelect: blurOnSelect, onChange: handleChange, onInputChange: handleInputChange, inputValue: value, freeSolo: true, autoComplete: true, disableClearable: true, loading: isLoading, loadingText: _jsx(FormattedMessage, { id: "ui.searchAutocomplete.loading", defaultMessage: "ui.searchAutocomplete.loading" }), noOptionsText: _jsx(FormattedMessage, { id: "ui.searchAutocomplete.noOptions", defaultMessage: "ui.searchAutocomplete.noOptions" }), options: options, getOptionLabel: (option) => {
|
|
120
120
|
if (typeof option === 'string') {
|
|
121
121
|
return option;
|
|
122
122
|
}
|
|
@@ -124,11 +124,25 @@ export default function SearchAutocomplete(inProps) {
|
|
|
124
124
|
}, renderOption: (props, option) => {
|
|
125
125
|
const { key } = props, rest = __rest(props, ["key"]);
|
|
126
126
|
return (_jsxs(Box, Object.assign({ component: "li" }, rest, { children: [_jsx(Avatar, { alt: getOptionData(option).name, src: getOptionData(option).image, variant: getOptionData(option).variant }), _jsx(Typography, Object.assign({ ml: 1 }, { children: getOptionData(option).name }))] }), key));
|
|
127
|
-
}, renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { placeholder:
|
|
127
|
+
}, renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { placeholder: intl.formatMessage(messages.placeholder, {
|
|
128
128
|
community: scPreferences.preferences[SCPreferences.TEXT_APPLICATION_NAME].value
|
|
129
|
-
})
|
|
130
|
-
input: Object.assign(Object.assign({}, params.InputProps), {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
}), slotProps: {
|
|
130
|
+
input: Object.assign(Object.assign({}, params.InputProps), { className: classes.input, startAdornment: (_jsx(Icon, Object.assign({ "aria-label": intl.formatMessage({
|
|
131
|
+
id: 'ui.searchAutocomplete.startAdornment.title',
|
|
132
|
+
defaultMessage: 'ui.searchAutocomplete.startAdornment.title'
|
|
133
|
+
}), className: classes.icon }, { children: "search" }))), endAdornment: (_jsx(Fade, Object.assign({ in: value.length > 0 || Boolean(onClear), appear: false }, { children: _jsx(IconButton, Object.assign({ "aria-label": intl.formatMessage({
|
|
134
|
+
id: 'ui.searchAutocomplete.endAdornment.title',
|
|
135
|
+
defaultMessage: 'ui.searchAutocomplete.endAdornment.title'
|
|
136
|
+
}), title: intl.formatMessage({
|
|
137
|
+
id: 'ui.searchAutocomplete.endAdornment.title',
|
|
138
|
+
defaultMessage: 'ui.searchAutocomplete.endAdornment.title'
|
|
139
|
+
}), className: classes.clear, onClick: handleClear, size: "small" }, { children: _jsx(Icon, { children: "close" }) })) }))) }),
|
|
140
|
+
htmlInput: {
|
|
141
|
+
role: 'search',
|
|
142
|
+
name: 'search-autocomplete',
|
|
143
|
+
title: intl.formatMessage(messages.placeholder, {
|
|
144
|
+
community: scPreferences.preferences[SCPreferences.TEXT_APPLICATION_NAME].value
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
} }))) }, rest)));
|
|
134
148
|
}
|
|
@@ -100,5 +100,5 @@ export default function User(inProps) {
|
|
|
100
100
|
*/
|
|
101
101
|
return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ elevation: elevation }, rest, { className: classNames(classes.root, className), ButtonBaseProps: buttonProps !== null && buttonProps !== void 0 ? buttonProps : (scUser.deleted
|
|
102
102
|
? { onClick: () => setOpenAlert(true) }
|
|
103
|
-
: { component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUser) }), image: badgeContent ? (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: badgeContent }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))) : (_jsx(UserAvatar, Object.assign({ hide: !hasBadge }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))), primary: (hasBadge && preferences) || isGroupAdmin ? (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: scUser.username })), _jsx(Chip, { component: "span", className: classNames(isGroupAdmin ? classes.groupAdminBadgeLabel : classes.staffBadgeLabel), size: "small", label: _jsx(Typography, Object.assign({ component: "span",
|
|
103
|
+
: { component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUser) }), image: badgeContent ? (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: badgeContent }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))) : (_jsx(UserAvatar, Object.assign({ hide: !hasBadge }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))), primary: (hasBadge && preferences) || isGroupAdmin ? (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: scUser.username })), _jsx(Chip, { component: "span", className: classNames(isGroupAdmin ? classes.groupAdminBadgeLabel : classes.staffBadgeLabel), size: "small", label: _jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: isGroupAdmin ? (_jsx(FormattedMessage, { defaultMessage: "ui.user.group.admin", id: "ui.user.group.admin" })) : (preferences[SCPreferences.STAFF_STAFF_BADGE_LABEL]) })) })] })) : (_jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: scUser.username }))), secondary: _jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: secondary || (showFollowers ? `${intl.formatMessage(messages.userFollowers, { total: scUser.followers_counter })}` : scUser.description) })), actions: actions !== null && actions !== void 0 ? actions : renderAuthenticatedActions() })), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
104
104
|
}
|
|
@@ -116,5 +116,5 @@ export default function VoteAudienceButton(inProps) {
|
|
|
116
116
|
return _jsx(FormattedMessage, { defaultMessage: "ui.voteAudienceButton.dialog.title", id: "ui.voteAudienceButton.dialog.title" });
|
|
117
117
|
}
|
|
118
118
|
}, [tab, reactions, contributionReactionsCount]);
|
|
119
|
-
return (_jsxs(_Fragment, { children: [
|
|
119
|
+
return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ title: intl.formatMessage({ id: 'ui.voteAudienceButton.title', defaultMessage: 'ui.voteAudienceButton.title' }), "aria-label": intl.formatMessage({ id: 'ui.voteAudienceButton.title', defaultMessage: 'ui.voteAudienceButton.title' }), onClick: handleOpen, disabled: isLoading || Boolean(error) || contributionVoteCount === 0, loading: isLoading, className: classNames(classes.root, className) }, rest, { children: _jsxs(Typography, Object.assign({ component: "span" }, { children: [audienceIcon, "\u00A0", scUserContext.user && contributionVoted ? (contributionVoteCount === 1 ? (_jsx(FormattedMessage, { id: "ui.voteAudienceButton.votedOnlyByMe", defaultMessage: "ui.voteAudienceButton.votedOnlyByMe" })) : (_jsx(FormattedMessage, { id: "ui.voteAudienceButton.votedByMe", defaultMessage: "ui.voteAudienceButton.votedByMe", values: { total: contributionVoteCount - 1 } }))) : (_jsx(FormattedMessage, { id: "ui.voteAudienceButton.votes", defaultMessage: "ui.voteAudienceButton.votes", values: { total: contributionVoteCount } }))] })) })), open && (_jsx(DialogRoot, Object.assign({ title: dialogTitle, onClose: handleClose, open: open, DialogContentProps: {} }, { children: isLoadingVoteList && !voteList ? (_jsx(CentralProgress, { size: 50 })) : (_jsx(InfiniteScroll, Object.assign({ dataLength: voteList.length, next: () => handleFetchVoteList({}), hasMoreNext: voteListHasNext, loaderNext: _jsx(CentralProgress, { size: 30 }), height: 400, endMessage: _jsx(Typography, Object.assign({ variant: "body2", align: "center", fontWeight: "bold" }, { children: _jsx(FormattedMessage, { id: "ui.voteAudienceButton.dialog.end", defaultMessage: "ui.voteAudienceButton.dialog.end" }) })) }, { children: _jsx(List, { children: voteList.map((vote) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: vote.user, badgeContent: _jsx(Avatar, Object.assign({ className: classes.dialogVoteBadge }, { children: vote.reaction ? (_jsx(Icon, { children: _jsx("img", { alt: vote.reaction.label, src: vote.reaction.image, width: "100%", height: "100%" }) })) : (_jsx(Icon, { children: "thumb_up" })) })), onClick: handleClose }) }, vote.user.id))) }) }))) })))] }));
|
|
120
120
|
}
|
|
@@ -135,7 +135,7 @@ export default function VoteButton(inProps) {
|
|
|
135
135
|
};
|
|
136
136
|
}, [reactions]);
|
|
137
137
|
// RENDER
|
|
138
|
-
const button = (_jsx(Root, Object.assign({ title: intl.formatMessage({ id: 'ui.voteButton.title', defaultMessage: 'ui.voteButton.title' }), onClick: isMobile && reactions.reactions
|
|
138
|
+
const button = (_jsx(Root, Object.assign({ title: intl.formatMessage({ id: 'ui.voteButton.title', defaultMessage: 'ui.voteButton.title' }), "aria-label": intl.formatMessage({ id: 'ui.voteButton.title', defaultMessage: 'ui.voteButton.title' }), onClick: isMobile && reactions.reactions
|
|
139
139
|
? handleMouseEnter
|
|
140
140
|
: () => handleVoteAction(contributionReaction ? contributionReaction : reactions.default ? reactions.default : null), disabled: isLoading || Boolean(error), loading: isVoting, className: classNames(classes.root, className, {
|
|
141
141
|
[classes.voted]: scUserContext.user && contributionVoted
|