@selfcommunity/react-ui 0.10.2-courses.193 → 0.10.2-courses.195

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 (40) hide show
  1. package/lib/cjs/components/CourseDashboard/Teacher/Comments.js +1 -1
  2. package/lib/cjs/components/CourseForm/CourseForm.js +2 -3
  3. package/lib/cjs/components/EditCourse/Customize.js +2 -2
  4. package/lib/cjs/components/EditCourse/Options.js +1 -1
  5. package/lib/cjs/components/Editor/Editor.d.ts +5 -0
  6. package/lib/cjs/components/Editor/Editor.js +2 -2
  7. package/lib/cjs/components/Editor/plugins/EmojiPlugin.d.ts +3 -1
  8. package/lib/cjs/components/Editor/plugins/EmojiPlugin.js +4 -10
  9. package/lib/cjs/components/EventForm/EventAddress.js +1 -1
  10. package/lib/cjs/components/EventForm/EventForm.js +10 -3
  11. package/lib/cjs/components/LessonCommentObject/LessonCommentObject.js +1 -1
  12. package/lib/cjs/components/LessonCommentObjects/LessonCommentObjects.js +1 -1
  13. package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +3 -1
  14. package/lib/cjs/components/Notification/Course/Course.js +19 -10
  15. package/lib/cjs/components/Notification/Notification.js +1 -0
  16. package/lib/cjs/components/SnippetNotifications/SnippetNotifications.js +1 -0
  17. package/lib/cjs/components/ToastNotifications/ToastNotifications.js +2 -1
  18. package/lib/cjs/shared/AccordionLessons/AccordionLessons.js +1 -1
  19. package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.js +2 -2
  20. package/lib/esm/components/CourseDashboard/Teacher/Comments.js +2 -2
  21. package/lib/esm/components/CourseForm/CourseForm.js +2 -3
  22. package/lib/esm/components/EditCourse/Customize.js +2 -2
  23. package/lib/esm/components/EditCourse/Options.js +1 -1
  24. package/lib/esm/components/Editor/Editor.d.ts +5 -0
  25. package/lib/esm/components/Editor/Editor.js +2 -2
  26. package/lib/esm/components/Editor/plugins/EmojiPlugin.d.ts +3 -1
  27. package/lib/esm/components/Editor/plugins/EmojiPlugin.js +4 -10
  28. package/lib/esm/components/EventForm/EventAddress.js +1 -1
  29. package/lib/esm/components/EventForm/EventForm.js +10 -3
  30. package/lib/esm/components/LessonCommentObject/LessonCommentObject.js +1 -1
  31. package/lib/esm/components/LessonCommentObjects/LessonCommentObjects.js +1 -1
  32. package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +3 -1
  33. package/lib/esm/components/Notification/Course/Course.js +15 -6
  34. package/lib/esm/components/Notification/Notification.js +1 -0
  35. package/lib/esm/components/SnippetNotifications/SnippetNotifications.js +1 -0
  36. package/lib/esm/components/ToastNotifications/ToastNotifications.js +2 -1
  37. package/lib/esm/shared/AccordionLessons/AccordionLessons.js +1 -1
  38. package/lib/esm/shared/CourseUsersTable/CourseUsersTable.js +3 -3
  39. package/lib/umd/react-ui.js +1 -1
  40. package/package.json +8 -8
@@ -97,7 +97,7 @@ function Comments(props) {
97
97
  map.set(name, [...map.get(name), comment]);
98
98
  }
99
99
  });
100
- return Array.from(map.entries()).map(([name, comments]) => ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.outerWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: name })), (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.innerWrapper }, { children: [comments.map((comment) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.userWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { src: comment.created_by.avatar, alt: comment.created_by.username, className: classes.avatar }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.userInfo }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: comment.created_by.username })), (0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.circle }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: new Date(comment.created_at).toLocaleDateString() }))] })), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", component: "div", dangerouslySetInnerHTML: { __html: comment.html } })] })] }), comment.id))), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, course), size: "small", variant: "outlined", color: "inherit", className: classes.button }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label", defaultMessage: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label" }) })) }))] }))] }), name)));
100
+ return Array.from(map.entries()).map(([name, comments]) => ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.outerWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: name })), (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.innerWrapper }, { children: [comments.map((comment) => ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.userWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { src: comment.created_by.avatar, alt: comment.created_by.username, className: classes.avatar }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.userInfo }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: comment.created_by.username })), (0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.circle }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedDate, { value: comment.created_at }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", component: "div", dangerouslySetInnerHTML: { __html: comment.html } })] })] }), comment.id))), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, course), size: "small", variant: "outlined", color: "inherit", className: classes.button }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label", defaultMessage: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label" }) })) }))] }))] }), name)));
101
101
  }, [state.results]);
102
102
  if (!state.initialized) {
103
103
  return (0, jsx_runtime_1.jsx)(CommentsSkeleton, {});
@@ -167,8 +167,7 @@ function CourseForm(inProps) {
167
167
  * @param categories
168
168
  */
169
169
  const handleOnChangeCategory = (categories) => {
170
- const categoriesIds = categories.map((item) => item.id);
171
- setField((prev) => (Object.assign(Object.assign({}, prev), { ['categories']: course ? categoriesIds : convertToCategoriesObject(categories) })));
170
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['categories']: convertToCategoriesObject(categories) })));
172
171
  };
173
172
  /**
174
173
  * Notify when a group info changed
@@ -206,7 +205,7 @@ function CourseForm(inProps) {
206
205
  }
207
206
  let courseService;
208
207
  if (course) {
209
- courseService = api_services_1.CourseService.updateCourse(course.id, formData, {
208
+ courseService = api_services_1.CourseService.patchCourse(course.id, formData, {
210
209
  headers: { 'Content-Type': 'multipart/form-data' }
211
210
  });
212
211
  }
@@ -14,12 +14,12 @@ function Customize(props) {
14
14
  const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
15
15
  // HANDLERS
16
16
  const handleSuccess = (0, react_1.useCallback)((data) => {
17
- setCourse(data);
17
+ setCourse(Object.assign(Object.assign({}, course), data));
18
18
  enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.customize.snackbar.save", defaultMessage: "ui.editCourse.tab.customize.snackbar.save" }), {
19
19
  variant: 'success',
20
20
  autoHideDuration: 3000
21
21
  });
22
- }, [setCourse]);
22
+ }, [course]);
23
23
  const handleError = (0, react_1.useCallback)(() => {
24
24
  enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
25
25
  variant: 'error',
@@ -74,7 +74,7 @@ function Options(props) {
74
74
  setLoading(true);
75
75
  api_services_1.CourseService.patchCourse(course.id, Object.assign({ id: course.id }, tempOptions))
76
76
  .then((data) => {
77
- setCourse(data);
77
+ setCourse(Object.assign(Object.assign({}, course), data));
78
78
  setTempOptions(null);
79
79
  setCanSave(false);
80
80
  setLoading(false);
@@ -80,6 +80,11 @@ export interface EditorProps {
80
80
  * @default <FormattedMessage id="ui.editor.placeholder" defaultMessage="ui.editor.placeholder" />
81
81
  */
82
82
  placeholder?: React.ReactNode;
83
+ /**
84
+ * Prop to customize emoji plugin position
85
+ * @default false
86
+ */
87
+ isLessonCommentEditor?: boolean;
83
88
  }
84
89
  declare const _default: React.ForwardRefExoticComponent<EditorProps & React.RefAttributes<EditorRef>>;
