@selfcommunity/react-ui 1.2.0-alpha.3 → 1.2.0-alpha.5

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 +6 -5
  2. package/lib/cjs/components/CourseDashboard/Header.d.ts +2 -2
  3. package/lib/cjs/components/CourseDashboard/Header.js +4 -10
  4. package/lib/cjs/components/CourseDashboard/Student/ActionButton.js +6 -2
  5. package/lib/cjs/components/CourseDashboard/Student.js +6 -5
  6. package/lib/cjs/components/CourseDashboard/Teacher/Comments.js +3 -3
  7. package/lib/cjs/components/CourseDashboard/Teacher/Info.js +2 -2
  8. package/lib/cjs/components/CourseDashboard/Teacher.js +2 -2
  9. package/lib/cjs/components/CourseForm/CourseForm.js +11 -6
  10. package/lib/cjs/components/CourseForm/Edit.js +4 -4
  11. package/lib/cjs/components/CourseParticipantsButton/CourseParticipantsButton.js +3 -2
  12. package/lib/cjs/components/EditCourse/EditCourse.js +2 -2
  13. package/lib/cjs/components/EditCourse/Lessons/ChangeLessonStatus.js +10 -5
  14. package/lib/cjs/components/EditCourse/Lessons/FieldName.js +2 -2
  15. package/lib/cjs/components/EditCourse/Lessons/LessonRow.js +3 -3
  16. package/lib/cjs/components/EditCourse/Lessons/SectionRow.js +3 -3
  17. package/lib/cjs/components/EditCourse/Lessons.js +5 -4
  18. package/lib/cjs/components/EditCourse/Options/Skeleton.js +2 -2
  19. package/lib/cjs/components/EditCourse/Options/SwitchForm.js +2 -2
  20. package/lib/cjs/components/EditCourse/Options.js +2 -2
  21. package/lib/cjs/components/EditCourse/Status.js +3 -5
  22. package/lib/cjs/components/EditCourse/Users.js +2 -2
  23. package/lib/cjs/components/FeedObject/Contributors/Contributors.js +1 -1
  24. package/lib/cjs/components/PaywallsConfigurator/PaywallsConfigurator.js +1 -1
  25. package/lib/cjs/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +2 -1
  26. package/lib/cjs/components/User/User.js +2 -2
  27. package/lib/cjs/shared/AccordionLessons/AccordionLessons.js +4 -4
  28. package/lib/cjs/shared/AddUsersButton/AddUsersButton.js +14 -6
  29. package/lib/cjs/shared/ConfirmDialog/ConfirmDialog.js +11 -7
  30. package/lib/cjs/shared/CourseUsersTable/ChangeUsersStatus.js +3 -5
  31. package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.js +6 -4
  32. package/lib/cjs/shared/CourseUsersTable/SeeProgressButton.js +4 -3
  33. package/lib/cjs/types/course.d.ts +5 -0
  34. package/lib/cjs/utils/course.d.ts +2 -1
  35. package/lib/cjs/utils/course.js +9 -1
  36. package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +7 -6
  37. package/lib/esm/components/CourseDashboard/Header.d.ts +2 -2
  38. package/lib/esm/components/CourseDashboard/Header.js +4 -10
  39. package/lib/esm/components/CourseDashboard/Student/ActionButton.js +6 -2
  40. package/lib/esm/components/CourseDashboard/Student.js +6 -5
  41. package/lib/esm/components/CourseDashboard/Teacher/Comments.js +3 -3
  42. package/lib/esm/components/CourseDashboard/Teacher/Info.js +2 -2
  43. package/lib/esm/components/CourseDashboard/Teacher.js +2 -2
  44. package/lib/esm/components/CourseForm/CourseForm.js +12 -7
  45. package/lib/esm/components/CourseForm/Edit.js +4 -4
  46. package/lib/esm/components/CourseParticipantsButton/CourseParticipantsButton.js +3 -2
  47. package/lib/esm/components/EditCourse/EditCourse.js +2 -2
  48. package/lib/esm/components/EditCourse/Lessons/ChangeLessonStatus.js +10 -5
  49. package/lib/esm/components/EditCourse/Lessons/FieldName.js +2 -2
  50. package/lib/esm/components/EditCourse/Lessons/LessonRow.js +4 -4
  51. package/lib/esm/components/EditCourse/Lessons/SectionRow.js +4 -4
  52. package/lib/esm/components/EditCourse/Lessons.js +5 -4
  53. package/lib/esm/components/EditCourse/Options/Skeleton.js +3 -3
  54. package/lib/esm/components/EditCourse/Options/SwitchForm.js +2 -2
  55. package/lib/esm/components/EditCourse/Options.js +2 -2
  56. package/lib/esm/components/EditCourse/Status.js +3 -4
  57. package/lib/esm/components/EditCourse/Users.js +2 -2
  58. package/lib/esm/components/FeedObject/Contributors/Contributors.js +1 -1
  59. package/lib/esm/components/PaywallsConfigurator/PaywallsConfigurator.js +1 -1
  60. package/lib/esm/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +2 -1
  61. package/lib/esm/components/User/User.js +3 -3
  62. package/lib/esm/shared/AccordionLessons/AccordionLessons.js +4 -4
  63. package/lib/esm/shared/AddUsersButton/AddUsersButton.js +15 -7
  64. package/lib/esm/shared/ConfirmDialog/ConfirmDialog.js +12 -8
  65. package/lib/esm/shared/CourseUsersTable/ChangeUsersStatus.js +4 -6
  66. package/lib/esm/shared/CourseUsersTable/CourseUsersTable.js +7 -5
  67. package/lib/esm/shared/CourseUsersTable/SeeProgressButton.js +4 -3
  68. package/lib/esm/types/course.d.ts +5 -0
  69. package/lib/esm/utils/course.d.ts +2 -1
  70. package/lib/esm/utils/course.js +7 -0
  71. package/lib/umd/react-ui.js +1 -1
  72. package/package.json +5 -5
@@ -35,7 +35,8 @@ const classes = {
35
35
  cellAlignCenter: `${PREFIX}-cell-align-center`,
36
36
  lessonEmptyStatus: `${PREFIX}-lesson-empty-status`,
37
37
  emptyStatusButton: `${PREFIX}-empty-status-button`,
38
- contrastColor: `${PREFIX}-contrast-color`
38
+ defaultContrastColor: `${PREFIX}-default-contrast-color`,
39
+ paperContrastColor: `${PREFIX}-paper-contrast-color`
39
40
  };
40
41
  function Lessons(props) {
41
42
  // PROPS
@@ -184,10 +185,10 @@ function Lessons(props) {
184
185
  }
185
186
  handleOpenDialog(null);
186
187
  }, [dialog, handleOpenDialog]);
