@selfcommunity/react-ui 1.2.0-alpha.0 → 1.2.0-alpha.2

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 (72) hide show
  1. package/lib/cjs/components/CategoryAutocomplete/CategoryAutocomplete.js +8 -7
  2. package/lib/cjs/components/CategoryAutocomplete/constants.d.ts +1 -0
  3. package/lib/cjs/components/CategoryAutocomplete/constants.js +4 -0
  4. package/lib/cjs/components/CourseCompletedDialog/CourseCompletedDialog.js +11 -9
  5. package/lib/cjs/components/CourseCompletedDialog/constants.d.ts +1 -0
  6. package/lib/cjs/components/CourseCompletedDialog/constants.js +4 -0
  7. package/lib/cjs/components/CourseContentMenu/CourseContentMenu.js +1 -1
  8. package/lib/cjs/components/CourseDashboard/Student.d.ts +2 -2
  9. package/lib/cjs/components/CourseDashboard/Student.js +6 -6
  10. package/lib/cjs/components/CourseDashboard/Teacher/Comments.js +2 -2
  11. package/lib/cjs/components/CourseDashboard/Teacher/Info.js +3 -2
  12. package/lib/cjs/components/CourseForm/CourseForm.js +5 -4
  13. package/lib/cjs/components/CourseForm/Dialog.js +5 -1
  14. package/lib/cjs/components/CourseForm/Edit.js +5 -4
  15. package/lib/cjs/components/CourseParticipantsButton/CourseParticipantsButton.js +4 -4
  16. package/lib/cjs/components/EditCourse/Lessons/AddButton.js +3 -2
  17. package/lib/cjs/components/EditCourse/Lessons/ChangeLessonStatus.js +6 -4
  18. package/lib/cjs/components/EditCourse/Lessons/FieldName.js +3 -2
  19. package/lib/cjs/components/EditCourse/Lessons/LessonRow.js +3 -2
  20. package/lib/cjs/components/EditCourse/Lessons/SectionRow.js +3 -2
  21. package/lib/cjs/components/EditCourse/Lessons.js +3 -3
  22. package/lib/cjs/components/EditCourse/Options/SwitchForm.js +5 -1
  23. package/lib/cjs/components/EditCourse/Options.js +3 -2
  24. package/lib/cjs/components/LessonDrawer/LessonDrawer.js +3 -2
  25. package/lib/cjs/components/LessonEditForm/LessonEditForm.js +3 -2
  26. package/lib/cjs/components/LessonReleaseMenu/LessonReleaseMenu.js +4 -3
  27. package/lib/cjs/shared/AccordionLessons/AccordionLessons.js +5 -4
  28. package/lib/cjs/shared/ConfirmDialog/ConfirmDialog.js +11 -3
  29. package/lib/cjs/shared/CourseUsersTable/ChangeUsersStatus.js +5 -1
  30. package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.js +5 -4
  31. package/lib/cjs/shared/CourseUsersTable/RemoveButton.js +1 -1
  32. package/lib/cjs/shared/CourseUsersTable/RequestButton.js +1 -1
  33. package/lib/cjs/shared/CourseUsersTable/SeeProgressButton.js +5 -3
  34. package/lib/cjs/shared/EmptyStatus/EmptyStatus.js +3 -2
  35. package/lib/cjs/shared/Media/File/DocComponent.js +3 -2
  36. package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +8 -7
  37. package/lib/esm/components/CategoryAutocomplete/constants.d.ts +1 -0
  38. package/lib/esm/components/CategoryAutocomplete/constants.js +1 -0
  39. package/lib/esm/components/CourseCompletedDialog/CourseCompletedDialog.js +5 -3
  40. package/lib/esm/components/CourseCompletedDialog/constants.d.ts +1 -0
  41. package/lib/esm/components/CourseCompletedDialog/constants.js +1 -0
  42. package/lib/esm/components/CourseContentMenu/CourseContentMenu.js +1 -1
  43. package/lib/esm/components/CourseDashboard/Student.d.ts +2 -2
  44. package/lib/esm/components/CourseDashboard/Student.js +6 -6
  45. package/lib/esm/components/CourseDashboard/Teacher/Comments.js +2 -2
  46. package/lib/esm/components/CourseDashboard/Teacher/Info.js +3 -2
  47. package/lib/esm/components/CourseForm/CourseForm.js +5 -4
  48. package/lib/esm/components/CourseForm/Dialog.js +5 -1
  49. package/lib/esm/components/CourseForm/Edit.js +5 -4
  50. package/lib/esm/components/CourseParticipantsButton/CourseParticipantsButton.js +4 -4
  51. package/lib/esm/components/EditCourse/Lessons/AddButton.js +3 -2
  52. package/lib/esm/components/EditCourse/Lessons/ChangeLessonStatus.js +6 -4
  53. package/lib/esm/components/EditCourse/Lessons/FieldName.js +3 -2
  54. package/lib/esm/components/EditCourse/Lessons/LessonRow.js +3 -2
  55. package/lib/esm/components/EditCourse/Lessons/SectionRow.js +3 -2
  56. package/lib/esm/components/EditCourse/Lessons.js +3 -3
  57. package/lib/esm/components/EditCourse/Options/SwitchForm.js +5 -1
  58. package/lib/esm/components/EditCourse/Options.js +3 -2
  59. package/lib/esm/components/LessonDrawer/LessonDrawer.js +3 -2
  60. package/lib/esm/components/LessonEditForm/LessonEditForm.js +4 -3
  61. package/lib/esm/components/LessonReleaseMenu/LessonReleaseMenu.js +4 -3
  62. package/lib/esm/shared/AccordionLessons/AccordionLessons.js +5 -4
  63. package/lib/esm/shared/ConfirmDialog/ConfirmDialog.js +12 -4
  64. package/lib/esm/shared/CourseUsersTable/ChangeUsersStatus.js +5 -1
  65. package/lib/esm/shared/CourseUsersTable/CourseUsersTable.js +5 -4
  66. package/lib/esm/shared/CourseUsersTable/RemoveButton.js +1 -1
  67. package/lib/esm/shared/CourseUsersTable/RequestButton.js +1 -1
  68. package/lib/esm/shared/CourseUsersTable/SeeProgressButton.js +6 -4
  69. package/lib/esm/shared/EmptyStatus/EmptyStatus.js +3 -2
  70. package/lib/esm/shared/Media/File/DocComponent.js +3 -2
  71. package/lib/umd/react-ui.js +1 -1
  72. package/package.json +6 -6
@@ -187,10 +187,10 @@ function Lessons(props) {
187
187
  }
188
188
  handleOpenDialog(null);
189
189
  }, [dialog, handleOpenDialog]);
190
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.lessonTitle, classes.contrastColor), variant: "h4" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.lessons", defaultMessage: "ui.editCourse.tab.lessons" }) })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.lessonInfoWrapper }, { children: [(0, jsx_runtime_1.jsx)(CourseTypePopover_1.default, { course: course }), (0, jsx_runtime_1.jsx)(Status_1.default, { course: course, handleTabChange: handleTabChange })] })), sections.length === 0 && ((0, jsx_runtime_1.jsx)(EmptyStatus_1.default, { icon: "courses", title: "ui.editCourse.tab.lessons.table.empty.title", description: "ui.editCourse.tab.lessons.table.empty.description", actions: (0, jsx_runtime_1.jsx)(AddButton_1.default, { className: classes.emptyStatusButton, label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "inherit", variant: "outlined" }), className: classes.lessonEmptyStatus })), sections.length > 0 && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.lessonsInnerWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.lessonsSectionsWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.lessonsSections }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.table.sections.title", defaultMessage: "ui.course.table.sections.title", values: {
190
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.lessonTitle, classes.contrastColor), variant: "h4" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.lessons", defaultMessage: "ui.editCourse.tab.lessons" }) })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.lessonInfoWrapper }, { children: [(0, jsx_runtime_1.jsx)(CourseTypePopover_1.default, { course: course }), (0, jsx_runtime_1.jsx)(Status_1.default, { course: course, handleTabChange: handleTabChange })] })), sections.length === 0 && ((0, jsx_runtime_1.jsx)(EmptyStatus_1.default, { icon: "courses", title: "ui.editCourse.tab.lessons.table.empty.title", description: "ui.editCourse.tab.lessons.table.empty.description", actions: (0, jsx_runtime_1.jsx)(AddButton_1.default, { className: classes.emptyStatusButton, label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "inherit", variant: "outlined" }), className: classes.lessonEmptyStatus })), sections.length > 0 && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.lessonsInnerWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.lessonsSectionsWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.lessonsSections }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.table.sections.title", defaultMessage: "ui.course.table.sections.title", values: {
191
191
  sectionsNumber: course.num_sections
192
- } }) })), (0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.circle }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
192
+ } }) })), (0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.circle }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
193
193
  lessonsNumber: course.num_lessons