85
90
  export default _default;
@@ -107,7 +107,7 @@ const Editor = (inProps, ref) => {
107
107
  props: inProps,
108
108
  name: constants_1.PREFIX
109
109
  });
110
- const { id = 'editor', className = null, defaultValue = '', toolbar = false, uploadImage = false, uploadFile = false, editable = true, onChange = null, onMediaChange = null, onFocus = null, onBlur = null, action = null, ToolBarProps = {}, MediaPluginProps = {}, placeholder = (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editor.placeholder", defaultMessage: "ui.editor.placeholder" }) } = props;
110
+ const { id = 'editor', className = null, defaultValue = '', toolbar = false, uploadImage = false, uploadFile = false, editable = true, onChange = null, onMediaChange = null, onFocus = null, onBlur = null, action = null, ToolBarProps = {}, MediaPluginProps = {}, placeholder = (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editor.placeholder", defaultMessage: "ui.editor.placeholder" }), isLessonCommentEditor = false } = props;
111
111
  const apiRef = (0, react_1.useRef)();
112
112
  // STATE
113
113
  const [focused, setFocused] = (0, react_1.useState)(false);
@@ -148,6 +148,6 @@ const Editor = (inProps, ref) => {
148
148
  nodes: [...nodes_1.default],
149
149
  theme: editorTheme
150
150
  }), [editable]);
151
- return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className, { [classes.toolbar]: toolbar, [classes.focused]: focused }) }, { children: (0, jsx_runtime_1.jsxs)(LexicalComposer_1.LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [toolbar ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToolbarPlugin_1.default, Object.assign({ uploadImage: uploadImage, uploadFile: uploadFile, MediaPluginProps: { onMediaAdd: handleMediaChange } }, ToolBarProps)), (0, jsx_runtime_1.jsx)(LexicalListPlugin_1.ListPlugin, {}), (0, jsx_runtime_1.jsx)(HorizontalRulePlugin_1.HorizontalRulePlugin, {})] })) : ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actions, direction: "row" }, { children: [uploadImage && (0, jsx_runtime_1.jsx)(plugins_1.ImagePlugin, {}), uploadFile && (0, jsx_runtime_1.jsx)(plugins_1.MediaPlugin, Object.assign({}, MediaPluginProps)), (0, jsx_runtime_1.jsx)(plugins_1.EmojiPlugin, {}), action && action] }))), (0, jsx_runtime_1.jsx)(LexicalRichTextPlugin_1.RichTextPlugin, { contentEditable: (0, jsx_runtime_1.jsx)(LexicalContentEditable_1.ContentEditable, { className: classes.content }), placeholder: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.placeholder, onClick: handleFocus }, { children: placeholder })), ErrorBoundary: LexicalErrorBoundary_1.LexicalErrorBoundary }), (0, jsx_runtime_1.jsx)(plugins_1.DefaultHtmlValuePlugin, { defaultValue: defaultValue }), (0, jsx_runtime_1.jsx)(LexicalHistoryPlugin_1.HistoryPlugin, {}), (0, jsx_runtime_1.jsx)(plugins_1.OnChangePlugin, { onChange: handleChange }), (0, jsx_runtime_1.jsx)(OnBlurPlugin_1.default, { onBlur: handleHasBlur }), (0, jsx_runtime_1.jsx)(OnFocusPlugin_1.default, { onFocus: handleHasFocus }), (0, jsx_runtime_1.jsx)(plugins_1.AutoLinkPlugin, {}), (0, jsx_runtime_1.jsx)(plugins_1.MentionsPlugin, {}), (0, jsx_runtime_1.jsx)(LexicalLinkPlugin_1.LinkPlugin, {}), (0, jsx_runtime_1.jsx)(FloatingLinkPlugin_1.default, {}), (0, jsx_runtime_1.jsx)(ApiPlugin_1.default, { ref: apiRef })] })) })));
151
+ return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className, { [classes.toolbar]: toolbar, [classes.focused]: focused }) }, { children: (0, jsx_runtime_1.jsxs)(LexicalComposer_1.LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [toolbar ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToolbarPlugin_1.default, Object.assign({ uploadImage: uploadImage, uploadFile: uploadFile, MediaPluginProps: { onMediaAdd: handleMediaChange } }, ToolBarProps)), (0, jsx_runtime_1.jsx)(LexicalListPlugin_1.ListPlugin, {}), (0, jsx_runtime_1.jsx)(HorizontalRulePlugin_1.HorizontalRulePlugin, {})] })) : ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actions, direction: "row" }, { children: [uploadImage && (0, jsx_runtime_1.jsx)(plugins_1.ImagePlugin, {}), (0, jsx_runtime_1.jsx)(plugins_1.EmojiPlugin, { isLessonCommentEditor: isLessonCommentEditor }), uploadFile && (0, jsx_runtime_1.jsx)(plugins_1.MediaPlugin, Object.assign({}, MediaPluginProps)), action && action] }))), (0, jsx_runtime_1.jsx)(LexicalRichTextPlugin_1.RichTextPlugin, { contentEditable: (0, jsx_runtime_1.jsx)(LexicalContentEditable_1.ContentEditable, { className: classes.content }), placeholder: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.placeholder, onClick: handleFocus }, { children: placeholder })), ErrorBoundary: LexicalErrorBoundary_1.LexicalErrorBoundary }), (0, jsx_runtime_1.jsx)(plugins_1.DefaultHtmlValuePlugin, { defaultValue: defaultValue }), (0, jsx_runtime_1.jsx)(LexicalHistoryPlugin_1.HistoryPlugin, {}), (0, jsx_runtime_1.jsx)(plugins_1.OnChangePlugin, { onChange: handleChange }), (0, jsx_runtime_1.jsx)(OnBlurPlugin_1.default, { onBlur: handleHasBlur }), (0, jsx_runtime_1.jsx)(OnFocusPlugin_1.default, { onFocus: handleHasFocus }), (0, jsx_runtime_1.jsx)(plugins_1.AutoLinkPlugin, {}), (0, jsx_runtime_1.jsx)(plugins_1.MentionsPlugin, {}), (0, jsx_runtime_1.jsx)(LexicalLinkPlugin_1.LinkPlugin, {}), (0, jsx_runtime_1.jsx)(FloatingLinkPlugin_1.default, {}), (0, jsx_runtime_1.jsx)(ApiPlugin_1.default, { ref: apiRef })] })) })));
152
152
  };
153
153
  exports.default = (0, react_1.forwardRef)(Editor);
@@ -1 +1,3 @@
1
- export default function EmojiPlugin(): JSX.Element;
1
+ export default function EmojiPlugin({ isLessonCommentEditor }: {
2
+ isLessonCommentEditor?: boolean;
3
+ }): JSX.Element;
@@ -9,7 +9,7 @@ const material_1 = require("@mui/material");
9
9
  const styles_1 = require("@mui/material/styles");
10
10
  const EmojiPicker_1 = tslib_1.__importDefault(require("../../../shared/EmojiPicker"));
11
11
  const constants_1 = require("../constants");
