@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
@@ -178,7 +178,7 @@ export default function LessonCommentObject(inProps) {
178
178
  */
179
179
  function renderComment(comment) {
180
180
  const summaryHtml = getCommentContributionHtml(comment.html, scRoutingContext.url);
181
- return (_jsx(React.Fragment, { children: editComment && editComment.id === comment.id ? (_jsx(Box, Object.assign({ className: classes.comment }, { children: _jsx(CommentObjectReply, 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)) }))) : (_jsx(BaseItem, { elevation: 0, className: classes.comment, image: _jsx(Link, Object.assign({}, (!comment.created_by.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, comment.created_by) }), { onClick: comment.created_by.deleted ? () => setOpenAlert(true) : null }, { children: _jsx(UserAvatar, Object.assign({ hide: !obj.created_by.community_badge }, { children: _jsx(Avatar, { alt: obj.created_by.username, variant: "circular", src: comment.created_by.avatar, className: classes.avatar }) })) })), disableTypography: true, primary: _jsx(_Fragment, { children: _jsxs(Widget, Object.assign({ className: classes.content, elevation: elevation }, rest, { children: [_jsxs(CardContent, { children: [_jsx(Link, Object.assign({ className: classes.author }, (!comment.created_by.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, comment.created_by) }), { onClick: comment.created_by.deleted ? () => setOpenAlert(true) : null }, { children: _jsx(Typography, Object.assign({ component: "span" }, { children: comment.created_by.username })) })), _jsxs(_Fragment, { children: [_jsx(Bullet, {}), _jsx(DateTimeAgo, { date: comment.created_at, showStartIcon: false })] }), _jsx(Typography, { className: classes.textContent, variant: "body2", gutterBottom: true, dangerouslySetInnerHTML: { __html: summaryHtml } }), obj.medias && obj.medias.length > 0 && (_jsx(_Fragment, { children: obj.medias.map((media) => {
181
+ return (_jsx(React.Fragment, { children: editComment && editComment.id === comment.id ? (_jsx(Box, Object.assign({ className: classes.comment }, { children: _jsx(CommentObjectReply, 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)) }))) : (_jsx(BaseItem, { elevation: 0, className: classes.comment, image: _jsx(Link, Object.assign({}, (!comment.created_by.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, comment.created_by) }), { onClick: comment.created_by.deleted ? () => setOpenAlert(true) : null }, { children: _jsx(UserAvatar, Object.assign({ hide: !obj.created_by.community_badge }, { children: _jsx(Avatar, { alt: obj.created_by.username, variant: "circular", src: comment.created_by.avatar, className: classes.avatar }) })) })), disableTypography: true, primary: _jsx(_Fragment, { children: _jsxs(Widget, Object.assign({ className: classes.content, elevation: elevation }, rest, { children: [_jsxs(CardContent, { children: [_jsx(Link, Object.assign({ className: classes.author }, (!comment.created_by.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, comment.created_by) }), { onClick: comment.created_by.deleted ? () => setOpenAlert(true) : null }, { children: _jsx(Typography, Object.assign({ component: "span" }, { children: comment.created_by.username })) })), _jsxs(_Fragment, { children: [_jsx(Bullet, {}), _jsx(DateTimeAgo, { date: comment.created_at, showStartIcon: false })] }), _jsx(Typography, { className: classes.textContent, variant: "body2", gutterBottom: true, dangerouslySetInnerHTML: { __html: summaryHtml } }), obj.medias && obj.medias.length > 0 && (_jsx(_Fragment, { children: obj.medias.map((media) => {
182
182
  return _jsx(LessonFilePreview, { className: classes.mediaContent, media: media }, media.id);
183
183
  }) }))] }), scUserContext.user && scUserContext.user.id === comment.created_by.id && (_jsx(Box, Object.assign({ className: classes.commentActionsMenu }, { children: _jsx(LessonCommentActionsMenu, { lesson: lessonObject, commentObject: comment, onDelete: handleDelete, onEdit: handleEdit }) })))] })) }) })) }, comment.id));
184
184
  }
@@ -174,5 +174,5 @@ export default function LessonCommentObjects(inProps) {
174
174
  if (!commentsObject.comments.length && commentsObject.isLoadingNext) {
175
175
  return _jsx(LessonCommentsObjectSkeleton, Object.assign({ count: 5 }, CommentsObjectSkeletonProps));
176
176
  }
177
- return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, rest, { children: _jsxs(_Fragment, { children: [_jsx(_Fragment, { children: commentsObject.comments.length > 0 ? (_jsx(InfiniteScroll, Object.assign({ height: '100%', dataLength: commentsObject.comments.length, next: handleNext, hasMoreNext: Boolean(commentsObject.next), loaderNext: _jsx(LessonCommentObjectSkeleton, Object.assign({}, CommentObjectSkeletonProps, { count: 1 })) }, { children: _jsx(List, Object.assign({ ref: commentsEndRef }, { children: commentsObject.comments.map((c, index) => (_jsx(ListItem, { children: _jsx(LessonCommentObject, Object.assign({ commentObject: c, lessonObject: commentsObject.lessonObject, onDelete: (comment) => handleCommentsUpdate(comment, true), isEditing: (editing) => setIsEditing(editing) }, CommentComponentProps, { CommentObjectSkeletonProps: CommentObjectSkeletonProps }), c.id) }, index))) })) }))) : null }), !editing && (_jsx(CommentObjectReply, { id: `reply-lessonCommentObjects`, showAvatar: false, replyIcon: true, editable: !commenting, onReply: handleCommentAction, EditorProps: { placeholder: intl.formatMessage(messages.commentEditorPlaceholder), uploadFile: true, uploadImage: false } }, replyKey))] }) })));
177
+ return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, rest, { children: _jsxs(_Fragment, { children: [_jsx(_Fragment, { children: commentsObject.comments.length > 0 ? (_jsx(InfiniteScroll, Object.assign({ height: '100%', dataLength: commentsObject.comments.length, next: handleNext, hasMoreNext: Boolean(commentsObject.next), loaderNext: _jsx(LessonCommentObjectSkeleton, Object.assign({}, CommentObjectSkeletonProps, { count: 1 })) }, { children: _jsx(List, Object.assign({ ref: commentsEndRef }, { children: commentsObject.comments.map((c, index) => (_jsx(ListItem, { children: _jsx(LessonCommentObject, Object.assign({ commentObject: c, lessonObject: commentsObject.lessonObject, onDelete: (comment) => handleCommentsUpdate(comment, true), isEditing: (editing) => setIsEditing(editing) }, CommentComponentProps, { CommentObjectSkeletonProps: CommentObjectSkeletonProps }), c.id) }, index))) })) }))) : null }), !editing && (_jsx(CommentObjectReply, { id: `reply-lessonCommentObjects`, showAvatar: false, replyIcon: true, editable: !commenting, onReply: handleCommentAction, EditorProps: { placeholder: intl.formatMessage(messages.commentEditorPlaceholder), uploadFile: true, uploadImage: false, isLessonCommentEditor: true } }, replyKey))] }) })));
178
178
  }
@@ -65,7 +65,9 @@ export function VideoConference(inProps) {
65
65
  { source: Track.Source.Camera, withPlaceholder: true },
66
66
  { source: Track.Source.ScreenShare, withPlaceholder: false }
67
67
  ], { updateOnlyOn: [RoomEvent.ActiveSpeakersChanged], onlySubscribed: false });
68
- const tracksNoParticipants = useMemo(() => tracks.filter((t) => t.participant.name === scUserContext.user.username || t.participant.name === speakerFocused.username || t.source === 'screen_share'), [tracks, scUserContext.user]);
68
+ const tracksNoParticipants = useMemo(() => tracks.filter((t) => t.participant.name === scUserContext.user.username ||
69
+ (speakerFocused && t.participant.name === speakerFocused.username) ||
70
+ t.source === 'screen_share'), [tracks, scUserContext.user]);
69
71
  const handleBlur = React.useCallback((event) => {
70
72
  var _a, _b;
71
73
  if (event.target) {
@@ -4,6 +4,7 @@ import { useState } from 'react';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { Avatar, Box, Stack, Typography } from '@mui/material';
6
6
  import { Link, SCRoutes, useSCRouting } from '@selfcommunity/react-core';
7
+ import { SCNotificationTypologyType } from '@selfcommunity/types';
7
8
  import { FormattedMessage } from 'react-intl';
8
9
  import DateTimeAgo from '../../../shared/DateTimeAgo';
9
10
  import classNames from 'classnames';
@@ -55,9 +56,13 @@ export default function CourseNotification(props) {
55
56
  }), { onClick: notificationObject.course.created_by.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: notificationObject.course.created_by.username })), ' ', _jsx(FormattedMessage, { id: `ui.notification.course.${notificationObject.type}`, defaultMessage: `ui.notification.course.${notificationObject.type}`, values: {
56
57
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
57
58
  // @ts-ignore
58
- course: notificationObject.course.name,
59
- link: (...chunks) => _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: chunks }))
60
- } })] }), footer: isToastTemplate ? (_jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at }), _jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: _jsx(FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) })) }))] }))) : (_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
59
+ name: notificationObject.course.name,
60
+ link: (...chunks) => (_jsx(Link, Object.assign({ to: scRoutingContext.url(notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
61
+ ? SCRoutes.COURSE_LESSON_ROUTE_NAME
62
+ : SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: chunks })))
63
+ } })] }), footer: isToastTemplate ? (_jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at }), _jsx(Typography, Object.assign({ color: "primary" }, { children: _jsx(Link, Object.assign({ to: scRoutingContext.url(notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
64
+ ? SCRoutes.COURSE_LESSON_ROUTE_NAME
65
+ : SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: _jsx(FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) })) }))] }))) : (_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
61
66
  }
