@selfcommunity/react-templates 0.4.5-courses.195 → 0.4.5-courses.196
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.
|
@@ -15,6 +15,7 @@ const api_services_1 = require("@selfcommunity/api-services");
|
|
|
15
15
|
const react_intl_1 = require("react-intl");
|
|
16
16
|
const lab_1 = require("@mui/lab");
|
|
17
17
|
const notistack_1 = require("notistack");
|
|
18
|
+
const react_ui_2 = require("@selfcommunity/react-ui");
|
|
18
19
|
const classes = {
|
|
19
20
|
root: `${constants_1.PREFIX}-root`,
|
|
20
21
|
containerRoot: `${constants_1.PREFIX}-container-root`,
|
|
@@ -26,22 +27,14 @@ const classes = {
|
|
|
26
27
|
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
27
28
|
name: constants_1.PREFIX,
|
|
28
29
|
slot: 'Root',
|
|
29
|
-
overridesResolver: (
|
|
30
|
+
overridesResolver: (_props, styles) => [styles.root]
|
|
30
31
|
})(() => ({}));
|
|
31
32
|
const Container = (0, styles_1.styled)(material_1.Box, {
|
|
32
33
|
name: constants_1.PREFIX,
|
|
33
34
|
slot: 'ContainerRoot',
|
|
34
|
-
overridesResolver: (
|
|
35
|
+
overridesResolver: (_props, styles) => styles.containerRoot,
|
|
35
36
|
shouldForwardProp: (prop) => prop !== 'open'
|
|
36
37
|
})(() => ({}));
|
|
37
|
-
function getUrlLesson(course, lesson) {
|
|
38
|
-
return {
|
|
39
|
-
id: course.id,
|
|
40
|
-
slug: course.slug,
|
|
41
|
-
section_id: lesson.section_id,
|
|
42
|
-
lesson_id: lesson.id
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
38
|
function Lesson(inProps) {
|
|
46
39
|
var _a, _b, _c;
|
|
47
40
|
// PROPS
|
|
@@ -202,7 +195,7 @@ function Lesson(inProps) {
|
|
|
202
195
|
return (0, jsx_runtime_1.jsx)(react_ui_1.HiddenPlaceholder, {});
|
|
203
196
|
}
|
|
204
197
|
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.LessonAppbar, Object.assign({ showComments: scLesson.comments_enabled, editMode: editMode, activePanel: activePanel, title: scCourse.name, handleOpen: handleOpenDrawer, onSave: handleLessonUpdate, updating: updating }, LessonAppbarProps)), (0, jsx_runtime_1.jsxs)(Container, Object.assign({ open: Boolean(activePanel) || editMode, className: classes.containerRoot }, { children: [previewMode && ((0, jsx_runtime_1.jsx)(material_1.Alert, Object.assign({ severity: "info", className: classes.previewInfo }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.lesson.previewMode", defaultMessage: "templates.lesson.previewMode", values: {
|
|
205
|
-
link: (...chunks) => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_LESSON_EDIT_ROUTE_NAME, getUrlLesson(scCourse, scLesson)) }, { children: chunks }))),
|
|
198
|
+
link: (...chunks) => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_LESSON_EDIT_ROUTE_NAME, (0, react_ui_2.getUrlLesson)(scCourse, scLesson)) }, { children: chunks }))),
|
|
206
199
|
linkBack: (...chunks) => (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.COURSE_DASHBOARD_ROUTE_NAME, scCourse) }, { children: chunks }))
|
|
207
200
|
} }) })) }))), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.navigation }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", color: "text.secondary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.lesson.number", defaultMessage: "templates.lesson.number", values: { from: currentLessonIndex + 1, to: availableLessons.length } }) })) })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.navigationTitle }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: scLesson.name })), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handlePrev, disabled: isPrevDisabled }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "arrow_back" }) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleNext, disabled: isNextDisabled }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "arrow_next" }) }))] })] })), (0, jsx_runtime_1.jsx)(react_ui_1.LessonObject, { course: scCourse, lesson: scLesson, editMode: editMode, onContentChange: handleLessonContentEdit, onMediaChange: handleLessonMediaEdit }), !isCourseAdmin && !editMode && !previewMode && ((0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ className: classes.button, loading: loading, size: "small", variant: completed ? 'outlined' : 'contained', startIcon: !completed && (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "arrow_next" }), endIcon: completed && (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "circle_checked" }), onClick: toggleLessonCompletion }, { children: completed ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.lesson.button.completed", defaultMessage: "templates.lesson.button.completed" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.lesson.button.complete", defaultMessage: "templates.lesson.button.complete" })) })))] })), (0, jsx_runtime_1.jsx)(react_ui_1.LessonDrawer, Object.assign({ course: scCourse, lesson: scLesson, editMode: isMobile ? activePanel === react_ui_1.SCLessonActionsType.SETTINGS : editMode, previewMode: previewMode, activePanel: activePanel, handleClose: handleCloseDrawer, handleChangeLesson: handleChangeLesson, LessonEditFormProps: { lesson: scLesson, onSave: handleLessonUpdate, updating: updating, onSettingsChange: handleSettingsChange } }, LessonDrawerProps))] })), openDialog && (0, jsx_runtime_1.jsx)(react_ui_1.CourseCompletedDialog, { course: scCourse, onClose: handleCloseDialog })] }));
|
|
208
201
|
}
|
|
@@ -13,6 +13,7 @@ import { CourseInfoViewType, CourseService } from '@selfcommunity/api-services';
|
|
|
13
13
|
import { FormattedMessage } from 'react-intl';
|
|
14
14
|
import { LoadingButton } from '@mui/lab';
|
|
15
15
|
import { useSnackbar } from 'notistack';
|
|
16
|
+
import { getUrlLesson } from '@selfcommunity/react-ui';
|
|
16
17
|
const classes = {
|
|
17
18
|
root: `${PREFIX}-root`,
|
|
18
19
|
containerRoot: `${PREFIX}-container-root`,
|
|
@@ -24,22 +25,14 @@ const classes = {
|
|
|
24
25
|
const Root = styled(Box, {
|
|
25
26
|
name: PREFIX,
|
|
26
27
|
slot: 'Root',
|
|
27
|
-
overridesResolver: (
|
|
28
|
+
overridesResolver: (_props, styles) => [styles.root]
|
|
28
29
|
})(() => ({}));
|
|
29
30
|
const Container = styled(Box, {
|
|
30
31
|
name: PREFIX,
|
|
31
32
|
slot: 'ContainerRoot',
|
|
32
|
-
overridesResolver: (
|
|
33
|
+
overridesResolver: (_props, styles) => styles.containerRoot,
|
|
33
34
|
shouldForwardProp: (prop) => prop !== 'open'
|
|
34
35
|
})(() => ({}));
|
|
35
|
-
function getUrlLesson(course, lesson) {
|
|
36
|
-
return {
|
|
37
|
-
id: course.id,
|
|
38
|
-
slug: course.slug,
|
|
39
|
-
section_id: lesson.section_id,
|
|
40
|
-
lesson_id: lesson.id
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
36
|
export default function Lesson(inProps) {
|
|
44
37
|
var _a, _b, _c;
|
|
45
38
|
// PROPS
|