12
- function Emoji({ editor, className = '' }) {
12
+ function Emoji({ editor, className = '', isLessonCommentEditor = false }) {
13
13
  // STATE
14
14
  const theme = (0, material_1.useTheme)();
15
15
  const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
@@ -25,13 +25,7 @@ function Emoji({ editor, className = '' }) {
25
25
  if (isMobile) {
26
26
  return null;
27
27
  }
28
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: className, onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "sentiment_satisfied_alt" }) })), (0, jsx_runtime_1.jsx)(material_1.Popover, Object.assign({ open: Boolean(emojiAnchorEl), anchorEl: emojiAnchorEl, onClose: () => setEmojiAnchorEl(null), TransitionComponent: material_1.Fade, anchorOrigin: {
29
- vertical: 'top',
30
- horizontal: 'right'
31
- }, transformOrigin: {
32
- vertical: 'bottom',
33
- horizontal: 'left'
34
- }, sx: (theme) => {
28
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: className, onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "sentiment_satisfied_alt" }) })), (0, jsx_runtime_1.jsx)(material_1.Popover, Object.assign({ open: Boolean(emojiAnchorEl), anchorEl: emojiAnchorEl, onClose: () => setEmojiAnchorEl(null), TransitionComponent: material_1.Fade, anchorOrigin: isLessonCommentEditor ? { vertical: 'bottom', horizontal: 'left' } : { vertical: 'top', horizontal: 'right' }, transformOrigin: isLessonCommentEditor ? { vertical: 'top', horizontal: 'right' } : { vertical: 'bottom', horizontal: 'left' }, sx: (theme) => {
35
29
  return { zIndex: theme.zIndex.tooltip };
36
30
  } }, { children: (0, jsx_runtime_1.jsx)(EmojiPicker_1.default, { onEmojiClick: handleEmojiClick }) }))] }));
37
31
  }
@@ -42,8 +36,8 @@ const Root = (0, styles_1.styled)(Emoji, {
42
36
  name: constants_1.PREFIX,
43
37
  slot: 'EmojiPluginRoot'
44
38
  })(() => ({}));
45
- function EmojiPlugin() {
39
+ function EmojiPlugin({ isLessonCommentEditor = false }) {
46
40
  const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
47
- return (0, jsx_runtime_1.jsx)(Root, { editor: editor, className: classes.root });
41
+ return (0, jsx_runtime_1.jsx)(Root, { editor: editor, className: classes.root, isLessonCommentEditor: isLessonCommentEditor });
48
42
  }
49
43
  exports.default = EmojiPlugin;
@@ -157,6 +157,6 @@ function EventAddress(inProps) {
157
157
  }
158
158
  return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [isInPersonTabActive && ((0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "add_location_alt" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) })), isOnlineTabActive && ((0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "play_circle_outline" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) })), isLiveTabActive && ((0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.LIVESTREAM, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "photo_camera" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.liveStream.label", defaultMessage: "ui.eventForm.address.liveStream.label" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.tabContent }, { children: [isInPersonTabActive && location === types_1.SCEventLocationType.PERSON && ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, { disabled: !geocodingApiKey, size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description || geolocation.description, noOptionsText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), isOptionEqualToValue: (option, value) => option.description === value.description, renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.placeholder", defaultMessage: "ui.eventForm.address.live.placeholder" }), variant: "outlined", fullWidth: true, InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "add_location_alt" }) })), params.InputProps.endAdornment] })) }) }))) })), isOnlineTabActive && location === types_1.SCEventLocationType.ONLINE && ((0, jsx_runtime_1.jsx)(UrlTextField_1.default, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
159
159
  endAdornment: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "play_circle_outline" })
160
- }, onChange: handleLinkChange })), isLiveTabActive && location === types_1.SCEventLocationType.LIVESTREAM && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(LiveStream_1.default, { template: liveStream_1.SCLiveStreamTemplateType.SNIPPET, liveStream: liveStream, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}) }), (0, jsx_runtime_1.jsx)(LiveStreamFormSettings_1.default, { settings: liveStream.settings || constants_2.LIVESTREAM_DEFAULT_SETTINGS, onChange: handleLiveStreamSettingsChange })] }))] }))] })));
160
+ }, value: event ? event.link : '', onChange: handleLinkChange })), isLiveTabActive && location === types_1.SCEventLocationType.LIVESTREAM && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(LiveStream_1.default, { template: liveStream_1.SCLiveStreamTemplateType.SNIPPET, liveStream: liveStream, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}) }), (0, jsx_runtime_1.jsx)(LiveStreamFormSettings_1.default, { settings: liveStream.settings || constants_2.LIVESTREAM_DEFAULT_SETTINGS, onChange: handleLiveStreamSettingsChange })] }))] }))] })));
161
161
  }
162
162
  exports.default = EventAddress;
@@ -145,9 +145,11 @@ function EventForm(inProps) {
145
145
  endDate: (event === null || event === void 0 ? void 0 : event.end_date) ? endDateTime : (0, utils_2.getNewDate)(),
146
146
  endTime: (event === null || event === void 0 ? void 0 : event.end_date) ? endDateTime : (0, utils_2.getLaterHoursDate)(3),
147
147
  location: (event === null || event === void 0 ? void 0 : event.location)
148
- ? event.location === types_1.SCEventLocationType.ONLINE && event.live_stream
149
- ? types_1.SCEventLocationType.LIVESTREAM
150
- : types_1.SCEventLocationType.ONLINE
148
+ ? event.location === types_1.SCEventLocationType.PERSON
149
+ ? types_1.SCEventLocationType.PERSON
150
+ : event.location === types_1.SCEventLocationType.ONLINE && event.live_stream
151
+ ? types_1.SCEventLocationType.LIVESTREAM
152
+ : types_1.SCEventLocationType.ONLINE
151
153
  : ((_a = EventAddressComponentProps.locations) === null || _a === void 0 ? void 0 : _a.length)
152
154
  ? presetLocation in EventAddressComponentProps.locations
153
155
  ? presetLocation
@@ -242,6 +244,11 @@ function EventForm(inProps) {
242
244
  formData.append('link', '');
243
245
  formData.append('live_stream_settings', null);
244
246
  }
247
+ if (field.location !== types_1.SCEventLocationType.PERSON) {
248
+ formData.append('geolocation', '');
249
+ formData.append('geolocation_lat', '');
250
+ formData.append('geolocation_lng', '');
251
+ }
245
252
  if (privateEnabled) {
246
253
  formData.append('privacy', field.isPublic ? types_1.SCEventPrivacyType.PUBLIC : types_1.SCEventPrivacyType.PRIVATE);
247
254
  }
@@ -180,7 +180,7 @@ function LessonCommentObject(inProps) {
180
180
  */
181
181
  function renderComment(comment) {
182
182
  const summaryHtml = (0, contribution_1.getCommentContributionHtml)(comment.html, scRoutingContext.url);
183
- return ((0, jsx_runtime_1.jsx)(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, medias: comment.medias, autoFocus: true, id: `edit-${comment.id}`, onSave: handleUpdate, onCancel: handleCancel, editable: !isSavingComment, EditorProps: { uploadFile: true, uploadImage: false } }, 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.created_by.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, comment.created_by) }), { onClick: comment.created_by.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !obj.created_by.community_badge }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: obj.created_by.username, variant: "circular", src: comment.created_by.avatar, className: classes.avatar }) })) })), disableTypography: true, primary: (0, jsx_runtime_1.jsx)(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, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ className: classes.author }, (!comment.created_by.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, comment.created_by) }), { onClick: comment.created_by.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: comment.created_by.username })) })), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: comment.created_at, showStartIcon: false })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { className: classes.textContent, variant: "body2", gutterBottom: true, dangerouslySetInnerHTML: { __html: summaryHtml } }), obj.medias && obj.medias.length > 0 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: obj.medias.map((media) => {
183
+ return ((0, jsx_runtime_1.jsx)(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, medias: comment.medias, autoFocus: true, id: `edit-${comment.id}`, onSave: handleUpdate, onCancel: handleCancel, editable: !isSavingComment, EditorProps: { uploadFile: true, uploadImage: false, isLessonCommentEditor: true } }, 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.created_by.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, comment.created_by) }), { onClick: comment.created_by.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !obj.created_by.community_badge }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: obj.created_by.username, variant: "circular", src: comment.created_by.avatar, className: classes.avatar }) })) })), disableTypography: true, primary: (0, jsx_runtime_1.jsx)(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, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ className: classes.author }, (!comment.created_by.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, comment.created_by) }), { onClick: comment.created_by.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: comment.created_by.username })) })), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: comment.created_at, showStartIcon: false })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { className: classes.textContent, variant: "body2", gutterBottom: true, dangerouslySetInnerHTML: { __html: summaryHtml } }), obj.medias && obj.medias.length > 0 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: obj.medias.map((media) => {
184
184
  return (0, jsx_runtime_1.jsx)(LessonFilePreview_1.default, { className: classes.mediaContent, media: media }, media.id);
185
185
  }) }))] }), scUserContext.user && scUserContext.user.id === comment.created_by.id && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.commentActionsMenu }, { children: (0, jsx_runtime_1.jsx)(LessonCommentActionsMenu_1.default, { lesson: lessonObject, commentObject: comment, onDelete: handleDelete, onEdit: handleEdit }) })))] })) }) })) }, comment.id));