194
- } }) }))] })), (0, jsx_runtime_1.jsx)(AddButton_1.default, { label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "primary", variant: "contained", disabled: isDisabled })] })), (0, jsx_runtime_1.jsx)(dnd_1.DragDropContext, Object.assign({ onDragEnd: handleDragEnd }, { children: (0, jsx_runtime_1.jsx)(material_1.TableContainer, Object.assign({ className: classes.tableContainer }, { children: (0, jsx_runtime_1.jsxs)(material_1.Table, Object.assign({ className: classes.table }, { children: [(0, jsx_runtime_1.jsx)(material_1.TableHead, Object.assign({ className: classes.tableHeader }, { children: (0, jsx_runtime_1.jsxs)(material_1.TableRow, { children: [(0, jsx_runtime_1.jsx)(material_1.TableCell, { className: classes.cellWidth }), headerCells.map((cell, i) => ((0, jsx_runtime_1.jsx)(material_1.TableCell, Object.assign({ className: cell.className }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.tableHeaderTypography, variant: "overline" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i)))] }) })), (0, jsx_runtime_1.jsx)(dnd_1.Droppable, Object.assign({ droppableId: "droppable-1" }, { children: (outerProvider) => ((0, jsx_runtime_1.jsxs)(material_1.TableBody, Object.assign({ ref: outerProvider.innerRef }, outerProvider.droppableProps, { className: classes.tableBody }, { children: [sections.map((section, i, array) => ((0, jsx_runtime_1.jsx)(dnd_1.Draggable, Object.assign({ draggableId: i.toString(), index: i, isDragDisabled: isDisabled }, { children: (innerProvider) => ((0, jsx_runtime_1.jsx)(SectionRow_1.default, { course: course, provider: innerProvider, section: section, isNewRow: isNewRow && i + 1 === array.length, handleManageSection: handleManageSection, handleOpenDialog: handleOpenDialog, ref: ref }, i)) }), i))), outerProvider.placeholder] }))) }))] })) })) })), dialog && (0, jsx_runtime_1.jsx)(ConfirmDialog_1.default, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleDeleteRow })] })))] }));
194
+ } }) }))] })), (0, jsx_runtime_1.jsx)(AddButton_1.default, { label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "primary", variant: "contained", disabled: isDisabled })] })), (0, jsx_runtime_1.jsx)(dnd_1.DragDropContext, Object.assign({ onDragEnd: handleDragEnd }, { children: (0, jsx_runtime_1.jsx)(material_1.TableContainer, Object.assign({ className: classes.tableContainer }, { children: (0, jsx_runtime_1.jsxs)(material_1.Table, Object.assign({ className: classes.table }, { children: [(0, jsx_runtime_1.jsx)(material_1.TableHead, Object.assign({ className: classes.tableHeader }, { children: (0, jsx_runtime_1.jsxs)(material_1.TableRow, { children: [(0, jsx_runtime_1.jsx)(material_1.TableCell, { className: classes.cellWidth }), headerCells.map((cell, i) => ((0, jsx_runtime_1.jsx)(material_1.TableCell, Object.assign({ className: cell.className }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.tableHeaderTypography, classes.contrastColor), variant: "overline" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i)))] }) })), (0, jsx_runtime_1.jsx)(dnd_1.Droppable, Object.assign({ droppableId: "droppable-1" }, { children: (outerProvider) => ((0, jsx_runtime_1.jsxs)(material_1.TableBody, Object.assign({ ref: outerProvider.innerRef }, outerProvider.droppableProps, { className: classes.tableBody }, { children: [sections.map((section, i, array) => ((0, jsx_runtime_1.jsx)(dnd_1.Draggable, Object.assign({ draggableId: i.toString(), index: i, isDragDisabled: isDisabled }, { children: (innerProvider) => ((0, jsx_runtime_1.jsx)(SectionRow_1.default, { course: course, provider: innerProvider, section: section, isNewRow: isNewRow && i + 1 === array.length, handleManageSection: handleManageSection, handleOpenDialog: handleOpenDialog, ref: ref }, i)) }), i))), outerProvider.placeholder] }))) }))] })) })) })), dialog && (0, jsx_runtime_1.jsx)(ConfirmDialog_1.default, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleDeleteRow })] })))] }));
195
195
  }
196
196
  exports.default = (0, react_1.memo)(Lessons);
@@ -4,6 +4,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
4
4
  const material_1 = require("@mui/material");
5
5
  const react_1 = require("react");
6
6
  const react_intl_1 = require("react-intl");
7
+ const constants_1 = require("../constants");
8
+ const classes = {
9
+ contrastColor: `${constants_1.PREFIX}-contrast-color`
10
+ };
7
11
  function SwitchForm(props) {
8
12
  // PROPS
9
13
  const { name, title, description, checked, handleChangeOptions } = props;
@@ -15,6 +19,6 @@ function SwitchForm(props) {
15
19
  setValue(_checked);
16
20
  handleChangeOptions(name, _checked);
17
21
  }, [setValue]);
18
- return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ component: "fieldset", variant: "standard" }, { children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, Object.assign({ component: "legend" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: title, defaultMessage: title }) })) })), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Switch, { color: "primary", checked: value, name: name, onChange: handleChange }), label: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: description, defaultMessage: description }) })) })] })));
22
+ return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ component: "fieldset", variant: "standard" }, { children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, Object.assign({ component: "legend" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: title, defaultMessage: title }) })) })), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Switch, { color: "primary", checked: value, name: name, onChange: handleChange }), label: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: description, defaultMessage: description }) })) })] })));
19
23
  }
20
24
  exports.default = (0, react_1.memo)(SwitchForm);
@@ -16,7 +16,8 @@ const classes = {
16
16
  optionsContainer: `${constants_1.PREFIX}-options-container`,
17
17
  optionsWrapper: `${constants_1.PREFIX}-options-wrapper`,
18
18
  optionsDivider: `${constants_1.PREFIX}-options-divider`,
19
- optionsButtonWrapper: `${constants_1.PREFIX}-options-button-wrapper`
19
+ optionsButtonWrapper: `${constants_1.PREFIX}-options-button-wrapper`,
20
+ contrastColor: `${constants_1.PREFIX}-contrast-color`
20
21
  };
21
22
  const OPTIONS = {
22
23
  enforce_lessons_order: {
@@ -90,6 +91,6 @@ function Options(props) {
90
91
  });
91
92
  });
92
93
  }, [course, tempOptions, setCanSave, setLoading]);
93
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.optionsContainer }, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.optionsWrapper }, { children: Object.entries(OPTIONS).map(([key, value], i) => ((0, jsx_runtime_1.jsx)(SwitchForm_1.default, { name: key, title: value.title, description: value.description, checked: course[key], handleChangeOptions: handleChange }, i))) })), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.optionsButtonWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "contained", disabled: !canSave, onClick: handleSubmit, loading: loading }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.options.button.save", defaultMessage: "ui.editCourse.tab.options.button.save" }) })) })) }))] })));
94
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.optionsContainer }, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.optionsWrapper }, { children: Object.entries(OPTIONS).map(([key, value], i) => ((0, jsx_runtime_1.jsx)(SwitchForm_1.default, { name: key, title: value.title, description: value.description, checked: course[key], handleChangeOptions: handleChange }, i))) })), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.optionsButtonWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "contained", disabled: !canSave, onClick: handleSubmit, loading: loading }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.editCourse.tab.options.button.save", defaultMessage: "ui.editCourse.tab.options.button.save" }) })) })) }))] })));
94
95
  }
95
96
  exports.default = (0, react_1.memo)(Options);
@@ -17,7 +17,8 @@ const classes = {
17
17
  header: `${constants_1.PREFIX}-header`,
18
18
  headerAction: `${constants_1.PREFIX}-header-action`,
19
19
  headerContent: `${constants_1.PREFIX}-header-content`,
20
- headerEdit: `${constants_1.PREFIX}-header-edit`
20
+ headerEdit: `${constants_1.PREFIX}-header-edit`,
21
+ contrastColor: `${constants_1.PREFIX}-contrast-color`
21
22
  };
