@selfcommunity/react-ui 1.1.0 → 1.2.0-alpha.1

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 (103) hide show
  1. package/lib/cjs/components/AcceptRequestUserEventButton/AcceptRequestUserEventButton.js +1 -1
  2. package/lib/cjs/components/CategoryAutocomplete/CategoryAutocomplete.js +8 -7
  3. package/lib/cjs/components/CategoryAutocomplete/constants.d.ts +1 -0
  4. package/lib/cjs/components/CategoryAutocomplete/constants.js +4 -0
  5. package/lib/cjs/components/CategoryFollowButton/CategoryFollowButton.js +2 -2
  6. package/lib/cjs/components/Course/Course.js +2 -2
  7. package/lib/cjs/components/CourseCompletedDialog/CourseCompletedDialog.js +11 -9
  8. package/lib/cjs/components/CourseCompletedDialog/constants.d.ts +1 -0
  9. package/lib/cjs/components/CourseCompletedDialog/constants.js +4 -0
  10. package/lib/cjs/components/CourseContentMenu/CourseContentMenu.js +1 -1
  11. package/lib/cjs/components/CourseDashboard/Student.d.ts +2 -2
  12. package/lib/cjs/components/CourseDashboard/Student.js +6 -6
  13. package/lib/cjs/components/CourseDashboard/Teacher/Comments.js +2 -2
  14. package/lib/cjs/components/CourseDashboard/Teacher/Info.js +3 -2
  15. package/lib/cjs/components/CourseForm/CourseForm.js +5 -4
  16. package/lib/cjs/components/CourseForm/Dialog.js +5 -1
  17. package/lib/cjs/components/CourseForm/Edit.js +5 -4
  18. package/lib/cjs/components/CourseParticipantsButton/CourseParticipantsButton.js +4 -4
  19. package/lib/cjs/components/EditCourse/Lessons/AddButton.js +3 -2
  20. package/lib/cjs/components/EditCourse/Lessons/ChangeLessonStatus.js +6 -4
  21. package/lib/cjs/components/EditCourse/Lessons/FieldName.js +3 -2
  22. package/lib/cjs/components/EditCourse/Lessons/LessonRow.js +3 -2
  23. package/lib/cjs/components/EditCourse/Lessons/SectionRow.js +3 -2
  24. package/lib/cjs/components/EditCourse/Lessons.js +3 -3
  25. package/lib/cjs/components/EditCourse/Options/SwitchForm.js +5 -1
  26. package/lib/cjs/components/EditCourse/Options.js +3 -2
  27. package/lib/cjs/components/Event/Event.js +3 -3
  28. package/lib/cjs/components/EventInviteButton/EventInviteButton.js +1 -1
  29. package/lib/cjs/components/FollowUserButton/FollowUserButton.js +2 -2
  30. package/lib/cjs/components/FriendshipUserButton/FriendshipUserButton.js +1 -1
  31. package/lib/cjs/components/Group/Group.js +1 -1
  32. package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.js +2 -2
  33. package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +1 -1
  34. package/lib/cjs/components/IncubatorSubscribeButton/IncubatorSubscribeButton.js +2 -2
  35. package/lib/cjs/components/LessonDrawer/LessonDrawer.js +3 -2
  36. package/lib/cjs/components/LessonEditForm/LessonEditForm.js +3 -2
  37. package/lib/cjs/components/LessonReleaseMenu/LessonReleaseMenu.js +4 -3
  38. package/lib/cjs/components/LoyaltyProgramWidget/LoyaltyProgramWidget.js +1 -1
  39. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +1 -1
  40. package/lib/cjs/components/PlatformWidget/PlatformWidget.js +4 -4
  41. package/lib/cjs/shared/AccordionLessons/AccordionLessons.js +5 -4
  42. package/lib/cjs/shared/AutoPlayer/index.js +7 -2
  43. package/lib/cjs/shared/ConfirmDialog/ConfirmDialog.js +11 -3
  44. package/lib/cjs/shared/CourseUsersTable/ChangeUsersStatus.js +5 -1
  45. package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.js +5 -4
  46. package/lib/cjs/shared/CourseUsersTable/RemoveButton.js +1 -1
  47. package/lib/cjs/shared/CourseUsersTable/RequestButton.js +1 -1
  48. package/lib/cjs/shared/CourseUsersTable/SeeProgressButton.js +5 -3
  49. package/lib/cjs/shared/EmptyStatus/EmptyStatus.js +3 -2
  50. package/lib/cjs/shared/Media/File/DocComponent.js +3 -2
  51. package/lib/esm/components/AcceptRequestUserEventButton/AcceptRequestUserEventButton.js +1 -1
  52. package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +8 -7
  53. package/lib/esm/components/CategoryAutocomplete/constants.d.ts +1 -0
  54. package/lib/esm/components/CategoryAutocomplete/constants.js +1 -0
  55. package/lib/esm/components/CategoryFollowButton/CategoryFollowButton.js +2 -2
  56. package/lib/esm/components/Course/Course.js +2 -2
  57. package/lib/esm/components/CourseCompletedDialog/CourseCompletedDialog.js +5 -3
  58. package/lib/esm/components/CourseCompletedDialog/constants.d.ts +1 -0
  59. package/lib/esm/components/CourseCompletedDialog/constants.js +1 -0
  60. package/lib/esm/components/CourseContentMenu/CourseContentMenu.js +1 -1
  61. package/lib/esm/components/CourseDashboard/Student.d.ts +2 -2
  62. package/lib/esm/components/CourseDashboard/Student.js +6 -6
  63. package/lib/esm/components/CourseDashboard/Teacher/Comments.js +2 -2
  64. package/lib/esm/components/CourseDashboard/Teacher/Info.js +3 -2
  65. package/lib/esm/components/CourseForm/CourseForm.js +5 -4
  66. package/lib/esm/components/CourseForm/Dialog.js +5 -1
  67. package/lib/esm/components/CourseForm/Edit.js +5 -4
  68. package/lib/esm/components/CourseParticipantsButton/CourseParticipantsButton.js +4 -4
  69. package/lib/esm/components/EditCourse/Lessons/AddButton.js +3 -2
  70. package/lib/esm/components/EditCourse/Lessons/ChangeLessonStatus.js +6 -4
  71. package/lib/esm/components/EditCourse/Lessons/FieldName.js +3 -2
  72. package/lib/esm/components/EditCourse/Lessons/LessonRow.js +3 -2
  73. package/lib/esm/components/EditCourse/Lessons/SectionRow.js +3 -2
  74. package/lib/esm/components/EditCourse/Lessons.js +3 -3
  75. package/lib/esm/components/EditCourse/Options/SwitchForm.js +5 -1
  76. package/lib/esm/components/EditCourse/Options.js +3 -2
  77. package/lib/esm/components/Event/Event.js +3 -3
  78. package/lib/esm/components/EventInviteButton/EventInviteButton.js +1 -1
  79. package/lib/esm/components/FollowUserButton/FollowUserButton.js +2 -2
  80. package/lib/esm/components/FriendshipUserButton/FriendshipUserButton.js +1 -1
  81. package/lib/esm/components/Group/Group.js +1 -1
  82. package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.js +2 -2
  83. package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +1 -1
  84. package/lib/esm/components/IncubatorSubscribeButton/IncubatorSubscribeButton.js +2 -2
  85. package/lib/esm/components/LessonDrawer/LessonDrawer.js +3 -2
  86. package/lib/esm/components/LessonEditForm/LessonEditForm.js +4 -3
  87. package/lib/esm/components/LessonReleaseMenu/LessonReleaseMenu.js +4 -3
  88. package/lib/esm/components/LoyaltyProgramWidget/LoyaltyProgramWidget.js +1 -1
  89. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +1 -1
  90. package/lib/esm/components/PlatformWidget/PlatformWidget.js +4 -4
  91. package/lib/esm/shared/AccordionLessons/AccordionLessons.js +5 -4
  92. package/lib/esm/shared/AutoPlayer/index.js +7 -2
  93. package/lib/esm/shared/ConfirmDialog/ConfirmDialog.js +12 -4
  94. package/lib/esm/shared/CourseUsersTable/ChangeUsersStatus.js +5 -1
  95. package/lib/esm/shared/CourseUsersTable/CourseUsersTable.js +5 -4
  96. package/lib/esm/shared/CourseUsersTable/RemoveButton.js +1 -1
  97. package/lib/esm/shared/CourseUsersTable/RequestButton.js +1 -1
  98. package/lib/esm/shared/CourseUsersTable/SeeProgressButton.js +6 -4
  99. package/lib/esm/shared/EmptyStatus/EmptyStatus.js +3 -2
  100. package/lib/esm/shared/Media/File/DocComponent.js +3 -2
  101. package/lib/umd/484.js +1 -1
  102. package/lib/umd/react-ui.js +1 -1
  103. package/package.json +8 -8