186
186
  }
@@ -176,6 +176,6 @@ function LessonCommentObjects(inProps) {
176
176
  if (!commentsObject.comments.length && commentsObject.isLoadingNext) {
177
177
  return (0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({ count: 5 }, CommentsObjectSkeletonProps));
178
178
  }
179
- return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: commentsObject.comments.length > 0 ? ((0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ height: '100%', dataLength: commentsObject.comments.length, next: handleNext, hasMoreNext: Boolean(commentsObject.next), loaderNext: (0, jsx_runtime_1.jsx)(LessonCommentObject_1.LessonCommentObjectSkeleton, Object.assign({}, CommentObjectSkeletonProps, { count: 1 })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ ref: commentsEndRef }, { children: commentsObject.comments.map((c, index) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(LessonCommentObject_1.default, Object.assign({ commentObject: c, lessonObject: commentsObject.lessonObject, onDelete: (comment) => handleCommentsUpdate(comment, true), isEditing: (editing) => setIsEditing(editing) }, CommentComponentProps, { CommentObjectSkeletonProps: CommentObjectSkeletonProps }), c.id) }, index))) })) }))) : null }), !editing && ((0, jsx_runtime_1.jsx)(CommentObjectReply_1.default, { id: `reply-lessonCommentObjects`, showAvatar: false, replyIcon: true, editable: !commenting, onReply: handleCommentAction, EditorProps: { placeholder: intl.formatMessage(messages.commentEditorPlaceholder), uploadFile: true, uploadImage: false } }, replyKey))] }) })));
179
+ return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: commentsObject.comments.length > 0 ? ((0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ height: '100%', dataLength: commentsObject.comments.length, next: handleNext, hasMoreNext: Boolean(commentsObject.next), loaderNext: (0, jsx_runtime_1.jsx)(LessonCommentObject_1.LessonCommentObjectSkeleton, Object.assign({}, CommentObjectSkeletonProps, { count: 1 })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ ref: commentsEndRef }, { children: commentsObject.comments.map((c, index) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(LessonCommentObject_1.default, Object.assign({ commentObject: c, lessonObject: commentsObject.lessonObject, onDelete: (comment) => handleCommentsUpdate(comment, true), isEditing: (editing) => setIsEditing(editing) }, CommentComponentProps, { CommentObjectSkeletonProps: CommentObjectSkeletonProps }), c.id) }, index))) })) }))) : null }), !editing && ((0, jsx_runtime_1.jsx)(CommentObjectReply_1.default, { id: `reply-lessonCommentObjects`, showAvatar: false, replyIcon: true, editable: !commenting, onReply: handleCommentAction, EditorProps: { placeholder: intl.formatMessage(messages.commentEditorPlaceholder), uploadFile: true, uploadImage: false, isLessonCommentEditor: true } }, replyKey))] }) })));
180
180
  }
181
181
  exports.default = LessonCommentObjects;
@@ -68,7 +68,9 @@ function VideoConference(inProps) {
68
68
  { source: livekit_client_1.Track.Source.Camera, withPlaceholder: true },
69
69
  { source: livekit_client_1.Track.Source.ScreenShare, withPlaceholder: false }
70
70
  ], { updateOnlyOn: [livekit_client_1.RoomEvent.ActiveSpeakersChanged], onlySubscribed: false });