22
23
  const Root = (0, material_1.styled)(material_1.Drawer, {
23
24
  name: constants_1.PREFIX,
@@ -31,6 +32,6 @@ function LessonDrawer(inProps) {
31
32
  name: constants_1.PREFIX
32
33
  });
33
34
  const { className = null, lesson, course, editMode = false, previewMode = false, activePanel = null, LessonCommentObjectsProps = {}, LessonEditFormProps, handleClose, handleChangeLesson } = props, rest = tslib_1.__rest(props, ["className", "lesson", "course", "editMode", "previewMode", "activePanel", "LessonCommentObjectsProps", "LessonEditFormProps", "handleClose", "handleChangeLesson"]);
34
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), anchor: "right", open: Boolean(activePanel) || editMode, variant: "persistent" }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: (0, classnames_1.default)(classes.header, { [classes.headerEdit]: editMode }) }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.headerContent }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", textAlign: "center" }, { children: editMode ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonDrawer.settings", defaultMessage: "ui.lessonDrawer.settings" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.lessonDrawer.${activePanel}`, defaultMessage: `ui.lessonDrawer.${activePanel}` })) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.headerAction, onClick: handleClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Divider, {}), editMode ? ((0, jsx_runtime_1.jsx)(LessonEditForm_1.default, Object.assign({}, LessonEditFormProps))) : activePanel === types_1.SCLessonActionsType.COMMENTS ? ((0, jsx_runtime_1.jsx)(LessonCommentObjects_1.default, Object.assign({ lessonObject: lesson }, LessonCommentObjectsProps))) : ((0, jsx_runtime_1.jsx)(ScrollContainer_1.default, { children: (0, jsx_runtime_1.jsx)(CourseContentMenu_1.default, { course: course, lesson: lesson, onLessonClick: handleChangeLesson, previewMode: previewMode }) }))] })));
35
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), anchor: "right", open: Boolean(activePanel) || editMode, variant: "persistent" }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: (0, classnames_1.default)(classes.header, { [classes.headerEdit]: editMode }) }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.headerContent }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", textAlign: "center", className: classes.contrastColor }, { children: editMode ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonDrawer.settings", defaultMessage: "ui.lessonDrawer.settings" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.lessonDrawer.${activePanel}`, defaultMessage: `ui.lessonDrawer.${activePanel}` })) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.headerAction, onClick: handleClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Divider, {}), editMode ? ((0, jsx_runtime_1.jsx)(LessonEditForm_1.default, Object.assign({}, LessonEditFormProps))) : activePanel === types_1.SCLessonActionsType.COMMENTS ? ((0, jsx_runtime_1.jsx)(LessonCommentObjects_1.default, Object.assign({ lessonObject: lesson }, LessonCommentObjectsProps))) : ((0, jsx_runtime_1.jsx)(ScrollContainer_1.default, { children: (0, jsx_runtime_1.jsx)(CourseContentMenu_1.default, { course: course, lesson: lesson, onLessonClick: handleChangeLesson, previewMode: previewMode }) }))] })));
35
36
  }
36
37
  exports.default = LessonDrawer;
@@ -13,7 +13,8 @@ const classes = {
13
13
  root: `${constants_1.PREFIX}-root`,
14
14
  form: `${constants_1.PREFIX}-form`,
15
15
  settings: `${constants_1.PREFIX}-settings`,
16
- button: `${constants_1.PREFIX}-button`
16
+ button: `${constants_1.PREFIX}-button`,
17
+ contrastColor: `${constants_1.PREFIX}-contrast-color`
17
18
  };
18
19
  const Root = (0, material_1.styled)(material_1.Box, {
19
20
  name: constants_1.PREFIX,
@@ -38,6 +39,6 @@ function LessonEditForm(inProps) {
38
39
  /**
39
40
  * Rendering
40
41
  */
41
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.form }, { children: [(0, jsx_runtime_1.jsxs)(material_1.FormControl, { children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, Object.assign({ id: "status" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.status.title", defaultMessage: "ui.lessonEditForm.status.title" }) })), (0, jsx_runtime_1.jsxs)(material_1.RadioGroup, Object.assign({ "aria-labelledby": "course-status-radio-buttons-group", name: "course-status-radio-buttons-group", value: settings.status, onChange: (e) => handleChange('status', e.target.value) }, { children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: types_1.SCCourseLessonStatusType.DRAFT, control: (0, jsx_runtime_1.jsx)(material_1.Radio, {}), label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.status.draft", defaultMessage: "ui.lessonEditForm.status.draft" }) }), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: types_1.SCCourseLessonStatusType.PUBLISHED, control: (0, jsx_runtime_1.jsx)(material_1.Radio, {}), label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.status.published", defaultMessage: "ui.lessonEditForm.status.published" }) })] }))] }), (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ className: classes.settings }, { children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, Object.assign({ id: "settings" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.settings.title", defaultMessage: "ui.lessonEditForm.settings.title" }) })), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: settings.comments_enabled, onChange: (e) => handleChange('comments_enabled', e.target.checked) }), label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.settings.enableComments", defaultMessage: "ui.lessonEditForm.settings.enableComments" }) })] }))] })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ className: classes.button, variant: "contained", size: "small", onClick: onSave, loading: updating }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.button.save", defaultMessage: "ui.lessonEditForm.button.save" }) }))] })));
42
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.form }, { children: [(0, jsx_runtime_1.jsxs)(material_1.FormControl, { children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, Object.assign({ id: "status" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.status.title", defaultMessage: "ui.lessonEditForm.status.title" }) })) })), (0, jsx_runtime_1.jsxs)(material_1.RadioGroup, Object.assign({ "aria-labelledby": "course-status-radio-buttons-group", name: "course-status-radio-buttons-group", value: settings.status, onChange: (e) => handleChange('status', e.target.value) }, { children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: types_1.SCCourseLessonStatusType.DRAFT, control: (0, jsx_runtime_1.jsx)(material_1.Radio, {}), label: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.status.draft", defaultMessage: "ui.lessonEditForm.status.draft" }) })) }), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: types_1.SCCourseLessonStatusType.PUBLISHED, control: (0, jsx_runtime_1.jsx)(material_1.Radio, {}), label: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.status.published", defaultMessage: "ui.lessonEditForm.status.published" }) })) })] }))] }), (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ className: classes.settings }, { children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, Object.assign({ id: "settings" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.settings.title", defaultMessage: "ui.lessonEditForm.settings.title" }) })) })), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: settings.comments_enabled, onChange: (e) => handleChange('comments_enabled', e.target.checked) }), label: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.settings.enableComments", defaultMessage: "ui.lessonEditForm.settings.enableComments" }) })) })] }))] })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ className: (0, classnames_1.default)(classes.button, classes.contrastColor), variant: "contained", size: "small", onClick: onSave, loading: updating }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonEditForm.button.save", defaultMessage: "ui.lessonEditForm.button.save" }) }))] })));
42
43
  }
43
44
  exports.default = LessonEditForm;
@@ -45,7 +45,8 @@ const classes = {
45
45
  popoverRoot: `${constants_1.PREFIX}-popover-root`,
46
46
  popoverContent: `${constants_1.PREFIX}-popover-content`,
47
47
  popoverSelection: `${constants_1.PREFIX}-popover-selection`,
48
- popoverAction: `${constants_1.PREFIX}-popover-action`
48
+ popoverAction: `${constants_1.PREFIX}-popover-action`,
49
+ popoverContrastColor: `${constants_1.PREFIX}-popover-contrast-color`
49
50
  };