@@ -193,7 +193,7 @@ export default function PlatformWidget(inProps) {
193
193
  ...((isAdmin || isEditor) && !hideConsoleAction
194
194
  ? [
195
195
  {
196
- render: (_jsx(Button, Object.assign({ variant: "outlined", size: "small", onClick: () => fetchPlatform('') }, { children: _jsx(FormattedMessage, { id: "ui.platformWidget.adm", defaultMessage: "ui.platformWidget.adm" }) }))),
196
+ render: (_jsx(Button, Object.assign({ variant: "contained", size: "small", onClick: () => fetchPlatform('') }, { children: _jsx(FormattedMessage, { id: "ui.platformWidget.adm", defaultMessage: "ui.platformWidget.adm" }) }))),
197
197
  title: _jsx(FormattedMessage, { id: "ui.platformWidget.adm", defaultMessage: "ui.platformWidget.adm" }),
198
198
  content: _jsx(FormattedMessage, { id: "ui.platformWidget.adm.desc", defaultMessage: "ui.platformWidget.adm.desc" })
199
199
  }
@@ -202,7 +202,7 @@ export default function PlatformWidget(inProps) {
202
202
  ...((isAdmin || isModerator) && !hideModerationAction
203
203
  ? [
204
204
  {
205
- render: (_jsx(Button, Object.assign({ variant: "outlined", size: "small", onClick: () => fetchPlatform('/moderation/flags/') }, { children: _jsx(FormattedMessage, { id: "ui.platformWidget.mod", defaultMessage: "ui.platformWidget.mod" }) }))),
205
+ render: (_jsx(Button, Object.assign({ variant: "contained", size: "small", onClick: () => fetchPlatform('/moderation/flags/') }, { children: _jsx(FormattedMessage, { id: "ui.platformWidget.mod", defaultMessage: "ui.platformWidget.mod" }) }))),
206
206
  title: _jsx(FormattedMessage, { id: "ui.platformWidget.mod", defaultMessage: "ui.platformWidget.mod" }),
207
207
  content: _jsx(FormattedMessage, { id: "ui.platformWidget.mod.desc", defaultMessage: "ui.platformWidget.mod.desc" })
208
208
  }
@@ -211,7 +211,7 @@ export default function PlatformWidget(inProps) {
211
211
  ...(isAdmin && isCommunityOwner && !hideHubAction
212
212
  ? [
213
213
  {
214
- render: (_jsx(Button, Object.assign({ variant: "outlined", size: "small", component: Link, to: isStage ? HUB_STAGE : HUB_PROD, target: "_blank" }, { children: _jsx(FormattedMessage, { id: "ui.platformWidget.hub", defaultMessage: "ui.platformWidget.hub" }) }))),
214
+ render: (_jsx(Button, Object.assign({ variant: "contained", size: "small", component: Link, to: isStage ? HUB_STAGE : HUB_PROD, target: "_blank" }, { children: _jsx(FormattedMessage, { id: "ui.platformWidget.hub", defaultMessage: "ui.platformWidget.hub" }) }))),
215
215
  title: _jsx(FormattedMessage, { id: "ui.platformWidget.hub", defaultMessage: "ui.platformWidget.hub" }),
216
216
  content: _jsx(FormattedMessage, { id: "ui.platformWidget.hub.desc", defaultMessage: "ui.platformWidget.hub.desc" })
217
217
  }
@@ -220,7 +220,7 @@ export default function PlatformWidget(inProps) {
220
220
  ...(isCommunityOwner && !hideContactUsAction
221
221
  ? [
222
222
  {
223
- render: (_jsx(Button, Object.assign({ variant: "outlined", size: "small", component: Link, to: isStage ? CONTACT_STAGE : CONTACT_PROD, target: "_blank" }, { children: _jsx(FormattedMessage, { id: "ui.platformWidget.contactUs", defaultMessage: "ui.platformWidget.contactUs" }) }))),
223
+ render: (_jsx(Button, Object.assign({ variant: "contained", size: "small", component: Link, to: isStage ? CONTACT_STAGE : CONTACT_PROD, target: "_blank" }, { children: _jsx(FormattedMessage, { id: "ui.platformWidget.contactUs", defaultMessage: "ui.platformWidget.contactUs" }) }))),
224
224
  title: _jsx(FormattedMessage, { id: "ui.platformWidget.contactUs", defaultMessage: "ui.platformWidget.contactUs" }),
225
225
  content: _jsx(FormattedMessage, { id: "ui.platformWidget.contactUs.desc", defaultMessage: "ui.platformWidget.contactUs.desc" })
226
226
  }
@@ -18,7 +18,8 @@ const classes = {
18
18
  nameWrapper: `${PREFIX}-name-wrapper`,
19
19
  details: `${PREFIX}-details`,
20
20
  circle: `${PREFIX}-circle`,
21
- link: `${PREFIX}-link`
21
+ link: `${PREFIX}-link`,
22
+ contrastColor: `${PREFIX}-contrast-color`
22
23
  };
23
24
  const Root = styled(Box, {
24
25
  name: PREFIX,
@@ -49,13 +50,13 @@ export default function AccordionLessons(inProps) {
49
50
  if (!course) {
50
51
  return _jsx(AccordionLessonSkeleton, {});
51
52
  }
52
- 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: {
53
+ 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", className: classes.contrastColor }, { children: section.name })), viewerJoinStatus !== SCCourseJoinStatusType.CREATOR && viewerJoinStatus !== SCCourseJoinStatusType.MANAGER && section.locked && (_jsxs(Fragment, { children: [_jsx(Bullet, {}), _jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.date", defaultMessage: "ui.course.accordionLessons.date", values: {
53
54
  date: intl.formatDate(section.available_date, { day: 'numeric', month: 'numeric', year: 'numeric' }),
54
55
  hour: intl.formatDate(section.available_date, { hour: 'numeric', minute: 'numeric' })
55
- } }) }))] }))] })), !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: {
56
+ } }) }))] }))] })), !isMobile && (_jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
56
57
  lessonsNumber: section.lessons.length
57
58
  } }) })))] })), section.lessons.map((lesson) => (_jsxs(AccordionDetails, Object.assign({ className: classes.details }, { children: [lesson.completion_status === SCCourseLessonCompletionStatusType.COMPLETED ? (_jsx(Icon, Object.assign({ fontSize: "small", color: "primary" }, { children: "circle_checked" }))) : lesson.locked ? (_jsx(Icon, { children: "private" })) : (_jsx(Box, { className: classes.circle })), course.join_status === null ||
58
59
  viewerJoinStatus === SCCourseJoinStatusType.CREATOR ||
59
60
  viewerJoinStatus === SCCourseJoinStatusType.MANAGER ||
60
- lesson.locked ? (_jsx(Typography, { children: lesson.name })) : (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_ROUTE_NAME, getUrlLesson(course, lesson, section)), variant: "text", color: "inherit", className: classes.link }, { children: _jsx(Typography, { children: lesson.name }) })))] }), lesson.id)))] }), section.id)))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classes.empty }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.empty", defaultMessage: "ui.course.accordionLessons.empty" }) }))) })));
61
+ lesson.locked ? (_jsx(Typography, Object.assign({ className: classes.contrastColor }, { children: lesson.name }))) : (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_ROUTE_NAME, getUrlLesson(course, lesson, section)), variant: "text", color: "inherit", className: classes.link }, { children: _jsx(Typography, Object.assign({ className: classes.contrastColor }, { children: lesson.name })) })))] }), lesson.id)))] }), section.id)))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classNames(classes.empty, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.empty", defaultMessage: "ui.course.accordionLessons.empty" }) }))) })));
61
62
  }