71
- const tracksNoParticipants = (0, react_1.useMemo)(() => tracks.filter((t) => t.participant.name === scUserContext.user.username || t.participant.name === speakerFocused.username || t.source === 'screen_share'), [tracks, scUserContext.user]);
71
+ const tracksNoParticipants = (0, react_1.useMemo)(() => tracks.filter((t) => t.participant.name === scUserContext.user.username ||
72
+ (speakerFocused && t.participant.name === speakerFocused.username) ||
73
+ t.source === 'screen_share'), [tracks, scUserContext.user]);
72
74
  const handleBlur = React.useCallback((event) => {
73
75
  var _a, _b;
74
76
  if (event.target) {
@@ -6,10 +6,11 @@ const react_1 = require("react");
6
6
  const styles_1 = require("@mui/material/styles");
7
7
  const material_1 = require("@mui/material");
8
8
  const react_core_1 = require("@selfcommunity/react-core");
9
+ const types_1 = require("@selfcommunity/types");
9
10
  const react_intl_1 = require("react-intl");
10
11
  const DateTimeAgo_1 = tslib_1.__importDefault(require("../../../shared/DateTimeAgo"));
11
12
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
12
- const types_1 = require("../../../types");
13
+ const types_2 = require("../../../types");
13
14
  const NotificationItem_1 = tslib_1.__importDefault(require("../../../shared/NotificationItem"));
14
15
  const lab_1 = require("@mui/lab");
15
16
  const UserDeletedSnackBar_1 = tslib_1.__importDefault(require("../../../shared/UserDeletedSnackBar"));
@@ -37,14 +38,14 @@ const Root = (0, styles_1.styled)(NotificationItem_1.default, {
37
38
  */
38
39
  function CourseNotification(props) {
39
40
  // PROPS
40
- const { notificationObject, id = `n_${props.notificationObject['sid']}`, className, template = types_1.SCNotificationObjectTemplateType.DETAIL } = props, rest = tslib_1.__rest(props, ["notificationObject", "id", "className", "template"]);
41
+ const { notificationObject, id = `n_${props.notificationObject['sid']}`, className, template = types_2.SCNotificationObjectTemplateType.DETAIL } = props, rest = tslib_1.__rest(props, ["notificationObject", "id", "className", "template"]);
41
42
  // CONTEXT
42
43
  const scRoutingContext = (0, react_core_1.useSCRouting)();
43
44
  // STATE
44
45
  const [openAlert, setOpenAlert] = (0, react_1.useState)(false);
45
46
  // CONST
46
- const isSnippetTemplate = template === types_1.SCNotificationObjectTemplateType.SNIPPET;
47
- const isToastTemplate = template === types_1.SCNotificationObjectTemplateType.TOAST;
47
+ const isSnippetTemplate = template === types_2.SCNotificationObjectTemplateType.SNIPPET;
48
+ const isToastTemplate = template === types_2.SCNotificationObjectTemplateType.TOAST;
48
49
  if (!notificationObject.course) {
49
50
  return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
50
51
  }
@@ -57,9 +58,13 @@ function CourseNotification(props) {
57
58
  }), { onClick: notificationObject.course.created_by.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: notificationObject.course.created_by.username })), ' ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.notification.course.${notificationObject.type}`, defaultMessage: `ui.notification.course.${notificationObject.type}`, values: {
58
59
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
59
60
  // @ts-ignore
60
- course: notificationObject.course.name,
61
- link: (...chunks) => (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: chunks }))
62
- } })] }), footer: isToastTemplate ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) })) }))] }))) : ((0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
61
+ name: notificationObject.course.name,
62
+ link: (...chunks) => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
63
+ ? react_core_1.SCRoutes.COURSE_LESSON_ROUTE_NAME
64
+ : react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: chunks })))
65
+ } })] }), footer: isToastTemplate ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
66
+ ? react_core_1.SCRoutes.COURSE_LESSON_ROUTE_NAME
67
+ : react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) })) }))] }))) : ((0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
63
68
  }
64
69
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className, `${constants_1.PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, image: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!notificationObject.course.created_by.deleted && {
65
70
  to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.course.created_by)
@@ -68,8 +73,12 @@ function CourseNotification(props) {
68
73
  }), { onClick: notificationObject.course.created_by.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: notificationObject.course.created_by.username })), ' ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.notification.course.${notificationObject.type}`, defaultMessage: `ui.notification.course.${notificationObject.type}`, values: {
69
74
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
70
75
  // @ts-ignore
71
- course: notificationObject.course.name,
72
- link: (...chunks) => (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: chunks }))
73
- } }), (0, jsx_runtime_1.jsx)(Course_1.default, { course: notificationObject.course, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), template: types_1.SCCourseTemplateType.SNIPPET, elevation: 0 })] }), actions: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.activeAt }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton }, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) }))] })) }, rest)), openAlert && (0, jsx_runtime_1.jsx)(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
76
+ name: notificationObject.course.name,
77
+ link: (...chunks) => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
78
+ ? react_core_1.SCRoutes.COURSE_LESSON_ROUTE_NAME
79
+ : react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: chunks })))
80
+ } }), notificationObject.type !== types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON && ((0, jsx_runtime_1.jsx)(Course_1.default, { course: notificationObject.course, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), template: types_2.SCCourseTemplateType.SNIPPET, elevation: 0 }))] }), actions: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.activeAt }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton }, component: react_core_1.Link, to: scRoutingContext.url(notificationObject.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
81
+ ? react_core_1.SCRoutes.COURSE_LESSON_ROUTE_NAME
82
+ : react_core_1.SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) }))] })) }, rest)), openAlert && (0, jsx_runtime_1.jsx)(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
74
83
  }
75
84
  exports.default = CourseNotification;
@@ -311,6 +311,7 @@ function UserNotification(inProps) {
311
311
  return (0, jsx_runtime_1.jsx)(Event_1.default, { notificationObject: n }, i);
312
312
  }
313
313
  else if (n.type === types_1.SCNotificationTypologyType.USER_ADDED_TO_COURSE ||
314
+ n.type === types_1.SCNotificationTypologyType.MANAGER_ADDED_TO_COURSE ||
314
315
  n.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ||
315
316
  n.type === types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE ||
316
317
  n.type === types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE ||
@@ -272,6 +272,7 @@ function SnippetNotifications(inProps) {
272
272
  return (0, jsx_runtime_1.jsx)(Event_1.default, { notificationObject: n, template: types_1.SCNotificationObjectTemplateType.SNIPPET }, i);
273
273
  }
274
274
  else if (n.type === types_2.SCNotificationTypologyType.USER_ADDED_TO_COURSE ||
275
+ n.type === types_2.SCNotificationTypologyType.MANAGER_ADDED_TO_COURSE ||
275
276
  n.type === types_2.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ||
276
277
  n.type === types_2.SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE ||
277
278
  n.type === types_2.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE ||
@@ -129,7 +129,8 @@ function UserToastNotifications(inProps) {
129
129
  content = (0, jsx_runtime_1.jsx)(Event_1.default, { notificationObject: n.notification_obj, template: types_2.SCNotificationObjectTemplateType.TOAST });
130
130
  }
131
131
  else if (type === types_1.SCNotificationTypologyType.USER_ADDED_TO_COURSE ||
132
- n.type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ||
132
+ type === types_1.SCNotificationTypologyType.MANAGER_ADDED_TO_COURSE ||
133
+ type === types_1.SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ||
133
134
  type === types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE ||
134
135
  type === types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE ||
135
136
  type === types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE) {
@@ -59,7 +59,7 @@ function AccordionLessons(inProps) {
59
59
  if (!course) {
60
60
  return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
61
61
  }
62
- return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: ((_a = course.sections) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (course.sections.map((section) => ((0, jsx_runtime_1.jsxs)(material_1.Accordion, Object.assign({ className: classes.accordion, expanded: expanded === section.id, onChange: handleChange(section.id), disableGutters: true, elevation: 0, square: true }, { children: [(0, jsx_runtime_1.jsxs)(material_1.AccordionSummary, Object.assign({ className: classes.summary, expandIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_less" }) }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.nameWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", variant: "body1" }, { children: section.name })), viewerJoinStatus !== types_1.SCCourseJoinStatusType.CREATOR && viewerJoinStatus !== types_1.SCCourseJoinStatusType.MANAGER && section.locked && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.accordionLessons.date", defaultMessage: "ui.course.accordionLessons.date", values: {
62
+ return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: ((_a = course.sections) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (course.sections.map((section) => ((0, jsx_runtime_1.jsxs)(material_1.Accordion, Object.assign({ className: classes.accordion, expanded: expanded === section.id, onChange: handleChange(section.id), disableGutters: true, elevation: 0, square: true }, { children: [(0, jsx_runtime_1.jsxs)(material_1.AccordionSummary, Object.assign({ className: classes.summary, expandIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_more" }) }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.nameWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", variant: "body1" }, { children: section.name })), viewerJoinStatus !== types_1.SCCourseJoinStatusType.CREATOR && viewerJoinStatus !== types_1.SCCourseJoinStatusType.MANAGER && section.locked && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.accordionLessons.date", defaultMessage: "ui.course.accordionLessons.date", values: {
63
63
  date: intl.formatDate(section.available_date, { day: 'numeric', month: 'numeric', year: 'numeric' }),
64
64
  hour: intl.formatDate(section.available_date, { hour: 'numeric', minute: 'numeric' })
65
65
  } }) }))] }))] })), !isMobile && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
@@ -55,7 +55,7 @@ function CourseUsersTable(inProps) {
55
55
  const ref = (0, react_1.useRef)(null);
56
56
  // CONTEXTS
57
57
  const scUserContext = (0, react_core_1.useSCUser)();
58
- // HOOKS
58
+ // INTL
59
59
  const intl = (0, react_intl_1.useIntl)();
60
60
  // EFFECTS
61
61
  (0, react_1.useEffect)(() => {
@@ -121,7 +121,7 @@ function CourseUsersTable(inProps) {
121
121
  }
122
122
  return ((0, jsx_runtime_1.jsx)(material_1.TableCell, Object.assign({ width: mode === course_1.SCCourseUsersTableModeType.DASHBOARD ? '20%' : '25%' }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i));
123
123
  }) }) }), (0, jsx_runtime_1.jsxs)(material_1.TableBody, { children: [users.length > 0 &&
124
- users.map((user, i) => ((0, jsx_runtime_1.jsxs)(material_1.TableRow, { children: [(0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.avatarWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: user.username, src: user.avatar }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: user.username }))] })) }), mode === course_1.SCCourseUsersTableModeType.DASHBOARD && ((0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.progressWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.LinearProgress, { className: classes.progress, variant: "determinate", value: user.user_completion_rate }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: `${Math.round(user.user_completion_rate)}%` }))] })) })), mode === course_1.SCCourseUsersTableModeType.EDIT && ((0, jsx_runtime_1.jsx)(material_1.TableCell, { children: user.join_status !== types_1.SCCourseJoinStatusType.CREATOR && scUserContext.user.id !== user.id ? ((0, jsx_runtime_1.jsx)(ChangeUsersStatus_1.default, { course: course, user: user })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.editCourse.tab.users.table.select.${user.join_status}`, defaultMessage: `ui.editCourse.tab.users.table.select.${user.join_status}` }) }))) })), (0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: new Date(mode === course_1.SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.joined_at || new Date()).toLocaleDateString() })) }), (0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: new Date(mode === course_1.SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.last_active_at || new Date()).toLocaleDateString() })) }), mode === course_1.SCCourseUsersTableModeType.EDIT &&
124
+ users.map((user, i) => ((0, jsx_runtime_1.jsxs)(material_1.TableRow, { children: [(0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.avatarWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: user.username, src: user.avatar }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: user.username }))] })) }), mode === course_1.SCCourseUsersTableModeType.DASHBOARD && ((0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.progressWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.LinearProgress, { className: classes.progress, variant: "determinate", value: user.user_completion_rate }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: `${Math.round(user.user_completion_rate)}%` }))] })) })), mode === course_1.SCCourseUsersTableModeType.EDIT && ((0, jsx_runtime_1.jsx)(material_1.TableCell, { children: user.join_status !== types_1.SCCourseJoinStatusType.CREATOR && scUserContext.user.id !== user.id ? ((0, jsx_runtime_1.jsx)(ChangeUsersStatus_1.default, { course: course, user: user })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.editCourse.tab.users.table.select.${user.join_status}`, defaultMessage: `ui.editCourse.tab.users.table.select.${user.join_status}` }) }))) })), (0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedDate, { value: mode === course_1.SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.joined_at || new Date() }) })) }), (0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedDate, { value: mode === course_1.SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.last_active_at || new Date() }) })) }), mode === course_1.SCCourseUsersTableModeType.EDIT &&
125
125
  user.join_status !== types_1.SCCourseJoinStatusType.CREATOR &&
