@selfcommunity/react-templates 1.0.5 → 1.1.0-alpha.0
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/Category/Category.js +2 -2
- package/lib/cjs/components/CategoryFeed/CategoryFeed.js +2 -2
- package/lib/cjs/components/Lesson/Lesson.js +3 -2
- package/lib/esm/components/Category/Category.js +1 -1
- package/lib/esm/components/CategoryFeed/CategoryFeed.js +1 -1
- package/lib/esm/components/Lesson/Lesson.js +3 -2
- package/lib/umd/234.js +1 -1
- package/lib/umd/react-templates.js +1 -1
- package/package.json +6 -6
|
@@ -7,7 +7,7 @@ const react_ui_1 = require("@selfcommunity/react-ui");
|
|
|
7
7
|
const CategoryFeed_1 = tslib_1.__importDefault(require("../CategoryFeed"));
|
|
8
8
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
9
9
|
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
10
|
-
const
|
|
10
|
+
const material_2 = require("@mui/material");
|
|
11
11
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
12
12
|
const constants_1 = require("./constants");
|
|
13
13
|
const classes = {
|
|
@@ -46,7 +46,7 @@ const Root = (0, material_1.styled)(material_1.Box, {
|
|
|
46
46
|
*/
|
|
47
47
|
function Category(inProps) {
|
|
48
48
|
// PROPS
|
|
49
|
-
const props = (0,
|
|
49
|
+
const props = (0, material_2.useThemeProps)({
|
|
50
50
|
props: inProps,
|
|
51
51
|
name: constants_1.PREFIX
|
|
52
52
|
});
|
|
@@ -9,7 +9,7 @@ const api_services_1 = require("@selfcommunity/api-services");
|
|
|
9
9
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
10
10
|
const types_1 = require("@selfcommunity/types");
|
|
11
11
|
const index_1 = require("./index");
|
|
12
|
-
const
|
|
12
|
+
const material_2 = require("@mui/material");
|
|
13
13
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
14
14
|
const react_intl_1 = require("react-intl");
|
|
15
15
|
const notistack_1 = require("notistack");
|
|
@@ -66,7 +66,7 @@ const WIDGETS = [
|
|
|
66
66
|
function CategoryFeed(inProps) {
|
|
67
67
|
var _a;
|
|
68
68
|
// PROPS
|
|
69
|
-
const props = (0,
|
|
69
|
+
const props = (0, material_2.useThemeProps)({
|
|
70
70
|
props: inProps,
|
|
71
71
|
name: constants_1.PREFIX
|
|
72
72
|
});
|
|
@@ -20,7 +20,8 @@ const classes = {
|
|
|
20
20
|
navigation: `${constants_1.PREFIX}-navigation`,
|
|
21
21
|
navigationTitle: `${constants_1.PREFIX}-navigation-title`,
|
|
22
22
|
previewInfo: `${constants_1.PREFIX}-preview-info`,
|
|
23
|
-
button: `${constants_1.PREFIX}-button
|
|
23
|
+
button: `${constants_1.PREFIX}-button`,
|
|
24
|
+
contrastColor: `${constants_1.PREFIX}-contrast-color`
|
|
24
25
|
};
|
|
25
26
|
const Root = (0, material_1.styled)(material_1.Box, {
|
|
26
27
|
name: constants_1.PREFIX,
|
|
@@ -194,6 +195,6 @@ function Lesson(inProps) {
|
|
|
194
195
|
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: {
|
|
195
196
|
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 }), "templates.lesson.previewMode.link")),
|
|
196
197
|
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 }), "templates.lesson.previewMode.linkBack"))
|
|
197
|
-
} }) })) }))), (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",
|
|
198
|
+
} }) })) }))), (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", className: classes.contrastColor }, { 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", className: classes.contrastColor }, { 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)(material_1.Button, Object.assign({ className: (0, classnames_1.default)(classes.button, classes.contrastColor), loading: loading, size: "small", variant: "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 })] }));
|
|
198
199
|
}
|
|
199
200
|
exports.default = Lesson;
|
|
@@ -4,7 +4,7 @@ import { CategoryHeader } from '@selfcommunity/react-ui';
|
|
|
4
4
|
import CategoryFeed from '../CategoryFeed';
|
|
5
5
|
import { useSCFetchCategory } from '@selfcommunity/react-core';
|
|
6
6
|
import CategorySkeleton from './Skeleton';
|
|
7
|
-
import { useThemeProps } from '@mui/
|
|
7
|
+
import { useThemeProps } from '@mui/material';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { PREFIX } from './constants';
|
|
10
10
|
const classes = {
|
|
@@ -6,7 +6,7 @@ import { Endpoints } from '@selfcommunity/api-services';
|
|
|
6
6
|
import { Link, SCPreferences, SCRoutes, UserUtils, useSCFetchCategory, useSCPreferenceEnabled, useSCPreferencesAndFeaturesEnabled, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
7
7
|
import { SCCustomAdvPosition, SCFeatureName, SCFeedTypologyType } from '@selfcommunity/types';
|
|
8
8
|
import { CategoryFeedSkeleton } from './index';
|
|
9
|
-
import { useThemeProps } from '@mui/
|
|
9
|
+
import { useThemeProps } from '@mui/material';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import { FormattedMessage } from 'react-intl';
|
|
12
12
|
import { useSnackbar } from 'notistack';
|
|
@@ -18,7 +18,8 @@ const classes = {
|
|
|
18
18
|
navigation: `${PREFIX}-navigation`,
|
|
19
19
|
navigationTitle: `${PREFIX}-navigation-title`,
|
|
20
20
|
previewInfo: `${PREFIX}-preview-info`,
|
|
21
|
-
button: `${PREFIX}-button
|
|
21
|
+
button: `${PREFIX}-button`,
|
|
22
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
22
23
|
};
|
|
23
24
|
const Root = styled(Box, {
|
|
24
25
|
name: PREFIX,
|
|
@@ -192,5 +193,5 @@ export default function Lesson(inProps) {
|
|
|
192
193
|
return (_jsxs(Fragment, { children: [_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsx(LessonAppbar, Object.assign({ showComments: scLesson.comments_enabled, editMode: editMode, activePanel: activePanel, title: scCourse.name, handleOpen: handleOpenDrawer, onSave: handleLessonUpdate, updating: updating }, LessonAppbarProps)), _jsxs(Container, Object.assign({ open: Boolean(activePanel) || editMode, className: classes.containerRoot }, { children: [previewMode && (_jsx(Alert, Object.assign({ severity: "info", className: classes.previewInfo }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "templates.lesson.previewMode", defaultMessage: "templates.lesson.previewMode", values: {
|
|
193
194
|
link: (chunks) => (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_LESSON_EDIT_ROUTE_NAME, getUrlLesson(scCourse, scLesson)) }, { children: chunks }), "templates.lesson.previewMode.link")),
|
|
194
195
|
linkBack: (chunks) => (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.COURSE_DASHBOARD_ROUTE_NAME, scCourse) }, { children: chunks }), "templates.lesson.previewMode.linkBack"))
|
|
195
|
-
} }) })) }))), _jsx(Box, Object.assign({ className: classes.navigation }, { children: _jsx(Typography, Object.assign({ variant: "body2",
|
|
196
|
+
} }) })) }))), _jsx(Box, Object.assign({ className: classes.navigation }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "templates.lesson.number", defaultMessage: "templates.lesson.number", values: { from: currentLessonIndex + 1, to: availableLessons.length } }) })) })), _jsxs(Box, Object.assign({ className: classes.navigationTitle }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: scLesson.name })), _jsxs(Box, { children: [_jsx(IconButton, Object.assign({ onClick: handlePrev, disabled: isPrevDisabled }, { children: _jsx(Icon, { children: "arrow_back" }) })), _jsx(IconButton, Object.assign({ onClick: handleNext, disabled: isNextDisabled }, { children: _jsx(Icon, { children: "arrow_next" }) }))] })] })), _jsx(LessonObject, { course: scCourse, lesson: scLesson, editMode: editMode, onContentChange: handleLessonContentEdit, onMediaChange: handleLessonMediaEdit }), !isCourseAdmin && !editMode && !previewMode && (_jsx(Button, Object.assign({ className: classNames(classes.button, classes.contrastColor), loading: loading, size: "small", variant: "contained", startIcon: !completed && _jsx(Icon, { children: "arrow_next" }), endIcon: completed && _jsx(Icon, { children: "circle_checked" }), onClick: toggleLessonCompletion }, { children: completed ? (_jsx(FormattedMessage, { id: "templates.lesson.button.completed", defaultMessage: "templates.lesson.button.completed" })) : (_jsx(FormattedMessage, { id: "templates.lesson.button.complete", defaultMessage: "templates.lesson.button.complete" })) })))] })), _jsx(LessonDrawer, Object.assign({ course: scCourse, lesson: scLesson, editMode: isMobile ? activePanel === SCLessonActionsType.SETTINGS : editMode, previewMode: previewMode, activePanel: activePanel, handleClose: handleCloseDrawer, handleChangeLesson: handleChangeLesson, LessonEditFormProps: { lesson: scLesson, onSave: handleLessonUpdate, updating: updating, onSettingsChange: handleSettingsChange } }, LessonDrawerProps))] })), openDialog && _jsx(CourseCompletedDialog, { course: scCourse, onClose: handleCloseDialog })] }));
|
|
196
197
|
}
|