@@ -11,7 +11,12 @@ const Root = styled(Waypoint, {
11
11
  name: PREFIX,
12
12
  slot: 'Root',
13
13
  overridesResolver: (_props, styles) => styles.root
14
- })(() => ({}));
14
+ })(({ theme }) => ({
15
+ '& .react-player__preview': {
16
+ backgroundSize: 'contain !important',
17
+ backgroundColor: theme.palette.common.black
18
+ }
19
+ }));
15
20
  export default function AutoPlayer(props) {
16
21
  // PROPS
17
22
  const { loop = false, muted = true, playsinline = true, controls = true, stopOnUnmount = true, pip = true, onVideoWatch } = props, rest = __rest(props, ["loop", "muted", "playsinline", "controls", "stopOnUnmount", "pip", "onVideoWatch"]);
@@ -46,7 +51,7 @@ export default function AutoPlayer(props) {
46
51
  /**
47
52
  * Renders root object
48
53
  */
49
- return (_jsx(Root, Object.assign({ scrollableAncestor: window, onEnter: handleEnterViewport, onLeave: handleExitViewport }, { children: _jsx("div", { children: _jsx(ReactPlayer, Object.assign({ loop: loop, controls: controls, stopOnUnmount: stopOnUnmount, pip: pip, playing: shouldPlay, muted: muted, onProgress: (progress) => {
54
+ return (_jsx(Root, Object.assign({ scrollableAncestor: window, onEnter: handleEnterViewport, onLeave: handleExitViewport }, { children: _jsx("div", { children: _jsx(ReactPlayer, Object.assign({ light: !enableAutoplay, loop: loop, controls: controls, stopOnUnmount: stopOnUnmount, pip: pip, playing: shouldPlay, muted: muted, onProgress: (progress) => {
50
55
  const playedSeconds = progress.playedSeconds;
51
56
  if (played === 0) {
52
57
  setStartPlay(playedSeconds);
@@ -1,15 +1,23 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { styled, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Card } from '@mui/material';
3
+ import { styled, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Card, lighten, darken, getContrastRatio } from '@mui/material';
4
4
  import { FormattedMessage } from 'react-intl';
5
5
  const PREFIX = 'SCConfirmDialog';
6
+ const classes = {
7
+ contrastColor: `${PREFIX}-contrast-color`
8
+ };
6
9
  const Root = styled(Card, {
7
10
  name: PREFIX,
8
11
  slot: 'Root',
9
- overridesResolver: (props, styles) => styles.root
12
+ overridesResolver: (_props, styles) => styles.root
10
13
  })(({ theme }) => ({
11
14
  maxWidth: 800,
12
- marginBottom: theme.spacing(2)
15
+ marginBottom: theme.spacing(2),
16
+ [`& .${PREFIX}-contrast-color`]: {
17
+ color: getContrastRatio(theme.palette.background.paper, theme.palette.common.white) > 4.5
18
+ ? lighten(theme.palette.common.white, 0.5)
19
+ : darken(theme.palette.common.white, 0.5)
20
+ }
13
21
  }));
14
22
  export default function ConfirmDialog(props) {
15
23
  // PROPS
@@ -35,5 +43,5 @@ export default function ConfirmDialog(props) {
35
43
  /**
36
44
  * Renders root object
37
45
  */
38
- return (_jsx(Root, { children: _jsxs(Dialog, Object.assign({ open: open, onClose: handleClose }, rest, { children: [_jsx(DialogTitle, { children: title || _jsx(FormattedMessage, { id: "ui.confirmDialog.title", defaultMessage: "ui.confirmDialog.title" }) }), content && (_jsx(DialogContent, { children: _jsx(DialogContentText, Object.assign({ component: "div" }, { children: content })) })), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ onClick: handleClose }, { children: btnCancel || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnCancel", defaultMessage: "ui.confirmDialog.btnCancel" }) })), _jsx(Button, Object.assign({ onClick: handleConfirm, variant: "contained", autoFocus: true, loading: isUpdating }, { children: btnConfirm || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnConfirm", defaultMessage: "ui.confirmDialog.btnConfirm" }) }))] })] })) }));
46
+ return (_jsx(Root, { children: _jsxs(Dialog, Object.assign({ open: open, onClose: handleClose }, rest, { children: [_jsx(DialogTitle, Object.assign({ className: classes.contrastColor }, { children: title || _jsx(FormattedMessage, { id: "ui.confirmDialog.title", defaultMessage: "ui.confirmDialog.title" }) })), content && (_jsx(DialogContent, { children: _jsx(DialogContentText, Object.assign({ component: "div", className: classes.contrastColor }, { children: content })) })), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ onClick: handleClose, className: classes.contrastColor }, { children: btnCancel || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnCancel", defaultMessage: "ui.confirmDialog.btnCancel" }) })), _jsx(Button, Object.assign({ onClick: handleConfirm, variant: "contained", autoFocus: true, loading: isUpdating, className: classes.contrastColor }, { children: btnConfirm || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnConfirm", defaultMessage: "ui.confirmDialog.btnConfirm" }) }))] })] })) }));
39
47
  }
@@ -7,7 +7,11 @@ import { CourseService } from '@selfcommunity/api-services';
7
7
  import { Logger } from '@selfcommunity/utils';
8
8
  import { SCOPE_SC_UI } from '../../constants/Errors';
9
9
  import { useSnackbar } from 'notistack';
10
+ import { PREFIX } from './constants';
10
11
  const OPTIONS = ['ui.editCourse.tab.users.table.select.joined', 'ui.editCourse.tab.users.table.select.manager'];
12
+ const classes = {
13
+ contrastColor: `${PREFIX}-contrast-color`
14
+ };
11
15
  function ChangeUserStatus(props) {
12
16
  // PROPS
13
17
  const { course, user } = props;
@@ -50,6 +54,6 @@ function ChangeUserStatus(props) {
50
54
  ':hover': {
51
55
  backgroundColor: 'unset'
52
56
  }
53
- } }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: option, defaultMessage: option }) })) })) }), i))) })));
57
+ } }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: option, defaultMessage: option }) })) })) }), i))) })));
54
58
  }
