@selfcommunity/react-templates 0.4.5-courses.111 → 0.4.5-courses.112
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SCCourseType } from '@selfcommunity/types';
|
|
1
|
+
import { SCCourseLessonType, SCCourseType } from '@selfcommunity/types';
|
|
2
2
|
import { LessonAppbarProps, LessonDrawerProps } from '@selfcommunity/react-ui';
|
|
3
3
|
export interface LessonProps {
|
|
4
4
|
/**
|
|
@@ -13,15 +13,20 @@ export interface LessonProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* The course id
|
|
15
15
|
*/
|
|
16
|
-
courseId
|
|
16
|
+
courseId: string | number;
|
|
17
17
|
/**
|
|
18
18
|
* The section id
|
|
19
19
|
*/
|
|
20
|
-
sectionId: number;
|
|
20
|
+
sectionId: string | number;
|
|
21
|
+
/**
|
|
22
|
+
* The lesson object
|
|
23
|
+
* @default null
|
|
24
|
+
*/
|
|
25
|
+
lesson?: SCCourseLessonType;
|
|
21
26
|
/**
|
|
22
27
|
* The lesson id
|
|
23
28
|
*/
|
|
24
|
-
lessonId?: number;
|
|
29
|
+
lessonId?: string | number;
|
|
25
30
|
/**
|
|
26
31
|
* Props to spread to LessonAppbar Component
|
|
27
32
|
* @default {}
|
|
@@ -37,7 +37,7 @@ function Lesson(inProps) {
|
|
|
37
37
|
props: inProps,
|
|
38
38
|
name: constants_1.PREFIX
|
|
39
39
|
});
|
|
40
|
-
const { className = null, course, courseId, sectionId, lessonId, LessonAppbarProps = {}, LessonDrawerProps = {} } = props, rest = tslib_1.__rest(props, ["className", "course", "courseId", "sectionId", "lessonId", "LessonAppbarProps", "LessonDrawerProps"]);
|
|
40
|
+
const { className = null, course, courseId, sectionId, lesson = null, lessonId, LessonAppbarProps = {}, LessonDrawerProps = {} } = props, rest = tslib_1.__rest(props, ["className", "course", "courseId", "sectionId", "lesson", "lessonId", "LessonAppbarProps", "LessonDrawerProps"]);
|
|
41
41
|
// HOOKS
|
|
42
42
|
const theme = (0, material_1.useTheme)();
|
|
43
43
|
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
@@ -45,7 +45,7 @@ function Lesson(inProps) {
|
|
|
45
45
|
const [_sectionId, setSectionId] = (0, react_1.useState)(sectionId);
|
|
46
46
|
const isCourseAdmin = (0, react_1.useMemo)(() => course && (course.join_status === types_1.SCCourseJoinStatusType.CREATOR || course.join_status === types_1.SCCourseJoinStatusType.MANAGER), [course]);
|
|
47
47
|
const { scCourse } = (0, react_core_1.useSCFetchCourse)({ id: courseId, params: { view: isCourseAdmin ? api_services_1.CourseInfoViewType.EDIT : api_services_1.CourseInfoViewType.USER } });
|
|
48
|
-
const { scLesson, setSCLesson } = (0, react_core_1.useSCFetchLesson)({ id: _lessonId, courseId, sectionId: _sectionId });
|
|
48
|
+
const { scLesson, setSCLesson } = (0, react_core_1.useSCFetchLesson)({ id: _lessonId, lesson, courseId, sectionId: _sectionId });
|
|
49
49
|
// STATE
|
|
50
50
|
const [activePanel, setActivePanel] = (0, react_1.useState)(null);
|
|
51
51
|
const [settings, setSettings] = (0, react_1.useState)(null);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SCCourseType } from '@selfcommunity/types';
|
|
1
|
+
import { SCCourseLessonType, SCCourseType } from '@selfcommunity/types';
|
|
2
2
|
import { LessonAppbarProps, LessonDrawerProps } from '@selfcommunity/react-ui';
|
|
3
3
|
export interface LessonProps {
|
|
4
4
|
/**
|
|
@@ -13,15 +13,20 @@ export interface LessonProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* The course id
|
|
15
15
|
*/
|
|
16
|
-
courseId
|
|
16
|
+
courseId: string | number;
|
|
17
17
|
/**
|
|
18
18
|
* The section id
|
|
19
19
|
*/
|
|
20
|
-
sectionId: number;
|
|
20
|
+
sectionId: string | number;
|
|
21
|
+
/**
|
|
22
|
+
* The lesson object
|
|
23
|
+
* @default null
|
|
24
|
+
*/
|
|
25
|
+
lesson?: SCCourseLessonType;
|
|
21
26
|
/**
|
|
22
27
|
* The lesson id
|
|
23
28
|
*/
|
|
24
|
-
lessonId?: number;
|
|
29
|
+
lessonId?: string | number;
|
|
25
30
|
/**
|
|
26
31
|
* Props to spread to LessonAppbar Component
|
|
27
32
|
* @default {}
|
|
@@ -35,7 +35,7 @@ export default function Lesson(inProps) {
|
|
|
35
35
|
props: inProps,
|
|
36
36
|
name: PREFIX
|
|
37
37
|
});
|
|
38
|
-
const { className = null, course, courseId, sectionId, lessonId, LessonAppbarProps = {}, LessonDrawerProps = {} } = props, rest = __rest(props, ["className", "course", "courseId", "sectionId", "lessonId", "LessonAppbarProps", "LessonDrawerProps"]);
|
|
38
|
+
const { className = null, course, courseId, sectionId, lesson = null, lessonId, LessonAppbarProps = {}, LessonDrawerProps = {} } = props, rest = __rest(props, ["className", "course", "courseId", "sectionId", "lesson", "lessonId", "LessonAppbarProps", "LessonDrawerProps"]);
|
|
39
39
|
// HOOKS
|
|
40
40
|
const theme = useTheme();
|
|
41
41
|
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
@@ -43,7 +43,7 @@ export default function Lesson(inProps) {
|
|
|
43
43
|
const [_sectionId, setSectionId] = useState(sectionId);
|
|
44
44
|
const isCourseAdmin = useMemo(() => course && (course.join_status === SCCourseJoinStatusType.CREATOR || course.join_status === SCCourseJoinStatusType.MANAGER), [course]);
|
|
45
45
|
const { scCourse } = useSCFetchCourse({ id: courseId, params: { view: isCourseAdmin ? CourseInfoViewType.EDIT : CourseInfoViewType.USER } });
|
|
46
|
-
const { scLesson, setSCLesson } = useSCFetchLesson({ id: _lessonId, courseId, sectionId: _sectionId });
|
|
46
|
+
const { scLesson, setSCLesson } = useSCFetchLesson({ id: _lessonId, lesson, courseId, sectionId: _sectionId });
|
|
47
47
|
// STATE
|
|
48
48
|
const [activePanel, setActivePanel] = useState(null);
|
|
49
49
|
const [settings, setSettings] = useState(null);
|