126
126
  scUserContext.user.id !== user.id ? ((0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsx)(RemoveButton_1.default, { ref: ref, course: course, user: user, handleOpenDialog: handleOpenDialog }) })) : (mode === course_1.SCCourseUsersTableModeType.EDIT && (0, jsx_runtime_1.jsx)(material_1.TableCell, {})), mode === course_1.SCCourseUsersTableModeType.DASHBOARD && ((0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsx)(SeeProgressButton_1.default, { course: course, user: user }) })), mode === course_1.SCCourseUsersTableModeType.REQUESTS && ((0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsx)(RequestButton_1.default, { ref: ref, course: course, user: user, handleOpenDialog: handleOpenDialog }) }))] }, i))), state.isLoadingNext && (0, jsx_runtime_1.jsx)(RowSkeleton_1.default, { editMode: mode !== course_1.SCCourseUsersTableModeType.DASHBOARD })] })] }) }), users.length > 0 && ((0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ size: "small", variant: "outlined", color: "inherit", loading: state.isLoadingNext, disabled: !state.next, className: classes.loadingButton, onClick: handleNext }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseUsersTable.btn.label", defaultMessage: "ui.courseUsersTable.btn.label" }) })) }))), users.length === 0 && value.length === 0 && (0, jsx_runtime_1.jsx)(EmptyStatus_1.default, { icon: "face", title: emptyStatusTitle, description: emptyStatusDescription }), dialog && (0, jsx_runtime_1.jsx)(ConfirmDialog_1.default, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleConfirm })] })));
127
127
  }
@@ -3,7 +3,7 @@ import { Avatar, Box, Button, Divider, Skeleton, Stack, Typography } from '@mui/
3
3
  import { Fragment, memo, useCallback, useEffect, useMemo, useReducer, useState } from 'react';
4
4
  import { CacheStrategies, Logger } from '@selfcommunity/utils';
5
5
  import { SCOPE_SC_UI } from '../../../constants/Errors';
6
- import { FormattedMessage } from 'react-intl';
6
+ import { FormattedDate, FormattedMessage } from 'react-intl';
7
7
  import { LoadingButton } from '@mui/lab';
8
8
  import { PREFIX } from '../constants';
9
9
  import { DEFAULT_PAGINATION_OFFSET } from '../../../constants/Pagination';
@@ -95,7 +95,7 @@ function Comments(props) {
95
95
  map.set(name, [...map.get(name), comment]);
96
96
  }
97
97
  });