55
59
  export default memo(ChangeUserStatus);
@@ -27,7 +27,8 @@ const classes = {
27
27
  avatarWrapper: `${PREFIX}-avatar-wrapper`,
28
28
  progressWrapper: `${PREFIX}-progress-wrapper`,
29
29
  progress: `${PREFIX}-progress`,
30
- loadingButton: `${PREFIX}-loading-button`
30
+ loadingButton: `${PREFIX}-loading-button`,
31
+ contrastColor: `${PREFIX}-contrast-color`
31
32
  };
32
33
  const Root = styled(Box, {
33
34
  name: PREFIX,
@@ -144,10 +145,10 @@ function CourseUsersTable(inProps) {
144
145
  if (i === array.length - 1) {
145
146
  return _jsx(TableCell, { width: "14%" }, i);
146
147
  }
147
- 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));
148
+ return (_jsx(TableCell, Object.assign({ width: mode === SCCourseUsersTableModeType.DASHBOARD ? '20%' : '25%' }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i));
148
149
  }) }) }), _jsxs(TableBody, { children: [users.length > 0 &&
149
- 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 &&
150
+ 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", className: classes.contrastColor }, { 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", className: classes.contrastColor }, { 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", className: classes.contrastColor }, { 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", className: classes.contrastColor }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.joined_at || new Date() }) })) }), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.last_active_at || new Date() }) })) }), mode === SCCourseUsersTableModeType.EDIT &&
150
151
  user.join_status !== SCCourseJoinStatusType.CREATOR &&