187
- return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ className: classNames(classes.lessonTitle, classes.contrastColor), variant: "h4" }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons", defaultMessage: "ui.editCourse.tab.lessons" }) })), _jsxs(Stack, Object.assign({ className: classes.lessonInfoWrapper }, { children: [_jsx(CourseTypePopover, { course: course }), _jsx(Status, { course: course, handleTabChange: handleTabChange })] })), sections.length === 0 && (_jsx(EmptyStatus, { icon: "courses", title: "ui.editCourse.tab.lessons.table.empty.title", description: "ui.editCourse.tab.lessons.table.empty.description", actions: _jsx(AddButton, { className: classes.emptyStatusButton, label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "inherit", variant: "outlined" }), className: classes.lessonEmptyStatus })), sections.length > 0 && (_jsxs(Box, Object.assign({ className: classes.lessonsInnerWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.lessonsSectionsWrapper }, { children: [_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: {
188
+ return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ className: classNames(classes.lessonTitle, classes.defaultContrastColor), variant: "h4" }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons", defaultMessage: "ui.editCourse.tab.lessons" }) })), _jsxs(Stack, Object.assign({ className: classes.lessonInfoWrapper }, { children: [_jsx(CourseTypePopover, { course: course }), _jsx(Status, { course: course, handleTabChange: handleTabChange })] })), sections.length === 0 && (_jsx(EmptyStatus, { icon: "courses", title: "ui.editCourse.tab.lessons.table.empty.title", description: "ui.editCourse.tab.lessons.table.empty.description", actions: _jsx(AddButton, { className: classes.emptyStatusButton, label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "inherit", variant: "outlined" }), className: classes.lessonEmptyStatus })), sections.length > 0 && (_jsxs(Box, Object.assign({ className: classes.lessonsInnerWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.lessonsSectionsWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.lessonsSections }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.table.sections.title", defaultMessage: "ui.course.table.sections.title", values: {
188
189
  sectionsNumber: course.num_sections
189
- } }) })), _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: {
190
+ } }) })), _jsx(Box, { className: classes.circle }), _jsx(Typography, Object.assign({ variant: "h5", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
190
191
  lessonsNumber: course.num_lessons
191
- } }) }))] })), _jsx(AddButton, { label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "primary", variant: "contained", disabled: isDisabled })] })), _jsx(DragDropContext, Object.assign({ onDragEnd: handleDragEnd }, { children: _jsx(TableContainer, Object.assign({ className: classes.tableContainer }, { children: _jsxs(Table, Object.assign({ className: classes.table }, { children: [_jsx(TableHead, Object.assign({ className: classes.tableHeader }, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { className: classes.cellWidth }), headerCells.map((cell, i) => (_jsx(TableCell, Object.assign({ className: cell.className }, { children: _jsx(Typography, Object.assign({ className: classNames(classes.tableHeaderTypography, classes.contrastColor), variant: "overline" }, { children: _jsx(FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i)))] }) })), _jsx(Droppable, Object.assign({ droppableId: "droppable-1" }, { children: (outerProvider) => (_jsxs(TableBody, Object.assign({ ref: outerProvider.innerRef }, outerProvider.droppableProps, { className: classes.tableBody }, { children: [sections.map((section, i, array) => (_jsx(Draggable, Object.assign({ draggableId: i.toString(), index: i, isDragDisabled: isDisabled }, { children: (innerProvider) => (_jsx(SectionRow, { course: course, provider: innerProvider, section: section, isNewRow: isNewRow && i + 1 === array.length, handleManageSection: handleManageSection, handleOpenDialog: handleOpenDialog, ref: ref }, i)) }), i))), outerProvider.placeholder] }))) }))] })) })) })), dialog && _jsx(ConfirmDialog, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleDeleteRow })] })))] }));
192
+ } }) }))] })), _jsx(AddButton, { label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "primary", variant: "contained", disabled: isDisabled })] })), _jsx(DragDropContext, Object.assign({ onDragEnd: handleDragEnd }, { children: _jsx(TableContainer, Object.assign({ className: classes.tableContainer }, { children: _jsxs(Table, Object.assign({ className: classes.table }, { children: [_jsx(TableHead, Object.assign({ className: classes.tableHeader }, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { className: classes.cellWidth }), headerCells.map((cell, i) => (_jsx(TableCell, Object.assign({ className: cell.className }, { children: _jsx(Typography, Object.assign({ className: classNames(classes.tableHeaderTypography, classes.paperContrastColor), variant: "overline" }, { children: _jsx(FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i)))] }) })), _jsx(Droppable, Object.assign({ droppableId: "droppable-1" }, { children: (outerProvider) => (_jsxs(TableBody, Object.assign({ ref: outerProvider.innerRef }, outerProvider.droppableProps, { className: classes.tableBody }, { children: [sections.map((section, i, array) => (_jsx(Draggable, Object.assign({ draggableId: i.toString(), index: i, isDragDisabled: isDisabled }, { children: (innerProvider) => (_jsx(SectionRow, { course: course, provider: innerProvider, section: section, isNewRow: isNewRow && i + 1 === array.length, handleManageSection: handleManageSection, handleOpenDialog: handleOpenDialog, ref: ref }, i)) }), i))), outerProvider.placeholder] }))) }))] })) })) })), dialog && _jsx(ConfirmDialog, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleDeleteRow })] })))] }));
192
193
  }
193
194
  export default memo(Lessons);
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Divider, FormControl, FormControlLabel, FormLabel, Skeleton, Stack, Switch } from '@mui/material';
2
+ import { Box, Divider, FormControl, FormControlLabel, FormLabel, Skeleton, Stack, Switch } from '@mui/material';
3
3
  import { PREFIX } from '../constants';
4
- import { Fragment } from 'react';
5
4
  const classes = {
5
+ optionsContainer: `${PREFIX}-options-container`,
6
6
  optionsWrapper: `${PREFIX}-options-wrapper`,
7
7
  optionsDivider: `${PREFIX}-options-divider`,
8
8
  optionsButtonWrapper: `${PREFIX}-options-button-wrapper`
9
9
  };
10
10
  export default function OptionsSkeleton() {
11
- return (_jsxs(Fragment, { children: [_jsx(Stack, Object.assign({ className: classes.optionsWrapper }, { children: Array.from(Array(3)).map((_, i) => (_jsxs(FormControl, Object.assign({ component: "fieldset", variant: "standard" }, { children: [_jsx(FormLabel, Object.assign({ component: "legend" }, { children: _jsx(Skeleton, { animation: "wave", variant: "text", width: "52px", height: "21px" }) })), _jsx(FormControlLabel, { control: _jsx(Switch, {}), label: _jsx(Skeleton, { animation: "wave", variant: "text", width: "215px", height: "38px" }) })] }), i))) })), _jsx(Divider, { className: classes.optionsDivider }), _jsx(Stack, Object.assign({ className: classes.optionsButtonWrapper }, { children: _jsx(Skeleton, { animation: "wave", variant: "rounded", width: "133px", height: "33px" }) }))] }));
11
+ return (_jsxs(Box, Object.assign({ className: classes.optionsContainer }, { children: [_jsx(Stack, Object.assign({ className: classes.optionsWrapper }, { children: Array.from(Array(3)).map((_, i) => (_jsxs(FormControl, Object.assign({ component: "fieldset", variant: "standard" }, { children: [_jsx(FormLabel, Object.assign({ component: "legend" }, { children: _jsx(Skeleton, { animation: "wave", variant: "text", width: "52px", height: "21px" }) })), _jsx(FormControlLabel, { control: _jsx(Switch, {}), label: _jsx(Skeleton, { animation: "wave", variant: "text", width: "215px", height: "38px" }) })] }), i))) })), _jsx(Divider, { className: classes.optionsDivider }), _jsx(Stack, Object.assign({ className: classes.optionsButtonWrapper }, { children: _jsx(Skeleton, { animation: "wave", variant: "rounded", width: "133px", height: "33px" }) }))] })));
12
12
  }
@@ -4,7 +4,7 @@ import { memo, useCallback, useState } from 'react';
4
4
  import { FormattedMessage } from 'react-intl';
5
5
  import { PREFIX } from '../constants';
6
6
  const classes = {
7
- contrastColor: `${PREFIX}-contrast-color`
7
+ paperContrastColor: `${PREFIX}-paper-contrast-color`
8
8
  };
9
9
  function SwitchForm(props) {
10
10
  // PROPS
@@ -17,6 +17,6 @@ function SwitchForm(props) {
17
17
  setValue(_checked);
18
18
  handleChangeOptions(name, _checked);
19
19
  }, [setValue]);
20
- return (_jsxs(FormControl, Object.assign({ component: "fieldset", variant: "standard" }, { children: [_jsx(FormLabel, Object.assign({ component: "legend" }, { children: _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })) })), _jsx(FormControlLabel, { control: _jsx(Switch, { color: "primary", checked: value, name: name, onChange: handleChange }), label: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: description, defaultMessage: description }) })) })] })));
20
+ return (_jsxs(FormControl, Object.assign({ component: "fieldset", variant: "standard" }, { children: [_jsx(FormLabel, Object.assign({ component: "legend" }, { children: _jsx(Typography, Object.assign({ variant: "h5", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })) })), _jsx(FormControlLabel, { control: _jsx(Switch, { color: "primary", checked: value, name: name, onChange: handleChange }), label: _jsx(Typography, Object.assign({ variant: "body1", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: description, defaultMessage: description }) })) })] })));
21
21
  }
22
22
  export default memo(SwitchForm);
@@ -14,7 +14,7 @@ const classes = {
14
14
  optionsWrapper: `${PREFIX}-options-wrapper`,
15
15
  optionsDivider: `${PREFIX}-options-divider`,
16
16
  optionsButtonWrapper: `${PREFIX}-options-button-wrapper`,
17
- contrastColor: `${PREFIX}-contrast-color`
17
+ paperContrastColor: `${PREFIX}-paper-contrast-color`
18
18
  };
19
19
  const OPTIONS = {
20
20
  enforce_lessons_order: {
@@ -88,6 +88,6 @@ function Options(props) {
88
88
  });
89
89
  });
90
90
  }, [course, tempOptions, setCanSave, setLoading]);