50
51
  const Root = (0, material_1.styled)(material_2.FormControl, {
51
52
  name: constants_1.PREFIX,
@@ -169,12 +170,12 @@ function LessonReleaseMenu(inProps) {
169
170
  }, transformOrigin: {
170
171
  vertical: 'top',
171
172
  horizontal: 'left'
172
- } }, { children: [(0, jsx_runtime_1.jsx)(material_2.Typography, Object.assign({ variant: "h6" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.title", defaultMessage: "ui.lessonReleaseMenu.dialog.title" }) })), (0, jsx_runtime_1.jsxs)(material_2.Box, Object.assign({ className: classes.popoverContent }, { children: [(0, jsx_runtime_1.jsxs)(material_2.Box, Object.assign({ className: classes.popoverSelection }, { children: [(0, jsx_runtime_1.jsx)(material_2.TextField, { type: "number", value: dripDelay, onChange: handleValueChange, slotProps: {
173
+ } }, { children: [(0, jsx_runtime_1.jsx)(material_2.Typography, Object.assign({ variant: "h6", className: classes.popoverContrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.title", defaultMessage: "ui.lessonReleaseMenu.dialog.title" }) })), (0, jsx_runtime_1.jsxs)(material_2.Box, Object.assign({ className: classes.popoverContent }, { children: [(0, jsx_runtime_1.jsxs)(material_2.Box, Object.assign({ className: classes.popoverSelection }, { children: [(0, jsx_runtime_1.jsx)(material_2.TextField, { type: "number", value: dripDelay, onChange: handleValueChange, slotProps: {
173
174
  input: {
174
175
  inputProps: {
175
176
  min: 0
176
177
  }
177
178
  }
178
- } }), (0, jsx_runtime_1.jsx)(material_2.FormControl, { children: (0, jsx_runtime_1.jsxs)(material_2.RadioGroup, Object.assign({ value: unit, onChange: handleUnitChange }, { children: [(0, jsx_runtime_1.jsx)(material_2.FormControlLabel, { value: constants_1.unitType.DAYS, control: (0, jsx_runtime_1.jsx)(material_2.Radio, { size: "small" }), label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.days", defaultMessage: "ui.lessonReleaseMenu.dialog.days" }) }), (0, jsx_runtime_1.jsx)(material_2.FormControlLabel, { value: constants_1.unitType.WEEKS, control: (0, jsx_runtime_1.jsx)(material_2.Radio, { size: "small" }), label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.weeks", defaultMessage: "ui.lessonReleaseMenu.dialog.weeks" }) })] })) })] })), (0, jsx_runtime_1.jsx)(material_2.Typography, Object.assign({ variant: "body1" }, { children: dripDelay > 0 ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.lessonReleaseMenu.dialog.info.structured.${unit}`, defaultMessage: `ui.lessonReleaseMenu.dialog.info.structured.${unit}`, values: { total: dripDelay } })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.info.now", defaultMessage: "ui.lessonReleaseMenu.dialog.info.now" })) })), (0, jsx_runtime_1.jsx)(material_2.Button, Object.assign({ className: classes.popoverAction, variant: "contained", disabled: section.drip_delay === dripDelay, onClick: handleSave }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.button.done", defaultMessage: "ui.lessonReleaseMenu.dialog.button.done" }) }))] }))] }))] })) })));
179
+ } }), (0, jsx_runtime_1.jsx)(material_2.FormControl, { children: (0, jsx_runtime_1.jsxs)(material_2.RadioGroup, Object.assign({ value: unit, onChange: handleUnitChange }, { children: [(0, jsx_runtime_1.jsx)(material_2.FormControlLabel, { value: constants_1.unitType.DAYS, control: (0, jsx_runtime_1.jsx)(material_2.Radio, { size: "small" }), label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.days", defaultMessage: "ui.lessonReleaseMenu.dialog.days" }) }), (0, jsx_runtime_1.jsx)(material_2.FormControlLabel, { value: constants_1.unitType.WEEKS, control: (0, jsx_runtime_1.jsx)(material_2.Radio, { size: "small" }), label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.weeks", defaultMessage: "ui.lessonReleaseMenu.dialog.weeks" }) })] })) })] })), (0, jsx_runtime_1.jsx)(material_2.Typography, Object.assign({ variant: "body1", className: classes.popoverContrastColor }, { children: dripDelay > 0 ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.lessonReleaseMenu.dialog.info.structured.${unit}`, defaultMessage: `ui.lessonReleaseMenu.dialog.info.structured.${unit}`, values: { total: dripDelay } })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.info.now", defaultMessage: "ui.lessonReleaseMenu.dialog.info.now" })) })), (0, jsx_runtime_1.jsx)(material_2.Button, Object.assign({ className: (0, classnames_1.default)(classes.popoverAction, classes.popoverContrastColor), variant: "contained", disabled: section.drip_delay === dripDelay, onClick: handleSave }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.button.done", defaultMessage: "ui.lessonReleaseMenu.dialog.button.done" }) }))] }))] }))] })) })));
179
180
  }
180
181
  exports.default = LessonReleaseMenu;
@@ -21,7 +21,8 @@ const classes = {
21
21
  nameWrapper: `${constants_1.PREFIX}-name-wrapper`,
22
22
  details: `${constants_1.PREFIX}-details`,
23
23
  circle: `${constants_1.PREFIX}-circle`,
24
- link: `${constants_1.PREFIX}-link`
24
+ link: `${constants_1.PREFIX}-link`,
25
+ contrastColor: `${constants_1.PREFIX}-contrast-color`
25
26
  };
26
27
  const Root = (0, material_1.styled)(material_1.Box, {
27
28
  name: constants_1.PREFIX,
@@ -52,14 +53,14 @@ function AccordionLessons(inProps) {
52
53
  if (!course) {
53
54
  return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
54
55
  }
55
- 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: {
56
+ 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", className: classes.contrastColor }, { 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", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.accordionLessons.date", defaultMessage: "ui.course.accordionLessons.date", values: {
56
57
  date: intl.formatDate(section.available_date, { day: 'numeric', month: 'numeric', year: 'numeric' }),
57
58
  hour: intl.formatDate(section.available_date, { hour: 'numeric', minute: 'numeric' })
58
- } }) }))] }))] })), !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: {
59
+ } }) }))] }))] })), !isMobile && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", variant: "body1", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
59
60
  lessonsNumber: section.lessons.length
60
61
  } }) })))] })), section.lessons.map((lesson) => ((0, jsx_runtime_1.jsxs)(material_1.AccordionDetails, Object.assign({ className: classes.details }, { children: [lesson.completion_status === types_1.SCCourseLessonCompletionStatusType.COMPLETED ? ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small", color: "primary" }, { children: "circle_checked" }))) : lesson.locked ? ((0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" })) : ((0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.circle })), course.join_status === null ||
61
62
  viewerJoinStatus === types_1.SCCourseJoinStatusType.CREATOR ||
62
63
  viewerJoinStatus === types_1.SCCourseJoinStatusType.MANAGER ||
63
- lesson.locked ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { children: lesson.name })) : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_2.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_LESSON_ROUTE_NAME, (0, course_1.getUrlLesson)(course, lesson, section)), variant: "text", color: "inherit", className: classes.link }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, { children: lesson.name }) })))] }), lesson.id)))] }), section.id)))) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.empty }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.accordionLessons.empty", defaultMessage: "ui.course.accordionLessons.empty" }) }))) })));
64
+ lesson.locked ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.contrastColor }, { children: lesson.name }))) : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_2.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_LESSON_ROUTE_NAME, (0, course_1.getUrlLesson)(course, lesson, section)), variant: "text", color: "inherit", className: classes.link }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.contrastColor }, { children: lesson.name })) })))] }), lesson.id)))] }), section.id)))) : ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: (0, classnames_1.default)(classes.empty, classes.contrastColor) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.accordionLessons.empty", defaultMessage: "ui.course.accordionLessons.empty" }) }))) })));
64
65
  }
65
66
  exports.default = AccordionLessons;
@@ -5,13 +5,21 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const react_intl_1 = require("react-intl");
7
7
  const PREFIX = 'SCConfirmDialog';
8
+ const classes = {
9
+ contrastColor: `${PREFIX}-contrast-color`
10
+ };
8
11
  const Root = (0, material_1.styled)(material_1.Card, {
9
12
  name: PREFIX,
10
13
  slot: 'Root',
11
- overridesResolver: (props, styles) => styles.root
14
+ overridesResolver: (_props, styles) => styles.root
12
15
  })(({ theme }) => ({
13
16
  maxWidth: 800,
14
- marginBottom: theme.spacing(2)
17
+ marginBottom: theme.spacing(2),
18
+ [`& .${PREFIX}-contrast-color`]: {
19
+ color: (0, material_1.getContrastRatio)(theme.palette.background.paper, theme.palette.common.white) > 4.5
20
+ ? (0, material_1.lighten)(theme.palette.common.white, 0.5)
21
+ : (0, material_1.darken)(theme.palette.common.white, 0.5)
22
+ }
15
23
  }));