151
- scUserContext.user.id !== user.id ? (_jsx(TableCell, { children: _jsx(RemoveButton, { ref: buttonRef, 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: buttonRef, course: course, user: user, handleOpenDialog: handleOpenDialog }) }))] }, i))), state.isLoadingNext && _jsx(RowSkeleton, { editMode: mode !== SCCourseUsersTableModeType.DASHBOARD })] })] }) }), users.length > 0 && (_jsx(Button, Object.assign({ size: "small", variant: "outlined", color: "inherit", loading: state.isLoadingNext, disabled: value.length > 0 || !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 && (_jsx(EmptyStatus, { icon: "face", title: value.length > 0 ? 'ui.courseUsersTable.empty.search.title' : emptyStatusTitle, description: value.length > 0 ? 'ui.courseUsersTable.empty.search.description' : emptyStatusDescription })), dialog && _jsx(ConfirmDialog, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleConfirm })] })));
152
+ scUserContext.user.id !== user.id ? (_jsx(TableCell, { children: _jsx(RemoveButton, { ref: buttonRef, 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: buttonRef, course: course, user: user, handleOpenDialog: handleOpenDialog }) }))] }, i))), state.isLoadingNext && _jsx(RowSkeleton, { editMode: mode !== SCCourseUsersTableModeType.DASHBOARD })] })] }) }), users.length > 0 && (_jsx(Button, Object.assign({ size: "small", variant: "contained", color: "inherit", loading: state.isLoadingNext, disabled: value.length > 0 || !state.next, className: classes.loadingButton, onClick: handleNext }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.btn.label", defaultMessage: "ui.courseUsersTable.btn.label" }) })) }))), users.length === 0 && (_jsx(EmptyStatus, { icon: "face", title: value.length > 0 ? 'ui.courseUsersTable.empty.search.title' : emptyStatusTitle, description: value.length > 0 ? 'ui.courseUsersTable.empty.search.description' : emptyStatusDescription })), dialog && _jsx(ConfirmDialog, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleConfirm })] })));
152
153
  }
153
154
  export default memo(CourseUsersTable);
@@ -42,6 +42,6 @@ function RemoveButton(props, ref) {
42
42
  useImperativeHandle(ref, () => ({
43
43
  handleManageUser: (userToRemove) => handleSubmit(userToRemove)
44
44
  }), [handleSubmit]);
45
- return (_jsx(Button, Object.assign({ size: "small", color: "inherit", variant: "outlined", onClick: () => handleOpenDialog({ tab: SCCourseEditTabType.USERS, user }), loading: loading, disabled: loading }, { children: _jsx(Icon, { children: "close" }) })));
45
+ return (_jsx(Button, Object.assign({ size: "small", color: "inherit", variant: "contained", onClick: () => handleOpenDialog({ tab: SCCourseEditTabType.USERS, user }), loading: loading, disabled: loading }, { children: _jsx(Icon, { children: "close" }) })));
46
46
  }
47
47
  export default memo(forwardRef(RemoveButton));
@@ -70,6 +70,6 @@ function RequestButton(props, ref) {
70
70
  useImperativeHandle(ref, () => ({
71
71
  handleManageUser: (userToReject) => handleReject(userToReject)
72
72
  }), [handleReject]);
73
- return (_jsxs(Stack, Object.assign({ className: classes.requestButtonWrapper }, { children: [_jsx(Button, Object.assign({ size: "small", color: "primary", variant: "outlined", onClick: handleAccept, loading: acceptLoading, disabled: acceptLoading }, { children: _jsx(Icon, { children: "check" }) })), _jsx(Button, Object.assign({ size: "small", color: "inherit", variant: "outlined", onClick: () => handleOpenDialog({ tab: SCCourseEditTabType.REQUESTS, request: user }), loading: rejectLoading, disabled: rejectLoading }, { children: _jsx(Icon, { children: "close" }) }))] })));
73
+ return (_jsxs(Stack, Object.assign({ className: classes.requestButtonWrapper }, { children: [_jsx(Button, Object.assign({ size: "small", color: "primary", variant: "contained", onClick: handleAccept, loading: acceptLoading, disabled: acceptLoading }, { children: _jsx(Icon, { children: "check" }) })), _jsx(Button, Object.assign({ size: "small", color: "inherit", variant: "contained", onClick: () => handleOpenDialog({ tab: SCCourseEditTabType.REQUESTS, request: user }), loading: rejectLoading, disabled: rejectLoading }, { children: _jsx(Icon, { children: "close" }) }))] })));
74
74
  }
75
75
  export default memo(forwardRef(RequestButton));
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Avatar, Button, Icon, IconButton, Skeleton, Stack, styled, Typography, useMediaQuery, useTheme } from '@mui/material';
3
3
  import { Fragment, memo, useCallback, useEffect, useMemo, useState } from 'react';
4
- import { FormattedMessage } from 'react-intl';
4
+ import { FormattedMessage, useIntl } from 'react-intl';
5
5
  import BaseDialog from '../BaseDialog';
6
6
  import { Link, SCPreferences, SCRoutes, useSCPreferences, useSCRouting } from '@selfcommunity/react-core';
7
7
  import { PREFIX } from './constants';
@@ -16,7 +16,8 @@ const classes = {
16
16
  infoOuterWrapper: `${PREFIX}-info-outer-wrapper`,
17
17
  infoInnerWrapper: `${PREFIX}-info-inner-wrapper`,
18
18
  avatarWrapper: `${PREFIX}-avatar-wrapper`,
19
- avatar: `${PREFIX}-avatar`
19
+ avatar: `${PREFIX}-avatar`,
20
+ contrastColor: `${PREFIX}-contrast-color`
20
21
  };
21
22
  const DialogRoot = styled(BaseDialog, {
22
23
  name: PREFIX,
@@ -35,6 +36,7 @@ function SeeProgressButton(props) {
35
36
  // HOOKS
36
37
  const theme = useTheme();
37
38
  const isMobile = useMediaQuery(theme.breakpoints.down('md'));
39
+ const intl = useIntl();
38
40
  const privateMessagingEnabled = useMemo(() => SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED in preferences && preferences[SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED].value, [preferences]);
39
41
  // EFFECTS
40
42
  useEffect(() => {
@@ -48,8 +50,8 @@ function SeeProgressButton(props) {
48
50
  const handleToggleOpen = useCallback(() => {
49
51
  setOpen((prev) => !prev);
50
52
  }, [setOpen]);
51
- return (_jsxs(Fragment, { children: [isMobile ? (_jsx(IconButton, Object.assign({ size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Icon, { children: "chevron_right" }) }))) : (_jsx(Button, Object.assign({ variant: "outlined", size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.action.btn.label", defaultMessage: "ui.courseUsersTable.action.btn.label" }) })) }))), open && (_jsx(DialogRoot, Object.assign({ DialogContentProps: { dividers: isMobile }, open: true, scroll: "paper", onClose: handleToggleOpen, title: _jsx(Typography, Object.assign({ variant: "h3" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.title", defaultMessage: "ui.courseUsersTable.dialog.title" }) })), className: classes.dialogRoot }, { children: _jsxs(Stack, Object.assign({ className: classes.contentWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoOuterWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoInnerWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Link, Object.assign({}, (!course.created_by.deleted && {
53
+ return (_jsxs(Fragment, { children: [isMobile ? (_jsx(IconButton, Object.assign({ size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Icon, { children: "chevron_right" }) }))) : (_jsx(Button, Object.assign({ variant: "contained", size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.action.btn.label", defaultMessage: "ui.courseUsersTable.action.btn.label" }) })) }))), open && (_jsx(DialogRoot, Object.assign({ DialogContentProps: { dividers: isMobile }, open: true, scroll: "paper", onClose: handleToggleOpen, title: intl.formatMessage({ id: 'ui.courseUsersTable.dialog.title', defaultMessage: 'ui.courseUsersTable.dialog.title' }), className: classes.dialogRoot }, { children: _jsxs(Stack, Object.assign({ className: classes.contentWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoOuterWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoInnerWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Link, Object.assign({}, (!course.created_by.deleted && {
52
54
  to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, course.created_by)
53
- }), { children: _jsx(UserAvatar, Object.assign({ hide: !course.created_by.community_badge, smaller: true }, { children: _jsx(Avatar, { className: classes.avatar, src: user.avatar, alt: user.username }) })) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: user.username }))] })), privateMessagingEnabled && (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, user), variant: "outlined", size: "small", color: "inherit" }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.btn.label", defaultMessage: "ui.courseUsersTable.dialog.btn.label" }) })) })))] })), student ? (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text1", defaultMessage: "ui.courseUsersTable.dialog.info.text1", values: { lessonsCompleted: student.num_lessons_completed } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" })), student ? (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text2", defaultMessage: "ui.courseUsersTable.dialog.info.text2", values: { courseCompleted: student.user_completion_rate } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" }))] })), _jsx(AccordionLessons, { course: student, viewerJoinStatus: course.join_status })] })) })))] }));
55
+ }), { children: _jsx(UserAvatar, Object.assign({ hide: !course.created_by.community_badge, smaller: true }, { children: _jsx(Avatar, { className: classes.avatar, src: user.avatar, alt: user.username }) })) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: user.username }))] })), privateMessagingEnabled && (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, user), variant: "contained", size: "small", color: "inherit" }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.btn.label", defaultMessage: "ui.courseUsersTable.dialog.btn.label" }) })) })))] })), student ? (_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text1", defaultMessage: "ui.courseUsersTable.dialog.info.text1", values: { lessonsCompleted: student.num_lessons_completed } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" })), student ? (_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text2", defaultMessage: "ui.courseUsersTable.dialog.info.text2", values: { courseCompleted: student.user_completion_rate } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" }))] })), _jsx(AccordionLessons, { course: student, viewerJoinStatus: course.join_status })] })) })))] }));
54
56
  }
55
57
  export default memo(SeeProgressButton);
@@ -8,7 +8,8 @@ const classes = {
8
8
  root: `${PREFIX}-root`,
9
9
  box: `${PREFIX}-box`,
10
10
  rotatedBox: `${PREFIX}-rotated-box`,
11
- icon: `${PREFIX}-icon`
11
+ icon: `${PREFIX}-icon`,
12
+ contrastColor: `${PREFIX}-contrast-color`
12
13
  };
13
14
  const Root = styled(Stack, {
14
15
  name: PREFIX,
@@ -18,6 +19,6 @@ const Root = styled(Stack, {
18
19
  function EmptyStatus(props) {
19
20
  // PROPS
20
21
  const { icon, title, description, actions, className } = props;
21
- return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Stack, Object.assign({ className: classes.box }, { children: _jsx(Stack, Object.assign({ className: classes.rotatedBox }, { children: _jsx(Icon, Object.assign({ className: classes.icon, color: "disabled", fontSize: "large" }, { children: icon })) })) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })), description && (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: description, defaultMessage: description }) }))), actions] })));
22
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Stack, Object.assign({ className: classes.box }, { children: _jsx(Stack, Object.assign({ className: classes.rotatedBox }, { children: _jsx(Icon, Object.assign({ className: classes.icon, color: "disabled", fontSize: "large" }, { children: icon })) })) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })), description && (_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: description, defaultMessage: description }) }))), actions] })));
22
23
  }