91
- return (_jsxs(Box, Object.assign({ className: classes.optionsContainer }, { children: [_jsx(Stack, Object.assign({ className: classes.optionsWrapper }, { children: Object.entries(OPTIONS).map(([key, value], i) => (_jsx(SwitchForm, { name: key, title: value.title, description: value.description, checked: course[key], handleChangeOptions: handleChange }, i))) })), _jsx(Stack, Object.assign({ className: classes.optionsButtonWrapper }, { children: _jsx(Button, Object.assign({ size: "small", variant: "contained", disabled: !canSave, onClick: handleSubmit, loading: loading }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.options.button.save", defaultMessage: "ui.editCourse.tab.options.button.save" }) })) })) }))] })));
91
+ return (_jsxs(Box, Object.assign({ className: classes.optionsContainer }, { children: [_jsx(Stack, Object.assign({ className: classes.optionsWrapper }, { children: Object.entries(OPTIONS).map(([key, value], i) => (_jsx(SwitchForm, { name: key, title: value.title, description: value.description, checked: course[key], handleChangeOptions: handleChange }, i))) })), _jsx(Stack, Object.assign({ className: classes.optionsButtonWrapper }, { children: _jsx(Button, Object.assign({ size: "small", variant: "contained", disabled: !canSave, onClick: handleSubmit, loading: loading }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.options.button.save", defaultMessage: "ui.editCourse.tab.options.button.save" }) })) })) }))] })));
92
92
  }
93
93
  export default memo(Options);
@@ -3,12 +3,11 @@ import { Button, Chip, Typography } from '@mui/material';
3
3
  import { useIntl } from 'react-intl';
4
4
  import { PREFIX } from './constants';
5
5
  import { SCCoursePrivacyType } from '@selfcommunity/types';
6
- import classNames from 'classnames';
7
6
  import { useCallback } from 'react';
8
7
  import { SCCourseEditTabType } from '../../types';
9
8
  const classes = {
10
9
  status: `${PREFIX}-status`,
11
- contrastColor: `${PREFIX}-contrast-color`
10
+ defaultContrastColor: `${PREFIX}-default-contrast-color`
12
11
  };
13
12
  export default function Status(props) {
14
13
  // STATES
@@ -19,11 +18,11 @@ export default function Status(props) {
19
18
  const handleClick = useCallback(() => {
20
19
  handleTabChange(null, SCCourseEditTabType.CUSTOMIZE);
21
20
  }, [handleTabChange]);
22
- return (_jsx(Chip, { label: _jsx(Button, Object.assign({ size: "small", variant: "text", color: "inherit", onClick: handleClick }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: intl.formatMessage({ id: 'ui.editCourse.tab.lessons.status', defaultMessage: 'ui.editCourse.tab.lessons.status' }, {
21
+ return (_jsx(Chip, { label: _jsx(Button, Object.assign({ size: "small", variant: "text", color: "inherit", onClick: handleClick }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.defaultContrastColor }, { children: intl.formatMessage({ id: 'ui.editCourse.tab.lessons.status', defaultMessage: 'ui.editCourse.tab.lessons.status' }, {
23
22
  status: intl.formatMessage({
24
23
  id: `ui.course.privacy.${course.privacy === SCCoursePrivacyType.DRAFT ? 'draft' : course.privacy}`,
25
24
  defaultMessage: `ui.course.privacy.${course.privacy === SCCoursePrivacyType.DRAFT ? 'draft' : course.privacy}`
26
25
  }),
27
26
  b: (chunks) => (_jsx(Typography, Object.assign({ component: "b", fontWeight: "bold" }, { children: chunks }), "ui.editCourse.tab.lessons.status.b"))
28
- }) })) })), className: classNames(classes.status, classes.contrastColor) }));
27
+ }) })) })), className: classes.status }));
29
28
  }
@@ -19,7 +19,7 @@ import { SCCourseEventType, SCTopicType } from '../../constants/PubSub';
19
19
  import { SCCourseUsersTableModeType } from '../../types/course';
20
20
  const classes = {
21
21
  usersStatusWrapper: `${PREFIX}-users-status-wrapper`,
22
- contrastColor: `${PREFIX}-contrast-color`
22
+ defaultContrastColor: `${PREFIX}-default-contrast-color`
23
23
  };
24
24
  const headerCells = [
25
25
  {
@@ -124,7 +124,7 @@ function Users(props) {
124
124
  });
125
125
  });
126
126
  }, [course, dispatch]);
127
- return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.users.title", defaultMessage: "ui.editCourse.tab.users.title", values: { usersNumber: state.count } }) })), _jsxs(Stack, Object.assign({ className: classes.usersStatusWrapper }, { children: [_jsx(Status, { course: course, handleTabChange: handleTabChange }), _jsx(AddUsersButton, { label: "ui.editCourse.tab.users.addUsersButton.label", endpoint: {
127
+ return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classes.defaultContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.users.title", defaultMessage: "ui.editCourse.tab.users.title", values: { usersNumber: state.count } }) })), _jsxs(Stack, Object.assign({ className: classes.usersStatusWrapper }, { children: [_jsx(Status, { course: course, handleTabChange: handleTabChange }), _jsx(AddUsersButton, { label: "ui.editCourse.tab.users.addUsersButton.label", endpoint: {
128
128
  url: () => Endpoints.GetCourseSuggestedUsers.url({ id: course.id }),
129
129
  method: Endpoints.GetCourseSuggestedUsers.method
130
130
  }, onConfirm: handleConfirm })] })), _jsx(CourseUsersTable, { state: state, dispatch: dispatch, course: course, endpointSearch: {
@@ -47,5 +47,5 @@ export default function ContributorsFeedObject(props) {
47
47
  if (!contributorsObject.feedObject) {
48
48
  return null;
49
49
  }
50
- return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(Box, { children: contributorsObject.isLoadingNext && !openContributorsDialog ? (_jsx(ContributorsSkeleton, Object.assign({}, ContributorsSkeletonProps))) : (_jsx(_Fragment, { children: contributorsObject.contributors.length > 0 ? (_jsxs(_Fragment, { children: [_jsxs(Button, Object.assign({ variant: "text", onClick: () => setOpenContributorsDialog(true), classes: { root: classes.btnParticipants }, color: "inherit" }, { children: [_jsx(FormattedMessage, { id: "ui.feedObject.contributors.participants", defaultMessage: "ui.feedObject.contributors.participants" }), ":", _jsxs(AvatarGroup, Object.assign({}, rest, { children: [contributorsObject.contributors.map((c, i) => (_jsx(Avatar, { alt: c.username, src: c.avatar }, i))), [...Array(Math.max(contributorsObject.total - contributorsObject.contributors.length, 0))].map((x, i) => (_jsx(Avatar, {}, i)))] }))] })), openContributorsDialog && (_jsx(BaseDialog, Object.assign({ title: _jsx(FormattedMessage, { defaultMessage: "ui.feedObject.contributors.title", id: "ui.feedObject.contributors.title", values: { total: contributorsObject.total } }), onClose: () => setOpenContributorsDialog(false), open: openContributorsDialog }, { children: contributorsObject.isLoadingNext ? (_jsx(CentralProgress, { size: 50 })) : (_jsx(InfiniteScroll, Object.assign({ dataLength: contributorsObject.contributors.length, next: contributorsObject.getNextPage(), hasMoreNext: Boolean(contributorsObject.next), loaderNext: _jsx(CentralProgress, { size: 30 }), height: 400, endMessage: _jsx(Typography, Object.assign({ variant: "body2", align: "center", fontWeight: "bold" }, { children: _jsx(FormattedMessage, { id: "ui.feedObject.contributors.noOtherContributors", defaultMessage: "ui.feedObject.contributors.noOtherContributors" }) })) }, { children: _jsx(List, { children: contributorsObject.contributors.map((c, i) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: c, sx: { m: 0 }, onClick: () => setOpenContributorsDialog(false) }, c.id) }, i))) }) }))) })))] })) : null })) }) })));
50
+ return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(Box, { children: contributorsObject.isLoadingNext && !openContributorsDialog ? (_jsx(ContributorsSkeleton, Object.assign({}, ContributorsSkeletonProps))) : (_jsx(_Fragment, { children: contributorsObject.contributors.length > 0 ? (_jsxs(_Fragment, { children: [_jsxs(Button, Object.assign({ variant: "text", onClick: () => setOpenContributorsDialog(true), classes: { root: classes.btnParticipants }, color: "inherit" }, { children: [_jsxs(Typography, Object.assign({ component: "span", sx: { '&': { all: 'unset' } } }, { children: [_jsx(FormattedMessage, { id: "ui.feedObject.contributors.participants", defaultMessage: "ui.feedObject.contributors.participants" }), ":"] })), _jsxs(AvatarGroup, Object.assign({}, rest, { children: [contributorsObject.contributors.map((c, i) => (_jsx(Avatar, { alt: c.username, src: c.avatar }, i))), [...Array(Math.max(contributorsObject.total - contributorsObject.contributors.length, 0))].map((_x, i) => (_jsx(Avatar, {}, i)))] }))] })), openContributorsDialog && (_jsx(BaseDialog, Object.assign({ title: _jsx(FormattedMessage, { defaultMessage: "ui.feedObject.contributors.title", id: "ui.feedObject.contributors.title", values: { total: contributorsObject.total } }), onClose: () => setOpenContributorsDialog(false), open: openContributorsDialog }, { children: contributorsObject.isLoadingNext ? (_jsx(CentralProgress, { size: 50 })) : (_jsx(InfiniteScroll, Object.assign({ dataLength: contributorsObject.contributors.length, next: contributorsObject.getNextPage(), hasMoreNext: Boolean(contributorsObject.next), loaderNext: _jsx(CentralProgress, { size: 30 }), height: 400, endMessage: _jsx(Typography, Object.assign({ variant: "body2", align: "center", fontWeight: "bold" }, { children: _jsx(FormattedMessage, { id: "ui.feedObject.contributors.noOtherContributors", defaultMessage: "ui.feedObject.contributors.noOtherContributors" }) })) }, { children: _jsx(List, { children: contributorsObject.contributors.map((c, i) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: c, sx: { m: 0 }, onClick: () => setOpenContributorsDialog(false) }, c.id) }, i))) }) }))) })))] })) : null })) }) })));
51
51
  }