16
24
  function ConfirmDialog(props) {
17
25
  // PROPS
@@ -37,6 +45,6 @@ function ConfirmDialog(props) {
37
45
  /**
38
46
  * Renders root object
39
47
  */
40
- return ((0, jsx_runtime_1.jsx)(Root, { children: (0, jsx_runtime_1.jsxs)(material_1.Dialog, Object.assign({ open: open, onClose: handleClose }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: title || (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.confirmDialog.title", defaultMessage: "ui.confirmDialog.title" }) }), content && ((0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, Object.assign({ component: "div" }, { children: content })) })), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleClose }, { children: btnCancel || (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.confirmDialog.btnCancel", defaultMessage: "ui.confirmDialog.btnCancel" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleConfirm, variant: "contained", autoFocus: true, loading: isUpdating }, { children: btnConfirm || (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.confirmDialog.btnConfirm", defaultMessage: "ui.confirmDialog.btnConfirm" }) }))] })] })) }));
48
+ return ((0, jsx_runtime_1.jsx)(Root, { children: (0, jsx_runtime_1.jsxs)(material_1.Dialog, Object.assign({ open: open, onClose: handleClose }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, Object.assign({ className: classes.contrastColor }, { children: title || (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.confirmDialog.title", defaultMessage: "ui.confirmDialog.title" }) })), content && ((0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, Object.assign({ component: "div", className: classes.contrastColor }, { children: content })) })), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleClose, className: classes.contrastColor }, { children: btnCancel || (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.confirmDialog.btnCancel", defaultMessage: "ui.confirmDialog.btnCancel" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleConfirm, variant: "contained", autoFocus: true, loading: isUpdating, className: classes.contrastColor }, { children: btnConfirm || (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.confirmDialog.btnConfirm", defaultMessage: "ui.confirmDialog.btnConfirm" }) }))] })] })) }));
41
49
  }
42
50
  exports.default = ConfirmDialog;
@@ -9,7 +9,11 @@ const api_services_1 = require("@selfcommunity/api-services");
9
9
  const utils_1 = require("@selfcommunity/utils");
10
10
  const Errors_1 = require("../../constants/Errors");
11
11
  const notistack_1 = require("notistack");
12
+ const constants_1 = require("./constants");
12
13
  const OPTIONS = ['ui.editCourse.tab.users.table.select.joined', 'ui.editCourse.tab.users.table.select.manager'];
14
+ const classes = {
15
+ contrastColor: `${constants_1.PREFIX}-contrast-color`
16
+ };
13
17
  function ChangeUserStatus(props) {
14
18
  // PROPS
15
19
  const { course, user } = props;
@@ -52,6 +56,6 @@ function ChangeUserStatus(props) {
52
56
  ':hover': {
53
57
  backgroundColor: 'unset'
54
58
  }
55
- } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: option, defaultMessage: option }) })) })) }), i))) })));
59
+ } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: option, defaultMessage: option }) })) })) }), i))) })));
56
60
  }
57
61
  exports.default = (0, react_1.memo)(ChangeUserStatus);
@@ -30,7 +30,8 @@ const classes = {
30
30
  avatarWrapper: `${constants_1.PREFIX}-avatar-wrapper`,
31
31
  progressWrapper: `${constants_1.PREFIX}-progress-wrapper`,
32
32
  progress: `${constants_1.PREFIX}-progress`,
33
- loadingButton: `${constants_1.PREFIX}-loading-button`
33
+ loadingButton: `${constants_1.PREFIX}-loading-button`,
34
+ contrastColor: `${constants_1.PREFIX}-contrast-color`
34
35
  };
35
36
  const Root = (0, material_1.styled)(material_1.Box, {
36
37
  name: constants_1.PREFIX,
@@ -147,10 +148,10 @@ function CourseUsersTable(inProps) {
147
148
  if (i === array.length - 1) {
148
149
  return (0, jsx_runtime_1.jsx)(material_1.TableCell, { width: "14%" }, i);
149
150
  }
150
- 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));
151
+ 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", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i));
151
152
  }) }) }), (0, jsx_runtime_1.jsxs)(material_1.TableBody, { children: [users.length > 0 &&
152
- 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 &&
153
+ 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", className: classes.contrastColor }, { 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", className: classes.contrastColor }, { 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", className: classes.contrastColor }, { 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", className: classes.contrastColor }, { 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", className: classes.contrastColor }, { 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 &&
153
154
  user.join_status !== types_1.SCCourseJoinStatusType.CREATOR &&
154
- scUserContext.user.id !== user.id ? ((0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsx)(RemoveButton_1.default, { ref: buttonRef, 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: buttonRef, 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)(material_1.Button, Object.assign({ size: "small", variant: "outlined", color: "inherit", loading: state.isLoadingNext, disabled: value.length > 0 || !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 && ((0, jsx_runtime_1.jsx)(EmptyStatus_1.default, { icon: "face", title: value.length > 0 ? 'ui.courseUsersTable.empty.search.title' : emptyStatusTitle, description: value.length > 0 ? 'ui.courseUsersTable.empty.search.description' : emptyStatusDescription })), dialog && (0, jsx_runtime_1.jsx)(ConfirmDialog_1.default, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleConfirm })] })));
155
+ scUserContext.user.id !== user.id ? ((0, jsx_runtime_1.jsx)(material_1.TableCell, { children: (0, jsx_runtime_1.jsx)(RemoveButton_1.default, { ref: buttonRef, 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: buttonRef, 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)(material_1.Button, Object.assign({ size: "small", variant: "contained", color: "inherit", loading: state.isLoadingNext, disabled: value.length > 0 || !state.next, className: classes.loadingButton, onClick: handleNext }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseUsersTable.btn.label", defaultMessage: "ui.courseUsersTable.btn.label" }) })) }))), users.length === 0 && ((0, jsx_runtime_1.jsx)(EmptyStatus_1.default, { icon: "face", title: value.length > 0 ? 'ui.courseUsersTable.empty.search.title' : emptyStatusTitle, description: value.length > 0 ? 'ui.courseUsersTable.empty.search.description' : emptyStatusDescription })), dialog && (0, jsx_runtime_1.jsx)(ConfirmDialog_1.default, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleConfirm })] })));
155
156
  }
156
157
  exports.default = (0, react_1.memo)(CourseUsersTable);
@@ -45,6 +45,6 @@ function RemoveButton(props, ref) {
45
45
  (0, react_1.useImperativeHandle)(ref, () => ({
46
46
  handleManageUser: (userToRemove) => handleSubmit(userToRemove)
47
47
  }), [handleSubmit]);
48
- return ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", color: "inherit", variant: "outlined", onClick: () => handleOpenDialog({ tab: course_1.SCCourseEditTabType.USERS, user }), loading: loading, disabled: loading }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) })));
48
+ return ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", color: "inherit", variant: "contained", onClick: () => handleOpenDialog({ tab: course_1.SCCourseEditTabType.USERS, user }), loading: loading, disabled: loading }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) })));
49
49
  }
50
50
  exports.default = (0, react_1.memo)((0, react_1.forwardRef)(RemoveButton));
@@ -73,6 +73,6 @@ function RequestButton(props, ref) {
73
73
  (0, react_1.useImperativeHandle)(ref, () => ({
74
74
  handleManageUser: (userToReject) => handleReject(userToReject)
75
75
  }), [handleReject]);
76
- return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.requestButtonWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", color: "primary", variant: "outlined", onClick: handleAccept, loading: acceptLoading, disabled: acceptLoading }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "check" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", color: "inherit", variant: "outlined", onClick: () => handleOpenDialog({ tab: course_1.SCCourseEditTabType.REQUESTS, request: user }), loading: rejectLoading, disabled: rejectLoading }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })));
76
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.requestButtonWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", color: "primary", variant: "contained", onClick: handleAccept, loading: acceptLoading, disabled: acceptLoading }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "check" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", color: "inherit", variant: "contained", onClick: () => handleOpenDialog({ tab: course_1.SCCourseEditTabType.REQUESTS, request: user }), loading: rejectLoading, disabled: rejectLoading }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })));
77
77
  }
78
78
  exports.default = (0, react_1.memo)((0, react_1.forwardRef)(RequestButton));
@@ -19,7 +19,8 @@ const classes = {
19
19
  infoOuterWrapper: `${constants_1.PREFIX}-info-outer-wrapper`,
20
20
  infoInnerWrapper: `${constants_1.PREFIX}-info-inner-wrapper`,
21
21
  avatarWrapper: `${constants_1.PREFIX}-avatar-wrapper`,
22
- avatar: `${constants_1.PREFIX}-avatar`
22
+ avatar: `${constants_1.PREFIX}-avatar`,
23
+ contrastColor: `${constants_1.PREFIX}-contrast-color`
23
24
  };