23
24
  export default memo(EmptyStatus);
@@ -18,7 +18,8 @@ const classes = {
18
18
  title: `${PREFIX}-title`,
19
19
  subtitle: `${PREFIX}-subtitle`,
20
20
  actionWrapper: `${PREFIX}-action-wrapper`,
21
- action: `${PREFIX}-action`
21
+ action: `${PREFIX}-action`,
22
+ contrastColor: `${PREFIX}-contrast-color`
22
23
  };
23
24
  const Root = styled(Stack, {
24
25
  name: PREFIX,
@@ -69,5 +70,5 @@ export default function DocComponent(props) {
69
70
  return fallback;
70
71
  }
71
72
  }, [document.mimetype]);
72
- return (_jsxs(Root, Object.assign({ className: classNames(classes.docRoot, className) }, { children: [_jsx(Box, { component: "img", alt: document.title, src: getImage() }), _jsxs(Stack, Object.assign({ className: classes.textWrapper }, { children: [_jsx(Typography, Object.assign({ className: classes.title }, { children: document.title })), document.size && _jsx(Typography, Object.assign({ className: classes.subtitle }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && (_jsxs(Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && (_jsx(IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: _jsx(Icon, { children: "delete" }) }))), handleDownload && (_jsxs(_Fragment, { children: [document.mimetype === SCMimeTypes.PDF && (_jsx(IconButton, Object.assign({ className: classes.action, component: Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: _jsx(Icon, { children: "visibility" }) }))), _jsx(IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: _jsx(Icon, { children: "download" }) }))] }))] })))] })));
73
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.docRoot, className) }, { children: [_jsx(Box, { component: "img", alt: document.title, src: getImage() }), _jsxs(Stack, Object.assign({ className: classes.textWrapper }, { children: [_jsx(Typography, Object.assign({ className: classNames(classes.title, classes.contrastColor) }, { children: document.title })), document.size && _jsx(Typography, Object.assign({ className: classNames(classes.subtitle, classes.contrastColor) }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && (_jsxs(Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && (_jsx(IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: _jsx(Icon, { children: "delete" }) }))), handleDownload && (_jsxs(_Fragment, { children: [document.mimetype === SCMimeTypes.PDF && (_jsx(IconButton, Object.assign({ className: classes.action, component: Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: _jsx(Icon, { children: "visibility" }) }))), _jsx(IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: _jsx(Icon, { children: "download" }) }))] }))] })))] })));
73
74
  }