@@ -242,7 +242,7 @@ export default function PaywallsConfigurator(inProps) {
242
242
  setPendingValue(newValue);
243
243
  }, disableCloseOnSelect: true, slots: {
244
244
  popper: PopperComponent
245
- }, renderTags: () => null, noOptionsText: _jsx(FormattedMessage, { id: "ui.paywallsConfigurator.noProducts", defaultMessage: "ui.paywallsConfigurator.noProducts" }), renderOption: renderOption, options: getOptions, isOptionEqualToValue: (option, value) => option.id === value.id, getOptionLabel: (option) => option.name.toString(), renderInput: (params) => (_jsx(FilterInputRoot, { disabled: loadingProducts || loading, ref: params.InputProps.ref, inputProps: params.inputProps, autoFocus: true, placeholder: intl.formatMessage({
245
+ }, renderValue: () => null, noOptionsText: _jsx(FormattedMessage, { id: "ui.paywallsConfigurator.noProducts", defaultMessage: "ui.paywallsConfigurator.noProducts" }), renderOption: renderOption, options: getOptions, isOptionEqualToValue: (option, value) => option.id === value.id, getOptionLabel: (option) => option.name.toString(), renderInput: (params) => (_jsx(FilterInputRoot, { disabled: loadingProducts || loading, ref: params.InputProps.ref, inputProps: params.inputProps, autoFocus: true, placeholder: intl.formatMessage({
246
246
  id: 'ui.paywallsConfigurator.filterByName',
247
247
  defaultMessage: 'ui.paywallsConfigurator.filterByName'
248
248
  }) })) }), _jsx(Box, Object.assign({ className: classes.paymentProductsPopperFooter }, { children: _jsx(Button, Object.assign({ variant: "contained", size: "small", disableRipple: true, onClick: handleClose, startIcon: _jsx(Icon, { children: "check" }) }, { children: _jsx(FormattedMessage, { id: "ui.paywallsConfigurator.popper.btnConfirm", defaultMessage: "ui.paywallsConfigurator.popper.btnConfirm" }) })) }))] }) })) })))] })] }))] }))) })));
@@ -28,6 +28,7 @@ const classes = {
28
28
  messageTime: `${PREFIX}-message-time`,
29
29
  menuItem: `${PREFIX}-menu-item`,
30
30
  downloadButton: `${PREFIX}-download-button`,
31
+ paperContrastColor: `${PREFIX}-paper-contrast-color`,
31
32
  dialogRoot: `${PREFIX}-dialog-root`
32
33
  };