24
25
  const DialogRoot = (0, material_1.styled)(BaseDialog_1.default, {
25
26
  name: constants_1.PREFIX,
@@ -38,6 +39,7 @@ function SeeProgressButton(props) {
38
39
  // HOOKS
39
40
  const theme = (0, material_1.useTheme)();
40
41
  const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
42
+ const intl = (0, react_intl_1.useIntl)();
41
43
  const privateMessagingEnabled = (0, react_1.useMemo)(() => react_core_1.SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED in preferences && preferences[react_core_1.SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED].value, [preferences]);
42
44
  // EFFECTS
43
45
  (0, react_1.useEffect)(() => {
@@ -51,8 +53,8 @@ function SeeProgressButton(props) {
51
53
  const handleToggleOpen = (0, react_1.useCallback)(() => {
52
54
  setOpen((prev) => !prev);
53
55
  }, [setOpen]);
54
- return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [isMobile ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "small", color: "inherit", onClick: handleToggleOpen }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "chevron_right" }) }))) : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", color: "inherit", onClick: handleToggleOpen }, { 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.action.btn.label", defaultMessage: "ui.courseUsersTable.action.btn.label" }) })) }))), open && ((0, jsx_runtime_1.jsx)(DialogRoot, Object.assign({ DialogContentProps: { dividers: isMobile }, open: true, scroll: "paper", onClose: handleToggleOpen, title: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseUsersTable.dialog.title", defaultMessage: "ui.courseUsersTable.dialog.title" }) })), className: classes.dialogRoot }, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.contentWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.infoOuterWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.infoInnerWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.avatarWrapper }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!course.created_by.deleted && {
56
+ return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [isMobile ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "small", color: "inherit", onClick: handleToggleOpen }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "chevron_right" }) }))) : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "contained", size: "small", color: "inherit", onClick: handleToggleOpen }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseUsersTable.action.btn.label", defaultMessage: "ui.courseUsersTable.action.btn.label" }) })) }))), open && ((0, jsx_runtime_1.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: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.contentWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.infoOuterWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.infoInnerWrapper }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.avatarWrapper }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!course.created_by.deleted && {
55
57
  to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, course.created_by)
56
- }), { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !course.created_by.community_badge, smaller: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { className: classes.avatar, src: user.avatar, alt: user.username }) })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: user.username }))] })), privateMessagingEnabled && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, user), variant: "outlined", size: "small", color: "inherit" }, { 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.dialog.btn.label", defaultMessage: "ui.courseUsersTable.dialog.btn.label" }) })) })))] })), student ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text1", defaultMessage: "ui.courseUsersTable.dialog.info.text1", values: { lessonsCompleted: student.num_lessons_completed } }) }))) : ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" })), student ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text2", defaultMessage: "ui.courseUsersTable.dialog.info.text2", values: { courseCompleted: student.user_completion_rate } }) }))) : ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" }))] })), (0, jsx_runtime_1.jsx)(AccordionLessons_1.default, { course: student, viewerJoinStatus: course.join_status })] })) })))] }));
58
+ }), { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !course.created_by.community_badge, smaller: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { className: classes.avatar, src: user.avatar, alt: user.username }) })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: user.username }))] })), privateMessagingEnabled && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, user), variant: "contained", size: "small", color: "inherit" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseUsersTable.dialog.btn.label", defaultMessage: "ui.courseUsersTable.dialog.btn.label" }) })) })))] })), student ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text1", defaultMessage: "ui.courseUsersTable.dialog.info.text1", values: { lessonsCompleted: student.num_lessons_completed } }) }))) : ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" })), student ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text2", defaultMessage: "ui.courseUsersTable.dialog.info.text2", values: { courseCompleted: student.user_completion_rate } }) }))) : ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" }))] })), (0, jsx_runtime_1.jsx)(AccordionLessons_1.default, { course: student, viewerJoinStatus: course.join_status })] })) })))] }));
57
59
  }
58
60
  exports.default = (0, react_1.memo)(SeeProgressButton);
@@ -11,7 +11,8 @@ const classes = {
11
11
  root: `${PREFIX}-root`,
12
12
  box: `${PREFIX}-box`,
13
13
  rotatedBox: `${PREFIX}-rotated-box`,
14
- icon: `${PREFIX}-icon`
14
+ icon: `${PREFIX}-icon`,
15
+ contrastColor: `${PREFIX}-contrast-color`
15
16
  };
16
17
  const Root = (0, material_1.styled)(material_1.Stack, {
17
18
  name: PREFIX,
@@ -21,6 +22,6 @@ const Root = (0, material_1.styled)(material_1.Stack, {
21
22
  function EmptyStatus(props) {
22
23
  // PROPS
23
24
  const { icon, title, description, actions, className } = props;
24
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.box }, { children: (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.rotatedBox }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.icon, color: "disabled", fontSize: "large" }, { children: icon })) })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: title, defaultMessage: title }) })), description && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: description, defaultMessage: description }) }))), actions] })));
25
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.box }, { children: (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.rotatedBox }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.icon, color: "disabled", fontSize: "large" }, { children: icon })) })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: title, defaultMessage: title }) })), description && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: description, defaultMessage: description }) }))), actions] })));
25
26
  }
26
27
  exports.default = (0, react_1.memo)(EmptyStatus);
@@ -21,7 +21,8 @@ const classes = {
21
21
  title: `${constants_1.PREFIX}-title`,
22
22
  subtitle: `${constants_1.PREFIX}-subtitle`,
23
23
  actionWrapper: `${constants_1.PREFIX}-action-wrapper`,
24
- action: `${constants_1.PREFIX}-action`
24
+ action: `${constants_1.PREFIX}-action`,
25
+ contrastColor: `${constants_1.PREFIX}-contrast-color`
25
26
  };
26
27
  const Root = (0, material_1.styled)(material_1.Stack, {
27
28
  name: constants_1.PREFIX,
@@ -72,6 +73,6 @@ function DocComponent(props) {
72
73
  return fallback_1.default;
73
74
  }
74
75
  }, [document.mimetype]);
75
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.docRoot, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", alt: document.title, src: getImage() }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.textWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.title }, { children: document.title })), document.size && (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.subtitle }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "delete" }) }))), handleDownload && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [document.mimetype === types_1.SCMimeTypes.PDF && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, component: react_core_1.Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "download" }) }))] }))] })))] })));
76
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.docRoot, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", alt: document.title, src: getImage() }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.textWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.title, classes.contrastColor) }, { children: document.title })), document.size && (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: (0, classnames_1.default)(classes.subtitle, classes.contrastColor) }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "delete" }) }))), handleDownload && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [document.mimetype === types_1.SCMimeTypes.PDF && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, component: react_core_1.Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "download" }) }))] }))] })))] })));
76
77
  }
77
78
  exports.default = DocComponent;
@@ -1,15 +1,16 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { Fragment, useEffect, useState } from 'react';
3
+ import { useEffect, useState } from 'react';
4
4
  import { FormattedMessage } from 'react-intl';
5
5
  import parse from 'autosuggest-highlight/parse';
6
6
  import match from 'autosuggest-highlight/match';
7
- import { Autocomplete, Chip, TextField, Checkbox, CircularProgress, styled } from '@mui/material';
7
+ import { Autocomplete, Chip, TextField, Checkbox, CircularProgress, styled, Typography } from '@mui/material';
8
8
  import { useSCFetchCategories } from '@selfcommunity/react-core';
9
9
  import { useThemeProps } from '@mui/system';
10
- const PREFIX = 'SCCategoryAutocomplete';
10
+ import { PREFIX } from './constants';
11
11
  const classes = {
12
- root: `${PREFIX}-root`
12
+ root: `${PREFIX}-root`,
13
+ contrastColor: `${PREFIX}-contrast-color`
13
14
  };
