@selfcommunity/react-ui 1.2.0-alpha.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/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/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/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/shared/AccordionLessons/AccordionLessons.js +5 -4
- 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/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/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/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/shared/AccordionLessons/AccordionLessons.js +5 -4
- 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/react-ui.js +1 -1
- package/package.json +6 -6
|
@@ -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);
|
|
@@ -17,7 +17,8 @@ const classes = {
|
|
|
17
17
|
publishInfo: `${PREFIX}-edit-publish-info`,
|
|
18
18
|
privacyItem: `${PREFIX}-edit-privacy-item`,
|
|
19
19
|
privacyItemInfo: `${PREFIX}-edit-privacy-item-info`,
|
|
20
|
-
disabled: `${PREFIX}-disabled
|
|
20
|
+
disabled: `${PREFIX}-disabled`,
|
|
21
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
21
22
|
};
|
|
22
23
|
const Root = styled(Box, {
|
|
23
24
|
name: PREFIX,
|
|
@@ -43,11 +44,11 @@ export default function CourseEdit(inProps) {
|
|
|
43
44
|
/**
|
|
44
45
|
* Renders root object
|
|
45
46
|
*/
|
|
46
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [course.privacy === SCCoursePrivacyType.DRAFT && (_jsxs(Box, Object.assign({ className: classes.access }, { children: [_jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.access.section.title", defaultMessage: "ui.courseForm.edit.access.section.title" }) })), _jsxs(Widget, Object.assign({ className: classes.card }, { children: [_jsx(Icon, Object.assign({ fontSize: "medium", color: "warning" }, { children: "error" })), _jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.access.info.title", defaultMessage: "ui.courseForm.edit.access.info.title" }) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.access.info.subtitle", defaultMessage: "ui.courseForm.edit.access.info.subtitle" }) })), _jsxs(Box, Object.assign({ className: classes.accessInfo }, { children: [_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.access.info.access", defaultMessage: "ui.courseForm.edit.access.info.access", values: { icon: (chunks) => _jsx(Icon, { children: chunks }, "ui.courseForm.edit.access.info.access.icon") } }) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.access.info.visibility", defaultMessage: "ui.courseForm.edit.access.info.visibility", values: { icon: (chunks) => _jsx(Icon, { children: chunks }, "ui.courseForm.edit.access.info.visibility.icon") } }) }))] }))] })] }))] }))), _jsxs(Box, Object.assign({ className: classes.publish }, { children: [_jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.publication.title", defaultMessage: "ui.courseForm.edit.publication.title" }) })), notPublishable ? (_jsxs(Widget, Object.assign({ className: classes.card }, { children: [_jsx(Icon, Object.assign({ fontSize: "medium", color: "warning" }, { children: "error" })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.publication.subtitle.info", defaultMessage: "ui.courseForm.edit.publication.subtitle.info" }) })] }))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classes.publishInfo }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.publication.subtitle", defaultMessage: "ui.courseForm.edit.publication.subtitle" }) }))), _jsx(RadioGroup, { children: Object.values(SCCoursePrivacyType)
|
|
47
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [course.privacy === SCCoursePrivacyType.DRAFT && (_jsxs(Box, Object.assign({ className: classes.access }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.access.section.title", defaultMessage: "ui.courseForm.edit.access.section.title" }) })), _jsxs(Widget, Object.assign({ className: classes.card }, { children: [_jsx(Icon, Object.assign({ fontSize: "medium", color: "warning" }, { children: "error" })), _jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.access.info.title", defaultMessage: "ui.courseForm.edit.access.info.title" }) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.access.info.subtitle", defaultMessage: "ui.courseForm.edit.access.info.subtitle" }) })), _jsxs(Box, Object.assign({ className: classes.accessInfo }, { children: [_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.access.info.access", defaultMessage: "ui.courseForm.edit.access.info.access", values: { icon: (chunks) => _jsx(Icon, { children: chunks }, "ui.courseForm.edit.access.info.access.icon") } }) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.access.info.visibility", defaultMessage: "ui.courseForm.edit.access.info.visibility", values: { icon: (chunks) => _jsx(Icon, { children: chunks }, "ui.courseForm.edit.access.info.visibility.icon") } }) }))] }))] })] }))] }))), _jsxs(Box, Object.assign({ className: classes.publish }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.publication.title", defaultMessage: "ui.courseForm.edit.publication.title" }) })), notPublishable ? (_jsxs(Widget, Object.assign({ className: classes.card }, { children: [_jsx(Icon, Object.assign({ fontSize: "medium", color: "warning" }, { children: "error" })), _jsx(Typography, Object.assign({ className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.publication.subtitle.info", defaultMessage: "ui.courseForm.edit.publication.subtitle.info" }) }))] }))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classNames(classes.publishInfo, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.courseForm.edit.publication.subtitle", defaultMessage: "ui.courseForm.edit.publication.subtitle" }) }))), _jsx(RadioGroup, { children: Object.values(SCCoursePrivacyType)
|
|
47
48
|
.filter((option) => option !== SCCoursePrivacyType.DRAFT)
|
|
48
|
-
.map((option, index) => (_jsxs(FormControl, Object.assign({ className: classes.privacyItem, disabled: notPublishable }, { children: [_jsx(FormControlLabel, { control: _jsx(Radio, { size: "small", value: option, checked: option === privacy, onChange: handleChange, disabled: notPublishable }), label: _jsx(FormattedMessage, { id: `ui.courseForm.edit.publication.option.${option}.title`, defaultMessage: `ui.courseForm.edit.publication.option.${option}.title` }) }), _jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "body1", className: classNames(classes.privacyItemInfo, { [classes.disabled]: notPublishable }) }, { children: _jsx(FormattedMessage, { id: `ui.courseForm.edit.publication.option.${option}.access`, defaultMessage: `ui.courseForm.edit.publication.option.${option}.access`, values: {
|
|
49
|
+
.map((option, index) => (_jsxs(FormControl, Object.assign({ className: classes.privacyItem, disabled: notPublishable }, { children: [_jsx(FormControlLabel, { control: _jsx(Radio, { size: "small", value: option, checked: option === privacy, onChange: handleChange, disabled: notPublishable }), label: _jsx(Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: `ui.courseForm.edit.publication.option.${option}.title`, defaultMessage: `ui.courseForm.edit.publication.option.${option}.title` }) })) }), _jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "body1", className: classNames(classes.contrastColor, classes.privacyItemInfo, { [classes.disabled]: notPublishable }) }, { children: _jsx(FormattedMessage, { id: `ui.courseForm.edit.publication.option.${option}.access`, defaultMessage: `ui.courseForm.edit.publication.option.${option}.access`, values: {
|
|
49
50
|
icon: (chunks) => (_jsx(Icon, { children: chunks }, `ui.courseForm.edit.publication.option.${option}.access.icon`))
|
|
50
|
-
} }) })), _jsx(Typography, Object.assign({ variant: "body1", className: classNames(classes.privacyItemInfo, { [classes.disabled]: notPublishable }) }, { children: _jsx(FormattedMessage, { id: `ui.courseForm.edit.publication.option.${option}.visibility`, defaultMessage: `ui.courseForm.edit.publication.option.${option}.visibility`, values: {
|
|
51
|
+
} }) })), _jsx(Typography, Object.assign({ variant: "body1", className: (classes.contrastColor, classNames(classes.privacyItemInfo, { [classes.disabled]: notPublishable })) }, { children: _jsx(FormattedMessage, { id: `ui.courseForm.edit.publication.option.${option}.visibility`, defaultMessage: `ui.courseForm.edit.publication.option.${option}.visibility`, values: {
|
|
51
52
|
icon: (chunks) => (_jsx(Icon, { children: chunks }, `ui.courseForm.edit.publication.option.${option}.visibility.icon`))
|
|
52
53
|
} }) }))] })] }), index))) })] }))] })));
|
|
53
54
|
}
|
|
@@ -1,7 +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, AvatarGroup, Button, Icon, List, ListItem, Typography, styled } from '@mui/material';
|
|
4
|
-
import { useThemeProps } from '@mui/system';
|
|
3
|
+
import { Avatar, AvatarGroup, Button, Icon, List, ListItem, Typography, styled, useThemeProps } from '@mui/material';
|
|
5
4
|
import { CourseService, Endpoints, http } from '@selfcommunity/api-services';
|
|
6
5
|
import { useSCFetchCourse } from '@selfcommunity/react-core';
|
|
7
6
|
import { SCCourseJoinStatusType } from '@selfcommunity/types';
|
|
@@ -23,7 +22,8 @@ const classes = {
|
|
|
23
22
|
dialogRoot: `${PREFIX}-dialog-root`,
|
|
24
23
|
endMessage: `${PREFIX}-end-message`,
|
|
25
24
|
infiniteScroll: `${PREFIX}-infinite-scroll`,
|
|
26
|
-
participants: `${PREFIX}-participants
|
|
25
|
+
participants: `${PREFIX}-participants`,
|
|
26
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
27
27
|
};
|
|
28
28
|
const Root = styled(Button, {
|
|
29
29
|
name: PREFIX,
|
|
@@ -142,5 +142,5 @@ export default function CourseParticipantsButton(inProps) {
|
|
|
142
142
|
}
|
|
143
143
|
return (_jsxs(_Fragment, { children: [_jsxs(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleToggleDialogOpen, disabled: loading || !scCourse || count === 0,
|
|
144
144
|
// @ts-expect-error this is needed to use enrolled into SCCourseParticipantsButton
|
|
145
|
-
enrolled: enrolled }, rest, { children: [!hideCaption && (_jsxs(Typography, Object.assign({ className: classes.participants }, { children: [_jsx(Icon, { children: "people_alt" }), _jsx(FormattedMessage, { defaultMessage: "ui.courseParticipantsButton.participants", id: "ui.courseParticipantsButton.participants", values: { total: count } })] }))), !count && (loading || !scCourse) ? (_jsx(AvatarGroupSkeleton, Object.assign({}, rest, (!participantsAvailable && { skeletonsAnimation: false }), { count: 4 }))) : (_jsx(AvatarGroup, Object.assign({ total: count, renderSurplus: renderSurplus }, { children: enrolled.map((c) => (_jsx(Avatar, { alt: c.username, src: c.avatar }, c.id))) })))] })), open && (_jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: _jsx(FormattedMessage, { defaultMessage: "ui.courseParticipantsButton.dialogTitle", id: "ui.courseParticipantsButton.dialogTitle", values: { total: count } }), onClose: handleToggleDialogOpen, open: true }, DialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: count, next: fetchEnrolledUsers, hasMoreNext: next !== null || loading, loaderNext: _jsx(UserSkeleton, { elevation: 0 }), className: classes.infiniteScroll, endMessage: _jsx(Typography, Object.assign({ className: classes.endMessage }, { children: _jsx(FormattedMessage, { id: "ui.courseParticipantsButton.noOtherParticipants", defaultMessage: "ui.courseParticipantsButton.noOtherParticipants" }) })) }, { children: _jsx(List, { children: enrolled.map((e) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: e }) }, e.id))) }) })) })))] }));
|
|
145
|
+
enrolled: enrolled }, rest, { children: [!hideCaption && (_jsxs(Typography, Object.assign({ className: classNames(classes.participants, classes.contrastColor) }, { children: [_jsx(Icon, { children: "people_alt" }), _jsx(FormattedMessage, { defaultMessage: "ui.courseParticipantsButton.participants", id: "ui.courseParticipantsButton.participants", values: { total: count } })] }))), !count && (loading || !scCourse) ? (_jsx(AvatarGroupSkeleton, Object.assign({}, rest, (!participantsAvailable && { skeletonsAnimation: false }), { count: 4 }))) : (_jsx(AvatarGroup, Object.assign({ total: count, renderSurplus: renderSurplus, className: classes.contrastColor }, { children: enrolled.map((c) => (_jsx(Avatar, { alt: c.username, src: c.avatar }, c.id))) })))] })), open && (_jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: _jsx(FormattedMessage, { defaultMessage: "ui.courseParticipantsButton.dialogTitle", id: "ui.courseParticipantsButton.dialogTitle", values: { total: count } }), onClose: handleToggleDialogOpen, open: true }, DialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: count, next: fetchEnrolledUsers, hasMoreNext: next !== null || loading, loaderNext: _jsx(UserSkeleton, { elevation: 0 }), className: classes.infiniteScroll, endMessage: _jsx(Typography, Object.assign({ className: classNames(classes.endMessage, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.courseParticipantsButton.noOtherParticipants", defaultMessage: "ui.courseParticipantsButton.noOtherParticipants" }) })) }, { children: _jsx(List, { children: enrolled.map((e) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: e }) }, e.id))) }) })) })))] }));
|
|
146
146
|
}
|
|
@@ -9,7 +9,8 @@ import { SCGroupEventType, SCTopicType } from '../../../constants/PubSub';
|
|
|
9
9
|
import { Fragment, memo, useCallback } from 'react';
|
|
10
10
|
const classes = {
|
|
11
11
|
sectionButton: `${PREFIX}-section-button`,
|
|
12
|
-
sectionButtonTypography: `${PREFIX}-section-button-typography
|
|
12
|
+
sectionButtonTypography: `${PREFIX}-section-button-typography`,
|
|
13
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
13
14
|
};
|
|
14
15
|
function AddButton(props) {
|
|
15
16
|
// PROPS
|
|
@@ -22,6 +23,6 @@ function AddButton(props) {
|
|
|
22
23
|
handleAddRow();
|
|
23
24
|
PubSub.publish(`${SCTopicType.COURSE}.${SCGroupEventType.UPDATE}`, true);
|
|
24
25
|
}, [handleAddRow]);
|
|
25
|
-
return (_jsx(Fragment, { children: isMobile ? (_jsx(IconButton, Object.assign({ onClick: handleClick }, { children: _jsx(Icon, { children: "add_circle_outline" }) }))) : (_jsx(Button, Object.assign({ className: classNames(classes.sectionButton, className), size: "small", startIcon: _jsx(Icon, { children: "add_circle_outline" }), onClick: handleClick }, rest, { children: _jsx(Typography, Object.assign({ className: classes.sectionButtonTypography, variant: "body1" }, { children: _jsx(FormattedMessage, { id: label, defaultMessage: label }) })) }))) }));
|
|
26
|
+
return (_jsx(Fragment, { children: isMobile ? (_jsx(IconButton, Object.assign({ onClick: handleClick }, { children: _jsx(Icon, { children: "add_circle_outline" }) }))) : (_jsx(Button, Object.assign({ className: classNames(classes.sectionButton, className), size: "small", startIcon: _jsx(Icon, { children: "add_circle_outline" }), onClick: handleClick }, rest, { children: _jsx(Typography, Object.assign({ className: classNames(classes.sectionButtonTypography, classes.contrastColor), variant: "body1" }, { children: _jsx(FormattedMessage, { id: label, defaultMessage: label }) })) }))) }));
|
|
26
27
|
}
|
|
27
28
|
export default memo(AddButton);
|
|
@@ -10,6 +10,7 @@ import { useSnackbar } from 'notistack';
|
|
|
10
10
|
import { SCCourseLessonStatusType } from '@selfcommunity/types';
|
|
11
11
|
import { CourseService } from '@selfcommunity/api-services';
|
|
12
12
|
import { ActionLessonType } from '../types';
|
|
13
|
+
import classNames from 'classnames';
|
|
13
14
|
const OPTIONS = [
|
|
14
15
|
{
|
|
15
16
|
id: 'ui.editCourse.tab.lessons.table.select.draft',
|
|
@@ -22,7 +23,8 @@ const OPTIONS = [
|
|
|
22
23
|
];
|
|
23
24
|
const classes = {
|
|
24
25
|
changeLessonStatusPublishedWrapper: `${PREFIX}-change-lesson-status-published-wrapper`,
|
|
25
|
-
changeLessonStatusIconDraft: `${PREFIX}-change-lesson-status-icon-draft
|
|
26
|
+
changeLessonStatusIconDraft: `${PREFIX}-change-lesson-status-icon-draft`,
|
|
27
|
+
contrastColor: `${PREFIX}-constrast-color`
|
|
26
28
|
};
|
|
27
29
|
function ChangeLessonStatus(props) {
|
|
28
30
|
// PROPS
|
|
@@ -73,16 +75,16 @@ function ChangeLessonStatus(props) {
|
|
|
73
75
|
handleAction(newValue);
|
|
74
76
|
}
|
|
75
77
|
}, [handleAction, value]);
|
|
76
|
-
return (_jsx(Fragment, { children: isMobile ? (_jsx(MenuRow, Object.assign({ buttonClassName: hasPublished ? classes.changeLessonStatusPublishedWrapper : undefined, icon: icon }, { children: OPTIONS.map((option, i) => (_jsx(MenuItem, { children: _jsx(Button, Object.assign({ size: "small", color: "inherit", onClick: handleClick, loading: loading, disabled: loading, "data-value": option.value, sx: {
|
|
78
|
+
return (_jsx(Fragment, { children: isMobile ? (_jsx(MenuRow, Object.assign({ buttonClassName: classNames(classes.contrastColor, hasPublished ? classes.changeLessonStatusPublishedWrapper : undefined), icon: icon }, { children: OPTIONS.map((option, i) => (_jsx(MenuItem, { children: _jsx(Button, Object.assign({ size: "small", color: "inherit", onClick: handleClick, loading: loading, disabled: loading, "data-value": option.value, sx: {
|
|
77
79
|
padding: 0,
|
|
78
80
|
':hover': {
|
|
79
81
|
backgroundColor: 'unset'
|
|
80
82
|
}
|
|
81
|
-
} }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: option.id, defaultMessage: option.id }) })) })) }, i))) }))) : (_jsx(Select, Object.assign({ className: hasPublished ? classes.changeLessonStatusPublishedWrapper : undefined, size: "small", value: value, onChange: handleChange, disabled: disabled }, { children: OPTIONS.map((option, i) => (_jsx(MenuItem, Object.assign({ value: option.value }, { children: _jsx(Button, Object.assign({ size: "small", color: "inherit", loading: loading, disabled: loading, sx: {
|
|
83
|
+
} }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: option.id, defaultMessage: option.id }) })) })) }, i))) }))) : (_jsx(Select, Object.assign({ className: classNames(classes.contrastColor, hasPublished ? classes.changeLessonStatusPublishedWrapper : undefined), size: "small", value: value, onChange: handleChange, disabled: disabled }, { children: OPTIONS.map((option, i) => (_jsx(MenuItem, Object.assign({ value: option.value }, { children: _jsx(Button, Object.assign({ size: "small", color: "inherit", loading: loading, disabled: loading, sx: {
|
|
82
84
|
padding: 0,
|
|
83
85
|
':hover': {
|
|
84
86
|
backgroundColor: 'unset'
|
|
85
87
|
}
|
|
86
|
-
} }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: option.id, defaultMessage: option.id }) })) })) }), i))) }))) }));
|
|
88
|
+
} }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: option.id, defaultMessage: option.id }) })) })) }), i))) }))) }));
|
|
87
89
|
}
|
|
88
90
|
export default memo(ChangeLessonStatus);
|
|
@@ -14,7 +14,8 @@ import { SCGroupEventType, SCTopicType } from '../../../constants/PubSub';
|
|
|
14
14
|
const classes = {
|
|
15
15
|
editModeWrapper: `${PREFIX}-edit-mode-wrapper`,
|
|
16
16
|
editModeSaveButton: `${PREFIX}-edit-mode-save-button`,
|
|
17
|
-
editModeCloseButton: `${PREFIX}-edit-mode-close-button
|
|
17
|
+
editModeCloseButton: `${PREFIX}-edit-mode-close-button`,
|
|
18
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
18
19
|
};
|
|
19
20
|
function FieldName(props) {
|
|
20
21
|
// PROPS
|
|
@@ -74,6 +75,6 @@ function FieldName(props) {
|
|
|
74
75
|
handleDisableEditMode();
|
|
75
76
|
}
|
|
76
77
|
}, [row, isNewRow, handleManageRow, setName, handleDisableEditMode]);
|
|
77
|
-
return (_jsx(Fragment, { children: isNewRow || editMode ? (_jsxs(Stack, Object.assign({ className: classes.editModeWrapper }, { children: [_jsx(TextField, { type: "text", variant: "outlined", size: "small", focused: true, autoFocus: true, defaultValue: row.name, onChange: handleChange }), _jsx(Button, Object.assign({ size: "small", color: "primary", variant: "
|
|
78
|
+
return (_jsx(Fragment, { children: isNewRow || editMode ? (_jsxs(Stack, Object.assign({ className: classes.editModeWrapper }, { children: [_jsx(TextField, { type: "text", variant: "outlined", size: "small", focused: true, autoFocus: true, defaultValue: row.name, onChange: handleChange }), _jsx(Button, Object.assign({ size: "small", color: "primary", variant: "contained", onClick: handleSubmit, loading: loading, disabled: loading, className: classes.editModeSaveButton }, { children: _jsx(Icon, { children: "check" }) })), _jsx(IconButton, Object.assign({ color: "default", size: "small", onClick: handleClose, className: classes.editModeCloseButton }, { children: _jsx(Icon, { children: "close" }) }))] }))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: row.name }))) }));
|
|
78
79
|
}
|
|
79
80
|
export default memo(FieldName);
|
|
@@ -20,7 +20,8 @@ const classes = {
|
|
|
20
20
|
cellAlignRight: `${PREFIX}-cell-align-right`,
|
|
21
21
|
cellPadding: `${PREFIX}-cell-padding`,
|
|
22
22
|
tableBodyIconWrapper: `${PREFIX}-table-body-icon-wrapper`,
|
|
23
|
-
actionsWrapper: `${PREFIX}-actions-wrapper
|
|
23
|
+
actionsWrapper: `${PREFIX}-actions-wrapper`,
|
|
24
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
24
25
|
};
|
|
25
26
|
function LessonRow(props, ref) {
|
|
26
27
|
// PROPS
|
|
@@ -60,6 +61,6 @@ function LessonRow(props, ref) {
|
|
|
60
61
|
? Endpoints.CreateCourseLesson.url({ id: course.id, section_id: section.id })
|
|
61
62
|
: Endpoints.PatchCourseLesson.url({ id: course.id, section_id: section.id, lesson_id: lesson.id }),
|
|
62
63
|
method: isNewRow ? Endpoints.CreateCourseLesson.method : Endpoints.PatchCourseLesson.method
|
|
63
|
-
}, row: lesson, isNewRow: isNewRow, handleManageRow: handleManageLesson, editMode: editMode, handleDisableEditMode: handleDisableEditMode }) }), _jsx(TableCell, {}), _jsx(TableCell, Object.assign({ className: classes.cellAlignRight }, { children: _jsxs(Stack, Object.assign({ className: classes.actionsWrapper }, { children: [_jsx(ChangeLessonStatus, { course: course, section: section, lesson: lesson, onChange: handleManageLesson, disabled: isDisabled }), _jsxs(MenuRow, Object.assign({ disabled: isDisabled }, { children: [_jsx(MenuItem, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_EDIT_ROUTE_NAME, getUrlLesson(course, lesson, section)) }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.edit", defaultMessage: "ui.editCourse.tab.lessons.table.menu.edit" }) })) })), _jsx(MenuItem, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_PREVIEW_ROUTE_NAME, getUrlLesson(course, lesson, section)) }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.preview", defaultMessage: "ui.editCourse.tab.lessons.table.menu.preview" }) })) })), _jsx(MenuItem, Object.assign({ onClick: handleAbleEditMode }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.rename", defaultMessage: "ui.editCourse.tab.lessons.table.menu.rename" }) })) })), _jsx(MenuItem, Object.assign({ onClick: handleOpenDialog }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.delete", defaultMessage: "ui.editCourse.tab.lessons.table.menu.delete" }) })) }))] }))] })) }))] })));
|
|
64
|
+
}, row: lesson, isNewRow: isNewRow, handleManageRow: handleManageLesson, editMode: editMode, handleDisableEditMode: handleDisableEditMode }) }), _jsx(TableCell, {}), _jsx(TableCell, Object.assign({ className: classes.cellAlignRight }, { children: _jsxs(Stack, Object.assign({ className: classes.actionsWrapper }, { children: [_jsx(ChangeLessonStatus, { course: course, section: section, lesson: lesson, onChange: handleManageLesson, disabled: isDisabled }), _jsxs(MenuRow, Object.assign({ disabled: isDisabled }, { children: [_jsx(MenuItem, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_EDIT_ROUTE_NAME, getUrlLesson(course, lesson, section)) }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.edit", defaultMessage: "ui.editCourse.tab.lessons.table.menu.edit" }) })) })), _jsx(MenuItem, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_PREVIEW_ROUTE_NAME, getUrlLesson(course, lesson, section)) }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.preview", defaultMessage: "ui.editCourse.tab.lessons.table.menu.preview" }) })) })), _jsx(MenuItem, Object.assign({ onClick: handleAbleEditMode }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.rename", defaultMessage: "ui.editCourse.tab.lessons.table.menu.rename" }) })) })), _jsx(MenuItem, Object.assign({ onClick: handleOpenDialog }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.delete", defaultMessage: "ui.editCourse.tab.lessons.table.menu.delete" }) })) }))] }))] })) }))] })));
|
|
64
65
|
}
|
|
65
66
|
export default memo(forwardRef(LessonRow));
|
|
@@ -25,7 +25,8 @@ const classes = {
|
|
|
25
25
|
cellWidth: `${PREFIX}-cell-width`,
|
|
26
26
|
cellAlignRight: `${PREFIX}-cell-align-right`,
|
|
27
27
|
cellAlignCenter: `${PREFIX}-cell-align-center`,
|
|
28
|
-
cellPadding: `${PREFIX}-cell-padding
|
|
28
|
+
cellPadding: `${PREFIX}-cell-padding`,
|
|
29
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
29
30
|
};
|
|
30
31
|
function SectionRow(props, ref) {
|
|
31
32
|
// PROPS
|
|
@@ -150,6 +151,6 @@ function SectionRow(props, ref) {
|
|
|
150
151
|
? Endpoints.CreateCourseSection.url({ id: course.id })
|
|
151
152
|
: Endpoints.PatchCourseSection.url({ id: course.id, section_id: section.id }),
|
|
152
153
|
method: isNewRow ? Endpoints.CreateCourseSection.method : Endpoints.PatchCourseSection.method
|
|
153
|
-
}, row: section, isNewRow: isNewRow, handleManageRow: handleManageSection, editMode: editMode, handleDisableEditMode: handleDisableEditMode }) }), course.type !== SCCourseTypologyType.SELF && (_jsx(TableCell, Object.assign({ className: classes.cellAlignCenter }, { children: _jsx(LessonReleaseMenu, { course: course, section: section }) }))), _jsx(TableCell, Object.assign({ className: classes.cellAlignRight }, { children: _jsxs(Stack, Object.assign({ className: classes.actionsWrapper }, { children: [_jsx(AddButton, { label: "ui.editCourse.tab.lessons.table.lesson", handleAddRow: handleAddTempLesson, color: "primary", variant: "
|
|
154
|
+
}, row: section, isNewRow: isNewRow, handleManageRow: handleManageSection, editMode: editMode, handleDisableEditMode: handleDisableEditMode }) }), course.type !== SCCourseTypologyType.SELF && (_jsx(TableCell, Object.assign({ className: classes.cellAlignCenter }, { children: _jsx(LessonReleaseMenu, { course: course, section: section }) }))), _jsx(TableCell, Object.assign({ className: classes.cellAlignRight }, { children: _jsxs(Stack, Object.assign({ className: classes.actionsWrapper }, { children: [_jsx(AddButton, { label: "ui.editCourse.tab.lessons.table.lesson", handleAddRow: handleAddTempLesson, color: "primary", variant: "contained", disabled: isDisabled }), _jsxs(MenuRow, Object.assign({ disabled: isDisabled }, { children: [_jsx(MenuItem, Object.assign({ onClick: handleAbleEditMode }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.rename", defaultMessage: "ui.editCourse.tab.lessons.table.menu.rename" }) })) })), _jsx(MenuItem, Object.assign({ onClick: () => handleOpenDialog({ row: RowType.SECTION, section }) }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.delete", defaultMessage: "ui.editCourse.tab.lessons.table.menu.delete" }) })) }))] }))] })) }))] })), _jsx(TableRow, { children: _jsx(TableCell, Object.assign({ className: classes.tableBodyCollapseWrapper, colSpan: 4 }, { children: _jsx(Collapse, Object.assign({ in: expand, timeout: "auto", unmountOnExit: true }, { children: _jsx(DragDropContext, Object.assign({ onDragEnd: handleDragEnd }, { children: _jsx(Table, { children: _jsx(Droppable, Object.assign({ droppableId: "droppable-2" }, { children: (outerProvider) => (_jsxs(TableBody, Object.assign({ ref: outerProvider.innerRef }, outerProvider.droppableProps, { children: [lessons.map((lesson, i, array) => (_jsx(Draggable, Object.assign({ draggableId: i.toString(), index: i, isDragDisabled: isDisabled }, { children: (innerProvider) => (_jsx(LessonRow, { provider: innerProvider, course: course, section: section, lesson: lesson, isNewRow: isNewLocalRow && i + 1 === array.length, handleManageLesson: handleManageLesson, handleOpenDialog: () => handleOpenDialog({ row: RowType.LESSON, section, lesson }), ref: innerRef }, i)) }), i))), outerProvider.placeholder] }))) })) }) })) })) })) })] }));
|
|
154
155
|
}
|
|
155
156
|
export default memo(forwardRef(SectionRow));
|
|
@@ -184,10 +184,10 @@ function Lessons(props) {
|
|
|
184
184
|
}
|
|
185
185
|
handleOpenDialog(null);
|
|
186
186
|
}, [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" }, { children: _jsx(FormattedMessage, { id: "ui.course.table.sections.title", defaultMessage: "ui.course.table.sections.title", values: {
|
|
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
188
|
sectionsNumber: course.num_sections
|
|
189
|
-
} }) })), _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: {
|
|
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
190
|
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: classes.tableHeaderTypography, 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 })] })))] }));
|
|
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
192
|
}
|
|
193
193
|
export default memo(Lessons);
|
|
@@ -2,6 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { FormControl, FormControlLabel, FormLabel, Switch, Typography } from '@mui/material';
|
|
3
3
|
import { memo, useCallback, useState } from 'react';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
|
+
import { PREFIX } from '../constants';
|
|
6
|
+
const classes = {
|
|
7
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
8
|
+
};
|
|
5
9
|
function SwitchForm(props) {
|
|
6
10
|
// PROPS
|
|
7
11
|
const { name, title, description, checked, handleChangeOptions } = props;
|
|
@@ -13,6 +17,6 @@ function SwitchForm(props) {
|
|
|
13
17
|
setValue(_checked);
|
|
14
18
|
handleChangeOptions(name, _checked);
|
|
15
19
|
}, [setValue]);
|
|
16
|
-
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" }, { 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" }, { 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 }) })) })] })));
|
|
17
21
|
}
|
|
18
22
|
export default memo(SwitchForm);
|
|
@@ -13,7 +13,8 @@ const classes = {
|
|
|
13
13
|
optionsContainer: `${PREFIX}-options-container`,
|
|
14
14
|
optionsWrapper: `${PREFIX}-options-wrapper`,
|
|
15
15
|
optionsDivider: `${PREFIX}-options-divider`,
|
|
16
|
-
optionsButtonWrapper: `${PREFIX}-options-button-wrapper
|
|
16
|
+
optionsButtonWrapper: `${PREFIX}-options-button-wrapper`,
|
|
17
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
17
18
|
};
|
|
18
19
|
const OPTIONS = {
|
|
19
20
|
enforce_lessons_order: {
|
|
@@ -87,6 +88,6 @@ function Options(props) {
|
|
|
87
88
|
});
|
|
88
89
|
});
|
|
89
90
|
}, [course, tempOptions, setCanSave, setLoading]);
|
|
90
|
-
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" }) })) })) }))] })));
|
|
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
92
|
}
|
|
92
93
|
export default memo(Options);
|
|
@@ -15,7 +15,8 @@ const classes = {
|
|
|
15
15
|
header: `${PREFIX}-header`,
|
|
16
16
|
headerAction: `${PREFIX}-header-action`,
|
|
17
17
|
headerContent: `${PREFIX}-header-content`,
|
|
18
|
-
headerEdit: `${PREFIX}-header-edit
|
|
18
|
+
headerEdit: `${PREFIX}-header-edit`,
|
|
19
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
19
20
|
};
|
|
20
21
|
const Root = styled(Drawer, {
|
|
21
22
|
name: PREFIX,
|
|
@@ -29,5 +30,5 @@ export default function LessonDrawer(inProps) {
|
|
|
29
30
|
name: PREFIX
|
|
30
31
|
});
|
|
31
32
|
const { className = null, lesson, course, editMode = false, previewMode = false, activePanel = null, LessonCommentObjectsProps = {}, LessonEditFormProps, handleClose, handleChangeLesson } = props, rest = __rest(props, ["className", "lesson", "course", "editMode", "previewMode", "activePanel", "LessonCommentObjectsProps", "LessonEditFormProps", "handleClose", "handleChangeLesson"]);
|
|
32
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className), anchor: "right", open: Boolean(activePanel) || editMode, variant: "persistent" }, rest, { children: [_jsx(Box, Object.assign({ className: classNames(classes.header, { [classes.headerEdit]: editMode }) }, { children: _jsxs(Box, Object.assign({ className: classes.headerContent }, { children: [_jsx(Typography, Object.assign({ variant: "h4", textAlign: "center" }, { children: editMode ? (_jsx(FormattedMessage, { id: "ui.lessonDrawer.settings", defaultMessage: "ui.lessonDrawer.settings" })) : (_jsx(FormattedMessage, { id: `ui.lessonDrawer.${activePanel}`, defaultMessage: `ui.lessonDrawer.${activePanel}` })) })), _jsx(IconButton, Object.assign({ className: classes.headerAction, onClick: handleClose }, { children: _jsx(Icon, { children: "close" }) }))] })) })), _jsx(Divider, {}), editMode ? (_jsx(LessonEditForm, Object.assign({}, LessonEditFormProps))) : activePanel === SCLessonActionsType.COMMENTS ? (_jsx(LessonCommentObjects, Object.assign({ lessonObject: lesson }, LessonCommentObjectsProps))) : (_jsx(ScrollContainer, { children: _jsx(CourseContentMenu, { course: course, lesson: lesson, onLessonClick: handleChangeLesson, previewMode: previewMode }) }))] })));
|
|
33
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className), anchor: "right", open: Boolean(activePanel) || editMode, variant: "persistent" }, rest, { children: [_jsx(Box, Object.assign({ className: classNames(classes.header, { [classes.headerEdit]: editMode }) }, { children: _jsxs(Box, Object.assign({ className: classes.headerContent }, { children: [_jsx(Typography, Object.assign({ variant: "h4", textAlign: "center", className: classes.contrastColor }, { children: editMode ? (_jsx(FormattedMessage, { id: "ui.lessonDrawer.settings", defaultMessage: "ui.lessonDrawer.settings" })) : (_jsx(FormattedMessage, { id: `ui.lessonDrawer.${activePanel}`, defaultMessage: `ui.lessonDrawer.${activePanel}` })) })), _jsx(IconButton, Object.assign({ className: classes.headerAction, onClick: handleClose }, { children: _jsx(Icon, { children: "close" }) }))] })) })), _jsx(Divider, {}), editMode ? (_jsx(LessonEditForm, Object.assign({}, LessonEditFormProps))) : activePanel === SCLessonActionsType.COMMENTS ? (_jsx(LessonCommentObjects, Object.assign({ lessonObject: lesson }, LessonCommentObjectsProps))) : (_jsx(ScrollContainer, { children: _jsx(CourseContentMenu, { course: course, lesson: lesson, onLessonClick: handleChangeLesson, previewMode: previewMode }) }))] })));
|
|
33
34
|
}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { useThemeProps } from '@mui/system';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import { Box, Button, Checkbox, FormControl, FormControlLabel, FormLabel, Radio, RadioGroup, styled } from '@mui/material';
|
|
6
|
+
import { Box, Button, Checkbox, FormControl, FormControlLabel, FormLabel, Radio, RadioGroup, styled, Typography } from '@mui/material';
|
|
7
7
|
import { PREFIX } from './constants';
|
|
8
8
|
import { FormattedMessage } from 'react-intl';
|
|
9
9
|
import { SCCourseLessonStatusType } from '@selfcommunity/types';
|
|
@@ -11,7 +11,8 @@ const classes = {
|
|
|
11
11
|
root: `${PREFIX}-root`,
|
|
12
12
|
form: `${PREFIX}-form`,
|
|
13
13
|
settings: `${PREFIX}-settings`,
|
|
14
|
-
button: `${PREFIX}-button
|
|
14
|
+
button: `${PREFIX}-button`,
|
|
15
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
15
16
|
};
|
|
16
17
|
const Root = styled(Box, {
|
|
17
18
|
name: PREFIX,
|
|
@@ -36,5 +37,5 @@ export default function LessonEditForm(inProps) {
|
|
|
36
37
|
/**
|
|
37
38
|
* Rendering
|
|
38
39
|
*/
|
|
39
|
-
return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsxs(Box, Object.assign({ className: classes.form }, { children: [_jsxs(FormControl, { children: [_jsx(FormLabel, Object.assign({ id: "status" }, { children: _jsx(FormattedMessage, { id: "ui.lessonEditForm.status.title", defaultMessage: "ui.lessonEditForm.status.title" }) })), _jsxs(RadioGroup, Object.assign({ "aria-labelledby": "course-status-radio-buttons-group", name: "course-status-radio-buttons-group", value: settings.status, onChange: (e) => handleChange('status', e.target.value) }, { children: [_jsx(FormControlLabel, { value: SCCourseLessonStatusType.DRAFT, control: _jsx(Radio, {}), label: _jsx(FormattedMessage, { id: "ui.lessonEditForm.status.draft", defaultMessage: "ui.lessonEditForm.status.draft" }) }), _jsx(FormControlLabel, { value: SCCourseLessonStatusType.PUBLISHED, control: _jsx(Radio, {}), label: _jsx(FormattedMessage, { id: "ui.lessonEditForm.status.published", defaultMessage: "ui.lessonEditForm.status.published" }) })] }))] }), _jsxs(FormControl, Object.assign({ className: classes.settings }, { children: [_jsx(FormLabel, Object.assign({ id: "settings" }, { children: _jsx(FormattedMessage, { id: "ui.lessonEditForm.settings.title", defaultMessage: "ui.lessonEditForm.settings.title" }) })), _jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: settings.comments_enabled, onChange: (e) => handleChange('comments_enabled', e.target.checked) }), label: _jsx(FormattedMessage, { id: "ui.lessonEditForm.settings.enableComments", defaultMessage: "ui.lessonEditForm.settings.enableComments" }) })] }))] })), _jsx(Button, Object.assign({ className: classes.button, variant: "contained", size: "small", onClick: onSave, loading: updating }, { children: _jsx(FormattedMessage, { id: "ui.lessonEditForm.button.save", defaultMessage: "ui.lessonEditForm.button.save" }) }))] })));
|
|
40
|
+
return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsxs(Box, Object.assign({ className: classes.form }, { children: [_jsxs(FormControl, { children: [_jsx(FormLabel, Object.assign({ id: "status" }, { children: _jsx(Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.lessonEditForm.status.title", defaultMessage: "ui.lessonEditForm.status.title" }) })) })), _jsxs(RadioGroup, Object.assign({ "aria-labelledby": "course-status-radio-buttons-group", name: "course-status-radio-buttons-group", value: settings.status, onChange: (e) => handleChange('status', e.target.value) }, { children: [_jsx(FormControlLabel, { value: SCCourseLessonStatusType.DRAFT, control: _jsx(Radio, {}), label: _jsx(Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.lessonEditForm.status.draft", defaultMessage: "ui.lessonEditForm.status.draft" }) })) }), _jsx(FormControlLabel, { value: SCCourseLessonStatusType.PUBLISHED, control: _jsx(Radio, {}), label: _jsx(Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.lessonEditForm.status.published", defaultMessage: "ui.lessonEditForm.status.published" }) })) })] }))] }), _jsxs(FormControl, Object.assign({ className: classes.settings }, { children: [_jsx(FormLabel, Object.assign({ id: "settings" }, { children: _jsx(Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.lessonEditForm.settings.title", defaultMessage: "ui.lessonEditForm.settings.title" }) })) })), _jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: settings.comments_enabled, onChange: (e) => handleChange('comments_enabled', e.target.checked) }), label: _jsx(Typography, Object.assign({ component: "span", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.lessonEditForm.settings.enableComments", defaultMessage: "ui.lessonEditForm.settings.enableComments" }) })) })] }))] })), _jsx(Button, Object.assign({ className: classNames(classes.button, classes.contrastColor), variant: "contained", size: "small", onClick: onSave, loading: updating }, { children: _jsx(FormattedMessage, { id: "ui.lessonEditForm.button.save", defaultMessage: "ui.lessonEditForm.button.save" }) }))] })));
|
|
40
41
|
}
|
|
@@ -43,7 +43,8 @@ const classes = {
|
|
|
43
43
|
popoverRoot: `${PREFIX}-popover-root`,
|
|
44
44
|
popoverContent: `${PREFIX}-popover-content`,
|
|
45
45
|
popoverSelection: `${PREFIX}-popover-selection`,
|
|
46
|
-
popoverAction: `${PREFIX}-popover-action
|
|
46
|
+
popoverAction: `${PREFIX}-popover-action`,
|
|
47
|
+
popoverContrastColor: `${PREFIX}-popover-contrast-color`
|
|
47
48
|
};
|
|
48
49
|
const Root = styled(FormControl, {
|
|
49
50
|
name: PREFIX,
|
|
@@ -167,11 +168,11 @@ export default function LessonReleaseMenu(inProps) {
|
|
|
167
168
|
}, transformOrigin: {
|
|
168
169
|
vertical: 'top',
|
|
169
170
|
horizontal: 'left'
|
|
170
|
-
} }, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: _jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.title", defaultMessage: "ui.lessonReleaseMenu.dialog.title" }) })), _jsxs(Box, Object.assign({ className: classes.popoverContent }, { children: [_jsxs(Box, Object.assign({ className: classes.popoverSelection }, { children: [_jsx(TextField, { type: "number", value: dripDelay, onChange: handleValueChange, slotProps: {
|
|
171
|
+
} }, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classes.popoverContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.title", defaultMessage: "ui.lessonReleaseMenu.dialog.title" }) })), _jsxs(Box, Object.assign({ className: classes.popoverContent }, { children: [_jsxs(Box, Object.assign({ className: classes.popoverSelection }, { children: [_jsx(TextField, { type: "number", value: dripDelay, onChange: handleValueChange, slotProps: {
|
|
171
172
|
input: {
|
|
172
173
|
inputProps: {
|
|
173
174
|
min: 0
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
|
-
} }), _jsx(FormControl, { children: _jsxs(RadioGroup, Object.assign({ value: unit, onChange: handleUnitChange }, { children: [_jsx(FormControlLabel, { value: unitType.DAYS, control: _jsx(Radio, { size: "small" }), label: _jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.days", defaultMessage: "ui.lessonReleaseMenu.dialog.days" }) }), _jsx(FormControlLabel, { value: unitType.WEEKS, control: _jsx(Radio, { size: "small" }), label: _jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.weeks", defaultMessage: "ui.lessonReleaseMenu.dialog.weeks" }) })] })) })] })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: dripDelay > 0 ? (_jsx(FormattedMessage, { id: `ui.lessonReleaseMenu.dialog.info.structured.${unit}`, defaultMessage: `ui.lessonReleaseMenu.dialog.info.structured.${unit}`, values: { total: dripDelay } })) : (_jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.info.now", defaultMessage: "ui.lessonReleaseMenu.dialog.info.now" })) })), _jsx(Button, Object.assign({ className: classes.popoverAction, variant: "contained", disabled: section.drip_delay === dripDelay, onClick: handleSave }, { children: _jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.button.done", defaultMessage: "ui.lessonReleaseMenu.dialog.button.done" }) }))] }))] }))] })) })));
|
|
177
|
+
} }), _jsx(FormControl, { children: _jsxs(RadioGroup, Object.assign({ value: unit, onChange: handleUnitChange }, { children: [_jsx(FormControlLabel, { value: unitType.DAYS, control: _jsx(Radio, { size: "small" }), label: _jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.days", defaultMessage: "ui.lessonReleaseMenu.dialog.days" }) }), _jsx(FormControlLabel, { value: unitType.WEEKS, control: _jsx(Radio, { size: "small" }), label: _jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.weeks", defaultMessage: "ui.lessonReleaseMenu.dialog.weeks" }) })] })) })] })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.popoverContrastColor }, { children: dripDelay > 0 ? (_jsx(FormattedMessage, { id: `ui.lessonReleaseMenu.dialog.info.structured.${unit}`, defaultMessage: `ui.lessonReleaseMenu.dialog.info.structured.${unit}`, values: { total: dripDelay } })) : (_jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.info.now", defaultMessage: "ui.lessonReleaseMenu.dialog.info.now" })) })), _jsx(Button, Object.assign({ className: classNames(classes.popoverAction, classes.popoverContrastColor), variant: "contained", disabled: section.drip_delay === dripDelay, onClick: handleSave }, { children: _jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.dialog.button.done", defaultMessage: "ui.lessonReleaseMenu.dialog.button.done" }) }))] }))] }))] })) })));
|
|
177
178
|
}
|
|
@@ -18,7 +18,8 @@ const classes = {
|
|
|
18
18
|
nameWrapper: `${PREFIX}-name-wrapper`,
|
|
19
19
|
details: `${PREFIX}-details`,
|
|
20
20
|
circle: `${PREFIX}-circle`,
|
|
21
|
-
link: `${PREFIX}-link
|
|
21
|
+
link: `${PREFIX}-link`,
|
|
22
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
22
23
|
};
|
|
23
24
|
const Root = styled(Box, {
|
|
24
25
|
name: PREFIX,
|
|
@@ -49,13 +50,13 @@ export default function AccordionLessons(inProps) {
|
|
|
49
50
|
if (!course) {
|
|
50
51
|
return _jsx(AccordionLessonSkeleton, {});
|
|
51
52
|
}
|
|
52
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, { children: ((_a = course.sections) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (course.sections.map((section) => (_jsxs(Accordion, Object.assign({ className: classes.accordion, expanded: expanded === section.id, onChange: handleChange(section.id), disableGutters: true, elevation: 0, square: true }, { children: [_jsxs(AccordionSummary, Object.assign({ className: classes.summary, expandIcon: _jsx(Icon, { children: "expand_more" }) }, { children: [_jsxs(Stack, Object.assign({ className: classes.nameWrapper }, { children: [_jsx(Typography, Object.assign({ component: "span", variant: "body1" }, { children: section.name })), viewerJoinStatus !== SCCourseJoinStatusType.CREATOR && viewerJoinStatus !== SCCourseJoinStatusType.MANAGER && section.locked && (_jsxs(Fragment, { children: [_jsx(Bullet, {}), _jsx(Typography, Object.assign({ component: "span", variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.date", defaultMessage: "ui.course.accordionLessons.date", values: {
|
|
53
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, { children: ((_a = course.sections) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (course.sections.map((section) => (_jsxs(Accordion, Object.assign({ className: classes.accordion, expanded: expanded === section.id, onChange: handleChange(section.id), disableGutters: true, elevation: 0, square: true }, { children: [_jsxs(AccordionSummary, Object.assign({ className: classes.summary, expandIcon: _jsx(Icon, { children: "expand_more" }) }, { children: [_jsxs(Stack, Object.assign({ className: classes.nameWrapper }, { children: [_jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.contrastColor }, { children: section.name })), viewerJoinStatus !== SCCourseJoinStatusType.CREATOR && viewerJoinStatus !== SCCourseJoinStatusType.MANAGER && section.locked && (_jsxs(Fragment, { children: [_jsx(Bullet, {}), _jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.date", defaultMessage: "ui.course.accordionLessons.date", values: {
|
|
53
54
|
date: intl.formatDate(section.available_date, { day: 'numeric', month: 'numeric', year: 'numeric' }),
|
|
54
55
|
hour: intl.formatDate(section.available_date, { hour: 'numeric', minute: 'numeric' })
|
|
55
|
-
} }) }))] }))] })), !isMobile && (_jsx(Typography, Object.assign({ component: "span", variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
|
|
56
|
+
} }) }))] }))] })), !isMobile && (_jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
|
|
56
57
|
lessonsNumber: section.lessons.length
|
|
57
58
|
} }) })))] })), section.lessons.map((lesson) => (_jsxs(AccordionDetails, Object.assign({ className: classes.details }, { children: [lesson.completion_status === SCCourseLessonCompletionStatusType.COMPLETED ? (_jsx(Icon, Object.assign({ fontSize: "small", color: "primary" }, { children: "circle_checked" }))) : lesson.locked ? (_jsx(Icon, { children: "private" })) : (_jsx(Box, { className: classes.circle })), course.join_status === null ||
|
|
58
59
|
viewerJoinStatus === SCCourseJoinStatusType.CREATOR ||
|
|
59
60
|
viewerJoinStatus === SCCourseJoinStatusType.MANAGER ||
|
|
60
|
-
lesson.locked ? (_jsx(Typography, { children: lesson.name })) : (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_ROUTE_NAME, getUrlLesson(course, lesson, section)), variant: "text", color: "inherit", className: classes.link }, { children: _jsx(Typography, { children: lesson.name }) })))] }), lesson.id)))] }), section.id)))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classes.empty }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.empty", defaultMessage: "ui.course.accordionLessons.empty" }) }))) })));
|
|
61
|
+
lesson.locked ? (_jsx(Typography, Object.assign({ className: classes.contrastColor }, { children: lesson.name }))) : (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_ROUTE_NAME, getUrlLesson(course, lesson, section)), variant: "text", color: "inherit", className: classes.link }, { children: _jsx(Typography, Object.assign({ className: classes.contrastColor }, { children: lesson.name })) })))] }), lesson.id)))] }), section.id)))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classNames(classes.empty, classes.contrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.empty", defaultMessage: "ui.course.accordionLessons.empty" }) }))) })));
|
|
61
62
|
}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { styled, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Card } from '@mui/material';
|
|
3
|
+
import { styled, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Card, lighten, darken, getContrastRatio } from '@mui/material';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
const PREFIX = 'SCConfirmDialog';
|
|
6
|
+
const classes = {
|
|
7
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
8
|
+
};
|
|
6
9
|
const Root = styled(Card, {
|
|
7
10
|
name: PREFIX,
|
|
8
11
|
slot: 'Root',
|
|
9
|
-
overridesResolver: (
|
|
12
|
+
overridesResolver: (_props, styles) => styles.root
|
|
10
13
|
})(({ theme }) => ({
|
|
11
14
|
maxWidth: 800,
|
|
12
|
-
marginBottom: theme.spacing(2)
|
|
15
|
+
marginBottom: theme.spacing(2),
|
|
16
|
+
[`& .${PREFIX}-contrast-color`]: {
|
|
17
|
+
color: getContrastRatio(theme.palette.background.paper, theme.palette.common.white) > 4.5
|
|
18
|
+
? lighten(theme.palette.common.white, 0.5)
|
|
19
|
+
: darken(theme.palette.common.white, 0.5)
|
|
20
|
+
}
|
|
13
21
|
}));
|
|
14
22
|
export default function ConfirmDialog(props) {
|
|
15
23
|
// PROPS
|
|
@@ -35,5 +43,5 @@ export default function ConfirmDialog(props) {
|
|
|
35
43
|
/**
|
|
36
44
|
* Renders root object
|
|
37
45
|
*/
|
|
38
|
-
return (_jsx(Root, { children: _jsxs(Dialog, Object.assign({ open: open, onClose: handleClose }, rest, { children: [_jsx(DialogTitle, { children: title || _jsx(FormattedMessage, { id: "ui.confirmDialog.title", defaultMessage: "ui.confirmDialog.title" }) }), content && (_jsx(DialogContent, { children: _jsx(DialogContentText, Object.assign({ component: "div" }, { children: content })) })), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ onClick: handleClose }, { children: btnCancel || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnCancel", defaultMessage: "ui.confirmDialog.btnCancel" }) })), _jsx(Button, Object.assign({ onClick: handleConfirm, variant: "contained", autoFocus: true, loading: isUpdating }, { children: btnConfirm || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnConfirm", defaultMessage: "ui.confirmDialog.btnConfirm" }) }))] })] })) }));
|
|
46
|
+
return (_jsx(Root, { children: _jsxs(Dialog, Object.assign({ open: open, onClose: handleClose }, rest, { children: [_jsx(DialogTitle, Object.assign({ className: classes.contrastColor }, { children: title || _jsx(FormattedMessage, { id: "ui.confirmDialog.title", defaultMessage: "ui.confirmDialog.title" }) })), content && (_jsx(DialogContent, { children: _jsx(DialogContentText, Object.assign({ component: "div", className: classes.contrastColor }, { children: content })) })), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ onClick: handleClose, className: classes.contrastColor }, { children: btnCancel || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnCancel", defaultMessage: "ui.confirmDialog.btnCancel" }) })), _jsx(Button, Object.assign({ onClick: handleConfirm, variant: "contained", autoFocus: true, loading: isUpdating, className: classes.contrastColor }, { children: btnConfirm || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnConfirm", defaultMessage: "ui.confirmDialog.btnConfirm" }) }))] })] })) }));
|
|
39
47
|
}
|
|
@@ -7,7 +7,11 @@ import { CourseService } from '@selfcommunity/api-services';
|
|
|
7
7
|
import { Logger } from '@selfcommunity/utils';
|
|
8
8
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
9
9
|
import { useSnackbar } from 'notistack';
|
|
10
|
+
import { PREFIX } from './constants';
|
|
10
11
|
const OPTIONS = ['ui.editCourse.tab.users.table.select.joined', 'ui.editCourse.tab.users.table.select.manager'];
|
|
12
|
+
const classes = {
|
|
13
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
14
|
+
};
|
|
11
15
|
function ChangeUserStatus(props) {
|
|
12
16
|
// PROPS
|
|
13
17
|
const { course, user } = props;
|
|
@@ -50,6 +54,6 @@ function ChangeUserStatus(props) {
|
|
|
50
54
|
':hover': {
|
|
51
55
|
backgroundColor: 'unset'
|
|
52
56
|
}
|
|
53
|
-
} }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: option, defaultMessage: option }) })) })) }), i))) })));
|
|
57
|
+
} }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: option, defaultMessage: option }) })) })) }), i))) })));
|
|
54
58
|
}
|
|
55
59
|
export default memo(ChangeUserStatus);
|