@selfcommunity/react-ui 1.1.0 → 1.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/AcceptRequestUserEventButton/AcceptRequestUserEventButton.js +1 -1
- package/lib/cjs/components/CategoryAutocomplete/CategoryAutocomplete.js +8 -7
- package/lib/cjs/components/CategoryAutocomplete/constants.d.ts +1 -0
- package/lib/cjs/components/CategoryAutocomplete/constants.js +4 -0
- package/lib/cjs/components/CategoryFollowButton/CategoryFollowButton.js +2 -2
- package/lib/cjs/components/Course/Course.js +2 -2
- package/lib/cjs/components/CourseCompletedDialog/CourseCompletedDialog.js +11 -9
- package/lib/cjs/components/CourseCompletedDialog/constants.d.ts +1 -0
- package/lib/cjs/components/CourseCompletedDialog/constants.js +4 -0
- package/lib/cjs/components/CourseContentMenu/CourseContentMenu.js +1 -1
- package/lib/cjs/components/CourseDashboard/Student.d.ts +2 -2
- package/lib/cjs/components/CourseDashboard/Student.js +6 -6
- package/lib/cjs/components/CourseDashboard/Teacher/Comments.js +2 -2
- package/lib/cjs/components/CourseDashboard/Teacher/Info.js +3 -2
- package/lib/cjs/components/CourseForm/CourseForm.js +5 -4
- package/lib/cjs/components/CourseForm/Dialog.js +5 -1
- package/lib/cjs/components/CourseForm/Edit.js +5 -4
- package/lib/cjs/components/CourseParticipantsButton/CourseParticipantsButton.js +4 -4
- package/lib/cjs/components/EditCourse/Lessons/AddButton.js +3 -2
- package/lib/cjs/components/EditCourse/Lessons/ChangeLessonStatus.js +6 -4
- package/lib/cjs/components/EditCourse/Lessons/FieldName.js +3 -2
- package/lib/cjs/components/EditCourse/Lessons/LessonRow.js +3 -2
- package/lib/cjs/components/EditCourse/Lessons/SectionRow.js +3 -2
- package/lib/cjs/components/EditCourse/Lessons.js +3 -3
- package/lib/cjs/components/EditCourse/Options/SwitchForm.js +5 -1
- package/lib/cjs/components/EditCourse/Options.js +3 -2
- package/lib/cjs/components/Event/Event.js +3 -3
- package/lib/cjs/components/EventInviteButton/EventInviteButton.js +1 -1
- package/lib/cjs/components/FollowUserButton/FollowUserButton.js +2 -2
- package/lib/cjs/components/FriendshipUserButton/FriendshipUserButton.js +1 -1
- package/lib/cjs/components/Group/Group.js +1 -1
- package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.js +2 -2
- package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +1 -1
- package/lib/cjs/components/IncubatorSubscribeButton/IncubatorSubscribeButton.js +2 -2
- package/lib/cjs/components/LessonDrawer/LessonDrawer.js +3 -2
- package/lib/cjs/components/LessonEditForm/LessonEditForm.js +3 -2
- package/lib/cjs/components/LessonReleaseMenu/LessonReleaseMenu.js +4 -3
- package/lib/cjs/components/LoyaltyProgramWidget/LoyaltyProgramWidget.js +1 -1
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +1 -1
- package/lib/cjs/components/PlatformWidget/PlatformWidget.js +4 -4
- package/lib/cjs/shared/AccordionLessons/AccordionLessons.js +5 -4
- package/lib/cjs/shared/AutoPlayer/index.js +7 -2
- package/lib/cjs/shared/ConfirmDialog/ConfirmDialog.js +11 -3
- package/lib/cjs/shared/CourseUsersTable/ChangeUsersStatus.js +5 -1
- package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.js +5 -4
- package/lib/cjs/shared/CourseUsersTable/RemoveButton.js +1 -1
- package/lib/cjs/shared/CourseUsersTable/RequestButton.js +1 -1
- package/lib/cjs/shared/CourseUsersTable/SeeProgressButton.js +5 -3
- package/lib/cjs/shared/EmptyStatus/EmptyStatus.js +3 -2
- package/lib/cjs/shared/Media/File/DocComponent.js +3 -2
- package/lib/esm/components/AcceptRequestUserEventButton/AcceptRequestUserEventButton.js +1 -1
- package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +8 -7
- package/lib/esm/components/CategoryAutocomplete/constants.d.ts +1 -0
- package/lib/esm/components/CategoryAutocomplete/constants.js +1 -0
- package/lib/esm/components/CategoryFollowButton/CategoryFollowButton.js +2 -2
- package/lib/esm/components/Course/Course.js +2 -2
- package/lib/esm/components/CourseCompletedDialog/CourseCompletedDialog.js +5 -3
- package/lib/esm/components/CourseCompletedDialog/constants.d.ts +1 -0
- package/lib/esm/components/CourseCompletedDialog/constants.js +1 -0
- package/lib/esm/components/CourseContentMenu/CourseContentMenu.js +1 -1
- package/lib/esm/components/CourseDashboard/Student.d.ts +2 -2
- package/lib/esm/components/CourseDashboard/Student.js +6 -6
- package/lib/esm/components/CourseDashboard/Teacher/Comments.js +2 -2
- package/lib/esm/components/CourseDashboard/Teacher/Info.js +3 -2
- package/lib/esm/components/CourseForm/CourseForm.js +5 -4
- package/lib/esm/components/CourseForm/Dialog.js +5 -1
- package/lib/esm/components/CourseForm/Edit.js +5 -4
- package/lib/esm/components/CourseParticipantsButton/CourseParticipantsButton.js +4 -4
- package/lib/esm/components/EditCourse/Lessons/AddButton.js +3 -2
- package/lib/esm/components/EditCourse/Lessons/ChangeLessonStatus.js +6 -4
- package/lib/esm/components/EditCourse/Lessons/FieldName.js +3 -2
- package/lib/esm/components/EditCourse/Lessons/LessonRow.js +3 -2
- package/lib/esm/components/EditCourse/Lessons/SectionRow.js +3 -2
- package/lib/esm/components/EditCourse/Lessons.js +3 -3
- package/lib/esm/components/EditCourse/Options/SwitchForm.js +5 -1
- package/lib/esm/components/EditCourse/Options.js +3 -2
- package/lib/esm/components/Event/Event.js +3 -3
- package/lib/esm/components/EventInviteButton/EventInviteButton.js +1 -1
- package/lib/esm/components/FollowUserButton/FollowUserButton.js +2 -2
- package/lib/esm/components/FriendshipUserButton/FriendshipUserButton.js +1 -1
- package/lib/esm/components/Group/Group.js +1 -1
- package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.js +2 -2
- package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +1 -1
- package/lib/esm/components/IncubatorSubscribeButton/IncubatorSubscribeButton.js +2 -2
- package/lib/esm/components/LessonDrawer/LessonDrawer.js +3 -2
- package/lib/esm/components/LessonEditForm/LessonEditForm.js +4 -3
- package/lib/esm/components/LessonReleaseMenu/LessonReleaseMenu.js +4 -3
- package/lib/esm/components/LoyaltyProgramWidget/LoyaltyProgramWidget.js +1 -1
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +1 -1
- package/lib/esm/components/PlatformWidget/PlatformWidget.js +4 -4
- package/lib/esm/shared/AccordionLessons/AccordionLessons.js +5 -4
- package/lib/esm/shared/AutoPlayer/index.js +7 -2
- package/lib/esm/shared/ConfirmDialog/ConfirmDialog.js +12 -4
- package/lib/esm/shared/CourseUsersTable/ChangeUsersStatus.js +5 -1
- package/lib/esm/shared/CourseUsersTable/CourseUsersTable.js +5 -4
- package/lib/esm/shared/CourseUsersTable/RemoveButton.js +1 -1
- package/lib/esm/shared/CourseUsersTable/RequestButton.js +1 -1
- package/lib/esm/shared/CourseUsersTable/SeeProgressButton.js +6 -4
- package/lib/esm/shared/EmptyStatus/EmptyStatus.js +3 -2
- package/lib/esm/shared/Media/File/DocComponent.js +3 -2
- package/lib/umd/484.js +1 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +8 -8
|
@@ -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: (
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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;
|
|
@@ -85,5 +85,5 @@ export default function AcceptRequestUserEventButton(inProps) {
|
|
|
85
85
|
Logger.error(SCOPE_SC_UI, error);
|
|
86
86
|
});
|
|
87
87
|
}, [scEvent, scUser]);
|
|
88
|
-
return (_jsxs(_Fragment, { children: [_jsx(AcceptButton, Object.assign({ size: "small", variant: "
|
|
88
|
+
return (_jsxs(_Fragment, { children: [_jsx(AcceptButton, Object.assign({ size: "small", variant: "contained", onClick: () => setOpenDialog(true), loading: loading, className: classNames(classes.root, className) }, rest, { children: _jsx(FormattedMessage, { defaultMessage: "ui.acceptRequestUserEventButton.accept", id: "ui.acceptRequestUserEventButton.accept" }) })), openDialog && (_jsx(ConfirmDialog, { open: openDialog, title: _jsx(FormattedMessage, { id: "ui.acceptRequestUserEventButton.dialog.title", defaultMessage: "ui.acceptRequestUserEventButton.dialog.title" }), content: _jsx(FormattedMessage, { id: "ui.acceptRequestUserEventButton.dialog.msg", defaultMessage: "ui.acceptRequestUserEventButton.dialog.msg" }), btnConfirm: _jsx(FormattedMessage, { id: "ui.acceptRequestUserEventButton.dialog.confirm", defaultMessage: "ui.acceptRequestUserEventButton.dialog.confirm" }), isUpdating: loading, onConfirm: handleConfirmAction, onClose: () => setOpenDialog(false) }))] }));
|
|
89
89
|
}
|
|
@@ -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 {
|
|
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
|
-
|
|
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:
|
|
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';
|
|
@@ -102,7 +102,7 @@ export default function CategoryFollowButton(inProps) {
|
|
|
102
102
|
return null;
|
|
103
103
|
}
|
|
104
104
|
if (scUserContext.user && (scCategoriesManager.isLoading(scCategory) || followed === null)) {
|
|
105
|
-
return (_jsx(Root, Object.assign({ size: "small", variant: "
|
|
105
|
+
return (_jsx(Root, Object.assign({ size: "small", variant: "contained", loading: true, className: classNames(classes.root, className) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.categoryFollowButton.follow", id: "ui.categoryFollowButton.follow" }) })));
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* if the category is a paid content and it isn't followed show the Buy button
|
|
@@ -115,5 +115,5 @@ export default function CategoryFollowButton(inProps) {
|
|
|
115
115
|
(!followed || scCategoriesManager.isLoading(scCategory))) {
|
|
116
116
|
return _jsx(BuyButton, { contentType: SCContentType.CATEGORY, content: scCategory, disabled: disableBuyContentIfPaidContent });
|
|
117
117
|
}
|
|
118
|
-
return (_jsx(Root, Object.assign({ size: "small", variant: "
|
|
118
|
+
return (_jsx(Root, Object.assign({ size: "small", variant: "contained", onClick: handleFollowAction, loading: scUserContext.user ? scCategoriesManager.isLoading(scCategory) : null, className: classNames(classes.root, className), disabled: isActionFollowDisabled }, rest, { children: followed && scUserContext.user ? (_jsx(FormattedMessage, { defaultMessage: "ui.categoryFollowButton.unfollow", id: "ui.categoryFollowButton.unfollow" })) : (_jsx(FormattedMessage, { defaultMessage: "ui.categoryFollowButton.follow", id: "ui.categoryFollowButton.follow" })) })));
|
|
119
119
|
}
|
|
@@ -163,7 +163,7 @@ export default function Course(inProps) {
|
|
|
163
163
|
to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
164
164
|
}), { children: _jsx(UserAvatar, Object.assign({ hide: !((_b = scCourse.created_by) === null || _b === void 0 ? void 0 : _b.community_badge), smaller: true }, { children: _jsx(Avatar, { alt: scCourse.name, src: (_c = scCourse.created_by) === null || _c === void 0 ? void 0 : _c.avatar, className: classes.previewAvatar }) })) }))] })), _jsxs(CardContent, Object.assign({ className: classes.previewContent }, { children: [_jsx(Link, Object.assign({ className: classes.previewCreator }, (!((_d = scCourse.created_by) === null || _d === void 0 ? void 0 : _d.deleted) && {
|
|
165
165
|
to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
166
|
-
}), { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: (_e = scCourse.created_by) === null || _e === void 0 ? void 0 : _e.username })) })), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse), className: classes.previewNameWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h6", className: classes.previewName }, { children: scCourse.name })) })), _jsx(Stack, { children: _jsxs(Typography, Object.assign({ className: classes.previewInfo }, { children: [_jsx(FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', _jsx(FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` }), isPaymentsEnabled && ((_f = scCourse.paywalls) === null || _f === void 0 ? void 0 : _f.length) && (_jsxs(_Fragment, { children: ["\u00A0", _jsx(Icon, { children: "pagamenti" })] }))] })) }), _jsxs(Box, Object.assign({ className: classes.previewCategory }, { children: [scCourse.categories.slice(0, MAX_VISIBLE_CATEGORIES).map((category) => (_jsx(Chip, { size: "small", label: category.name }, category.id))), scCourse.categories.length > MAX_VISIBLE_CATEGORIES && (_jsx(Tooltip, Object.assign({ title: _jsx(_Fragment, { children: scCourse.categories.slice(MAX_VISIBLE_CATEGORIES).map((cat) => (_jsx(Box, { children: cat.name }, cat.id))) }) }, { children: _jsx(Chip, { size: "small", label: `+${scCourse.categories.length - MAX_VISIBLE_CATEGORIES}`, sx: { cursor: 'pointer' } }) })))] })), _jsx(Box, Object.assign({ className: classes.previewProgress }, { children: renderProgress() }))] })), actions !== null && actions !== void 0 ? actions : (_jsx(CardActions, Object.assign({ className: classes.previewActions }, { children: _jsx(Button, Object.assign({ variant: "
|
|
166
|
+
}), { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: (_e = scCourse.created_by) === null || _e === void 0 ? void 0 : _e.username })) })), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse), className: classes.previewNameWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h6", className: classes.previewName }, { children: scCourse.name })) })), _jsx(Stack, { children: _jsxs(Typography, Object.assign({ className: classes.previewInfo }, { children: [_jsx(FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', _jsx(FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` }), isPaymentsEnabled && ((_f = scCourse.paywalls) === null || _f === void 0 ? void 0 : _f.length) && (_jsxs(_Fragment, { children: ["\u00A0", _jsx(Icon, { children: "pagamenti" })] }))] })) }), _jsxs(Box, Object.assign({ className: classes.previewCategory }, { children: [scCourse.categories.slice(0, MAX_VISIBLE_CATEGORIES).map((category) => (_jsx(Chip, { size: "small", label: category.name }, category.id))), scCourse.categories.length > MAX_VISIBLE_CATEGORIES && (_jsx(Tooltip, Object.assign({ title: _jsx(_Fragment, { children: scCourse.categories.slice(MAX_VISIBLE_CATEGORIES).map((cat) => (_jsx(Box, { children: cat.name }, cat.id))) }) }, { children: _jsx(Chip, { size: "small", label: `+${scCourse.categories.length - MAX_VISIBLE_CATEGORIES}`, sx: { cursor: 'pointer' } }) })))] })), _jsx(Box, Object.assign({ className: classes.previewProgress }, { children: renderProgress() }))] })), actions !== null && actions !== void 0 ? actions : (_jsx(CardActions, Object.assign({ className: classes.previewActions }, { children: _jsx(Button, Object.assign({ variant: "contained", size: "small", component: Link, to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.course.see", id: "ui.course.see" }) })) })))] })));
|
|
167
167
|
}
|
|
168
168
|
else {
|
|
169
169
|
contentObj = (_jsx(SnippetRoot, { elevation: 0, className: classes.snippetRoot, image: _jsxs(Box, Object.assign({ className: classes.snippetImage }, { children: [_jsx(Avatar, { variant: "square", alt: scCourse.name, src: scCourse.image_medium, className: userProfileSnippet ? classes.snippetAvatarUserProfile : classes.snippetAvatar }), !userProfileSnippet &&
|
|
@@ -175,7 +175,7 @@ export default function Course(inProps) {
|
|
|
175
175
|
? 'warning'
|
|
176
176
|
: 'secondary', label: chipLabel, className: classes.chip }))] })), primary: _jsxs(_Fragment, { children: [!userProfileSnippet && (_jsx(Link, Object.assign({}, (!((_g = scCourse.created_by) === null || _g === void 0 ? void 0 : _g.deleted) && {
|
|
177
177
|
to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scCourse.created_by)
|
|
178
|
-
}), { children: _jsx(Typography, Object.assign({ component: "span" }, { children: (_h = scCourse.created_by) === null || _h === void 0 ? void 0 : _h.username })) }))), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: scCourse.name })) }))] }), secondary: _jsx(_Fragment, { children: userProfileSnippet ? (_jsx(_Fragment, { children: !scCourse.hide_member_count && (_jsx(FormattedMessage, { id: "ui.course.userProfileSnippet.students", defaultMessage: "ui.course.userProfileSnippet.students", values: { students: scCourse.member_count } })) })) : (_jsxs(Stack, Object.assign({ className: classes.snippetPrivacy }, { children: [_jsx(FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', _jsx(FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` }), isPaymentsEnabled && ((_j = scCourse.paywalls) === null || _j === void 0 ? void 0 : _j.length) && (_jsxs(_Fragment, { children: ["\u00A0", _jsx(Icon, Object.assign({ fontSize: "inherit" }, { children: "pagamenti" }))] }))] }))) }), actions: actions !== null && actions !== void 0 ? actions : (_jsx(Button, Object.assign({ size: "small", variant: "
|
|
178
|
+
}), { children: _jsx(Typography, Object.assign({ component: "span" }, { children: (_h = scCourse.created_by) === null || _h === void 0 ? void 0 : _h.username })) }))), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: scCourse.name })) }))] }), secondary: _jsx(_Fragment, { children: userProfileSnippet ? (_jsx(_Fragment, { children: !scCourse.hide_member_count && (_jsx(FormattedMessage, { id: "ui.course.userProfileSnippet.students", defaultMessage: "ui.course.userProfileSnippet.students", values: { students: scCourse.member_count } })) })) : (_jsxs(Stack, Object.assign({ className: classes.snippetPrivacy }, { children: [_jsx(FormattedMessage, { id: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft', defaultMessage: scCourse.privacy ? `ui.course.privacy.${scCourse.privacy}` : 'ui.course.privacy.draft' }), ' - ', _jsx(FormattedMessage, { id: `ui.course.type.${scCourse.type}`, defaultMessage: `ui.course.type.${scCourse.type}` }), isPaymentsEnabled && ((_j = scCourse.paywalls) === null || _j === void 0 ? void 0 : _j.length) && (_jsxs(_Fragment, { children: ["\u00A0", _jsx(Icon, Object.assign({ fontSize: "inherit" }, { children: "pagamenti" }))] }))] }))) }), actions: actions !== null && actions !== void 0 ? actions : (_jsx(Button, Object.assign({ size: "small", variant: "contained", component: Link, to: scRoutingContext.url(SCRoutes.COURSE_ROUTE_NAME, scCourse) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.course.see", id: "ui.course.see" }) }))) }));
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Renders root object
|
|
@@ -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
|
-
|
|
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: (
|
|
21
|
+
overridesResolver: (_props, styles) => [styles.root]
|
|
22
22
|
})(() => ({}));
|
|
23
23
|
export default function CourseContentMenu(inProps) {
|
|
24
24
|
// PROPS
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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:
|
|
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: "
|
|
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 ? '
|
|
187
|
-
(scCourse.join_status === null || scCourse.join_status === SCCourseJoinStatusType.REQUESTED) ? (_jsx(ActionButton, { labelId: sentRequest ? BUTTON_MESSAGES.cancel : BUTTON_MESSAGES.request, color: "inherit", variant: "
|
|
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
|
}
|
|
@@ -95,11 +95,11 @@ function Comments(props) {
|
|
|
95
95
|
map.set(name, [...map.get(name), comment]);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
return Array.from(map.entries()).map(([name, comments]) => (_jsxs(Box, Object.assign({ className: classes.outerWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h5" }, { children: name })), _jsx(Divider, {}), _jsxs(Stack, Object.assign({ className: classes.innerWrapper }, { children: [comments.map((comment) => (_jsxs(Stack, Object.assign({ className: classes.userWrapper }, { children: [_jsx(Avatar, { src: comment.created_by.avatar, alt: comment.created_by.username, className: classes.avatar }), _jsxs(Box, { children: [_jsxs(Stack, Object.assign({ className: classes.userInfo }, { children: [_jsx(Typography, Object.assign({ variant: "body1" }, { children: comment.created_by.username })), _jsx(Box, { className: classes.circle }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedDate, { value: comment.created_at }) }))] })), _jsx(Typography, { variant: "body1", component: "div", dangerouslySetInnerHTML: { __html: comment.html } })] })] }), comment.id))), _jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_COMMENTS_ROUTE_NAME, getUrlLesson(comments[0].extras.course, comments[0].extras.lesson, comments[0].extras.section)), size: "small", variant: "
|
|
98
|
+
return Array.from(map.entries()).map(([name, comments]) => (_jsxs(Box, Object.assign({ className: classes.outerWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: name })), _jsx(Divider, {}), _jsxs(Stack, Object.assign({ className: classes.innerWrapper }, { children: [comments.map((comment) => (_jsxs(Stack, Object.assign({ className: classes.userWrapper }, { children: [_jsx(Avatar, { src: comment.created_by.avatar, alt: comment.created_by.username, className: classes.avatar }), _jsxs(Box, { children: [_jsxs(Stack, Object.assign({ className: classes.userInfo }, { children: [_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: comment.created_by.username })), _jsx(Box, { className: classes.circle }), _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedDate, { value: comment.created_at }) }))] })), _jsx(Typography, { variant: "body1", component: "div", dangerouslySetInnerHTML: { __html: comment.html }, className: classes.contrastColor })] })] }), comment.id))), _jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_COMMENTS_ROUTE_NAME, getUrlLesson(comments[0].extras.course, comments[0].extras.lesson, comments[0].extras.section)), size: "small", variant: "contained", color: "inherit", className: classes.button }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label", defaultMessage: "ui.course.dashboard.teacher.tab.comments.lessons.btn.label" }) })) }))] }))] }), name)));
|
|
99
99
|
}, [state.results]);
|
|
100
100
|
if (!state.initialized) {
|
|
101
101
|
return _jsx(CommentsSkeleton, {});
|
|
102
102
|
}
|
|
103
|
-
return (_jsx(Box, Object.assign({ className: classes.container }, { children: state.count > 0 ? (_jsxs(Fragment, { children: [_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.number", defaultMessage: "ui.course.dashboard.teacher.tab.comments.number", values: { commentsNumber: state.count } }) })), renderComments, isLoading && _jsx(CommentSkeleton, { id: 1 }), _jsx(Button, Object.assign({ size: "small", variant: "
|
|
103
|
+
return (_jsx(Box, Object.assign({ className: classes.container }, { children: state.count > 0 ? (_jsxs(Fragment, { children: [_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.number", defaultMessage: "ui.course.dashboard.teacher.tab.comments.number", values: { commentsNumber: state.count } }) })), renderComments, isLoading && _jsx(CommentSkeleton, { id: 1 }), _jsx(Button, Object.assign({ size: "small", variant: "contained", color: "inherit", loading: isLoading, disabled: !state.next, onClick: handleNext }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.btn.label", defaultMessage: "ui.course.dashboard.teacher.tab.comments.btn.label" }) })) }))] })) : (_jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.dashboard.teacher.tab.comments.empty", defaultMessage: "ui.course.dashboard.teacher.tab.comments.empty" }) }))) })));
|
|
104
104
|
}
|
|
105
105
|
export default memo(Comments);
|
|
@@ -6,11 +6,12 @@ import CourseParticipantsButton from '../../CourseParticipantsButton';
|
|
|
6
6
|
import { memo } from 'react';
|
|
7
7
|
import { InfoPositionType } from '../types';
|
|
8
8
|
const classes = {
|
|
9
|
-
info: `${PREFIX}-info
|
|
9
|
+
info: `${PREFIX}-info`,
|
|
10
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
10
11
|
};
|
|
11
12
|
function InfoCourseDashboard(props) {
|
|
12
13
|
// PROPS
|
|
13
14
|
const { title, course, position } = props;
|
|
14
|
-
return (_jsxs(Stack, Object.assign({ className: classes.info }, { children: [_jsx(Typography, Object.assign({ variant: "h4" }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })), position === InfoPositionType.FIRST && _jsx(CourseParticipantsButton, { course: course }), position === InfoPositionType.SECOND && _jsxs(Typography, Object.assign({ variant: "h5" }, { children: [course.avg_completion_rate, "%"] }))] })));
|
|
15
|
+
return (_jsxs(Stack, Object.assign({ className: classes.info }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })), position === InfoPositionType.FIRST && _jsx(CourseParticipantsButton, { course: course }), position === InfoPositionType.SECOND && (_jsxs(Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: [course.avg_completion_rate, "%"] })))] })));
|
|
15
16
|
}
|
|
16
17
|
export default memo(InfoCourseDashboard);
|
|
@@ -280,13 +280,14 @@ export default function CourseForm(inProps) {
|
|
|
280
280
|
/**
|
|
281
281
|
* Renders root object
|
|
282
282
|
*/
|
|
283
|
-
return (_jsxs(Fragment, { children: [_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(Box, Object.assign({ className: _step === SCCourseFormStepType.GENERAL ? classes.stepOne : classes.stepTwo }, { children: [_step === SCCourseFormStepType.GENERAL &&
|
|
283
|
+
return (_jsxs(Fragment, { children: [_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(Box, Object.assign({ className: _step === SCCourseFormStepType.GENERAL ? classes.stepOne : classes.stepTwo }, { children: [_step === SCCourseFormStepType.GENERAL &&
|
|
284
|
+
Object.values(SCCourseTypologyType).map((option, index) => (_jsx(Card, Object.assign({ className: classNames(classes.card, { [classes.selected]: option === field.type }, { [classes.disabled]: !courseAdvancedEnabled && option !== SCCourseTypologyType.SELF }) }, { children: _jsx(CardActionArea, Object.assign({ onClick: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['type']: option }))) }, { children: _jsxs(CardContent, { children: [_jsxs(Typography, Object.assign({ variant: "subtitle2", className: classNames(classes.cardTitle, classes.contrastColor) }, { children: [_jsx(FormattedMessage, { id: `ui.courseForm.${option}.title`, defaultMessage: `ui.courseForm.${option}.title` }), !courseAdvancedEnabled && option !== SCCourseTypologyType.SELF && (_jsx(Chip, { variant: "outlined", color: "warning", size: "small", label: _jsx(FormattedMessage, { id: "ui.courseForm.comingSoon.chip", defaultMessage: "ui.courseForm.comingSoon.chip" }) }))] })), _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: `ui.courseForm.${option}.info`, defaultMessage: `ui.courseForm.${option}.info` }) }))] }) })) }), index))), _step === SCCourseFormStepType.CUSTOMIZATION && (_jsxs(Fragment, { children: [course && (_jsx(Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.title.general", defaultMessage: "ui.courseForm.edit.title.general" }) }))), _jsxs(FormGroup, Object.assign({ className: classNames(classes.form, _step === SCCourseFormStepType.CUSTOMIZATION && course ? classes.stepCustomization : undefined) }, { children: [_jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(UploadCourseCover, { isUploading: field.isSubmitting, onChange: handleChangeCover }) })), _jsx(TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, slotProps: {
|
|
284
285
|
input: {
|
|
285
|
-
endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: COURSE_TITLE_MAX_LENGTH - field.name.length }))
|
|
286
|
+
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: COURSE_TITLE_MAX_LENGTH - field.name.length })))
|
|
286
287
|
}
|
|
287
288
|
}, error: Boolean((!!course && !field.name) || field.name.length > COURSE_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: !!course && !field.name ? (_jsx(FormattedMessage, { id: "ui.courseForm.required", defaultMessage: "ui.courseForm.required" })) : field.name.length > COURSE_TITLE_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.courseForm.name.error.maxLength", defaultMessage: "ui.courseForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), _jsx(TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, slotProps: {
|
|
288
289
|
input: {
|
|
289
|
-
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) ? COURSE_DESCRIPTION_MAX_LENGTH - field.description.length : COURSE_DESCRIPTION_MAX_LENGTH })))
|
|
290
|
+
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) ? COURSE_DESCRIPTION_MAX_LENGTH - field.description.length : COURSE_DESCRIPTION_MAX_LENGTH })))
|
|
290
291
|
}
|
|
291
292
|
}, error: Boolean((!!field.privacy && !field.description) || ((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > COURSE_DESCRIPTION_MAX_LENGTH), helperText: !!field.privacy && !field.description ? (_jsx(FormattedMessage, { id: "ui.courseForm.required", defaultMessage: "ui.courseForm.required" })) : (((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) > COURSE_DESCRIPTION_MAX_LENGTH && (_jsx(FormattedMessage, { id: "ui.courseForm.description.error.maxLength", defaultMessage: "ui.courseForm.description.error.maxLength" }))) }), _jsx(CategoryAutocomplete, { defaultValue: field.categories, TextFieldProps: { label: intl.formatMessage(Object.keys(field.categories).length ? messages.category : messages.categoryEmpty) }, multiple: true, onChange: handleOnChangeCategory }), course && _jsx(CourseEdit, { course: course, onPrivacyChange: (privacy) => setField((prev) => (Object.assign(Object.assign({}, prev), { ['privacy']: privacy }))) }), isPaymentsEnabled && isStaff && !hidePaywalls && (_jsx(Box, Object.assign({ className: classes.paywallsConfiguratorWrap }, { children: _jsx(PaywallsConfigurator, Object.assign({}, (course && { contentId: course.id }), { contentType: SCContentType.COURSE, onChangeContentAccessType: handleChangeContentAccessType, onChangePaymentProducts: handleChangePaymentsProducts })) })))] }))] })), _jsx(Box, Object.assign({ className: classNames(classes.actions, _step === SCCourseFormStepType.CUSTOMIZATION && course ? classes.stepCustomization : undefined) }, { children: _jsx(Button, Object.assign({ size: "small", loading: field.isSubmitting, disabled: _step === SCCourseFormStepType.GENERAL
|
|
292
293
|
? !field.type || Object.keys(error).length !== 0
|
|
@@ -299,5 +300,5 @@ export default function CourseForm(inProps) {
|
|
|
299
300
|
? () => handleChangeStep(SCCourseFormStepType.CUSTOMIZATION)
|
|
300
301
|
: field.privacy !== SCCoursePrivacyType.DRAFT && course.privacy === SCCoursePrivacyType.DRAFT
|
|
301
302
|
? () => setOpenDialog(true)
|
|
302
|
-
: handleSubmit, color: "primary" }, { children: course ? (_jsx(FormattedMessage, { id: "ui.courseForm.edit.action.save", defaultMessage: "ui.courseForm.edit.action.save" })) : _step === SCCourseFormStepType.GENERAL ? (_jsx(FormattedMessage, { id: "ui.courseForm.button.next", defaultMessage: "ui.courseForm.button.next" })) : (_jsx(FormattedMessage, { id: "ui.courseForm.button.create", defaultMessage: "ui.courseForm.button.create" })) })) }))] })) })), openDialog && _jsx(CoursePublicationDialog, { onSubmit: handleSubmit, onClose: handleClose })] }));
|
|
303
|
+
: handleSubmit, color: "primary" }, { children: course ? (_jsx(Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.action.save", defaultMessage: "ui.courseForm.edit.action.save" }) }))) : _step === SCCourseFormStepType.GENERAL ? (_jsx(Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.button.next", defaultMessage: "ui.courseForm.button.next" }) }))) : (_jsx(Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.button.create", defaultMessage: "ui.courseForm.button.create" }) }))) })) }))] })) })), openDialog && _jsx(CoursePublicationDialog, { onSubmit: handleSubmit, onClose: handleClose })] }));
|
|
303
304
|
}
|
|
@@ -3,6 +3,10 @@ import { Button, Typography } from '@mui/material';
|
|
|
3
3
|
import BaseDialog from '../../shared/BaseDialog';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
import { memo, useCallback } from 'react';
|
|
6
|
+
import { PREFIX } from './constants';
|
|
7
|
+
const classes = {
|
|
8
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
9
|
+
};
|
|
6
10
|
function CoursePublicationDialog(props) {
|
|
7
11
|
// PROPS
|
|
8
12
|
const { onSubmit, onClose } = props;
|
|
@@ -11,6 +15,6 @@ function CoursePublicationDialog(props) {
|
|
|
11
15
|
onSubmit();
|
|
12
16
|
onClose();
|
|
13
17
|
}, [onSubmit, onClose]);
|
|
14
|
-
return (_jsx(BaseDialog, Object.assign({ open: true, DialogContentProps: { dividers: false }, onClose: onClose, title: _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.dialog.title", defaultMessage: "ui.courseForm.edit.dialog.title" }) })), actions: _jsx(Button, Object.assign({ size: "small", color: "primary", variant: "contained", onClick: handleSubmit }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.dialog.btn", defaultMessage: "ui.courseForm.edit.dialog.btn" }) })) })) }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.dialog.description", defaultMessage: "ui.courseForm.edit.dialog.description" }) })) })));
|
|
18
|
+
return (_jsx(BaseDialog, Object.assign({ open: true, DialogContentProps: { dividers: false }, onClose: onClose, title: _jsx(Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.dialog.title", defaultMessage: "ui.courseForm.edit.dialog.title" }) })), actions: _jsx(Button, Object.assign({ size: "small", color: "primary", variant: "contained", onClick: handleSubmit }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.dialog.btn", defaultMessage: "ui.courseForm.edit.dialog.btn" }) })) })) }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.dialog.description", defaultMessage: "ui.courseForm.edit.dialog.description" }) })) })));
|
|
15
19
|
}
|
|
16
20
|
export default memo(CoursePublicationDialog);
|