98
- return Array.from(map.entries()).map(([name, comments]) => (_jsxs(Box, Object.assign({ className: classes.outerWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h5" }, { children: name })), _jsx(Divider, {}), _jsxs(Stack, Object.assign({ className: classes.innerWrapper }, { children: [comments.map((comment) => (_jsxs(Stack, Object.assign({ className: classes.userWrapper }, { children: [_jsx(Avatar, { src: comment.created_by.avatar, alt: comment.created_by.username, className: classes.avatar }), _jsxs(Box, { children: [_jsxs(Stack, Object.assign({ className: classes.userInfo }, { children: [_jsx(Typography, Object.assign({ variant: "body1" }, { children: comment.created_by.username })), _jsx(Box, { className: classes.circle }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: new Date(comment.created_at).toLocaleDateString() }))] })), _jsx(Typography, { variant: "body1", component: "div", dangerouslySetInnerHTML: { __html: comment.html } })] })] }), comment.id))), _jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, course), size: "small", variant: "outlined", color: "inherit", className: classes.button }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label", defaultMessage: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label" }) })) }))] }))] }), name)));
98
+ return Array.from(map.entries()).map(([name, comments]) => (_jsxs(Box, Object.assign({ className: classes.outerWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h5" }, { children: name })), _jsx(Divider, {}), _jsxs(Stack, Object.assign({ className: classes.innerWrapper }, { children: [comments.map((comment) => (_jsxs(Stack, Object.assign({ className: classes.userWrapper }, { children: [_jsx(Avatar, { src: comment.created_by.avatar, alt: comment.created_by.username, className: classes.avatar }), _jsxs(Box, { children: [_jsxs(Stack, Object.assign({ className: classes.userInfo }, { children: [_jsx(Typography, Object.assign({ variant: "body1" }, { children: comment.created_by.username })), _jsx(Box, { className: classes.circle }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedDate, { value: comment.created_at }) }))] })), _jsx(Typography, { variant: "body1", component: "div", dangerouslySetInnerHTML: { __html: comment.html } })] })] }), comment.id))), _jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, course), size: "small", variant: "outlined", color: "inherit", className: classes.button }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label", defaultMessage: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label" }) })) }))] }))] }), name)));
99
99
  }, [state.results]);
100
100
  if (!state.initialized) {
101
101
  return _jsx(CommentsSkeleton, {});
@@ -165,8 +165,7 @@ export default function CourseForm(inProps) {
165
165
  * @param categories
166
166
  */
167
167
  const handleOnChangeCategory = (categories) => {
168
- const categoriesIds = categories.map((item) => item.id);
169
- setField((prev) => (Object.assign(Object.assign({}, prev), { ['categories']: course ? categoriesIds : convertToCategoriesObject(categories) })));
168
+ setField((prev) => (Object.assign(Object.assign({}, prev), { ['categories']: convertToCategoriesObject(categories) })));
170
169
  };
171
170
  /**
172
171
  * Notify when a group info changed
@@ -204,7 +203,7 @@ export default function CourseForm(inProps) {
204
203
  }
205
204
  let courseService;
206
205
  if (course) {
207
- courseService = CourseService.updateCourse(course.id, formData, {
206
+ courseService = CourseService.patchCourse(course.id, formData, {
208
207
  headers: { 'Content-Type': 'multipart/form-data' }
209
208
  });
210
209
  }
@@ -11,12 +11,12 @@ function Customize(props) {
11
11
  const { enqueueSnackbar } = useSnackbar();
12
12
  // HANDLERS
13
13
  const handleSuccess = useCallback((data) => {
14
- setCourse(data);
14
+ setCourse(Object.assign(Object.assign({}, course), data));
15
15
  enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.editCourse.tab.customize.snackbar.save", defaultMessage: "ui.editCourse.tab.customize.snackbar.save" }), {
16
16
  variant: 'success',
17
17
  autoHideDuration: 3000
18
18
  });
19
- }, [setCourse]);
19
+ }, [course]);
20
20
  const handleError = useCallback(() => {
21
21
  enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
22
22
  variant: 'error',
@@ -71,7 +71,7 @@ function Options(props) {
71
71
  setLoading(true);
72
72
  CourseService.patchCourse(course.id, Object.assign({ id: course.id }, tempOptions))
73
73
  .then((data) => {
74
- setCourse(data);
74
+ setCourse(Object.assign(Object.assign({}, course), data));
75
75
  setTempOptions(null);
76
76
  setCanSave(false);
77
77
  setLoading(false);
@@ -80,6 +80,11 @@ export interface EditorProps {
80
80
  * @default <FormattedMessage id="ui.editor.placeholder" defaultMessage="ui.editor.placeholder" />
81
81
  */
82
82
  placeholder?: React.ReactNode;
83
+ /**
84
+ * Prop to customize emoji plugin position
85
+ * @default false
86
+ */
87
+ isLessonCommentEditor?: boolean;
83
88
  }
84
89
  declare const _default: React.ForwardRefExoticComponent<EditorProps & React.RefAttributes<EditorRef>>;
85
90
  export default _default;
@@ -104,7 +104,7 @@ const Editor = (inProps, ref) => {
104
104
  props: inProps,
105
105
  name: PREFIX
106
106
  });
107
- const { id = 'editor', className = null, defaultValue = '', toolbar = false, uploadImage = false, uploadFile = false, editable = true, onChange = null, onMediaChange = null, onFocus = null, onBlur = null, action = null, ToolBarProps = {}, MediaPluginProps = {}, placeholder = _jsx(FormattedMessage, { id: "ui.editor.placeholder", defaultMessage: "ui.editor.placeholder" }) } = props;
107
+ const { id = 'editor', className = null, defaultValue = '', toolbar = false, uploadImage = false, uploadFile = false, editable = true, onChange = null, onMediaChange = null, onFocus = null, onBlur = null, action = null, ToolBarProps = {}, MediaPluginProps = {}, placeholder = _jsx(FormattedMessage, { id: "ui.editor.placeholder", defaultMessage: "ui.editor.placeholder" }), isLessonCommentEditor = false } = props;
108
108
  const apiRef = useRef();
109
109
  // STATE
110
110
  const [focused, setFocused] = useState(false);
@@ -145,6 +145,6 @@ const Editor = (inProps, ref) => {
145
145
  nodes: [...nodes],
146
146
  theme: editorTheme
147
147
  }), [editable]);
148
- return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className, { [classes.toolbar]: toolbar, [classes.focused]: focused }) }, { children: _jsxs(LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [toolbar ? (_jsxs(_Fragment, { children: [_jsx(ToolbarPlugin, Object.assign({ uploadImage: uploadImage, uploadFile: uploadFile, MediaPluginProps: { onMediaAdd: handleMediaChange } }, ToolBarProps)), _jsx(ListPlugin, {}), _jsx(HorizontalRulePlugin, {})] })) : (_jsxs(Stack, Object.assign({ className: classes.actions, direction: "row" }, { children: [uploadImage && _jsx(ImagePlugin, {}), uploadFile && _jsx(MediaPlugin, Object.assign({}, MediaPluginProps)), _jsx(EmojiPlugin, {}), action && action] }))), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: classes.content }), placeholder: _jsx(Box, Object.assign({ className: classes.placeholder, onClick: handleFocus }, { children: placeholder })), ErrorBoundary: LexicalErrorBoundary }), _jsx(DefaultHtmlValuePlugin, { defaultValue: defaultValue }), _jsx(HistoryPlugin, {}), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(OnBlurPlugin, { onBlur: handleHasBlur }), _jsx(OnFocusPlugin, { onFocus: handleHasFocus }), _jsx(AutoLinkPlugin, {}), _jsx(MentionsPlugin, {}), _jsx(LinkPlugin, {}), _jsx(FloatingLinkPlugin, {}), _jsx(ApiPlugin, { ref: apiRef })] })) })));
148
+ return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className, { [classes.toolbar]: toolbar, [classes.focused]: focused }) }, { children: _jsxs(LexicalComposer, Object.assign({ initialConfig: initialConfig }, { children: [toolbar ? (_jsxs(_Fragment, { children: [_jsx(ToolbarPlugin, Object.assign({ uploadImage: uploadImage, uploadFile: uploadFile, MediaPluginProps: { onMediaAdd: handleMediaChange } }, ToolBarProps)), _jsx(ListPlugin, {}), _jsx(HorizontalRulePlugin, {})] })) : (_jsxs(Stack, Object.assign({ className: classes.actions, direction: "row" }, { children: [uploadImage && _jsx(ImagePlugin, {}), _jsx(EmojiPlugin, { isLessonCommentEditor: isLessonCommentEditor }), uploadFile && _jsx(MediaPlugin, Object.assign({}, MediaPluginProps)), action && action] }))), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: classes.content }), placeholder: _jsx(Box, Object.assign({ className: classes.placeholder, onClick: handleFocus }, { children: placeholder })), ErrorBoundary: LexicalErrorBoundary }), _jsx(DefaultHtmlValuePlugin, { defaultValue: defaultValue }), _jsx(HistoryPlugin, {}), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(OnBlurPlugin, { onBlur: handleHasBlur }), _jsx(OnFocusPlugin, { onFocus: handleHasFocus }), _jsx(AutoLinkPlugin, {}), _jsx(MentionsPlugin, {}), _jsx(LinkPlugin, {}), _jsx(FloatingLinkPlugin, {}), _jsx(ApiPlugin, { ref: apiRef })] })) })));
149
149
  };