14
15
  const Root = styled(Autocomplete, {
15
16
  name: PREFIX,
@@ -85,15 +86,15 @@ const CategoryAutocomplete = (inProps) => {
85
86
  if (multiple) {
86
87
  return value.map((option, index) => {
87
88
  const _a = getItemProps({ index }), { key } = _a, rest = __rest(_a, ["key"]);
88
- return _jsx(Chip, Object.assign({ id: option.id, label: option.name, color: option.color }, rest), key);
89
+ return (_jsx(Chip, Object.assign({ id: option.id, label: _jsx(Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: option.name })), color: option.color }, rest), key));
89
90
  });
90
91
  }
91
- return _jsx(Chip, Object.assign({ id: value.id, label: value.name, color: value.color }, getItemProps));
92
+ return (_jsx(Chip, Object.assign({ id: value.id, label: _jsx(Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: value.name })), color: value.color }, getItemProps)));
92
93
  }, renderOption: (props, option, { selected, inputValue }) => {
93
94
  const { key } = props, rest = __rest(props, ["key"]);
94
95
  const matches = match(option.name, inputValue);
95
96
  const parts = parse(option.name, matches);
96
- return (_jsxs("li", Object.assign({}, rest, { children: [checkboxSelect && _jsx(Checkbox, { style: { marginRight: 8 }, checked: selected }), _jsx(Chip, { label: _jsx(Fragment, { children: parts.map((part, index) => (_jsx("span", Object.assign({ style: { fontWeight: part.highlight ? 700 : 400 } }, { children: part.text }), index))) }) })] }), key));
97
+ return (_jsxs("li", Object.assign({}, rest, { children: [checkboxSelect && _jsx(Checkbox, { style: { marginRight: 8 }, checked: selected }), _jsx(Chip, { label: parts.map((part, index) => (_jsx(Typography, Object.assign({ component: "span", style: { fontWeight: part.highlight ? 700 : 400 } }, { children: part.text }), index))) })] }), key));
97
98
  }, renderInput: (params) => {
98
99
  return (_jsx(TextField, Object.assign({}, params, TextFieldProps, { margin: "dense", slotProps: {
99
100
  input: Object.assign(Object.assign({}, params.InputProps), { autoComplete: 'categories', endAdornment: (_jsxs(_Fragment, { children: [isLoading ? _jsx(CircularProgress, { color: "inherit", size: 20 }) : null, params.InputProps.endAdornment] })) })
@@ -0,0 +1 @@
1
+ export declare const PREFIX = "SCCategoryAutocomplete";
@@ -0,0 +1 @@
1
+ export const PREFIX = 'SCCategoryAutocomplete';
@@ -5,13 +5,15 @@ import { FormattedMessage, useIntl } from 'react-intl';
5
5
  import clapping from '../../assets/courses/clapping';
6
6
  import { memo } from 'react';
7
7
  import { Link, SCRoutes, useSCRouting } from '@selfcommunity/react-core';
8
- const PREFIX = 'SCCourseCompletedDialog';
8
+ import { PREFIX } from './constants';
9
+ import classNames from 'classnames';
9
10
  const classes = {
10
11
  root: `${PREFIX}-root`,
11
12
  wrapper: `${PREFIX}-wrapper`,
12
13
  title: `${PREFIX}-title`,
13
14
  descriptionPt1: `${PREFIX}-description-pt1`,
14
- descriptionPt2: `${PREFIX}-description-pt2`
15
+ descriptionPt2: `${PREFIX}-description-pt2`,
16
+ contrastColor: `${PREFIX}-contrast-color`
15
17
  };
16
18
  const Root = styled(BaseDialog, {
17
19
  name: PREFIX,
@@ -29,7 +31,7 @@ function CourseCompletedDialog(inProps) {
29
31
  const scRoutingContext = useSCRouting();
30
32
  // HOOKS
31
33
  const intl = useIntl();
32
- return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, open: true, onClose: onClose, actions: _jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSES_ROUTE_NAME, {}), size: "medium", variant: "contained" }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.course.completedDialog.btn.label", defaultMessage: "ui.course.completedDialog.btn.label" }) })) })), className: classes.root }, { children: _jsxs(Stack, Object.assign({ className: classes.wrapper }, { children: [_jsx("img", { src: clapping, alt: intl.formatMessage({ id: 'ui.course.completedDialog.title', defaultMessage: 'ui.course.completedDialog.title' }), width: 100, height: 100 }), _jsx(Typography, Object.assign({ variant: "h2", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.course.completedDialog.title", defaultMessage: "ui.course.completedDialog.title" }) })), _jsx(Typography, Object.assign({ variant: "h4", className: classes.descriptionPt1 }, { children: _jsx(FormattedMessage, { id: "ui.course.completedDialog.description.pt1", defaultMessage: "ui.course.completedDialog.description.pt1" }) })), _jsx(Typography, Object.assign({ variant: "h4", className: classes.descriptionPt2 }, { children: intl.formatMessage({ id: 'ui.course.completedDialog.description.pt2', defaultMessage: 'ui.course.completedDialog.description.pt2' }, {
34
+ return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, open: true, onClose: onClose, actions: _jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSES_ROUTE_NAME, {}), size: "medium", variant: "contained" }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.completedDialog.btn.label", defaultMessage: "ui.course.completedDialog.btn.label" }) })) })), className: classes.root }, { children: _jsxs(Stack, Object.assign({ className: classes.wrapper }, { children: [_jsx("img", { src: clapping, alt: intl.formatMessage({ id: 'ui.course.completedDialog.title', defaultMessage: 'ui.course.completedDialog.title' }), width: 100, height: 100 }), _jsx(Typography, Object.assign({ variant: "h2", className: classNames(classes.title, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.completedDialog.title", defaultMessage: "ui.course.completedDialog.title" }) })), _jsx(Typography, Object.assign({ variant: "h4", className: classNames(classes.descriptionPt1, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.completedDialog.description.pt1", defaultMessage: "ui.course.completedDialog.description.pt1" }) })), _jsx(Typography, Object.assign({ variant: "h4", className: classNames(classes.descriptionPt2, classes.contrastColor) }, { children: intl.formatMessage({ id: 'ui.course.completedDialog.description.pt2', defaultMessage: 'ui.course.completedDialog.description.pt2' }, {
33
35
  courseName: course.name,
34
36
  span: (chunks) => (_jsx(Typography, Object.assign({ component: "span", variant: "inherit", color: "primary" }, { children: chunks }), "ui.course.completedDialog.description.pt2.span"))
35
37
  }) }))] })) })));