62
67
  return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className, `${PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, image: _jsx(Link, Object.assign({}, (!notificationObject.course.created_by.deleted && {
63
68
  to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.course.created_by)
@@ -66,7 +71,11 @@ export default function CourseNotification(props) {
66
71
  }), { onClick: notificationObject.course.created_by.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: notificationObject.course.created_by.username })), ' ', _jsx(FormattedMessage, { id: `ui.notification.course.${notificationObject.type}`, defaultMessage: `ui.notification.course.${notificationObject.type}`, values: {
67
72
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
68
73
  // @ts-ignore
69
- course: notificationObject.course.name,
70
- link: (...chunks) => _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: chunks }))
71
- } }), _jsx(CourseItem, { course: notificationObject.course, actions: _jsx(_Fragment, {}), template: SCCourseTemplateType.SNIPPET, elevation: 0 })] }), actions: _jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.activeAt }), _jsx(LoadingButton, Object.assign({ color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton }, component: Link, to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: _jsx(FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) }))] })) }, rest)), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
74
+ name: notificationObject.course.name,
75
+ link: (...chunks) => (_jsx(Link, Object.assign({ to: scRoutingContext.url(notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
76
+ ? SCRoutes.COURSE_LESSON_ROUTE_NAME
77
+ : SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: chunks })))
78
+ } }), notificationObject.type !== SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON && (_jsx(CourseItem, { course: notificationObject.course, actions: _jsx(_Fragment, {}), template: SCCourseTemplateType.SNIPPET, elevation: 0 }))] }), actions: _jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [_jsx(DateTimeAgo, { date: notificationObject.active_at, className: classes.activeAt }), _jsx(LoadingButton, Object.assign({ color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton }, component: Link, to: scRoutingContext.url(notificationObject.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON
79
+ ? SCRoutes.COURSE_LESSON_ROUTE_NAME
80
+ : SCRoutes.COURSE_ROUTE_NAME, notificationObject.course) }, { children: _jsx(FormattedMessage, { id: "ui.notification.course.button.see", defaultMessage: "ui.notification.course.button.see" }) }))] })) }, rest)), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
72
81
  }
@@ -309,6 +309,7 @@ export default function UserNotification(inProps) {
309
309
  return _jsx(EventNotification, { notificationObject: n }, i);
310
310
  }
311
311
  else if (n.type === SCNotificationTypologyType.USER_ADDED_TO_COURSE ||
312
+ n.type === SCNotificationTypologyType.MANAGER_ADDED_TO_COURSE ||
312
313
  n.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ||
313
314
  n.type === SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE ||
314
315
  n.type === SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE ||
@@ -270,6 +270,7 @@ export default function SnippetNotifications(inProps) {
270
270
  return _jsx(EventNotification, { notificationObject: n, template: SCNotificationObjectTemplateType.SNIPPET }, i);
271
271
  }
272
272
  else if (n.type === SCNotificationTypologyType.USER_ADDED_TO_COURSE ||
273
+ n.type === SCNotificationTypologyType.MANAGER_ADDED_TO_COURSE ||
273
274
  n.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ||
274
275
  n.type === SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE ||
275
276
  n.type === SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE ||
@@ -126,7 +126,8 @@ export default function UserToastNotifications(inProps) {
126
126
  content = _jsx(EventNotification, { notificationObject: n.notification_obj, template: SCNotificationObjectTemplateType.TOAST });
127
127
  }
128
128
  else if (type === SCNotificationTypologyType.USER_ADDED_TO_COURSE ||
129
- n.type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ||
129
+ type === SCNotificationTypologyType.MANAGER_ADDED_TO_COURSE ||
130
+ type === SCNotificationTypologyType.USER_COMMENTED_A_COURSE_LESSON ||
130
131
  type === SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE ||
131
132
  type === SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE ||
132
133
  type === SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE) {
@@ -56,7 +56,7 @@ export default function AccordionLessons(inProps) {
56
56
  if (!course) {
57
57
  return _jsx(AccordionLessonSkeleton, {});
58
58
  }
59
- return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, { children: ((_a = course.sections) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (course.sections.map((section) => (_jsxs(Accordion, Object.assign({ className: classes.accordion, expanded: expanded === section.id, onChange: handleChange(section.id), disableGutters: true, elevation: 0, square: true }, { children: [_jsxs(AccordionSummary, Object.assign({ className: classes.summary, expandIcon: _jsx(Icon, { children: "expand_less" }) }, { children: [_jsxs(Stack, Object.assign({ className: classes.nameWrapper }, { children: [_jsx(Typography, Object.assign({ component: "span", variant: "body1" }, { children: section.name })), viewerJoinStatus !== SCCourseJoinStatusType.CREATOR && viewerJoinStatus !== SCCourseJoinStatusType.MANAGER && section.locked && (_jsxs(Fragment, { children: [_jsx(Bullet, {}), _jsx(Typography, Object.assign({ component: "span", variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.date", defaultMessage: "ui.course.accordionLessons.date", values: {
59
+ return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, { children: ((_a = course.sections) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (course.sections.map((section) => (_jsxs(Accordion, Object.assign({ className: classes.accordion, expanded: expanded === section.id, onChange: handleChange(section.id), disableGutters: true, elevation: 0, square: true }, { children: [_jsxs(AccordionSummary, Object.assign({ className: classes.summary, expandIcon: _jsx(Icon, { children: "expand_more" }) }, { children: [_jsxs(Stack, Object.assign({ className: classes.nameWrapper }, { children: [_jsx(Typography, Object.assign({ component: "span", variant: "body1" }, { children: section.name })), viewerJoinStatus !== SCCourseJoinStatusType.CREATOR && viewerJoinStatus !== SCCourseJoinStatusType.MANAGER && section.locked && (_jsxs(Fragment, { children: [_jsx(Bullet, {}), _jsx(Typography, Object.assign({ component: "span", variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.date", defaultMessage: "ui.course.accordionLessons.date", values: {
60
60
  date: intl.formatDate(section.available_date, { day: 'numeric', month: 'numeric', year: 'numeric' }),
61
61
  hour: intl.formatDate(section.available_date, { hour: 'numeric', minute: 'numeric' })
62
62
  } }) }))] }))] })), !isMobile && (_jsx(Typography, Object.assign({ component: "span", variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Avatar, Box, Icon, InputAdornment, LinearProgress, Stack, styled, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, Typography, useThemeProps } from '@mui/material';
3
3
  import { memo, useCallback, useEffect, useRef, useState } from 'react';
4
- import { FormattedMessage, useIntl } from 'react-intl';
4
+ import { FormattedDate, FormattedMessage, useIntl } from 'react-intl';
5
5
  import RowSkeleton from './RowSkeleton';
6
6
  import { LoadingButton } from '@mui/lab';
7
7
  import { SCCourseJoinStatusType } from '@selfcommunity/types';
@@ -52,7 +52,7 @@ function CourseUsersTable(inProps) {
52
52
  const ref = useRef(null);
53
53
  // CONTEXTS
54
54
  const scUserContext = useSCUser();
55
- // HOOKS
55
+ // INTL
56
56
  const intl = useIntl();
57
57
  // EFFECTS
58
58
  useEffect(() => {
@@ -118,7 +118,7 @@ function CourseUsersTable(inProps) {
118
118
  }
119
119
  return (_jsx(TableCell, Object.assign({ width: mode === SCCourseUsersTableModeType.DASHBOARD ? '20%' : '25%' }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i));
120
120
  }) }) }), _jsxs(TableBody, { children: [users.length > 0 &&
121
- users.map((user, i) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Avatar, { alt: user.username, src: user.avatar }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: user.username }))] })) }), mode === SCCourseUsersTableModeType.DASHBOARD && (_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ className: classes.progressWrapper }, { children: [_jsx(LinearProgress, { className: classes.progress, variant: "determinate", value: user.user_completion_rate }), _jsx(Typography, Object.assign({ variant: "body1" }, { children: `${Math.round(user.user_completion_rate)}%` }))] })) })), mode === SCCourseUsersTableModeType.EDIT && (_jsx(TableCell, { children: user.join_status !== SCCourseJoinStatusType.CREATOR && scUserContext.user.id !== user.id ? (_jsx(ChangeUserStatus, { course: course, user: user })) : (_jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: `ui.editCourse.tab.users.table.select.${user.join_status}`, defaultMessage: `ui.editCourse.tab.users.table.select.${user.join_status}` }) }))) })), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: new Date(mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.joined_at || new Date()).toLocaleDateString() })) }), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: new Date(mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.last_active_at || new Date()).toLocaleDateString() })) }), mode === SCCourseUsersTableModeType.EDIT &&
121
+ users.map((user, i) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Avatar, { alt: user.username, src: user.avatar }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: user.username }))] })) }), mode === SCCourseUsersTableModeType.DASHBOARD && (_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ className: classes.progressWrapper }, { children: [_jsx(LinearProgress, { className: classes.progress, variant: "determinate", value: user.user_completion_rate }), _jsx(Typography, Object.assign({ variant: "body1" }, { children: `${Math.round(user.user_completion_rate)}%` }))] })) })), mode === SCCourseUsersTableModeType.EDIT && (_jsx(TableCell, { children: user.join_status !== SCCourseJoinStatusType.CREATOR && scUserContext.user.id !== user.id ? (_jsx(ChangeUserStatus, { course: course, user: user })) : (_jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: `ui.editCourse.tab.users.table.select.${user.join_status}`, defaultMessage: `ui.editCourse.tab.users.table.select.${user.join_status}` }) }))) })), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.joined_at || new Date() }) })) }), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.last_active_at || new Date() }) })) }), mode === SCCourseUsersTableModeType.EDIT &&
122
122
  user.join_status !== SCCourseJoinStatusType.CREATOR &&
123
123
  scUserContext.user.id !== user.id ? (_jsx(TableCell, { children: _jsx(RemoveButton, { ref: ref, course: course, user: user, handleOpenDialog: handleOpenDialog }) })) : (mode === SCCourseUsersTableModeType.EDIT && _jsx(TableCell, {})), mode === SCCourseUsersTableModeType.DASHBOARD && (_jsx(TableCell, { children: _jsx(SeeProgressButton, { course: course, user: user }) })), mode === SCCourseUsersTableModeType.REQUESTS && (_jsx(TableCell, { children: _jsx(RequestButton, { ref: ref, course: course, user: user, handleOpenDialog: handleOpenDialog }) }))] }, i))), state.isLoadingNext && _jsx(RowSkeleton, { editMode: mode !== SCCourseUsersTableModeType.DASHBOARD })] })] }) }), users.length > 0 && (_jsx(LoadingButton, Object.assign({ size: "small", variant: "outlined", color: "inherit", loading: state.isLoadingNext, disabled: !state.next, className: classes.loadingButton, onClick: handleNext }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.btn.label", defaultMessage: "ui.courseUsersTable.btn.label" }) })) }))), users.length === 0 && value.length === 0 && _jsx(EmptyStatus, { icon: "face", title: emptyStatusTitle, description: emptyStatusDescription }), dialog && _jsx(ConfirmDialog, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleConfirm })] })));
124
124
  }