150
150
  export default forwardRef(Editor);
@@ -1 +1,3 @@
1
- export default function EmojiPlugin(): JSX.Element;
1
+ export default function EmojiPlugin({ isLessonCommentEditor }: {
2
+ isLessonCommentEditor?: boolean;
3
+ }): JSX.Element;
@@ -6,7 +6,7 @@ import { Fade, Icon, IconButton, Popover, useMediaQuery, useTheme } from '@mui/m
6
6
  import { styled } from '@mui/material/styles';
7
7
  import EmojiPicker from '../../../shared/EmojiPicker';
8
8
  import { PREFIX } from '../constants';
9
- function Emoji({ editor, className = '' }) {
9
+ function Emoji({ editor, className = '', isLessonCommentEditor = false }) {
10
10
  // STATE
11
11
  const theme = useTheme();
12
12
  const isMobile = useMediaQuery(theme.breakpoints.down('md'));
@@ -22,13 +22,7 @@ function Emoji({ editor, className = '' }) {
22
22
  if (isMobile) {
23
23
  return null;
24
24
  }
25
- return (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: className, onClick: handleOpen }, { children: _jsx(Icon, { children: "sentiment_satisfied_alt" }) })), _jsx(Popover, Object.assign({ open: Boolean(emojiAnchorEl), anchorEl: emojiAnchorEl, onClose: () => setEmojiAnchorEl(null), TransitionComponent: Fade, anchorOrigin: {
26
- vertical: 'top',
27
- horizontal: 'right'
28
- }, transformOrigin: {
29
- vertical: 'bottom',
30
- horizontal: 'left'
31
- }, sx: (theme) => {
25
+ return (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: className, onClick: handleOpen }, { children: _jsx(Icon, { children: "sentiment_satisfied_alt" }) })), _jsx(Popover, Object.assign({ open: Boolean(emojiAnchorEl), anchorEl: emojiAnchorEl, onClose: () => setEmojiAnchorEl(null), TransitionComponent: Fade, anchorOrigin: isLessonCommentEditor ? { vertical: 'bottom', horizontal: 'left' } : { vertical: 'top', horizontal: 'right' }, transformOrigin: isLessonCommentEditor ? { vertical: 'top', horizontal: 'right' } : { vertical: 'bottom', horizontal: 'left' }, sx: (theme) => {
32
26
  return { zIndex: theme.zIndex.tooltip };
33
27
  } }, { children: _jsx(EmojiPicker, { onEmojiClick: handleEmojiClick }) }))] }));
34
28
  }
@@ -39,7 +33,7 @@ const Root = styled(Emoji, {
39
33
  name: PREFIX,
40
34
  slot: 'EmojiPluginRoot'
41
35
  })(() => ({}));
42
- export default function EmojiPlugin() {
36
+ export default function EmojiPlugin({ isLessonCommentEditor = false }) {
43
37
  const [editor] = useLexicalComposerContext();
44
- return _jsx(Root, { editor: editor, className: classes.root });
38
+ return _jsx(Root, { editor: editor, className: classes.root, isLessonCommentEditor: isLessonCommentEditor });
45
39
  }
@@ -155,5 +155,5 @@ export default function EventAddress(inProps) {
155
155
  }
156
156
  return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsxs(Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [isInPersonTabActive && (_jsx(Tab, { value: SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "add_location_alt" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) })), isOnlineTabActive && (_jsx(Tab, { value: SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "play_circle_outline" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) })), isLiveTabActive && (_jsx(Tab, { value: SCEventLocationType.LIVESTREAM, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "photo_camera" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.liveStream.label", defaultMessage: "ui.eventForm.address.liveStream.label" }) }))] })), _jsxs(Box, Object.assign({ className: classes.tabContent }, { children: [isInPersonTabActive && location === SCEventLocationType.PERSON && (_jsx(Autocomplete, { disabled: !geocodingApiKey, size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description || geolocation.description, noOptionsText: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), isOptionEqualToValue: (option, value) => option.description === value.description, renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.placeholder", defaultMessage: "ui.eventForm.address.live.placeholder" }), variant: "outlined", fullWidth: true, InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: (_jsxs(_Fragment, { children: [_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(Icon, { children: "add_location_alt" }) })), params.InputProps.endAdornment] })) }) }))) })), isOnlineTabActive && location === SCEventLocationType.ONLINE && (_jsx(UrlTextField, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
157
157
  endAdornment: _jsx(Icon, { children: "play_circle_outline" })
158
- }, onChange: handleLinkChange })), isLiveTabActive && location === SCEventLocationType.LIVESTREAM && (_jsxs(_Fragment, { children: [_jsx(LiveStream, { template: SCLiveStreamTemplateType.SNIPPET, liveStream: liveStream, actions: _jsx(_Fragment, {}) }), _jsx(LiveStreamFormSettings, { settings: liveStream.settings || LIVESTREAM_DEFAULT_SETTINGS, onChange: handleLiveStreamSettingsChange })] }))] }))] })));
158
+ }, value: event ? event.link : '', onChange: handleLinkChange })), isLiveTabActive && location === SCEventLocationType.LIVESTREAM && (_jsxs(_Fragment, { children: [_jsx(LiveStream, { template: SCLiveStreamTemplateType.SNIPPET, liveStream: liveStream, actions: _jsx(_Fragment, {}) }), _jsx(LiveStreamFormSettings, { settings: liveStream.settings || LIVESTREAM_DEFAULT_SETTINGS, onChange: handleLiveStreamSettingsChange })] }))] }))] })));
159
159
  }
@@ -143,9 +143,11 @@ export default function EventForm(inProps) {
143
143
  endDate: (event === null || event === void 0 ? void 0 : event.end_date) ? endDateTime : getNewDate(),
144
144
  endTime: (event === null || event === void 0 ? void 0 : event.end_date) ? endDateTime : getLaterHoursDate(3),
145
145
  location: (event === null || event === void 0 ? void 0 : event.location)
146
- ? event.location === SCEventLocationType.ONLINE && event.live_stream
147
- ? SCEventLocationType.LIVESTREAM
148
- : SCEventLocationType.ONLINE
146
+ ? event.location === SCEventLocationType.PERSON
147
+ ? SCEventLocationType.PERSON
148
+ : event.location === SCEventLocationType.ONLINE && event.live_stream
149
+ ? SCEventLocationType.LIVESTREAM
150
+ : SCEventLocationType.ONLINE
149
151
  : ((_a = EventAddressComponentProps.locations) === null || _a === void 0 ? void 0 : _a.length)
150
152
  ? presetLocation in EventAddressComponentProps.locations
151
153
  ? presetLocation
@@ -240,6 +242,11 @@ export default function EventForm(inProps) {
240
242
  formData.append('link', '');
241
243
  formData.append('live_stream_settings', null);
242
244
  }
245
+ if (field.location !== SCEventLocationType.PERSON) {
246
+ formData.append('geolocation', '');
247
+ formData.append('geolocation_lat', '');
248
+ formData.append('geolocation_lng', '');
249
+ }
243
250
  if (privateEnabled) {
244
251
  formData.append('privacy', field.isPublic ? SCEventPrivacyType.PUBLIC : SCEventPrivacyType.PRIVATE);
245
252
  }