@@ -0,0 +1 @@
1
+ export declare const PREFIX = "SCCourseCompletedDialog";
@@ -0,0 +1 @@
1
+ export const PREFIX = 'SCCourseCompletedDialog';
@@ -18,7 +18,7 @@ const classes = {
18
18
  const Root = styled(Box, {
19
19
  name: PREFIX,
20
20
  slot: 'Root',
21
- overridesResolver: (props, styles) => [styles.root]
21
+ overridesResolver: (_props, styles) => [styles.root]
22
22
  })(() => ({}));
23
23
  export default function CourseContentMenu(inProps) {
24
24
  // PROPS
@@ -1,4 +1,4 @@
1
- import React, { HTMLAttributes } from 'react';
1
+ import { HTMLAttributes } from 'react';
2
2
  import { SCCourseType } from '@selfcommunity/types';
3
3
  export interface StudentCourseDashboardProps {
4
4
  courseId?: number;
@@ -7,5 +7,5 @@ export interface StudentCourseDashboardProps {
7
7
  [p: string]: any;
8
8
  }
9
9
  declare function Student(inProps: StudentCourseDashboardProps): import("react/jsx-runtime").JSX.Element;
10
- declare const _default: React.MemoExoticComponent<typeof Student>;
10
+ declare const _default: import("react").MemoExoticComponent<typeof Student>;
11
11
  export default _default;
@@ -170,7 +170,7 @@ function Student(inProps) {
170
170
  if (!scCourse) {
171
171
  return _jsx(Skeleton, { animation: "wave", variant: "rectangular", width: "130px", height: "20px" });
172
172
  }
173
- return (_jsxs(Stack, Object.assign({ className: classes.actionsWrapper }, { children: [(scCourse.join_status === SCCourseJoinStatusType.CREATOR || scCourse.join_status === SCCourseJoinStatusType.MANAGER) && (_jsx(ActionButton, { labelId: BUTTON_MESSAGES.dashboard, to: scRoutingContext.url(SCRoutes.COURSE_DASHBOARD_ROUTE_NAME, scCourse), color: "inherit", variant: "outlined" })), (((scCourse.privacy === SCCoursePrivacyType.PRIVATE || scCourse.privacy === SCCoursePrivacyType.SECRET) &&
173
+ return (_jsxs(Stack, Object.assign({ className: classes.actionsWrapper }, { children: [(scCourse.join_status === SCCourseJoinStatusType.CREATOR || scCourse.join_status === SCCourseJoinStatusType.MANAGER) && (_jsx(ActionButton, { labelId: BUTTON_MESSAGES.dashboard, to: scRoutingContext.url(SCRoutes.COURSE_DASHBOARD_ROUTE_NAME, scCourse), color: "inherit", variant: "contained" })), (((scCourse.privacy === SCCoursePrivacyType.PRIVATE || scCourse.privacy === SCCoursePrivacyType.SECRET) &&
174
174
  (scCourse.join_status === SCCourseJoinStatusType.MANAGER || scCourse.join_status === SCCourseJoinStatusType.JOINED)) ||
175
175
  (scCourse.privacy === SCCoursePrivacyType.OPEN && scCourse.join_status !== SCCourseJoinStatusType.CREATOR)) &&
176
176
  (!isPaymentsEnabled ||
@@ -183,8 +183,8 @@ function Student(inProps) {
183
183
  ? BUTTON_MESSAGES.start
184
184
  : scCourse.user_completion_rate === 100
185
185
  ? BUTTON_MESSAGES.review
186
- : BUTTON_MESSAGES.continue, to: scCourse.join_status !== null ? scRoutingContext.url(SCRoutes.COURSE_LESSON_ROUTE_NAME, getUrlNextLesson(scCourse)) : undefined, disabled: scCourse.join_status !== null ? getIsNextLessonLocked(scCourse) : undefined, color: scCourse.user_completion_rate === 100 ? 'inherit' : undefined, variant: scCourse.user_completion_rate === 100 ? 'outlined' : undefined, loading: scCourse.join_status === null ? loadingRequest : undefined, onClick: !scUserContext.user ? handleAnonymousAction : scCourse.join_status === null ? handleRequest : undefined })), scCourse.privacy === SCCoursePrivacyType.PRIVATE &&
187
- (scCourse.join_status === null || scCourse.join_status === SCCourseJoinStatusType.REQUESTED) ? (_jsx(ActionButton, { labelId: sentRequest ? BUTTON_MESSAGES.cancel : BUTTON_MESSAGES.request, color: "inherit", variant: "outlined", loading: loadingRequest, onClick: handleRequest })) : (isPaymentsEnabled &&
186
+ : BUTTON_MESSAGES.continue, to: scCourse.join_status !== null ? scRoutingContext.url(SCRoutes.COURSE_LESSON_ROUTE_NAME, getUrlNextLesson(scCourse)) : undefined, disabled: scCourse.join_status !== null ? getIsNextLessonLocked(scCourse) : undefined, color: scCourse.user_completion_rate === 100 ? 'inherit' : undefined, variant: scCourse.user_completion_rate === 100 ? 'contained' : undefined, loading: scCourse.join_status === null ? loadingRequest : undefined, onClick: !scUserContext.user ? handleAnonymousAction : scCourse.join_status === null ? handleRequest : undefined })), scCourse.privacy === SCCoursePrivacyType.PRIVATE &&
187
+ (scCourse.join_status === null || scCourse.join_status === SCCourseJoinStatusType.REQUESTED) ? (_jsx(ActionButton, { labelId: sentRequest ? BUTTON_MESSAGES.cancel : BUTTON_MESSAGES.request, color: "inherit", variant: "contained", loading: loadingRequest, onClick: handleRequest })) : (isPaymentsEnabled &&
188
188
  ((_c = scCourse.paywalls) === null || _c === void 0 ? void 0 : _c.length) > 0 &&
189
189
  !(scCourse.join_status === SCCourseJoinStatusType.CREATOR) && _jsx(BuyButton, { contentType: SCContentType.COURSE, content: scCourse }))] })));
190
190
  }, [scCourse, sentRequest, loadingRequest, handleRequest]);
@@ -201,11 +201,11 @@ function Student(inProps) {
201
201
  scCourse.join_status === SCCourseJoinStatusType.JOINED)) ||
202
202
  scCourse.privacy === SCCoursePrivacyType.OPEN ||
203
203
  scCourse.privacy === SCCoursePrivacyType.DRAFT) &&
204
- scCourse.description && (_jsxs(Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classNames(classes.margin, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.description", defaultMessage: "ui.course.dashboard.student.description" }) })), _jsx(Stack, Object.assign({ className: classes.box }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.description }, { children: scCourse.description })) }))] })), (((scCourse.privacy === SCCoursePrivacyType.PRIVATE || scCourse.privacy === SCCoursePrivacyType.SECRET) &&
204
+ scCourse.description && (_jsxs(Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classNames(classes.margin, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.description", defaultMessage: "ui.course.dashboard.student.description" }) })), _jsx(Stack, Object.assign({ className: classes.box }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classNames(classes.description, classes.contrastColor) }, { children: scCourse.description })) }))] })), (((scCourse.privacy === SCCoursePrivacyType.PRIVATE || scCourse.privacy === SCCoursePrivacyType.SECRET) &&
205
205
  (scCourse.join_status === SCCourseJoinStatusType.MANAGER || scCourse.join_status === SCCourseJoinStatusType.JOINED)) ||
206
- (scCourse.privacy === SCCoursePrivacyType.OPEN && scCourse.join_status !== SCCourseJoinStatusType.CREATOR)) && (_jsxs(Fragment, { children: [scCourse.join_status !== null && (_jsxs(Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classNames(classes.margin, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.progress", defaultMessage: "ui.course.dashboard.student.progress" }) })), _jsxs(Stack, Object.assign({ className: classes.box }, { children: [_jsxs(Stack, Object.assign({ className: classes.percentageWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.progress.described", defaultMessage: "ui.course.dashboard.student.progress.described", values: { progress: scCourse.num_lessons_completed, end: scCourse.num_lessons } }) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.progress.percentage", defaultMessage: "ui.course.dashboard.student.progress.percentage", values: { percentage: scCourse.user_completion_rate } }) }))] })), _jsx(LinearProgress, { className: classes.progress, variant: "determinate", value: scCourse.user_completion_rate })] }))] })), scCourse.user_completion_rate === 100 && (_jsxs(Stack, Object.assign({ className: classNames(classes.completedWrapper, classes.margin) }, { children: [_jsx(Typography, Object.assign({ variant: "h3", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.completed", defaultMessage: "ui.course.dashboard.student.completed" }) })), _jsx("img", { src: clapping, alt: intl.formatMessage({ id: 'ui.course.dashboard.student.completed', defaultMessage: 'ui.course.dashboard.student.completed' }), width: 32, height: 32 })] }))), _jsx(Typography, Object.assign({ variant: "h6", className: classNames(classes.margin, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.contents", defaultMessage: "ui.course.dashboard.student.contents" }) })), _jsxs(Stack, Object.assign({ className: classes.lessonsSections }, { children: [_jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.course.table.sections.title", defaultMessage: "ui.course.table.sections.title", values: {
206
+ (scCourse.privacy === SCCoursePrivacyType.OPEN && scCourse.join_status !== SCCourseJoinStatusType.CREATOR)) && (_jsxs(Fragment, { children: [scCourse.join_status !== null && (_jsxs(Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classNames(classes.margin, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.progress", defaultMessage: "ui.course.dashboard.student.progress" }) })), _jsxs(Stack, Object.assign({ className: classes.box }, { children: [_jsxs(Stack, Object.assign({ className: classes.percentageWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.progress.described", defaultMessage: "ui.course.dashboard.student.progress.described", values: { progress: scCourse.num_lessons_completed, end: scCourse.num_lessons } }) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.progress.percentage", defaultMessage: "ui.course.dashboard.student.progress.percentage", values: { percentage: scCourse.user_completion_rate } }) }))] })), _jsx(LinearProgress, { className: classes.progress, variant: "determinate", value: scCourse.user_completion_rate })] }))] })), scCourse.user_completion_rate === 100 && (_jsxs(Stack, Object.assign({ className: classNames(classes.completedWrapper, classes.margin) }, { children: [_jsx(Typography, Object.assign({ variant: "h3", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.completed", defaultMessage: "ui.course.dashboard.student.completed" }) })), _jsx("img", { src: clapping, alt: intl.formatMessage({ id: 'ui.course.dashboard.student.completed', defaultMessage: 'ui.course.dashboard.student.completed' }), width: 32, height: 32 })] }))), _jsx(Typography, Object.assign({ variant: "h6", className: classNames(classes.margin, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.student.contents", defaultMessage: "ui.course.dashboard.student.contents" }) })), _jsxs(Stack, Object.assign({ className: classes.lessonsSections }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.table.sections.title", defaultMessage: "ui.course.table.sections.title", values: {
207
207
  sectionsNumber: scCourse.num_sections
208
- } }) })), _jsx(Box, { className: classes.circle }), _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
208
+ } }) })), _jsx(Box, { className: classes.circle }), _jsx(Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
209
209
  lessonsNumber: scCourse.num_lessons
210
210
  } }) }))] })), _jsx(AccordionLessons, { course: scCourse, className: classes.accordion })] }))] })));
211
211
  }