@selfcommunity/react-ui 0.10.2-alpha.1 → 0.10.2-alpha.11
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/CommentObject/CommentObject.js +6 -3
- package/lib/cjs/components/Editor/plugins/AutoLinkPlugin.js +7 -1
- package/lib/cjs/components/EventForm/EventAddress.js +2 -13
- package/lib/cjs/components/EventForm/EventForm.js +32 -25
- package/lib/cjs/components/EventForm/constants.d.ts +4 -4
- package/lib/cjs/components/EventForm/constants.js +4 -4
- package/lib/cjs/components/EventForm/utils.d.ts +3 -3
- package/lib/cjs/components/EventForm/utils.js +8 -5
- package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +2 -13
- package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +1 -2
- package/lib/cjs/components/Events/Events.js +2 -4
- package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +1 -1
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +65 -104
- package/lib/cjs/components/UserProfileEdit/UserProfileEdit.d.ts +1 -1
- package/lib/cjs/components/UserProfileEdit/UserProfileEdit.js +1 -1
- package/lib/cjs/components/UserSocialAssociation/UserSocialAssociation.js +16 -4
- package/lib/cjs/constants/SocialShare.d.ts +12 -0
- package/lib/cjs/constants/SocialShare.js +15 -2
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.js +3 -1
- package/lib/cjs/utils/contribution.d.ts +7 -0
- package/lib/cjs/utils/contribution.js +13 -1
- package/lib/esm/components/CommentObject/CommentObject.js +8 -5
- package/lib/esm/components/Editor/plugins/AutoLinkPlugin.js +7 -1
- package/lib/esm/components/EventForm/EventAddress.js +4 -15
- package/lib/esm/components/EventForm/EventForm.js +32 -25
- package/lib/esm/components/EventForm/constants.d.ts +4 -4
- package/lib/esm/components/EventForm/constants.js +4 -4
- package/lib/esm/components/EventForm/utils.d.ts +3 -3
- package/lib/esm/components/EventForm/utils.js +8 -5
- package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +4 -15
- package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +1 -2
- package/lib/esm/components/Events/Events.js +2 -4
- package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +1 -1
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +67 -106
- package/lib/esm/components/UserProfileEdit/UserProfileEdit.d.ts +1 -1
- package/lib/esm/components/UserProfileEdit/UserProfileEdit.js +1 -1
- package/lib/esm/components/UserSocialAssociation/UserSocialAssociation.js +18 -6
- package/lib/esm/constants/SocialShare.d.ts +12 -0
- package/lib/esm/constants/SocialShare.js +13 -0
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +2 -2
- package/lib/esm/utils/contribution.d.ts +7 -0
- package/lib/esm/utils/contribution.js +11 -0
- package/lib/umd/2aa155858f48b8f3911a.eot +0 -0
- package/lib/umd/36f3af7f155d916c26ff.woff2 +0 -0
- package/lib/umd/80884d7cc0fcb1a47982.svg +1 -0
- package/lib/umd/a221d3aba0f6753cfbb7.ttf +0 -0
- package/lib/umd/assets/icons.svg +251 -0
- package/lib/umd/c3528e120c4e831db2ae.woff +0 -0
- package/lib/umd/react-ui.js +19 -1
- package/package.json +5 -5
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/reducer.d.ts +0 -15
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/reducer.js +0 -42
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/reducer.d.ts +0 -15
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/reducer.js +0 -37
|
@@ -44,7 +44,9 @@ const classes = {
|
|
|
44
44
|
vote: `${constants_1.PREFIX}-vote`,
|
|
45
45
|
voteAudience: `${constants_1.PREFIX}-vote-audience`,
|
|
46
46
|
reply: `${constants_1.PREFIX}-reply`,
|
|
47
|
-
contentSubSection: `${constants_1.PREFIX}-comment-sub-section
|
|
47
|
+
contentSubSection: `${constants_1.PREFIX}-comment-sub-section`,
|
|
48
|
+
collapsed: `${constants_1.PREFIX}-collapsed`,
|
|
49
|
+
flagChip: `${constants_1.PREFIX}-flag-chip`
|
|
48
50
|
};
|
|
49
51
|
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
50
52
|
name: constants_1.PREFIX,
|
|
@@ -103,6 +105,7 @@ function CommentObject(inProps) {
|
|
|
103
105
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
104
106
|
// STATE
|
|
105
107
|
const { obj, setObj } = (0, react_core_1.useSCFetchCommentObject)({ id: commentObjectId, commentObject, cacheStrategy });
|
|
108
|
+
const [collapsed, setCollapsed] = (0, react_1.useState)(obj === null || obj === void 0 ? void 0 : obj.collapsed);
|
|
106
109
|
const [replyComment, setReplyComment] = (0, react_1.useState)(commentReply);
|
|
107
110
|
const [isReplying, setIsReplying] = (0, react_1.useState)(false);
|
|
108
111
|
const [isSavingComment, setIsSavingComment] = (0, react_1.useState)(false);
|
|
@@ -300,8 +303,8 @@ function CommentObject(inProps) {
|
|
|
300
303
|
}
|
|
301
304
|
const summaryHtmlTruncated = 'summary_truncated' in comment ? comment.summary_truncated : false;
|
|
302
305
|
const commentHtml = 'summary_html' in comment && truncateContent && summaryHtmlTruncated ? comment.summary_html : comment.html;
|
|
303
|
-
const summaryHtml = (0, contribution_1.
|
|
304
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [editComment && editComment.id === comment.id ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.comment }, { children: (0, jsx_runtime_1.jsx)(CommentObjectReply_1.default, Object.assign({ text: comment.html, autoFocus: true, id: `edit-${comment.id}`, onSave: handleSave, onCancel: handleCancel, editable: !isReplying || !isSavingComment }, CommentObjectReplyProps)) }))) : ((0, jsx_runtime_1.jsx)(BaseItem_1.default, { elevation: 0, className: classes.comment, image: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!comment.author.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, comment.author) }), { onClick: comment.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: comment.author.avatar, className: classes.avatar }) })) })), disableTypography: true, primary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Widget_1.default, Object.assign({ className: classes.content, elevation: elevation }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: (0, classnames_1.default)({ [classes.deleted]: obj && obj.deleted }) }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ className: classes.author }, (!comment.author.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, comment.author) }), { onClick: comment.author.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: comment.author.username })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, { className: classes.textContent, variant: "body2", gutterBottom: true, dangerouslySetInnerHTML: { __html: summaryHtml } }), summaryHtmlTruncated && truncateContent && ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COMMENT_ROUTE_NAME, (0, contribution_1.getRouteData)(comment)), className: classes.showMoreContent }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.commentObject.showMore", defaultMessage: "ui.commentObject.showMore" }) })))] })), scUserContext.user && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.commentActionsMenu }, { children: (0, jsx_runtime_1.jsx)(ContributionActionsMenu_1.default, { commentObject: comment, onRestoreContribution: handleRestore, onHideContribution: handleHide, onDeleteContribution: handleDelete, onEditContribution: handleEdit }) })))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ component: "span", className: classes.contentSubSection }, { children: [renderTimeAgo(comment), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(VoteButton_1.default, { size: "small", className: classes.vote, contributionId: comment.id, contributionType: types_1.SCContributionType.COMMENT, contribution: comment, onVote: handleVoteSuccess }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), renderActionReply(comment), (0, jsx_runtime_1.jsx)(VoteAudienceButton_1.default, { size: "small", className: classes.voteAudience, contributionId: comment.id, contributionType: types_1.SCContributionType.COMMENT, contribution: comment })] }))] }) })), comment.comment_count > 0 && (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.nestedComments }, { children: renderLatestComment(comment) })), scUserContext.user && replyComment && (replyComment.id === comment.id || replyComment.parent === comment.id) && !comment.parent && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.nestedComments }, { children: (0, jsx_runtime_1.jsx)(CommentObjectReply_1.default, Object.assign({ text: `@${replyComment.author.username}, `, autoFocus: true, id: `reply-${replyComment.id}`, onReply: handleReply, editable: !isReplying }, CommentObjectReplyProps), `reply-${replyComment.id}`) })))] }, comment.id));
|
|
306
|
+
const summaryHtml = (0, contribution_1.getCommentContributionHtml)(commentHtml, scRoutingContext.url);
|
|
307
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [collapsed ? ((0, jsx_runtime_1.jsx)(BaseItem_1.default, { elevation: 0, className: classes.comment, disableTypography: true, primary: (0, jsx_runtime_1.jsxs)(Widget_1.default, Object.assign({ className: (0, classnames_1.default)(classes.content, classes.collapsed), elevation: elevation }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.CardContent, Object.assign({ className: (0, classnames_1.default)({ [classes.deleted]: obj && obj.deleted }) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.commentObject.collapsed", defaultMessage: "ui.commentObject.collapsed" }) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.commentActionsMenu }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: () => setCollapsed(!collapsed) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }) })) }))] })) })) : editComment && editComment.id === comment.id ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.comment }, { children: (0, jsx_runtime_1.jsx)(CommentObjectReply_1.default, Object.assign({ text: comment.html, autoFocus: true, id: `edit-${comment.id}`, onSave: handleSave, onCancel: handleCancel, editable: !isReplying || !isSavingComment }, CommentObjectReplyProps)) }))) : ((0, jsx_runtime_1.jsx)(BaseItem_1.default, { elevation: 0, className: classes.comment, image: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!comment.author.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, comment.author) }), { onClick: comment.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: comment.author.avatar, className: classes.avatar }) })) })), disableTypography: true, primary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Widget_1.default, Object.assign({ className: classes.content, elevation: elevation }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: (0, classnames_1.default)({ [classes.deleted]: obj && obj.deleted }) }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ className: classes.author }, (!comment.author.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, comment.author) }), { onClick: comment.author.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: comment.author.username })) })), comment.collapsed && ((0, jsx_runtime_1.jsx)(material_1.Chip, { className: classes.flagChip, color: "error", size: "small", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.commentObject.flag", defaultMessage: "ui.commentObject.flag" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, { className: classes.textContent, variant: "body2", gutterBottom: true, dangerouslySetInnerHTML: { __html: summaryHtml } }), summaryHtmlTruncated && truncateContent && ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COMMENT_ROUTE_NAME, (0, contribution_1.getRouteData)(comment)), className: classes.showMoreContent }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.commentObject.showMore", defaultMessage: "ui.commentObject.showMore" }) })))] })), scUserContext.user && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.commentActionsMenu }, { children: (0, jsx_runtime_1.jsx)(ContributionActionsMenu_1.default, { commentObject: comment, onRestoreContribution: handleRestore, onHideContribution: handleHide, onDeleteContribution: handleDelete, onEditContribution: handleEdit }) })))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ component: "span", className: classes.contentSubSection }, { children: [renderTimeAgo(comment), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(VoteButton_1.default, { size: "small", className: classes.vote, contributionId: comment.id, contributionType: types_1.SCContributionType.COMMENT, contribution: comment, onVote: handleVoteSuccess }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), renderActionReply(comment), (0, jsx_runtime_1.jsx)(VoteAudienceButton_1.default, { size: "small", className: classes.voteAudience, contributionId: comment.id, contributionType: types_1.SCContributionType.COMMENT, contribution: comment })] }))] }) })), comment.comment_count > 0 && (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.nestedComments }, { children: renderLatestComment(comment) })), scUserContext.user && replyComment && (replyComment.id === comment.id || replyComment.parent === comment.id) && !comment.parent && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.nestedComments }, { children: (0, jsx_runtime_1.jsx)(CommentObjectReply_1.default, Object.assign({ text: `@${replyComment.author.username}, `, autoFocus: true, id: `reply-${replyComment.id}`, onReply: handleReply, editable: !isReplying }, CommentObjectReplyProps), `reply-${replyComment.id}`) })))] }, comment.id));
|
|
305
308
|
}
|
|
306
309
|
/**
|
|
307
310
|
* Render Latest Comment
|
|
@@ -4,6 +4,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
4
4
|
const LexicalAutoLinkPlugin_1 = require("@lexical/react/LexicalAutoLinkPlugin");
|
|
5
5
|
const URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
6
6
|
const EMAIL_MATCHER = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;
|
|
7
|
+
const normalizeURL = (url) => {
|
|
8
|
+
if (!url.startsWith('http://') && !url.startsWith('https://') && !url.startsWith('mailto:')) {
|
|
9
|
+
return `https://${url}`;
|
|
10
|
+
}
|
|
11
|
+
return url;
|
|
12
|
+
};
|
|
7
13
|
const MATCHERS = [
|
|
8
14
|
(text) => {
|
|
9
15
|
const match = URL_MATCHER.exec(text);
|
|
@@ -11,7 +17,7 @@ const MATCHERS = [
|
|
|
11
17
|
index: match.index,
|
|
12
18
|
length: match[0].length,
|
|
13
19
|
text: match[0],
|
|
14
|
-
url: match[0]
|
|
20
|
+
url: normalizeURL(match[0])
|
|
15
21
|
});
|
|
16
22
|
},
|
|
17
23
|
(text) => {
|
|
@@ -6,7 +6,6 @@ const material_1 = require("@mui/material");
|
|
|
6
6
|
const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
|
|
7
7
|
const styles_1 = require("@mui/material/styles");
|
|
8
8
|
const system_1 = require("@mui/system");
|
|
9
|
-
const api_1 = require("@react-google-maps/api");
|
|
10
9
|
const types_1 = require("@selfcommunity/types");
|
|
11
10
|
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
12
11
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
@@ -48,18 +47,8 @@ function EventAddress(inProps) {
|
|
|
48
47
|
const [inputValue, setInputValue] = (0, react_1.useState)('');
|
|
49
48
|
const [suggestions, setSuggestions] = (0, react_1.useState)([]);
|
|
50
49
|
const [timeoutId, setTimeoutId] = (0, react_1.useState)(null);
|
|
51
|
-
//
|
|
52
|
-
const {
|
|
53
|
-
// MEMO
|
|
54
|
-
const geocodingApiKey = (0, react_1.useMemo)(() => {
|
|
55
|
-
return preferences && react_core_1.SCPreferences.PROVIDERS_GOOGLE_GEOCODING_API_KEY in preferences
|
|
56
|
-
? preferences[react_core_1.SCPreferences.PROVIDERS_GOOGLE_GEOCODING_API_KEY].value
|
|
57
|
-
: null;
|
|
58
|
-
}, [preferences]);
|
|
59
|
-
const { isLoaded } = (0, api_1.useLoadScript)({
|
|
60
|
-
googleMapsApiKey: geocodingApiKey,
|
|
61
|
-
libraries: ['places', 'geocoding']
|
|
62
|
-
});
|
|
50
|
+
// HOOKS
|
|
51
|
+
const { isLoaded, geocodingApiKey } = (0, react_core_1.useSCGoogleApiLoader)();
|
|
63
52
|
// HANDLERS
|
|
64
53
|
const handleChange = (_event, newValue) => {
|
|
65
54
|
setLocation(newValue);
|
|
@@ -114,7 +114,7 @@ const Root = (0, styles_1.styled)(material_1.Box, {
|
|
|
114
114
|
* @param inProps
|
|
115
115
|
*/
|
|
116
116
|
function EventForm(inProps) {
|
|
117
|
-
var _a, _b, _c
|
|
117
|
+
var _a, _b, _c;
|
|
118
118
|
//PROPS
|
|
119
119
|
const props = (0, system_1.useThemeProps)({
|
|
120
120
|
props: inProps,
|
|
@@ -142,7 +142,7 @@ function EventForm(inProps) {
|
|
|
142
142
|
recurring: (event === null || event === void 0 ? void 0 : event.recurring) || types_1.SCEventRecurrenceType.NEVER,
|
|
143
143
|
name: (event === null || event === void 0 ? void 0 : event.name) || '',
|
|
144
144
|
description: event ? event.description : '',
|
|
145
|
-
isPublic: (
|
|
145
|
+
isPublic: (event === null || event === void 0 ? void 0 : event.privacy) === types_1.SCEventPrivacyType.PUBLIC || true,
|
|
146
146
|
isSubmitting: false
|
|
147
147
|
};
|
|
148
148
|
// STATE
|
|
@@ -227,9 +227,7 @@ function EventForm(inProps) {
|
|
|
227
227
|
})
|
|
228
228
|
.catch((e) => {
|
|
229
229
|
const _error = (0, api_services_1.formatHttpErrorCode)(e);
|
|
230
|
-
|
|
231
|
-
// @ts-ignore
|
|
232
|
-
if (Object.values(_error)[0].error === 'unique') {
|
|
230
|
+
if (Object.values(_error)[0]['error'] === 'unique') {
|
|
233
231
|
setError(Object.assign(Object.assign({}, error), { ['nameError']: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.name.error.unique", defaultMessage: "ui.eventForm.name.error.unique" }) }));
|
|
234
232
|
}
|
|
235
233
|
else {
|
|
@@ -239,7 +237,7 @@ function EventForm(inProps) {
|
|
|
239
237
|
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
|
|
240
238
|
onError === null || onError === void 0 ? void 0 : onError(e);
|
|
241
239
|
});
|
|
242
|
-
}, [field, privateEnabled, visibilityEnabled, onSuccess, onError]);
|
|
240
|
+
}, [field, privateEnabled, visibilityEnabled, onSuccess, onError, notifyChanges]);
|
|
243
241
|
const handleChange = (0, react_1.useCallback)((event) => {
|
|
244
242
|
const { name, value } = event.target;
|
|
245
243
|
setField((prev) => (Object.assign(Object.assign({}, prev), { [name]: value })));
|
|
@@ -247,7 +245,7 @@ function EventForm(inProps) {
|
|
|
247
245
|
delete error[`${name}Error`];
|
|
248
246
|
setError(error);
|
|
249
247
|
}
|
|
250
|
-
}, [error]);
|
|
248
|
+
}, [setField, error]);
|
|
251
249
|
const handleChangeDateTime = (0, react_1.useCallback)((value, name) => {
|
|
252
250
|
setField((prev) => (Object.assign(Object.assign({}, prev), { [name]: value })));
|
|
253
251
|
if (error[`${name}Error`]) {
|
|
@@ -258,29 +256,26 @@ function EventForm(inProps) {
|
|
|
258
256
|
delete error['endDateError'];
|
|
259
257
|
setError(error);
|
|
260
258
|
}
|
|
261
|
-
}, [error]);
|
|
262
|
-
const
|
|
259
|
+
}, [setField, error]);
|
|
260
|
+
const shouldDisableDate = (0, react_1.useCallback)((date) => {
|
|
263
261
|
let disabled = false;
|
|
264
262
|
switch (field.recurring) {
|
|
265
263
|
case types_1.SCEventRecurrenceType.DAILY:
|
|
266
|
-
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.DAILY_LATER_DAYS).getTime();
|
|
264
|
+
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.DAILY_LATER_DAYS, field.startDate).getTime();
|
|
267
265
|
break;
|
|
268
266
|
case types_1.SCEventRecurrenceType.WEEKLY:
|
|
269
|
-
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.WEEKLY_LATER_DAYS).getTime();
|
|
267
|
+
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.WEEKLY_LATER_DAYS, field.startDate).getTime();
|
|
270
268
|
break;
|
|
271
269
|
case types_1.SCEventRecurrenceType.MONTHLY:
|
|
272
|
-
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.MONTHLY_LATER_DAYS).getTime();
|
|
270
|
+
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.MONTHLY_LATER_DAYS, field.startDate).getTime();
|
|
273
271
|
break;
|
|
274
272
|
case types_1.SCEventRecurrenceType.NEVER:
|
|
275
273
|
default:
|
|
276
|
-
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.NEVER_LATER_DAYS).getTime();
|
|
277
|
-
}
|
|
278
|
-
if (field.startDate.getDate() > date.getDate()) {
|
|
279
|
-
disabled = true;
|
|
274
|
+
disabled = date.getTime() > (0, utils_2.getLaterDaysDate)(constants_1.NEVER_LATER_DAYS, field.startDate).getTime();
|
|
280
275
|
}
|
|
281
276
|
return disabled;
|
|
282
277
|
}, [field]);
|
|
283
|
-
const
|
|
278
|
+
const shouldDisableTime = (0, react_1.useCallback)((date) => field.startTime.getTime() > date.getTime(), [field]);
|
|
284
279
|
/**
|
|
285
280
|
* Renders root object
|
|
286
281
|
*/
|
|
@@ -307,24 +302,36 @@ function EventForm(inProps) {
|
|
|
307
302
|
return (0, jsx_runtime_1.jsx)("em", { children: `${intl.formatMessage(messages.frequencyPlaceholder)}` });
|
|
308
303
|
}
|
|
309
304
|
return ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.frequency.${selected}.placeholder`, defaultMessage: `ui.eventForm.frequency.${selected}.placeholder` }));
|
|
310
|
-
}, startAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "frequency" }) }) })) }, { children: Object.values(types_1.SCEventRecurrenceType).map((f) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: f }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.frequency.${f}.placeholder`, defaultMessage: `ui.eventForm.frequency.${f}.placeholder` }) }), f))) }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.dateTime }, { children: (0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it_1.default : en_US_1.default }, { children: [(0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileDatePicker, { className: classes.picker,
|
|
305
|
+
}, startAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "frequency" }) }) })) }, { children: Object.values(types_1.SCEventRecurrenceType).map((f) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: f }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.frequency.${f}.placeholder`, defaultMessage: `ui.eventForm.frequency.${f}.placeholder` }) }), f))) }))] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.dateTime }, { children: (0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it_1.default : en_US_1.default }, { children: [(0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileDatePicker, { className: classes.picker, minDate: field.startDate, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.end.placeholder", defaultMessage: "ui.eventForm.date.end.placeholder" }), value: field.endDate, slots: {
|
|
311
306
|
textField: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.endDate)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "calendar_off" }) }) }))) }) })))
|
|
312
|
-
},
|
|
307
|
+
}, slotProps: {
|
|
308
|
+
toolbar: {
|
|
309
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
310
|
+
// @ts-ignore
|
|
311
|
+
toolbarTitle: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.title", defaultMessage: "ui.eventForm.date.title" })
|
|
312
|
+
}
|
|
313
|
+
}, onChange: (value) => handleChangeDateTime(value, 'endDate'), shouldDisableDate: shouldDisableDate }), (0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileTimePicker, { className: classes.picker, disablePast: disablePastEndTime, label: field.endTime && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.end.placeholder", defaultMessage: "ui.eventForm.time.end.placeholder" }), value: field.endTime, slots: {
|
|
313
314
|
textField: (params) => {
|
|
314
315
|
var _a;
|
|
315
316
|
return ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.endTime)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "access_time" }) }) }))) }), error: Boolean(error['endDateError']), helperText: ((_a = error['endDateError']) === null || _a === void 0 ? void 0 : _a.error) ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.end.error.invalid", defaultMessage: "ui.eventForm.time.end.error.invalid" })) : null })));
|
|
316
317
|
}
|
|
317
|
-
},
|
|
318
|
-
|
|
319
|
-
|
|
318
|
+
}, slotProps: {
|
|
319
|
+
toolbar: {
|
|
320
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
321
|
+
// @ts-ignore
|
|
322
|
+
toolbarTitle: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.time.title", defaultMessage: "ui.eventForm.time.title" })
|
|
323
|
+
}
|
|
324
|
+
}, onChange: (value) => handleChangeDateTime(value, 'endTime'), shouldDisableTime: shouldDisableTime })] })) })), (0, jsx_runtime_1.jsx)(EventAddress_1.default, { forwardGeolocationData: handleGeoData, event: event !== null && event !== void 0 ? event : null }), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.privacySection }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), (0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: event && !field.isPublic }), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
|
|
325
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
326
|
+
// @ts-ignores
|
|
320
327
|
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|
|
321
328
|
} })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.private.info", defaultMessage: "ui.eventForm.private.public.info", values: {
|
|
322
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
329
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
323
330
|
// @ts-ignore
|
|
324
331
|
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|
|
325
332
|
} })) }))] }))), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
326
|
-
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((
|
|
327
|
-
}, error: Boolean(((
|
|
333
|
+
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_a = field.description) === null || _a === void 0 ? void 0 : _a.length) ? Event_1.EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : Event_1.EVENT_DESCRIPTION_MAX_LENGTH })))
|
|
334
|
+
}, error: Boolean(((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.name ||
|
|
328
335
|
!field.startDate ||
|
|
329
336
|
!field.startTime ||
|
|
330
337
|
!field.endDate ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const PREFIX = "SCEventForm";
|
|
2
|
-
export declare const NEVER_LATER_DAYS =
|
|
3
|
-
export declare const DAILY_LATER_DAYS =
|
|
4
|
-
export declare const WEEKLY_LATER_DAYS =
|
|
5
|
-
export declare const MONTHLY_LATER_DAYS =
|
|
2
|
+
export declare const NEVER_LATER_DAYS = 13;
|
|
3
|
+
export declare const DAILY_LATER_DAYS = 59;
|
|
4
|
+
export declare const WEEKLY_LATER_DAYS = 359;
|
|
5
|
+
export declare const MONTHLY_LATER_DAYS = 729;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MONTHLY_LATER_DAYS = exports.WEEKLY_LATER_DAYS = exports.DAILY_LATER_DAYS = exports.NEVER_LATER_DAYS = exports.PREFIX = void 0;
|
|
4
4
|
exports.PREFIX = 'SCEventForm';
|
|
5
|
-
exports.NEVER_LATER_DAYS =
|
|
6
|
-
exports.DAILY_LATER_DAYS = 60
|
|
7
|
-
exports.WEEKLY_LATER_DAYS = 360
|
|
8
|
-
exports.MONTHLY_LATER_DAYS =
|
|
5
|
+
exports.NEVER_LATER_DAYS = 13; // 2 weeks less 1 day
|
|
6
|
+
exports.DAILY_LATER_DAYS = 59; // 60 days less 1 day
|
|
7
|
+
exports.WEEKLY_LATER_DAYS = 359; // 360 days less 1 day
|
|
8
|
+
exports.MONTHLY_LATER_DAYS = 729; // 2 years less 1 day
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function getNewDate(date?: string): Date;
|
|
2
|
-
export declare function getLaterHoursDate(
|
|
3
|
-
export declare function getLaterDaysDate(
|
|
1
|
+
export declare function getNewDate(date?: string | Date): Date;
|
|
2
|
+
export declare function getLaterHoursDate(hours: number, date?: Date): Date;
|
|
3
|
+
export declare function getLaterDaysDate(days: number, date?: Date): Date;
|
|
4
4
|
export declare const combineDateAndTime: (date: Date, time: Date) => string;
|
|
@@ -4,17 +4,20 @@ exports.combineDateAndTime = exports.getLaterDaysDate = exports.getLaterHoursDat
|
|
|
4
4
|
const date_fns_1 = require("date-fns");
|
|
5
5
|
function getNewDate(date) {
|
|
6
6
|
if (date) {
|
|
7
|
-
|
|
7
|
+
if (typeof date === 'string') {
|
|
8
|
+
return new Date(date);
|
|
9
|
+
}
|
|
10
|
+
return date;
|
|
8
11
|
}
|
|
9
12
|
return new Date();
|
|
10
13
|
}
|
|
11
14
|
exports.getNewDate = getNewDate;
|
|
12
|
-
function getLaterHoursDate(
|
|
13
|
-
return (0, date_fns_1.addHours)(getNewDate(),
|
|
15
|
+
function getLaterHoursDate(hours, date) {
|
|
16
|
+
return (0, date_fns_1.addHours)(getNewDate(date), hours);
|
|
14
17
|
}
|
|
15
18
|
exports.getLaterHoursDate = getLaterHoursDate;
|
|
16
|
-
function getLaterDaysDate(
|
|
17
|
-
return (0, date_fns_1.addDays)(getNewDate(),
|
|
19
|
+
function getLaterDaysDate(days, date) {
|
|
20
|
+
return (0, date_fns_1.addDays)(getNewDate(date), days);
|
|
18
21
|
}
|
|
19
22
|
exports.getLaterDaysDate = getLaterDaysDate;
|
|
20
23
|
const combineDateAndTime = (date, time) => {
|
|
@@ -15,7 +15,6 @@ const string_1 = require("../../utils/string");
|
|
|
15
15
|
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
16
16
|
const constants_1 = require("./constants");
|
|
17
17
|
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
18
|
-
const react_1 = require("react");
|
|
19
18
|
const classes = {
|
|
20
19
|
root: `${constants_1.PREFIX}-root`,
|
|
21
20
|
title: `${constants_1.PREFIX}-title`,
|
|
@@ -67,18 +66,8 @@ function EventLocationWidget(inProps) {
|
|
|
67
66
|
const { className, event, eventId } = props, rest = tslib_1.__rest(props, ["className", "event", "eventId"]);
|
|
68
67
|
// STATE
|
|
69
68
|
const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
|
|
70
|
-
//
|
|
71
|
-
const {
|
|
72
|
-
// MEMO
|
|
73
|
-
const geocodingApiKey = (0, react_1.useMemo)(() => {
|
|
74
|
-
return preferences && react_core_1.SCPreferences.PROVIDERS_GOOGLE_GEOCODING_API_KEY in preferences
|
|
75
|
-
? preferences[react_core_1.SCPreferences.PROVIDERS_GOOGLE_GEOCODING_API_KEY].value
|
|
76
|
-
: null;
|
|
77
|
-
}, [preferences]);
|
|
78
|
-
const { isLoaded } = (0, api_1.useLoadScript)({
|
|
79
|
-
googleMapsApiKey: geocodingApiKey,
|
|
80
|
-
libraries: ['maps']
|
|
81
|
-
});
|
|
69
|
+
// HOOKS
|
|
70
|
+
const { isLoaded, geocodingApiKey } = (0, react_core_1.useSCGoogleApiLoader)();
|
|
82
71
|
const mapOptions = {
|
|
83
72
|
fullscreenControl: false,
|
|
84
73
|
mapTypeControl: false,
|
|
@@ -22,7 +22,6 @@ const User_1 = tslib_1.__importStar(require("../User"));
|
|
|
22
22
|
const PREFIX = 'SCEventParticipantsButton';
|
|
23
23
|
const classes = {
|
|
24
24
|
root: `${PREFIX}-root`,
|
|
25
|
-
avatar: `${PREFIX}-avatar`,
|
|
26
25
|
participants: `${PREFIX}-participants`,
|
|
27
26
|
dialogRoot: `${PREFIX}-dialog-root`,
|
|
28
27
|
infiniteScroll: `${PREFIX}-infinite-scroll`,
|
|
@@ -136,6 +135,6 @@ function EventParticipantsButton(inProps) {
|
|
|
136
135
|
}, [setOpen]);
|
|
137
136
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleToggleDialogOpen, disabled: loading || !scEvent || scEvent.goings_counter === 0,
|
|
138
137
|
// @ts-expect-error this is needed to use followers into SCEventParticipantsButton
|
|
139
|
-
followers: followers }, rest, { children: [!hideCaption && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.participants, variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.eventParticipantsButton.participants", id: "ui.eventParticipantsButton.participants" }) }))), !followers.length && (loading || !scEvent) ? ((0, jsx_runtime_1.jsx)(AvatarGroupSkeleton_1.default, Object.assign({}, rest, (!participantsAvailable && { skeletonsAnimation: false })))) : ((0, jsx_runtime_1.jsx)(material_1.AvatarGroup, Object.assign({ total: followers.length, renderSurplus: renderSurplus }, { children: followers.map((c) => ((0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: c.username, src: c.avatar
|
|
138
|
+
followers: followers }, rest, { children: [!hideCaption && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.participants, variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.eventParticipantsButton.participants", id: "ui.eventParticipantsButton.participants" }) }))), !followers.length && (loading || !scEvent) ? ((0, jsx_runtime_1.jsx)(AvatarGroupSkeleton_1.default, Object.assign({}, rest, (!participantsAvailable && { skeletonsAnimation: false })))) : ((0, jsx_runtime_1.jsx)(material_1.AvatarGroup, Object.assign({ total: followers.length, renderSurplus: renderSurplus }, { children: followers.map((c) => ((0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: c.username, src: c.avatar }, c.id))) })))] })), open && ((0, jsx_runtime_1.jsx)(DialogRoot, Object.assign({ className: classes.dialogRoot, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.eventParticipantsButton.dialogTitle", id: "ui.eventParticipantsButton.dialogTitle", values: { total: scEvent.goings_counter } }), onClose: handleToggleDialogOpen, open: open }, DialogProps, { children: (0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ dataLength: followers.length, next: fetchFollowers, hasMoreNext: next !== null || loading, loaderNext: (0, jsx_runtime_1.jsx)(User_1.UserSkeleton, { elevation: 0 }), className: classes.infiniteScroll, endMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.endMessage }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventParticipantsButton.noOtherParticipants", defaultMessage: "ui.eventParticipantsButton.noOtherParticipants" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: followers.map((follower) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(User_1.default, { elevation: 0, user: follower }) }, follower.id))) }) })) })))] }));
|
|
140
139
|
}
|
|
141
140
|
exports.default = EventParticipantsButton;
|
|
@@ -213,8 +213,7 @@ function Events(inProps) {
|
|
|
213
213
|
* Renders events list
|
|
214
214
|
*/
|
|
215
215
|
const c = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showFilters && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(events.length !== 0 || (events.length === 0 && showMyEvents)) && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.EventsChipRoot, { color: showMyEvents ? 'secondary' : 'default', variant: showMyEvents ? 'filled' : 'outlined', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByCreatedByMe", defaultMessage: "ui.events.filterByCreatedByMe" }), onClick: () => setShowMyEvents(!showMyEvents),
|
|
216
|
-
//
|
|
217
|
-
// @ts-ignore
|
|
216
|
+
// @ts-expect-error this is needed to use showFollowed into SCEvents
|
|
218
217
|
showFollowed: showMyEvents, deleteIcon: showMyEvents ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showMyEvents ? handleDeleteClick : null, disabled: loading }) }))), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(PastEventsFilter_1.default, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: loading }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: (0, jsx_runtime_1.jsx)(LocationEventsFilter_1.default, { value: location, autoHide: !loading && !events.length, disabled: loading || (!events.length && !location), handleOnChange: handleOnChangeLocation }) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 3 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { className: classes.search, size: 'small', fullWidth: true, value: query, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading || (!events.length && !query), onKeyUp: (e) => {
|
|
219
218
|
e.preventDefault();
|
|
220
219
|
if (e.key === 'Enter') {
|
|
@@ -223,8 +222,7 @@ function Events(inProps) {
|
|
|
223
222
|
}, InputProps: {
|
|
224
223
|
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "end" }, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: () => fetchEvents(true), disabled: loading || (!events.length && !query) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "search" }) }))) : ((0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "contained", color: "secondary", onClick: () => fetchEvents(true), endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "search" }), disabled: loading || (!events.length && !query) })) })))
|
|
225
224
|
} }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ disabled: showPastEvents || loading || (!events.length && dateSearch === types_1.SCEventDateFilterType.ANY), size: 'small', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }), value: dateSearch, onChange: handleOnChangeTimeFrame, renderValue: (selected) => options.find((option) => option.value === selected).label }, { children: options.map((option) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ value: option.value }, { children: [(0, jsx_runtime_1.jsx)(material_1.Radio, { checked: dateSearch === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: (0, jsx_runtime_1.jsx)(LocationEventsFilter_1.default, { value: location, disabled: loading || (!events.length && !location), handleOnChange: handleOnChangeLocation }) })), authUserId && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.EventsChipRoot, { color: showFollowed ? 'secondary' : 'default', variant: showFollowed ? 'filled' : 'outlined', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByFollowedInterest", defaultMessage: "ui.events.filterByFollowedInterest" }), onClick: handleChipClick,
|
|
226
|
-
//
|
|
227
|
-
// @ts-ignore
|
|
225
|
+
// @ts-expect-error this is needed to use showFollowed into SCEvents
|
|
228
226
|
showFollowed: showFollowed, deleteIcon: showFollowed ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null, disabled: loading || (!events.length && !showFollowed) }) }))), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(PastEventsFilter_1.default, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: dateSearch !== types_1.SCEventDateFilterType.ANY || loading }) }))] })) }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: loading ? ((0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({}, EventsSkeletonComponentProps, { EventSkeletonProps: EventSkeletonComponentProps }))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !events.length ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.noResults }, { children: general ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (onlyStaffEnabled && react_core_1.UserUtils.isStaff(scUserContext.user)) || !onlyStaffEnabled ? (0, jsx_runtime_1.jsx)(CreateEventButton_1.default, {}) : null })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (onlyStaffEnabled && react_core_1.UserUtils.isStaff(scUserContext.user)) || !onlyStaffEnabled ? (0, jsx_runtime_1.jsx)(CreateEventButton_1.default, {}) : null })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.noEvents.title.personal", defaultMessage: "ui.events.noEvents.title.personal" }) }))] })) }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.events }, GridContainerComponentProps, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [events.map((event) => ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.item }, GridItemComponentProps, { children: (0, jsx_runtime_1.jsx)(Event_1.default, Object.assign({ event: event, eventId: event.id }, EventComponentProps)) }), event.id))), authUserId && events.length % 2 !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.itemSkeleton }, GridItemComponentProps, { children: (0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (0, jsx_runtime_1.jsx)(CreateEventButton_1.default, Object.assign({ variant: "outlined", color: "primary", size: "small" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.skeleton.action.add", defaultMessage: "ui.events.skeleton.action.add" }) })) })) }), 'skeleton-item'))] }) })), Boolean(next) && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", variant: "text", onClick: handleNext, className: classes.showMore }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.button.seeMore", defaultMessage: "ui.events.button.seeMore" }) })))] })) })) })] }));
|
|
229
227
|
/**
|
|
230
228
|
* Renders root object (if content availability community option is false and user is anonymous, component is hidden)
|
|
@@ -135,6 +135,6 @@ function GroupMembersButton(inProps) {
|
|
|
135
135
|
const isMobile = (0, useMediaQuery_1.default)(theme.breakpoints.down('md'));
|
|
136
136
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleToggleDialogOpen, disabled: loading || !scGroup || scGroup.subscribers_counter === 0,
|
|
137
137
|
// @ts-expect-error this is needed to use subscribers into SCGroupMembersButton
|
|
138
|
-
subscribers: scGroup.subscribers_counter }, rest, { children: loading || !scGroup ? ((0, jsx_runtime_1.jsx)(AvatarGroupSkeleton_1.default, Object.assign({}, rest))) : ((0, jsx_runtime_1.jsx)(material_1.AvatarGroup, Object.assign({ total: scGroup.subscribers_counter, renderSurplus: renderSurplus }, { children: members.map((c) => ((0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: c.username, src: c.avatar }, c.id))) }))) })), open && ((0, jsx_runtime_1.jsx)(DialogRoot, Object.assign({ className: classes.dialogRoot, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.groupMembersButton.dialogTitle", id: "ui.groupMembersButton.dialogTitle", values: { total: scGroup.subscribers_counter } }), onClose: handleToggleDialogOpen, open: open }, DialogProps, { children: (0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ dataLength: members.length, next: fetchMembers, hasMoreNext: next !== null || loading, loaderNext: (0, jsx_runtime_1.jsx)(User_1.UserSkeleton, { elevation: 0 }), height: isMobile ? '100%' : 400, endMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.endMessage }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupMembersButton.noOtherMembers", defaultMessage: "ui.groupMembersButton.noOtherMembers" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: members.map((member) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(User_1.default, { elevation: 0, user: member, onClick: handleToggleDialogOpen }) }, member.id))) }) })) })))] }));
|
|
138
|
+
subscribers: scGroup === null || scGroup === void 0 ? void 0 : scGroup.subscribers_counter }, rest, { children: loading || !scGroup ? ((0, jsx_runtime_1.jsx)(AvatarGroupSkeleton_1.default, Object.assign({}, rest))) : ((0, jsx_runtime_1.jsx)(material_1.AvatarGroup, Object.assign({ total: scGroup.subscribers_counter, renderSurplus: renderSurplus }, { children: members.map((c) => ((0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: c.username, src: c.avatar }, c.id))) }))) })), open && ((0, jsx_runtime_1.jsx)(DialogRoot, Object.assign({ className: classes.dialogRoot, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.groupMembersButton.dialogTitle", id: "ui.groupMembersButton.dialogTitle", values: { total: scGroup.subscribers_counter } }), onClose: handleToggleDialogOpen, open: open }, DialogProps, { children: (0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ dataLength: members.length, next: fetchMembers, hasMoreNext: next !== null || loading, loaderNext: (0, jsx_runtime_1.jsx)(User_1.UserSkeleton, { elevation: 0 }), height: isMobile ? '100%' : 400, endMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.endMessage }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupMembersButton.noOtherMembers", defaultMessage: "ui.groupMembersButton.noOtherMembers" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: members.map((member) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(User_1.default, { elevation: 0, user: member, onClick: handleToggleDialogOpen }) }, member.id))) }) })) })))] }));
|
|
139
139
|
}
|
|
140
140
|
exports.default = GroupMembersButton;
|