@selfcommunity/react-ui 0.10.2-alpha.0 → 0.10.2-alpha.10

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