33
34
  const DialogRoot = styled(BaseDialog, {
@@ -156,7 +157,7 @@ export default function PrivateMessageThreadItem(inProps) {
156
157
  */
157
158
  return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, getMouseEvents(mouseEvents.onMouseEnter, mouseEvents.onMouseLeave), rest, { secondaryAction: (isHovering || isMobile) &&
158
159
  showMenuIcon &&
159
- message.status !== SCPrivateMessageStatusType.HIDDEN && _jsx(PrivateMessageSettingsIconButton, { onMenuItemDeleteClick: handleMenuItemClick }) }, { children: [message.group && ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.username) !== message.sender.username && (_jsx(Typography, Object.assign({ color: "secondary", variant: "h4", className: classes.username }, { children: message.sender.username }))), _jsxs(_Fragment, { children: [hasFile && message.status !== SCPrivateMessageStatusType.HIDDEN ? (renderMessageFile(message)) : (_jsx(Box, Object.assign({ className: classes.text }, { children: _jsx(Typography, { component: "span", dangerouslySetInnerHTML: { __html: message.message } }) }))), _jsx(Typography, Object.assign({ className: classes.messageTime, color: "text.secondary" }, { children: `${intl.formatDate(message.created_at, {
160
+ message.status !== SCPrivateMessageStatusType.HIDDEN && _jsx(PrivateMessageSettingsIconButton, { onMenuItemDeleteClick: handleMenuItemClick }) }, { children: [message.group && ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.username) !== message.sender.username && (_jsx(Typography, Object.assign({ color: "secondary", variant: "h4", className: classes.username }, { children: message.sender.username }))), _jsxs(_Fragment, { children: [hasFile && message.status !== SCPrivateMessageStatusType.HIDDEN ? (renderMessageFile(message)) : (_jsx(Box, Object.assign({ className: classes.text }, { children: _jsx(Typography, { component: "span", dangerouslySetInnerHTML: { __html: message.message }, className: classes.paperContrastColor }) }))), _jsx(Typography, Object.assign({ className: classNames(classes.messageTime, classes.paperContrastColor), color: "text.secondary" }, { children: `${intl.formatDate(message.created_at, {
160
161
  hour: 'numeric',
161
162
  minute: 'numeric'
162
163
  })}` }))] }), openDialog && (_jsx(_Fragment, { children: (message === null || message === void 0 ? void 0 : message.file.mimetype.startsWith(SCMessageFileType.VIDEO)) ? (_jsx(DialogRoot, Object.assign({ open: openDialog, onClose: () => setOpenDialog(false), className: classes.dialogRoot }, { children: _jsx(AutoPlayer, { url: message === null || message === void 0 ? void 0 : message.file.url, width: "100%" }) }))) : (_jsx(LightBox, { images: [{ src: message === null || message === void 0 ? void 0 : message.file.url, key: message.file.uuid }], onClose: () => setOpenDialog(false), toolbarButtons: _jsx(IconButton, Object.assign({ onClick: () => handleDownload(message === null || message === void 0 ? void 0 : message.file), className: classes.downloadButton }, { children: _jsx(Icon, { children: "download" }) }), "download") })) }))] })));
@@ -1,6 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { Avatar, Badge, Button, Chip, styled } from '@mui/material';
3
+ import { Avatar, Badge, Button, Chip, styled, Typography } from '@mui/material';
4
4
  import { useThemeProps } from '@mui/system';
5
5
  import { Link, SCPreferences, SCRoutes, useSCFetchUser, useSCPreferences, useSCRouting } from '@selfcommunity/react-core';
6
6
  import classNames from 'classnames';
@@ -23,7 +23,7 @@ const classes = {
23
23
  avatar: `${PREFIX}-avatar`,
24
24
  staffBadgeLabel: `${PREFIX}-staff-badge-label`,
25
25
  groupAdminBadgeLabel: `${PREFIX}-group-admin-badge-label`,
26
- contrastColor: `${PREFIX}-contrast-color`
26
+ paperContrastColor: `${PREFIX}-paper-contrast-color`
27
27
  };
28
28
  const Root = styled(BaseItemButton, {
29
29
  name: PREFIX,
@@ -100,5 +100,5 @@ export default function User(inProps) {
100
100
  */
101
101
  return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ elevation: elevation }, rest, { className: classNames(classes.root, className), ButtonBaseProps: buttonProps !== null && buttonProps !== void 0 ? buttonProps : (scUser.deleted
102
102
  ? { onClick: () => setOpenAlert(true) }
103
- : { component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUser) }), image: badgeContent ? (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: badgeContent }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))) : (_jsx(UserAvatar, Object.assign({ hide: !hasBadge }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))), primary: (hasBadge && preferences) || isGroupAdmin ? (_jsxs(_Fragment, { children: [scUser.username, _jsx(Chip, { component: "span", className: classNames(classes.contrastColor, isGroupAdmin ? classes.groupAdminBadgeLabel : classes.staffBadgeLabel), size: "small", label: isGroupAdmin ? (_jsx(FormattedMessage, { defaultMessage: "ui.user.group.admin", id: "ui.user.group.admin" })) : (preferences[SCPreferences.STAFF_STAFF_BADGE_LABEL]) })] })) : (scUser.username), secondary: secondary || (showFollowers ? `${intl.formatMessage(messages.userFollowers, { total: scUser.followers_counter })}` : scUser.description), actions: actions !== null && actions !== void 0 ? actions : renderAuthenticatedActions() })), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
103
+ : { component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUser) }), image: badgeContent ? (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: badgeContent }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))) : (_jsx(UserAvatar, Object.assign({ hide: !hasBadge }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))), primary: (hasBadge && preferences) || isGroupAdmin ? (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: scUser.username })), _jsx(Chip, { component: "span", className: classNames(isGroupAdmin ? classes.groupAdminBadgeLabel : classes.staffBadgeLabel), size: "small", label: _jsx(Typography, Object.assign({ component: "span", sx: { '&': { all: 'unset' } }, className: classes.paperContrastColor }, { children: isGroupAdmin ? (_jsx(FormattedMessage, { defaultMessage: "ui.user.group.admin", id: "ui.user.group.admin" })) : (preferences[SCPreferences.STAFF_STAFF_BADGE_LABEL]) })) })] })) : (_jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: scUser.username }))), secondary: _jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: secondary || (showFollowers ? `${intl.formatMessage(messages.userFollowers, { total: scUser.followers_counter })}` : scUser.description) })), actions: actions !== null && actions !== void 0 ? actions : renderAuthenticatedActions() })), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
104
104
  }
@@ -19,7 +19,7 @@ const classes = {
19
19
  details: `${PREFIX}-details`,
20
20
  circle: `${PREFIX}-circle`,
21
21
  link: `${PREFIX}-link`,
22
- contrastColor: `${PREFIX}-contrast-color`
22
+ paperContrastColor: `${PREFIX}-paper-contrast-color`
23
23
  };
24
24
  const Root = styled(Box, {
25
25
  name: PREFIX,
@@ -50,13 +50,13 @@ export default function AccordionLessons(inProps) {
50
50
  if (!course) {
51
51
  return _jsx(AccordionLessonSkeleton, {});
52
52
  }
53
- return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, { children: ((_a = course.sections) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (course.sections.map((section) => (_jsxs(Accordion, Object.assign({ className: classes.accordion, expanded: expanded === section.id, onChange: handleChange(section.id), disableGutters: true, elevation: 0, square: true }, { children: [_jsxs(AccordionSummary, Object.assign({ className: classes.summary, expandIcon: _jsx(Icon, { children: "expand_more" }) }, { children: [_jsxs(Stack, Object.assign({ className: classes.nameWrapper }, { children: [_jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.contrastColor }, { children: section.name })), viewerJoinStatus !== SCCourseJoinStatusType.CREATOR && viewerJoinStatus !== SCCourseJoinStatusType.MANAGER && section.locked && (_jsxs(Fragment, { children: [_jsx(Bullet, {}), _jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.date", defaultMessage: "ui.course.accordionLessons.date", values: {
53
+ return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, { children: ((_a = course.sections) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (course.sections.map((section) => (_jsxs(Accordion, Object.assign({ className: classes.accordion, expanded: expanded === section.id, onChange: handleChange(section.id), disableGutters: true, elevation: 0, square: true }, { children: [_jsxs(AccordionSummary, Object.assign({ className: classes.summary, expandIcon: _jsx(Icon, { children: "expand_more" }) }, { children: [_jsxs(Stack, Object.assign({ className: classes.nameWrapper }, { children: [_jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.paperContrastColor }, { children: section.name })), viewerJoinStatus !== SCCourseJoinStatusType.CREATOR && viewerJoinStatus !== SCCourseJoinStatusType.MANAGER && section.locked && (_jsxs(Fragment, { children: [_jsx(Bullet, {}), _jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.date", defaultMessage: "ui.course.accordionLessons.date", values: {
54
54
  date: intl.formatDate(section.available_date, { day: 'numeric', month: 'numeric', year: 'numeric' }),
55
55
  hour: intl.formatDate(section.available_date, { hour: 'numeric', minute: 'numeric' })
56
- } }) }))] }))] })), !isMobile && (_jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
56
+ } }) }))] }))] })), !isMobile && (_jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
57
57
  lessonsNumber: section.lessons.length
58
58
  } }) })))] })), section.lessons.map((lesson) => (_jsxs(AccordionDetails, Object.assign({ className: classes.details }, { children: [lesson.completion_status === SCCourseLessonCompletionStatusType.COMPLETED ? (_jsx(Icon, Object.assign({ fontSize: "small", color: "primary" }, { children: "circle_checked" }))) : lesson.locked ? (_jsx(Icon, { children: "private" })) : (_jsx(Box, { className: classes.circle })), course.join_status === null ||
59
59
  viewerJoinStatus === SCCourseJoinStatusType.CREATOR ||
60
60
  viewerJoinStatus === SCCourseJoinStatusType.MANAGER ||
61
- lesson.locked ? (_jsx(Typography, Object.assign({ className: classes.contrastColor }, { children: lesson.name }))) : (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_ROUTE_NAME, getUrlLesson(course, lesson, section)), variant: "text", color: "inherit", className: classes.link }, { children: _jsx(Typography, Object.assign({ className: classes.contrastColor }, { children: lesson.name })) })))] }), lesson.id)))] }), section.id)))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classNames(classes.empty, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.empty", defaultMessage: "ui.course.accordionLessons.empty" }) }))) })));
61
+ lesson.locked ? (_jsx(Typography, Object.assign({ className: classes.paperContrastColor }, { children: lesson.name }))) : (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_ROUTE_NAME, getUrlLesson(course, lesson, section)), variant: "text", color: "inherit", className: classes.link }, { children: _jsx(Typography, Object.assign({ className: classes.paperContrastColor }, { children: lesson.name })) })))] }), lesson.id)))] }), section.id)))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classNames(classes.empty, classes.paperContrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.empty", defaultMessage: "ui.course.accordionLessons.empty" }) }))) })));
62
62
  }
@@ -1,6 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Autocomplete, Avatar, Button, Chip, Stack, styled, TextField, Typography, useThemeProps } from '@mui/material';
3
+ import { Autocomplete, Avatar, Button, Chip, Stack, styled, TextField, Typography, useTheme, useThemeProps } from '@mui/material';
4
4
  import { Fragment, memo, useCallback, useEffect, useState } from 'react';
5
5
  import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
6
6
  import BaseDialog from '../BaseDialog';
@@ -13,11 +13,12 @@ import classNames from 'classnames';
13
13
  const PREFIX = 'SCAddUsersButton';
14
14
  const classes = {
15
15
  root: `${PREFIX}-root`,
16
+ defaultContrastColor: `${PREFIX}-default-contrast-color`,
16
17
  dialogRoot: `${PREFIX}-dialog-root`,
17
18
  dialogAutocompleteWrapper: `${PREFIX}-dialog-autocomplete-wrapper`,
18
19
  dialogUserWrapper: `${PREFIX}-dialog-user-wrapper`,
19
20
  dialogChipWrapper: `${PREFIX}-dialog-chip-wrapper`,
20
- contrastColor: `${PREFIX}-contrast-color`
21
+ dialogPaperContrastColor: `${PREFIX}-dialog-paper-contrast-color`
21
22
  };
22
23
  const messages = defineMessages({
23
24
  placeholder: {
@@ -41,16 +42,18 @@ function AddUsersButton(inProps) {
41
42
  props: inProps,
42
43
  name: PREFIX
43
44
  });
44
- const { label, variant = 'outlined', color = 'inherit', size = 'small', endpoint = Endpoints.GetCourseSuggestedUsers, endpointQueryParams = { limit: DEFAULT_PAGINATION_LIMIT, offset: DEFAULT_PAGINATION_OFFSET, search: '' }, onConfirm, className } = props, rest = __rest(props, ["label", "variant", "color", "size", "endpoint", "endpointQueryParams", "onConfirm", "className"]);
45
+ const { label, variant = 'contained', color = 'inherit', size = 'small', endpoint = Endpoints.GetCourseSuggestedUsers, endpointQueryParams = { limit: DEFAULT_PAGINATION_LIMIT, offset: DEFAULT_PAGINATION_OFFSET, search: '' }, onConfirm, className } = props, rest = __rest(props, ["label", "variant", "color", "size", "endpoint", "endpointQueryParams", "onConfirm", "className"]);
45
46
  // STATES
46
47
  const [openDialog, setOpenDialog] = useState(false);
47
48
  const [invited, setInvited] = useState([]);
48
49
  const [suggested, setSuggested] = useState([]);
49
50
  const [value, setValue] = useState('');
50
51
  const [loading, setLoading] = useState(false);
52
+ // CONTEXTS
53
+ const { enqueueSnackbar } = useSnackbar();
51
54
  // HOOKS
52
55
  const intl = useIntl();
53
- const { enqueueSnackbar } = useSnackbar();
56
+ const theme = useTheme();
54
57
  // CALLBACKS
55
58
  const fetchUsers = useCallback((newValue) => {
56
59
  setLoading(true);
@@ -126,9 +129,14 @@ function AddUsersButton(inProps) {
126
129
  const handleDelete = useCallback((userToDelete) => {
127
130
  setInvited((prev) => prev.filter((user) => user.id !== userToDelete.id));
128
131
  }, [setInvited]);
129
- return (_jsxs(Fragment, { children: [_jsx(Root, Object.assign({ onClick: handleToggleDialogOpen, variant: variant, color: color, size: size, className: classNames(classes.root, classes.contrastColor, className) }, rest, { children: _jsx(FormattedMessage, { id: label, defaultMessage: label }) })), openDialog && (_jsx(DialogRoot, Object.assign({ DialogContentProps: { dividers: false }, open: true, onClose: handleToggleDialogOpen, title: _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.dialog.title", defaultMessage: "ui.addUserButton.dialog.title" }) })), actions: _jsx(Button, Object.assign({ onClick: handleConfirm, size: "medium", variant: "contained", autoFocus: true, disabled: !invited.length }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.dialog.confirm", defaultMessage: "ui.addUserButton.dialog.confirm" }) })) })), className: classes.dialogRoot }, { children: _jsxs(Stack, Object.assign({ className: classes.dialogAutocompleteWrapper }, { children: [_jsx(Autocomplete, { loading: loading, size: "small", multiple: true, options: suggested, onChange: handleChange, onInputChange: handleInputChange, inputValue: value, filterOptions: filterOptions, value: invited, getOptionLabel: (option) => (option === null || option === void 0 ? void 0 : option.username) || '...', isOptionEqualToValue: (option, value) => (option === null || option === void 0 ? void 0 : option.id) === value.id, loadingText: _jsx(FormattedMessage, { id: "ui.addUserButton.autocomplete.loading", defaultMessage: "ui.addUserButton.autocomplete.loading" }), noOptionsText: _jsx(FormattedMessage, { id: "ui.addUserButton.autocomplete.noResults", defaultMessage: "ui.addUserButton.autocomplete.noResults" }), renderTags: () => null, popupIcon: null, disableClearable: true, renderOption: (props, option) => (_jsxs(Stack, Object.assign({ component: "li", flexDirection: "row", gap: "5px" }, props, { children: [_jsx(Avatar, { alt: option.username, src: option.avatar }), _jsx(Typography, { children: option.username })] }))), renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { variant: "outlined", placeholder: `${intl.formatMessage(messages.placeholder)}`, slotProps: {
130
- input: Object.assign({}, params.InputProps)
131
- } }))) }), _jsx(Stack, Object.assign({ className: classes.dialogChipWrapper }, { children: invited.map((option, index) => (_jsx(Chip, { avatar: _jsx(Avatar, { alt: option.username, src: option.avatar }), label: option.username, onDelete: () => {
132
+ return (_jsxs(Fragment, { children: [_jsx(Root, Object.assign({ onClick: handleToggleDialogOpen, variant: variant, color: color, size: size, className: classNames(classes.root, classes.defaultContrastColor, className) }, rest, { children: _jsx(FormattedMessage, { id: label, defaultMessage: label }) })), openDialog && (_jsx(DialogRoot, Object.assign({ DialogContentProps: { dividers: false }, open: true, onClose: handleToggleDialogOpen, title: _jsx(Typography, Object.assign({ variant: "h5", className: classes.dialogPaperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.dialog.title", defaultMessage: "ui.addUserButton.dialog.title" }) })), actions: _jsx(Button, Object.assign({ onClick: handleConfirm, size: "medium", variant: "contained", autoFocus: true, disabled: !invited.length }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.dialog.confirm", defaultMessage: "ui.addUserButton.dialog.confirm" }) })) })), className: classes.dialogRoot }, { children: _jsxs(Stack, Object.assign({ className: classes.dialogAutocompleteWrapper }, { children: [_jsx(Autocomplete, { loading: loading, size: "small", multiple: true, options: suggested, onChange: handleChange, onInputChange: handleInputChange, inputValue: value, filterOptions: filterOptions, value: invited, getOptionLabel: (option) => (option === null || option === void 0 ? void 0 : option.username) || '...', isOptionEqualToValue: (option, value) => (option === null || option === void 0 ? void 0 : option.id) === value.id, loadingText: _jsx(Typography, Object.assign({ component: "span", sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.autocomplete.loading", defaultMessage: "ui.addUserButton.autocomplete.loading" }) })), noOptionsText: _jsx(Typography, Object.assign({ component: "span", sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.autocomplete.noResults", defaultMessage: "ui.addUserButton.autocomplete.noResults" }) })), renderValue: () => null, popupIcon: null, disableClearable: true, renderOption: (props, option) => (_jsxs(Stack, Object.assign({ component: "li", flexDirection: "row", gap: "5px" }, props, { children: [_jsx(Avatar, { alt: option.username, src: option.avatar }), _jsx(Typography, Object.assign({ sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: option.username }))] }))), renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { variant: "outlined", placeholder: `${intl.formatMessage(messages.placeholder)}`, slotProps: {
133
+ input: Object.assign(Object.assign({}, params.InputProps), { sx: {
134
+ '&::placeholder': {
135
+ color: theme.palette.getContrastText(theme.palette.background.paper)
136
+ },
137
+ color: theme.palette.getContrastText(theme.palette.background.paper)
138
+ } })
139
+ } }))) }), _jsx(Stack, Object.assign({ className: classes.dialogChipWrapper }, { children: invited.map((option, index) => (_jsx(Chip, { avatar: _jsx(Avatar, { alt: option.username, src: option.avatar }), label: _jsx(Typography, Object.assign({ component: "span", sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: option.username })), onDelete: () => {
132
140
  handleDelete(option);
133
141
  } }, index))) }))] })) })))] }));
134
142
  }
@@ -1,10 +1,10 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { styled, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Card, lighten, darken, getContrastRatio } from '@mui/material';
3
+ import { styled, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Card, getContrastRatio, lighten } from '@mui/material';
4
4
  import { FormattedMessage } from 'react-intl';
5
5
  const PREFIX = 'SCConfirmDialog';
6
6
  const classes = {
7
- contrastColor: `${PREFIX}-contrast-color`
7
+ paperContrastColor: `${PREFIX}-paper-contrast-color`
8
8
  };
9
9
  const Root = styled(Card, {
10
10
  name: PREFIX,
@@ -12,11 +12,15 @@ const Root = styled(Card, {
12
12
  overridesResolver: (_props, styles) => styles.root
13
13
  })(({ theme }) => ({
14
14
  maxWidth: 800,
15
- marginBottom: theme.spacing(2),
16
- [`& .${PREFIX}-contrast-color`]: {
17
- color: getContrastRatio(theme.palette.background.paper, theme.palette.common.white) > 4.5
18
- ? lighten(theme.palette.common.white, 0.5)
19
- : darken(theme.palette.common.white, 0.5)
15
+ marginBottom: theme.spacing(2)
16
+ }));
17
+ const DialogRoot = styled(Dialog, {
18
+ name: PREFIX,
19
+ slot: 'DialogRoot',
20
+ overridesResolver: (_props, styles) => styles.dialogRoot
21
+ })(({ theme }) => ({
22
+ [`& .${classes.paperContrastColor}`]: {
23
+ color: getContrastRatio(theme.palette.background.paper, theme.palette.common.white) > 4.5 ? lighten(theme.palette.common.white, 0.5) : undefined
20
24
  }
21
25
  }));
22
26
  export default function ConfirmDialog(props) {
@@ -43,5 +47,5 @@ export default function ConfirmDialog(props) {
43
47
  /**
44
48
  * Renders root object
45
49
  */
46
- return (_jsx(Root, { children: _jsxs(Dialog, Object.assign({ open: open, onClose: handleClose }, rest, { children: [_jsx(DialogTitle, Object.assign({ className: classes.contrastColor }, { children: title || _jsx(FormattedMessage, { id: "ui.confirmDialog.title", defaultMessage: "ui.confirmDialog.title" }) })), content && (_jsx(DialogContent, { children: _jsx(DialogContentText, Object.assign({ component: "div", className: classes.contrastColor }, { children: content })) })), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ onClick: handleClose, className: classes.contrastColor }, { children: btnCancel || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnCancel", defaultMessage: "ui.confirmDialog.btnCancel" }) })), _jsx(Button, Object.assign({ onClick: handleConfirm, variant: "contained", autoFocus: true, loading: isUpdating, className: classes.contrastColor }, { children: btnConfirm || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnConfirm", defaultMessage: "ui.confirmDialog.btnConfirm" }) }))] })] })) }));
50
+ return (_jsx(Root, { children: _jsxs(DialogRoot, Object.assign({ open: open, onClose: handleClose }, rest, { children: [_jsx(DialogTitle, Object.assign({ className: classes.paperContrastColor }, { children: title || _jsx(FormattedMessage, { id: "ui.confirmDialog.title", defaultMessage: "ui.confirmDialog.title" }) })), content && (_jsx(DialogContent, { children: _jsx(DialogContentText, Object.assign({ component: "div", className: classes.paperContrastColor }, { children: content })) })), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ onClick: handleClose }, { children: btnCancel || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnCancel", defaultMessage: "ui.confirmDialog.btnCancel" }) })), _jsx(Button, Object.assign({ onClick: handleConfirm, variant: "contained", autoFocus: true, loading: isUpdating }, { children: btnConfirm || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnConfirm", defaultMessage: "ui.confirmDialog.btnConfirm" }) }))] })] })) }));
47
51
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Button, MenuItem, Select, Typography } from '@mui/material';
2
+ import { Button, MenuItem, Select, Typography, useTheme } from '@mui/material';
3
3
  import { memo, useCallback, useEffect, useState } from 'react';
4
4
  import { FormattedMessage } from 'react-intl';
5
5
  import { SCCourseJoinStatusType } from '@selfcommunity/types';
@@ -7,11 +7,7 @@ import { CourseService } from '@selfcommunity/api-services';
7
7
  import { Logger } from '@selfcommunity/utils';
8
8
  import { SCOPE_SC_UI } from '../../constants/Errors';
9
9
  import { useSnackbar } from 'notistack';
10
- import { PREFIX } from './constants';
11
10
  const OPTIONS = ['ui.editCourse.tab.users.table.select.joined', 'ui.editCourse.tab.users.table.select.manager'];
12
- const classes = {
13
- contrastColor: `${PREFIX}-contrast-color`
14
- };
15
11
  function ChangeUserStatus(props) {
16
12
  // PROPS
17
13
  const { course, user } = props;
@@ -20,6 +16,8 @@ function ChangeUserStatus(props) {
20
16
  const [loading, setLoading] = useState(false);
21
17
  // CONTEXTS
22
18
  const { enqueueSnackbar } = useSnackbar();
19
+ // HOOKS
20
+ const theme = useTheme();
23
21
  // EFFECTS
24
22
  useEffect(() => {
25
23
  setValue(`ui.editCourse.tab.users.table.select.${user.join_status || 'joined'}`);
@@ -54,6 +52,6 @@ function ChangeUserStatus(props) {
54
52
  ':hover': {
55
53
  backgroundColor: 'unset'
56
54
  }
57
- } }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: option, defaultMessage: option }) })) })) }), i))) })));
55
+ } }, { children: _jsx(Typography, Object.assign({ variant: "body1", sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: _jsx(FormattedMessage, { id: option, defaultMessage: option }) })) })) }), i))) })));
58
56
  }
59
57
  export default memo(ChangeUserStatus);
@@ -13,12 +13,13 @@ import { http } from '@selfcommunity/api-services';
13
13
  import { Logger } from '@selfcommunity/utils';
14
14
  import { SCOPE_SC_UI } from '../../constants/Errors';
15
15
  import ChangeUserStatus from './ChangeUsersStatus';
16
- import { useSCUser } from '@selfcommunity/react-core';
16
+ import { Link, SCRoutes, useSCRouting, useSCUser } from '@selfcommunity/react-core';
17
17
  import RequestButton from './RequestButton';
18
18
  import { SCCourseUsersTableModeType } from '../../types/course';
19
19
  import RemoveButton from './RemoveButton';
20
20
  import ConfirmDialog from '../ConfirmDialog/ConfirmDialog';
21
21
  import { SCCourseEditTabType } from '../../types/course';
22
+ import { getUrlEditDashboard } from '../../utils/course';
22
23
  const classes = {
23
24
  root: `${PREFIX}-root`,
24
25
  search: `${PREFIX}-search`,
@@ -28,7 +29,7 @@ const classes = {
28
29
  progressWrapper: `${PREFIX}-progress-wrapper`,
29
30
  progress: `${PREFIX}-progress`,
30
31
  loadingButton: `${PREFIX}-loading-button`,
31
- contrastColor: `${PREFIX}-contrast-color`
32
+ paperContrastColor: `${PREFIX}-paper-contrast-color`
32
33
  };
33
34
  const Root = styled(Box, {
34
35
  name: PREFIX,
@@ -52,6 +53,7 @@ function CourseUsersTable(inProps) {
52
53
  const inputRef = useRef(null);
53
54
  // CONTEXTS
54
55
  const scUserContext = useSCUser();
56
+ const scRoutingContext = useSCRouting();
55
57
  // INTL
56
58
  const intl = useIntl();
57
59
  // HANDLERS
@@ -145,10 +147,10 @@ function CourseUsersTable(inProps) {
145
147
  if (i === array.length - 1) {
146
148
  return _jsx(TableCell, { width: "14%" }, i);
147
149
  }
148
- return (_jsx(TableCell, Object.assign({ width: mode === SCCourseUsersTableModeType.DASHBOARD ? '20%' : '25%' }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i));
150
+ return (_jsx(TableCell, Object.assign({ width: mode === SCCourseUsersTableModeType.DASHBOARD ? '20%' : '25%' }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i));
149
151
  }) }) }), _jsxs(TableBody, { children: [users.length > 0 &&
150
- users.map((user, i) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Avatar, { alt: user.username, src: user.avatar }), _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: user.username }))] })) }), mode === SCCourseUsersTableModeType.DASHBOARD && (_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ className: classes.progressWrapper }, { children: [_jsx(LinearProgress, { className: classes.progress, variant: "determinate", value: user.user_completion_rate }), _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: `${Math.round(user.user_completion_rate)}%` }))] })) })), mode === SCCourseUsersTableModeType.EDIT && (_jsx(TableCell, { children: user.join_status !== SCCourseJoinStatusType.CREATOR && scUserContext.user.id !== user.id ? (_jsx(ChangeUserStatus, { course: course, user: user })) : (_jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: `ui.editCourse.tab.users.table.select.${user.join_status}`, defaultMessage: `ui.editCourse.tab.users.table.select.${user.join_status}` }) }))) })), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.joined_at || new Date() }) })) }), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.last_active_at || new Date() }) })) }), mode === SCCourseUsersTableModeType.EDIT &&
152
+ users.map((user, i) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Avatar, { alt: user.username, src: user.avatar }), _jsx(Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: user.username }))] })) }), mode === SCCourseUsersTableModeType.DASHBOARD && (_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ className: classes.progressWrapper }, { children: [_jsx(LinearProgress, { className: classes.progress, variant: "determinate", value: user.user_completion_rate }), _jsx(Typography, Object.assign({ variant: "body1", className: classes.paperContrastColor }, { children: `${Math.round(user.user_completion_rate)}%` }))] })) })), mode === SCCourseUsersTableModeType.EDIT && (_jsx(TableCell, { children: user.join_status !== SCCourseJoinStatusType.CREATOR && scUserContext.user.id !== user.id ? (_jsx(ChangeUserStatus, { course: course, user: user })) : (_jsx(Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: `ui.editCourse.tab.users.table.select.${user.join_status}`, defaultMessage: `ui.editCourse.tab.users.table.select.${user.join_status}` }) }))) })), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.joined_at || new Date() }) })) }), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.last_active_at || new Date() }) })) }), mode === SCCourseUsersTableModeType.EDIT &&
151
153
  user.join_status !== SCCourseJoinStatusType.CREATOR &&
152
- scUserContext.user.id !== user.id ? (_jsx(TableCell, { children: _jsx(RemoveButton, { ref: buttonRef, course: course, user: user, handleOpenDialog: handleOpenDialog }) })) : (mode === SCCourseUsersTableModeType.EDIT && _jsx(TableCell, {})), mode === SCCourseUsersTableModeType.DASHBOARD && (_jsx(TableCell, { children: _jsx(SeeProgressButton, { course: course, user: user }) })), mode === SCCourseUsersTableModeType.REQUESTS && (_jsx(TableCell, { children: _jsx(RequestButton, { ref: buttonRef, course: course, user: user, handleOpenDialog: handleOpenDialog }) }))] }, i))), state.isLoadingNext && _jsx(RowSkeleton, { editMode: mode !== SCCourseUsersTableModeType.DASHBOARD })] })] }) }), users.length > 0 && (_jsx(Button, Object.assign({ size: "small", variant: "contained", color: "inherit", loading: state.isLoadingNext, disabled: value.length > 0 || !state.next, className: classes.loadingButton, onClick: handleNext }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.btn.label", defaultMessage: "ui.courseUsersTable.btn.label" }) })) }))), users.length === 0 && (_jsx(EmptyStatus, { icon: "face", title: value.length > 0 ? 'ui.courseUsersTable.empty.search.title' : emptyStatusTitle, description: value.length > 0 ? 'ui.courseUsersTable.empty.search.description' : emptyStatusDescription })), dialog && _jsx(ConfirmDialog, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleConfirm })] })));
154
+ scUserContext.user.id !== user.id ? (_jsx(TableCell, { children: _jsx(RemoveButton, { ref: buttonRef, course: course, user: user, handleOpenDialog: handleOpenDialog }) })) : (mode === SCCourseUsersTableModeType.EDIT && _jsx(TableCell, {})), mode === SCCourseUsersTableModeType.DASHBOARD && (_jsx(TableCell, { children: _jsx(SeeProgressButton, { course: course, user: user }) })), mode === SCCourseUsersTableModeType.REQUESTS && (_jsx(TableCell, { children: _jsx(RequestButton, { ref: buttonRef, course: course, user: user, handleOpenDialog: handleOpenDialog }) }))] }, i))), state.isLoadingNext && _jsx(RowSkeleton, { editMode: mode !== SCCourseUsersTableModeType.DASHBOARD })] })] }) }), users.length > 0 && state.next && (_jsx(Button, Object.assign({ size: "small", variant: "contained", color: "inherit", loading: state.isLoadingNext, disabled: value.length > 0, className: classes.loadingButton, onClick: handleNext }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.btn.label", defaultMessage: "ui.courseUsersTable.btn.label" }) })) }))), users.length === 0 && (_jsx(EmptyStatus, { icon: "face", title: value.length > 0 ? 'ui.courseUsersTable.empty.search.title' : emptyStatusTitle, description: value.length > 0 ? 'ui.courseUsersTable.empty.search.description' : emptyStatusDescription, actions: value.length === 0 && (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_EDIT_ROUTE_NAME, getUrlEditDashboard(course, SCCourseEditTabType.USERS)), size: "small", variant: "contained", color: "primary" }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.empty.btn.label", defaultMessage: "ui.courseUsersTable.empty.btn.label" }) })) }))) })), dialog && _jsx(ConfirmDialog, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleConfirm })] })));
153
155
  }
154
156
  export default memo(CourseUsersTable);
@@ -17,7 +17,8 @@ const classes = {
17
17
  infoInnerWrapper: `${PREFIX}-info-inner-wrapper`,
18
18
  avatarWrapper: `${PREFIX}-avatar-wrapper`,
19
19
  avatar: `${PREFIX}-avatar`,
20
- contrastColor: `${PREFIX}-contrast-color`
20
+ paperContrastColor: `${PREFIX}-paper-contrast-color`,
21
+ dialogPaperContrastColor: `${PREFIX}-dialog-paper-contrast-color`
21
22
  };
22
23
  const DialogRoot = styled(BaseDialog, {
23
24
  name: PREFIX,
@@ -50,8 +51,8 @@ function SeeProgressButton(props) {
50
51
  const handleToggleOpen = useCallback(() => {
51
52
  setOpen((prev) => !prev);
52
53
  }, [setOpen]);
53
- return (_jsxs(Fragment, { children: [isMobile ? (_jsx(IconButton, Object.assign({ size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Icon, { children: "chevron_right" }) }))) : (_jsx(Button, Object.assign({ variant: "contained", size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.action.btn.label", defaultMessage: "ui.courseUsersTable.action.btn.label" }) })) }))), open && (_jsx(DialogRoot, Object.assign({ DialogContentProps: { dividers: isMobile }, open: true, scroll: "paper", onClose: handleToggleOpen, title: intl.formatMessage({ id: 'ui.courseUsersTable.dialog.title', defaultMessage: 'ui.courseUsersTable.dialog.title' }), className: classes.dialogRoot }, { children: _jsxs(Stack, Object.assign({ className: classes.contentWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoOuterWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoInnerWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Link, Object.assign({}, (!course.created_by.deleted && {
54
+ return (_jsxs(Fragment, { children: [isMobile ? (_jsx(IconButton, Object.assign({ size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Icon, { children: "chevron_right" }) }))) : (_jsx(Button, Object.assign({ variant: "contained", size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.action.btn.label", defaultMessage: "ui.courseUsersTable.action.btn.label" }) })) }))), open && (_jsx(DialogRoot, Object.assign({ DialogContentProps: { dividers: isMobile }, open: true, scroll: "paper", onClose: handleToggleOpen, title: intl.formatMessage({ id: 'ui.courseUsersTable.dialog.title', defaultMessage: 'ui.courseUsersTable.dialog.title' }), className: classes.dialogRoot }, { children: _jsxs(Stack, Object.assign({ className: classes.contentWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoOuterWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoInnerWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Link, Object.assign({}, (!course.created_by.deleted && {
54
55
  to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, course.created_by)
55
- }), { children: _jsx(UserAvatar, Object.assign({ hide: !course.created_by.community_badge, smaller: true }, { children: _jsx(Avatar, { className: classes.avatar, src: user.avatar, alt: user.username }) })) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: user.username }))] })), privateMessagingEnabled && (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, user), variant: "contained", size: "small", color: "inherit" }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.btn.label", defaultMessage: "ui.courseUsersTable.dialog.btn.label" }) })) })))] })), student ? (_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text1", defaultMessage: "ui.courseUsersTable.dialog.info.text1", values: { lessonsCompleted: student.num_lessons_completed } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" })), student ? (_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text2", defaultMessage: "ui.courseUsersTable.dialog.info.text2", values: { courseCompleted: student.user_completion_rate } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" }))] })), _jsx(AccordionLessons, { course: student, viewerJoinStatus: course.join_status })] })) })))] }));
56
+ }), { children: _jsx(UserAvatar, Object.assign({ hide: !course.created_by.community_badge, smaller: true }, { children: _jsx(Avatar, { className: classes.avatar, src: user.avatar, alt: user.username }) })) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.dialogPaperContrastColor }, { children: user.username }))] })), privateMessagingEnabled && (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, user), variant: "contained", size: "small", color: "inherit" }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.dialogPaperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.btn.label", defaultMessage: "ui.courseUsersTable.dialog.btn.label" }) })) })))] })), student ? (_jsx(Typography, Object.assign({ variant: "body1", className: classes.dialogPaperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text1", defaultMessage: "ui.courseUsersTable.dialog.info.text1", values: { lessonsCompleted: student.num_lessons_completed } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" })), student ? (_jsx(Typography, Object.assign({ variant: "body1", className: classes.dialogPaperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text2", defaultMessage: "ui.courseUsersTable.dialog.info.text2", values: { courseCompleted: student.user_completion_rate } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" }))] })), _jsx(AccordionLessons, { course: student, viewerJoinStatus: course.join_status })] })) })))] }));
56
57
  }
57
58
  export default memo(SeeProgressButton);
@@ -38,3 +38,8 @@ export interface SCCourseGetUrlLessonData {
38
38
  section_id: number;
39
39
  lesson_id: number;
40
40
  }
41
+ export interface SCDataUrlEditDashboard {
42
+ id: number;
43
+ slug: string;
44
+ tab: SCCourseEditTabType;
45
+ }
@@ -1,5 +1,5 @@
1
1
  import { SCCourseLessonType, SCCourseSectionType, SCCourseType } from '@selfcommunity/types';
2
- import { SCCourseGetUrlLessonData } from '../types/course';
2
+ import { SCCourseEditTabType, SCCourseGetUrlLessonData, SCDataUrlEditDashboard } from '../types/course';
3
3
  export declare function isCourseNew(course: SCCourseType | null): boolean;
4
4
  export declare function isCourseCompleted(course: SCCourseType | null): boolean;
5
5
  declare enum unitType {
@@ -11,4 +11,5 @@ export declare function getDripDelayAndUnit(value: number): {
11
11
  _unit: unitType;
12
12
  };
13
13
  export declare function getUrlLesson(course: SCCourseType, lesson: Partial<SCCourseLessonType>, section?: SCCourseSectionType): SCCourseGetUrlLessonData;
14
+ export declare function getUrlEditDashboard(course: SCCourseType, tab: SCCourseEditTabType): SCDataUrlEditDashboard;
14
15
  export {};
@@ -30,3 +30,10 @@ export function getUrlLesson(course, lesson, section) {
30
30
  lesson_id: lesson.id
31
31
  };
32
32
  }
33
+ export function getUrlEditDashboard(course, tab) {
34
+ return {
35
+ id: course.id,
36
+ slug: course.slug,
37
+ tab
38
+ };
39
+ }