@selfcommunity/react-ui 0.11.0-alpha.60 → 0.11.0-alpha.62
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/assets/courses/clapping.d.ts +1 -0
- package/lib/cjs/assets/courses/clapping.js +4 -0
- package/lib/cjs/components/BottomNavigation/BottomNavigation.js +17 -2
- package/lib/cjs/components/CategoryAutocomplete/CategoryAutocomplete.js +6 -8
- package/lib/cjs/components/CommentObject/CommentObject.d.ts +5 -0
- package/lib/cjs/components/CommentObject/CommentObject.js +2 -2
- package/lib/cjs/components/CommentObjectReply/CommentObjectReply.d.ts +24 -2
- package/lib/cjs/components/CommentObjectReply/CommentObjectReply.js +17 -4
- package/lib/cjs/components/Composer/Content/ContentLesson/ContentLesson.d.ts +38 -0
- package/lib/cjs/components/Composer/Content/ContentLesson/ContentLesson.js +67 -0
- package/lib/cjs/components/Composer/Content/ContentLesson/index.d.ts +3 -0
- package/lib/cjs/components/Composer/Content/ContentLesson/index.js +5 -0
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +2 -2
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.d.ts +9 -3
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.js +38 -9
- package/lib/cjs/components/Course/Course.d.ts +92 -0
- package/lib/cjs/components/Course/Course.js +185 -0
- package/lib/cjs/components/Course/CreatePlaceholder.d.ts +39 -0
- package/lib/cjs/components/Course/CreatePlaceholder.js +59 -0
- package/lib/cjs/components/Course/Skeleton.d.ts +51 -0
- package/lib/cjs/components/Course/Skeleton.js +77 -0
- package/lib/cjs/components/Course/constants.d.ts +1 -0
- package/lib/cjs/components/Course/constants.js +4 -0
- package/lib/cjs/components/Course/index.d.ts +4 -0
- package/lib/cjs/components/Course/index.js +8 -0
- package/lib/cjs/components/CourseCompletedDialog/CourseCompletedDialog.d.ts +9 -0
- package/lib/cjs/components/CourseCompletedDialog/CourseCompletedDialog.js +40 -0
- package/lib/cjs/components/CourseCompletedDialog/index.d.ts +3 -0
- package/lib/cjs/components/CourseCompletedDialog/index.js +5 -0
- package/lib/cjs/components/CourseContentMenu/CourseContentMenu.d.ts +25 -0
- package/lib/cjs/components/CourseContentMenu/CourseContentMenu.js +47 -0
- package/lib/cjs/components/CourseContentMenu/constants.d.ts +1 -0
- package/lib/cjs/components/CourseContentMenu/constants.js +4 -0
- package/lib/cjs/components/CourseContentMenu/index.d.ts +3 -0
- package/lib/cjs/components/CourseContentMenu/index.js +5 -0
- package/lib/cjs/components/CourseDashboard/Header/Skeleton.d.ts +1 -0
- package/lib/cjs/components/CourseDashboard/Header/Skeleton.js +16 -0
- package/lib/cjs/components/CourseDashboard/Header.d.ts +9 -0
- package/lib/cjs/components/CourseDashboard/Header.js +44 -0
- package/lib/cjs/components/CourseDashboard/Student/ActionButton.d.ts +8 -0
- package/lib/cjs/components/CourseDashboard/Student/ActionButton.js +16 -0
- package/lib/cjs/components/CourseDashboard/Student/Skeleton.d.ts +1 -0
- package/lib/cjs/components/CourseDashboard/Student/Skeleton.js +30 -0
- package/lib/cjs/components/CourseDashboard/Student.d.ts +11 -0
- package/lib/cjs/components/CourseDashboard/Student.js +203 -0
- package/lib/cjs/components/CourseDashboard/Teacher/Comments.d.ts +9 -0
- package/lib/cjs/components/CourseDashboard/Teacher/Comments.js +108 -0
- package/lib/cjs/components/CourseDashboard/Teacher/Info.d.ts +11 -0
- package/lib/cjs/components/CourseDashboard/Teacher/Info.js +19 -0
- package/lib/cjs/components/CourseDashboard/Teacher/Skeleton.d.ts +1 -0
- package/lib/cjs/components/CourseDashboard/Teacher/Skeleton.js +25 -0
- package/lib/cjs/components/CourseDashboard/Teacher/Students.d.ts +10 -0
- package/lib/cjs/components/CourseDashboard/Teacher/Students.js +71 -0
- package/lib/cjs/components/CourseDashboard/Teacher.d.ts +11 -0
- package/lib/cjs/components/CourseDashboard/Teacher.js +62 -0
- package/lib/cjs/components/CourseDashboard/constants.d.ts +1 -0
- package/lib/cjs/components/CourseDashboard/constants.js +4 -0
- package/lib/cjs/components/CourseDashboard/index.d.ts +11 -0
- package/lib/cjs/components/CourseDashboard/index.js +11 -0
- package/lib/cjs/components/CourseDashboard/types.d.ts +8 -0
- package/lib/cjs/components/CourseDashboard/types.js +13 -0
- package/lib/cjs/components/CourseForm/CourseForm.d.ts +74 -0
- package/lib/cjs/components/CourseForm/CourseForm.js +273 -0
- package/lib/cjs/components/CourseForm/Dialog.d.ts +8 -0
- package/lib/cjs/components/CourseForm/Dialog.js +19 -0
- package/lib/cjs/components/CourseForm/Edit.d.ts +24 -0
- package/lib/cjs/components/CourseForm/Edit.js +53 -0
- package/lib/cjs/components/CourseForm/Skeleton.d.ts +1 -0
- package/lib/cjs/components/CourseForm/Skeleton.js +17 -0
- package/lib/cjs/components/CourseForm/UploadCourseCover.d.ts +45 -0
- package/lib/cjs/components/CourseForm/UploadCourseCover.js +94 -0
- package/lib/cjs/components/CourseForm/constants.d.ts +1 -0
- package/lib/cjs/components/CourseForm/constants.js +4 -0
- package/lib/cjs/components/CourseForm/index.d.ts +4 -0
- package/lib/cjs/components/CourseForm/index.js +8 -0
- package/lib/cjs/components/CourseFormDialog/CourseFormDialog.d.ts +48 -0
- package/lib/cjs/components/CourseFormDialog/CourseFormDialog.js +67 -0
- package/lib/cjs/components/CourseFormDialog/constants.d.ts +1 -0
- package/lib/cjs/components/CourseFormDialog/constants.js +4 -0
- package/lib/cjs/components/CourseFormDialog/index.d.ts +3 -0
- package/lib/cjs/components/CourseFormDialog/index.js +5 -0
- package/lib/cjs/components/CourseJoinButton/CourseJoinButton.d.ts +56 -0
- package/lib/cjs/components/CourseJoinButton/CourseJoinButton.js +148 -0
- package/lib/cjs/components/CourseJoinButton/index.d.ts +3 -0
- package/lib/cjs/components/CourseJoinButton/index.js +5 -0
- package/lib/cjs/components/CourseParticipantsButton/CourseParticipantsButton.d.ts +53 -0
- package/lib/cjs/components/CourseParticipantsButton/CourseParticipantsButton.js +150 -0
- package/lib/cjs/components/CourseParticipantsButton/index.d.ts +3 -0
- package/lib/cjs/components/CourseParticipantsButton/index.js +5 -0
- package/lib/cjs/components/Courses/Courses.d.ts +100 -0
- package/lib/cjs/components/Courses/Courses.js +237 -0
- package/lib/cjs/components/Courses/Skeleton.d.ts +54 -0
- package/lib/cjs/components/Courses/Skeleton.js +45 -0
- package/lib/cjs/components/Courses/constants.d.ts +1 -0
- package/lib/cjs/components/Courses/constants.js +4 -0
- package/lib/cjs/components/Courses/index.d.ts +4 -0
- package/lib/cjs/components/Courses/index.js +8 -0
- package/lib/cjs/components/Courses/prefetchedCourses.d.ts +81 -0
- package/lib/cjs/components/Courses/prefetchedCourses.js +186 -0
- package/lib/cjs/components/CreateCourseButton/CreateCourseButton.d.ts +38 -0
- package/lib/cjs/components/CreateCourseButton/CreateCourseButton.js +81 -0
- package/lib/cjs/components/CreateCourseButton/index.d.ts +3 -0
- package/lib/cjs/components/CreateCourseButton/index.js +5 -0
- package/lib/cjs/components/EditCourse/Customize.d.ts +9 -0
- package/lib/cjs/components/EditCourse/Customize.js +31 -0
- package/lib/cjs/components/EditCourse/EditCourse.d.ts +13 -0
- package/lib/cjs/components/EditCourse/EditCourse.js +110 -0
- package/lib/cjs/components/EditCourse/Lessons/AddButton.d.ts +9 -0
- package/lib/cjs/components/EditCourse/Lessons/AddButton.js +29 -0
- package/lib/cjs/components/EditCourse/Lessons/ChangeLessonStatus.d.ts +13 -0
- package/lib/cjs/components/EditCourse/Lessons/ChangeLessonStatus.js +92 -0
- package/lib/cjs/components/EditCourse/Lessons/FieldName.d.ts +15 -0
- package/lib/cjs/components/EditCourse/Lessons/FieldName.js +83 -0
- package/lib/cjs/components/EditCourse/Lessons/LessonRow.d.ts +15 -0
- package/lib/cjs/components/EditCourse/Lessons/LessonRow.js +68 -0
- package/lib/cjs/components/EditCourse/Lessons/SectionRow.d.ts +14 -0
- package/lib/cjs/components/EditCourse/Lessons/SectionRow.js +158 -0
- package/lib/cjs/components/EditCourse/Lessons/Skeleton.d.ts +1 -0
- package/lib/cjs/components/EditCourse/Lessons/Skeleton.js +20 -0
- package/lib/cjs/components/EditCourse/Lessons.d.ts +11 -0
- package/lib/cjs/components/EditCourse/Lessons.js +196 -0
- package/lib/cjs/components/EditCourse/MenuRow.d.ts +9 -0
- package/lib/cjs/components/EditCourse/MenuRow.js +25 -0
- package/lib/cjs/components/EditCourse/Options/Skeleton.d.ts +1 -0
- package/lib/cjs/components/EditCourse/Options/Skeleton.js +15 -0
- package/lib/cjs/components/EditCourse/Options/SwitchForm.d.ts +11 -0
- package/lib/cjs/components/EditCourse/Options/SwitchForm.js +20 -0
- package/lib/cjs/components/EditCourse/Options.d.ts +9 -0
- package/lib/cjs/components/EditCourse/Options.js +96 -0
- package/lib/cjs/components/EditCourse/Requests.d.ts +12 -0
- package/lib/cjs/components/EditCourse/Requests.js +97 -0
- package/lib/cjs/components/EditCourse/Skeleton.d.ts +8 -0
- package/lib/cjs/components/EditCourse/Skeleton.js +28 -0
- package/lib/cjs/components/EditCourse/Status.d.ts +9 -0
- package/lib/cjs/components/EditCourse/Status.js +33 -0
- package/lib/cjs/components/EditCourse/Users/Skeleton.d.ts +1 -0
- package/lib/cjs/components/EditCourse/Users/Skeleton.js +15 -0
- package/lib/cjs/components/EditCourse/Users.d.ts +11 -0
- package/lib/cjs/components/EditCourse/Users.js +140 -0
- package/lib/cjs/components/EditCourse/constants.d.ts +1 -0
- package/lib/cjs/components/EditCourse/constants.js +4 -0
- package/lib/cjs/components/EditCourse/hooks.d.ts +3 -0
- package/lib/cjs/components/EditCourse/hooks.js +22 -0
- package/lib/cjs/components/EditCourse/index.d.ts +4 -0
- package/lib/cjs/components/EditCourse/index.js +8 -0
- package/lib/cjs/components/EditCourse/types.d.ts +29 -0
- package/lib/cjs/components/EditCourse/types.js +19 -0
- package/lib/cjs/components/Editor/Editor.d.ts +37 -0
- package/lib/cjs/components/Editor/Editor.js +6 -3
- package/lib/cjs/components/Editor/plugins/EmojiPlugin.d.ts +3 -1
- package/lib/cjs/components/Editor/plugins/EmojiPlugin.js +4 -10
- package/lib/cjs/components/Editor/plugins/MediaPlugin.d.ts +14 -0
- package/lib/cjs/components/Editor/plugins/MediaPlugin.js +121 -0
- package/lib/cjs/components/Editor/plugins/ToolbarPlugin.d.ts +5 -0
- package/lib/cjs/components/Editor/plugins/ToolbarPlugin.js +3 -2
- package/lib/cjs/components/Editor/plugins/index.d.ts +2 -1
- package/lib/cjs/components/Editor/plugins/index.js +3 -1
- package/lib/cjs/components/EventForm/EventForm.js +1 -1
- package/lib/cjs/components/LessonAppbar/LessonAppbar.d.ts +42 -0
- package/lib/cjs/components/LessonAppbar/LessonAppbar.js +34 -0
- package/lib/cjs/components/LessonAppbar/constants.d.ts +1 -0
- package/lib/cjs/components/LessonAppbar/constants.js +4 -0
- package/lib/cjs/components/LessonAppbar/index.d.ts +3 -0
- package/lib/cjs/components/LessonAppbar/index.js +5 -0
- package/lib/cjs/components/LessonCommentObject/LessonCommentObject.d.ts +94 -0
- package/lib/cjs/components/LessonCommentObject/LessonCommentObject.js +202 -0
- package/lib/cjs/components/LessonCommentObject/Skeleton.d.ts +21 -0
- package/lib/cjs/components/LessonCommentObject/Skeleton.js +46 -0
- package/lib/cjs/components/LessonCommentObject/constants.d.ts +1 -0
- package/lib/cjs/components/LessonCommentObject/constants.js +4 -0
- package/lib/cjs/components/LessonCommentObject/index.d.ts +4 -0
- package/lib/cjs/components/LessonCommentObject/index.js +8 -0
- package/lib/cjs/components/LessonCommentObjects/LessonCommentObjects.d.ts +76 -0
- package/lib/cjs/components/LessonCommentObjects/LessonCommentObjects.js +185 -0
- package/lib/cjs/components/LessonCommentObjects/Skeleton.d.ts +23 -0
- package/lib/cjs/components/LessonCommentObjects/Skeleton.js +40 -0
- package/lib/cjs/components/LessonCommentObjects/constants.d.ts +1 -0
- package/lib/cjs/components/LessonCommentObjects/constants.js +4 -0
- package/lib/cjs/components/LessonCommentObjects/index.d.ts +4 -0
- package/lib/cjs/components/LessonCommentObjects/index.js +8 -0
- package/lib/cjs/components/LessonDrawer/LessonDrawer.d.ts +50 -0
- package/lib/cjs/components/LessonDrawer/LessonDrawer.js +37 -0
- package/lib/cjs/components/LessonDrawer/constants.d.ts +1 -0
- package/lib/cjs/components/LessonDrawer/constants.js +4 -0
- package/lib/cjs/components/LessonDrawer/index.d.ts +3 -0
- package/lib/cjs/components/LessonDrawer/index.js +5 -0
- package/lib/cjs/components/LessonEditForm/LessonEditForm.d.ts +24 -0
- package/lib/cjs/components/LessonEditForm/LessonEditForm.js +45 -0
- package/lib/cjs/components/LessonEditForm/constants.d.ts +1 -0
- package/lib/cjs/components/LessonEditForm/constants.js +4 -0
- package/lib/cjs/components/LessonEditForm/index.d.ts +3 -0
- package/lib/cjs/components/LessonEditForm/index.js +5 -0
- package/lib/cjs/components/LessonObject/LessonObject.d.ts +40 -0
- package/lib/cjs/components/LessonObject/LessonObject.js +70 -0
- package/lib/cjs/components/LessonObject/constants.d.ts +1 -0
- package/lib/cjs/components/LessonObject/constants.js +4 -0
- package/lib/cjs/components/LessonObject/index.d.ts +3 -0
- package/lib/cjs/components/LessonObject/index.js +5 -0
- package/lib/cjs/components/LessonReleaseMenu/LessonReleaseMenu.d.ts +26 -0
- package/lib/cjs/components/LessonReleaseMenu/LessonReleaseMenu.js +172 -0
- package/lib/cjs/components/LessonReleaseMenu/constants.d.ts +5 -0
- package/lib/cjs/components/LessonReleaseMenu/constants.js +9 -0
- package/lib/cjs/components/LessonReleaseMenu/index.d.ts +3 -0
- package/lib/cjs/components/LessonReleaseMenu/index.js +5 -0
- package/lib/cjs/components/NavigationMenuIconButton/DefaultDrawerContent.js +7 -5
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +12 -1
- package/lib/cjs/components/Notification/Course/Course.d.ts +15 -0
- package/lib/cjs/components/Notification/Course/Course.js +89 -0
- package/lib/cjs/components/Notification/Course/index.d.ts +3 -0
- package/lib/cjs/components/Notification/Course/index.js +5 -0
- package/lib/cjs/components/Notification/Course/utils.d.ts +5 -0
- package/lib/cjs/components/Notification/Course/utils.js +44 -0
- package/lib/cjs/components/Notification/Notification.js +9 -0
- package/lib/cjs/components/SnippetNotifications/SnippetNotifications.js +9 -0
- package/lib/cjs/components/TagAutocomplete/TagAutocomplete.js +2 -2
- package/lib/cjs/components/ToastNotifications/ToastNotifications.js +9 -0
- package/lib/cjs/components/UserCreatedCoursesWidget/Skeleton.d.ts +21 -0
- package/lib/cjs/components/UserCreatedCoursesWidget/Skeleton.js +43 -0
- package/lib/cjs/components/UserCreatedCoursesWidget/UserCreatedCoursesWidget.d.ts +63 -0
- package/lib/cjs/components/UserCreatedCoursesWidget/UserCreatedCoursesWidget.js +154 -0
- package/lib/cjs/components/UserCreatedCoursesWidget/constants.d.ts +1 -0
- package/lib/cjs/components/UserCreatedCoursesWidget/constants.js +4 -0
- package/lib/cjs/components/UserCreatedCoursesWidget/index.d.ts +4 -0
- package/lib/cjs/components/UserCreatedCoursesWidget/index.js +8 -0
- package/lib/cjs/constants/Course.d.ts +6 -0
- package/lib/cjs/constants/Course.js +10 -0
- package/lib/cjs/constants/PubSub.d.ts +14 -0
- package/lib/cjs/constants/PubSub.js +16 -1
- package/lib/cjs/index.d.ts +23 -2
- package/lib/cjs/index.js +60 -5
- package/lib/cjs/shared/AccordionLessons/AccordionLessons.d.ts +8 -0
- package/lib/cjs/shared/AccordionLessons/AccordionLessons.js +65 -0
- package/lib/cjs/shared/AccordionLessons/Skeleton.d.ts +1 -0
- package/lib/cjs/shared/AccordionLessons/Skeleton.js +21 -0
- package/lib/cjs/shared/AccordionLessons/constants.d.ts +1 -0
- package/lib/cjs/shared/AccordionLessons/constants.js +4 -0
- package/lib/cjs/shared/AccordionLessons/index.d.ts +4 -0
- package/lib/cjs/shared/AccordionLessons/index.js +8 -0
- package/lib/cjs/shared/AddUsersButton/AddUsersButton.d.ts +29 -0
- package/lib/cjs/shared/AddUsersButton/AddUsersButton.js +136 -0
- package/lib/cjs/shared/AddUsersButton/index.d.ts +3 -0
- package/lib/cjs/shared/AddUsersButton/index.js +5 -0
- package/lib/cjs/shared/CourseTypePopover/CourseTypePopover.d.ts +9 -0
- package/lib/cjs/shared/CourseTypePopover/CourseTypePopover.js +48 -0
- package/lib/cjs/shared/CourseTypePopover/index.d.ts +3 -0
- package/lib/cjs/shared/CourseTypePopover/index.js +5 -0
- package/lib/cjs/shared/CourseUsersTable/ChangeUsersStatus.d.ts +9 -0
- package/lib/cjs/shared/CourseUsersTable/ChangeUsersStatus.js +58 -0
- package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.d.ts +21 -0
- package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.js +155 -0
- package/lib/cjs/shared/CourseUsersTable/RemoveButton.d.ts +10 -0
- package/lib/cjs/shared/CourseUsersTable/RemoveButton.js +51 -0
- package/lib/cjs/shared/CourseUsersTable/RequestButton.d.ts +10 -0
- package/lib/cjs/shared/CourseUsersTable/RequestButton.js +79 -0
- package/lib/cjs/shared/CourseUsersTable/RowSkeleton.d.ts +8 -0
- package/lib/cjs/shared/CourseUsersTable/RowSkeleton.js +14 -0
- package/lib/cjs/shared/CourseUsersTable/SeeProgressButton.d.ts +9 -0
- package/lib/cjs/shared/CourseUsersTable/SeeProgressButton.js +56 -0
- package/lib/cjs/shared/CourseUsersTable/Skeleton.d.ts +1 -0
- package/lib/cjs/shared/CourseUsersTable/Skeleton.js +19 -0
- package/lib/cjs/shared/CourseUsersTable/constants.d.ts +1 -0
- package/lib/cjs/shared/CourseUsersTable/constants.js +4 -0
- package/lib/cjs/shared/CourseUsersTable/index.d.ts +4 -0
- package/lib/cjs/shared/CourseUsersTable/index.js +8 -0
- package/lib/cjs/shared/DateTimeAgo/index.d.ts +1 -1
- package/lib/cjs/shared/EmptyStatus/EmptyStatus.d.ts +11 -0
- package/lib/cjs/shared/EmptyStatus/EmptyStatus.js +26 -0
- package/lib/cjs/shared/EmptyStatus/index.d.ts +3 -0
- package/lib/cjs/shared/EmptyStatus/index.js +5 -0
- package/lib/cjs/shared/LessonCommentActionsMenu/index.d.ts +41 -0
- package/lib/cjs/shared/LessonCommentActionsMenu/index.js +197 -0
- package/lib/cjs/shared/LessonFilePreview/index.d.ts +12 -0
- package/lib/cjs/shared/LessonFilePreview/index.js +29 -0
- package/lib/cjs/shared/Media/Link/UrlTextField/index.js +2 -3
- package/lib/cjs/types/course.d.ts +40 -0
- package/lib/cjs/types/course.js +33 -0
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/cjs/types/index.js +6 -1
- package/lib/cjs/utils/course.d.ts +14 -0
- package/lib/cjs/utils/course.js +39 -0
- package/lib/esm/assets/courses/clapping.d.ts +1 -0
- package/lib/esm/assets/courses/clapping.js +1 -0
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +17 -2
- package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +6 -8
- package/lib/esm/components/CommentObject/CommentObject.d.ts +5 -0
- package/lib/esm/components/CommentObject/CommentObject.js +2 -2
- package/lib/esm/components/CommentObjectReply/CommentObjectReply.d.ts +24 -2
- package/lib/esm/components/CommentObjectReply/CommentObjectReply.js +18 -5
- package/lib/esm/components/Composer/Content/ContentLesson/ContentLesson.d.ts +38 -0
- package/lib/esm/components/Composer/Content/ContentLesson/ContentLesson.js +64 -0
- package/lib/esm/components/Composer/Content/ContentLesson/index.d.ts +3 -0
- package/lib/esm/components/Composer/Content/ContentLesson/index.js +2 -0
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +2 -2
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.d.ts +9 -3
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +38 -9
- package/lib/esm/components/Course/Course.d.ts +92 -0
- package/lib/esm/components/Course/Course.js +182 -0
- package/lib/esm/components/Course/CreatePlaceholder.d.ts +39 -0
- package/lib/esm/components/Course/CreatePlaceholder.js +56 -0
- package/lib/esm/components/Course/Skeleton.d.ts +51 -0
- package/lib/esm/components/Course/Skeleton.js +74 -0
- package/lib/esm/components/Course/constants.d.ts +1 -0
- package/lib/esm/components/Course/constants.js +1 -0
- package/lib/esm/components/Course/index.d.ts +4 -0
- package/lib/esm/components/Course/index.js +4 -0
- package/lib/esm/components/CourseCompletedDialog/CourseCompletedDialog.d.ts +9 -0
- package/lib/esm/components/CourseCompletedDialog/CourseCompletedDialog.js +37 -0
- package/lib/esm/components/CourseCompletedDialog/index.d.ts +3 -0
- package/lib/esm/components/CourseCompletedDialog/index.js +2 -0
- package/lib/esm/components/CourseContentMenu/CourseContentMenu.d.ts +25 -0
- package/lib/esm/components/CourseContentMenu/CourseContentMenu.js +44 -0
- package/lib/esm/components/CourseContentMenu/constants.d.ts +1 -0
- package/lib/esm/components/CourseContentMenu/constants.js +1 -0
- package/lib/esm/components/CourseContentMenu/index.d.ts +3 -0
- package/lib/esm/components/CourseContentMenu/index.js +2 -0
- package/lib/esm/components/CourseDashboard/Header/Skeleton.d.ts +1 -0
- package/lib/esm/components/CourseDashboard/Header/Skeleton.js +13 -0
- package/lib/esm/components/CourseDashboard/Header.d.ts +9 -0
- package/lib/esm/components/CourseDashboard/Header.js +41 -0
- package/lib/esm/components/CourseDashboard/Student/ActionButton.d.ts +8 -0
- package/lib/esm/components/CourseDashboard/Student/ActionButton.js +13 -0
- package/lib/esm/components/CourseDashboard/Student/Skeleton.d.ts +1 -0
- package/lib/esm/components/CourseDashboard/Student/Skeleton.js +26 -0
- package/lib/esm/components/CourseDashboard/Student.d.ts +11 -0
- package/lib/esm/components/CourseDashboard/Student.js +201 -0
- package/lib/esm/components/CourseDashboard/Teacher/Comments.d.ts +9 -0
- package/lib/esm/components/CourseDashboard/Teacher/Comments.js +106 -0
- package/lib/esm/components/CourseDashboard/Teacher/Info.d.ts +11 -0
- package/lib/esm/components/CourseDashboard/Teacher/Info.js +16 -0
- package/lib/esm/components/CourseDashboard/Teacher/Skeleton.d.ts +1 -0
- package/lib/esm/components/CourseDashboard/Teacher/Skeleton.js +21 -0
- package/lib/esm/components/CourseDashboard/Teacher/Students.d.ts +10 -0
- package/lib/esm/components/CourseDashboard/Teacher/Students.js +68 -0
- package/lib/esm/components/CourseDashboard/Teacher.d.ts +11 -0
- package/lib/esm/components/CourseDashboard/Teacher.js +60 -0
- package/lib/esm/components/CourseDashboard/constants.d.ts +1 -0
- package/lib/esm/components/CourseDashboard/constants.js +1 -0
- package/lib/esm/components/CourseDashboard/index.d.ts +11 -0
- package/lib/esm/components/CourseDashboard/index.js +6 -0
- package/lib/esm/components/CourseDashboard/types.d.ts +8 -0
- package/lib/esm/components/CourseDashboard/types.js +10 -0
- package/lib/esm/components/CourseForm/CourseForm.d.ts +74 -0
- package/lib/esm/components/CourseForm/CourseForm.js +270 -0
- package/lib/esm/components/CourseForm/Dialog.d.ts +8 -0
- package/lib/esm/components/CourseForm/Dialog.js +16 -0
- package/lib/esm/components/CourseForm/Edit.d.ts +24 -0
- package/lib/esm/components/CourseForm/Edit.js +50 -0
- package/lib/esm/components/CourseForm/Skeleton.d.ts +1 -0
- package/lib/esm/components/CourseForm/Skeleton.js +14 -0
- package/lib/esm/components/CourseForm/UploadCourseCover.d.ts +45 -0
- package/lib/esm/components/CourseForm/UploadCourseCover.js +91 -0
- package/lib/esm/components/CourseForm/constants.d.ts +1 -0
- package/lib/esm/components/CourseForm/constants.js +1 -0
- package/lib/esm/components/CourseForm/index.d.ts +4 -0
- package/lib/esm/components/CourseForm/index.js +4 -0
- package/lib/esm/components/CourseFormDialog/CourseFormDialog.d.ts +48 -0
- package/lib/esm/components/CourseFormDialog/CourseFormDialog.js +64 -0
- package/lib/esm/components/CourseFormDialog/constants.d.ts +1 -0
- package/lib/esm/components/CourseFormDialog/constants.js +1 -0
- package/lib/esm/components/CourseFormDialog/index.d.ts +3 -0
- package/lib/esm/components/CourseFormDialog/index.js +2 -0
- package/lib/esm/components/CourseJoinButton/CourseJoinButton.d.ts +56 -0
- package/lib/esm/components/CourseJoinButton/CourseJoinButton.js +145 -0
- package/lib/esm/components/CourseJoinButton/index.d.ts +3 -0
- package/lib/esm/components/CourseJoinButton/index.js +2 -0
- package/lib/esm/components/CourseParticipantsButton/CourseParticipantsButton.d.ts +53 -0
- package/lib/esm/components/CourseParticipantsButton/CourseParticipantsButton.js +147 -0
- package/lib/esm/components/CourseParticipantsButton/index.d.ts +3 -0
- package/lib/esm/components/CourseParticipantsButton/index.js +2 -0
- package/lib/esm/components/Courses/Courses.d.ts +100 -0
- package/lib/esm/components/Courses/Courses.js +233 -0
- package/lib/esm/components/Courses/Skeleton.d.ts +54 -0
- package/lib/esm/components/Courses/Skeleton.js +42 -0
- package/lib/esm/components/Courses/constants.d.ts +1 -0
- package/lib/esm/components/Courses/constants.js +1 -0
- package/lib/esm/components/Courses/index.d.ts +4 -0
- package/lib/esm/components/Courses/index.js +4 -0
- package/lib/esm/components/Courses/prefetchedCourses.d.ts +81 -0
- package/lib/esm/components/Courses/prefetchedCourses.js +183 -0
- package/lib/esm/components/CreateCourseButton/CreateCourseButton.d.ts +38 -0
- package/lib/esm/components/CreateCourseButton/CreateCourseButton.js +78 -0
- package/lib/esm/components/CreateCourseButton/index.d.ts +3 -0
- package/lib/esm/components/CreateCourseButton/index.js +2 -0
- package/lib/esm/components/EditCourse/Customize.d.ts +9 -0
- package/lib/esm/components/EditCourse/Customize.js +28 -0
- package/lib/esm/components/EditCourse/EditCourse.d.ts +13 -0
- package/lib/esm/components/EditCourse/EditCourse.js +107 -0
- package/lib/esm/components/EditCourse/Lessons/AddButton.d.ts +9 -0
- package/lib/esm/components/EditCourse/Lessons/AddButton.js +27 -0
- package/lib/esm/components/EditCourse/Lessons/ChangeLessonStatus.d.ts +13 -0
- package/lib/esm/components/EditCourse/Lessons/ChangeLessonStatus.js +89 -0
- package/lib/esm/components/EditCourse/Lessons/FieldName.d.ts +15 -0
- package/lib/esm/components/EditCourse/Lessons/FieldName.js +80 -0
- package/lib/esm/components/EditCourse/Lessons/LessonRow.d.ts +15 -0
- package/lib/esm/components/EditCourse/Lessons/LessonRow.js +65 -0
- package/lib/esm/components/EditCourse/Lessons/SectionRow.d.ts +14 -0
- package/lib/esm/components/EditCourse/Lessons/SectionRow.js +155 -0
- package/lib/esm/components/EditCourse/Lessons/Skeleton.d.ts +1 -0
- package/lib/esm/components/EditCourse/Lessons/Skeleton.js +17 -0
- package/lib/esm/components/EditCourse/Lessons.d.ts +11 -0
- package/lib/esm/components/EditCourse/Lessons.js +193 -0
- package/lib/esm/components/EditCourse/MenuRow.d.ts +9 -0
- package/lib/esm/components/EditCourse/MenuRow.js +22 -0
- package/lib/esm/components/EditCourse/Options/Skeleton.d.ts +1 -0
- package/lib/esm/components/EditCourse/Options/Skeleton.js +12 -0
- package/lib/esm/components/EditCourse/Options/SwitchForm.d.ts +11 -0
- package/lib/esm/components/EditCourse/Options/SwitchForm.js +18 -0
- package/lib/esm/components/EditCourse/Options.d.ts +9 -0
- package/lib/esm/components/EditCourse/Options.js +93 -0
- package/lib/esm/components/EditCourse/Requests.d.ts +12 -0
- package/lib/esm/components/EditCourse/Requests.js +94 -0
- package/lib/esm/components/EditCourse/Skeleton.d.ts +8 -0
- package/lib/esm/components/EditCourse/Skeleton.js +25 -0
- package/lib/esm/components/EditCourse/Status.d.ts +9 -0
- package/lib/esm/components/EditCourse/Status.js +29 -0
- package/lib/esm/components/EditCourse/Users/Skeleton.d.ts +1 -0
- package/lib/esm/components/EditCourse/Users/Skeleton.js +12 -0
- package/lib/esm/components/EditCourse/Users.d.ts +11 -0
- package/lib/esm/components/EditCourse/Users.js +137 -0
- package/lib/esm/components/EditCourse/constants.d.ts +1 -0
- package/lib/esm/components/EditCourse/constants.js +1 -0
- package/lib/esm/components/EditCourse/hooks.d.ts +3 -0
- package/lib/esm/components/EditCourse/hooks.js +17 -0
- package/lib/esm/components/EditCourse/index.d.ts +4 -0
- package/lib/esm/components/EditCourse/index.js +4 -0
- package/lib/esm/components/EditCourse/types.d.ts +29 -0
- package/lib/esm/components/EditCourse/types.js +16 -0
- package/lib/esm/components/Editor/Editor.d.ts +37 -0
- package/lib/esm/components/Editor/Editor.js +7 -4
- package/lib/esm/components/Editor/plugins/EmojiPlugin.d.ts +3 -1
- package/lib/esm/components/Editor/plugins/EmojiPlugin.js +4 -10
- package/lib/esm/components/Editor/plugins/MediaPlugin.d.ts +14 -0
- package/lib/esm/components/Editor/plugins/MediaPlugin.js +117 -0
- package/lib/esm/components/Editor/plugins/ToolbarPlugin.d.ts +5 -0
- package/lib/esm/components/Editor/plugins/ToolbarPlugin.js +3 -2
- package/lib/esm/components/Editor/plugins/index.d.ts +2 -1
- package/lib/esm/components/Editor/plugins/index.js +2 -1
- package/lib/esm/components/EventForm/EventForm.js +1 -1
- package/lib/esm/components/LessonAppbar/LessonAppbar.d.ts +42 -0
- package/lib/esm/components/LessonAppbar/LessonAppbar.js +31 -0
- package/lib/esm/components/LessonAppbar/constants.d.ts +1 -0
- package/lib/esm/components/LessonAppbar/constants.js +1 -0
- package/lib/esm/components/LessonAppbar/index.d.ts +3 -0
- package/lib/esm/components/LessonAppbar/index.js +2 -0
- package/lib/esm/components/LessonCommentObject/LessonCommentObject.d.ts +94 -0
- package/lib/esm/components/LessonCommentObject/LessonCommentObject.js +199 -0
- package/lib/esm/components/LessonCommentObject/Skeleton.d.ts +21 -0
- package/lib/esm/components/LessonCommentObject/Skeleton.js +43 -0
- package/lib/esm/components/LessonCommentObject/constants.d.ts +1 -0
- package/lib/esm/components/LessonCommentObject/constants.js +1 -0
- package/lib/esm/components/LessonCommentObject/index.d.ts +4 -0
- package/lib/esm/components/LessonCommentObject/index.js +4 -0
- package/lib/esm/components/LessonCommentObjects/LessonCommentObjects.d.ts +76 -0
- package/lib/esm/components/LessonCommentObjects/LessonCommentObjects.js +182 -0
- package/lib/esm/components/LessonCommentObjects/Skeleton.d.ts +23 -0
- package/lib/esm/components/LessonCommentObjects/Skeleton.js +37 -0
- package/lib/esm/components/LessonCommentObjects/constants.d.ts +1 -0
- package/lib/esm/components/LessonCommentObjects/constants.js +1 -0
- package/lib/esm/components/LessonCommentObjects/index.d.ts +4 -0
- package/lib/esm/components/LessonCommentObjects/index.js +4 -0
- package/lib/esm/components/LessonDrawer/LessonDrawer.d.ts +50 -0
- package/lib/esm/components/LessonDrawer/LessonDrawer.js +34 -0
- package/lib/esm/components/LessonDrawer/constants.d.ts +1 -0
- package/lib/esm/components/LessonDrawer/constants.js +1 -0
- package/lib/esm/components/LessonDrawer/index.d.ts +3 -0
- package/lib/esm/components/LessonDrawer/index.js +2 -0
- package/lib/esm/components/LessonEditForm/LessonEditForm.d.ts +24 -0
- package/lib/esm/components/LessonEditForm/LessonEditForm.js +42 -0
- package/lib/esm/components/LessonEditForm/constants.d.ts +1 -0
- package/lib/esm/components/LessonEditForm/constants.js +1 -0
- package/lib/esm/components/LessonEditForm/index.d.ts +3 -0
- package/lib/esm/components/LessonEditForm/index.js +2 -0
- package/lib/esm/components/LessonObject/LessonObject.d.ts +40 -0
- package/lib/esm/components/LessonObject/LessonObject.js +67 -0
- package/lib/esm/components/LessonObject/constants.d.ts +1 -0
- package/lib/esm/components/LessonObject/constants.js +1 -0
- package/lib/esm/components/LessonObject/index.d.ts +3 -0
- package/lib/esm/components/LessonObject/index.js +2 -0
- package/lib/esm/components/LessonReleaseMenu/LessonReleaseMenu.d.ts +26 -0
- package/lib/esm/components/LessonReleaseMenu/LessonReleaseMenu.js +169 -0
- package/lib/esm/components/LessonReleaseMenu/constants.d.ts +5 -0
- package/lib/esm/components/LessonReleaseMenu/constants.js +6 -0
- package/lib/esm/components/LessonReleaseMenu/index.d.ts +3 -0
- package/lib/esm/components/LessonReleaseMenu/index.js +2 -0
- package/lib/esm/components/NavigationMenuIconButton/DefaultDrawerContent.js +9 -7
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +12 -1
- package/lib/esm/components/Notification/Course/Course.d.ts +15 -0
- package/lib/esm/components/Notification/Course/Course.js +86 -0
- package/lib/esm/components/Notification/Course/index.d.ts +3 -0
- package/lib/esm/components/Notification/Course/index.js +2 -0
- package/lib/esm/components/Notification/Course/utils.d.ts +5 -0
- package/lib/esm/components/Notification/Course/utils.js +39 -0
- package/lib/esm/components/Notification/Notification.js +9 -0
- package/lib/esm/components/SnippetNotifications/SnippetNotifications.js +9 -0
- package/lib/esm/components/TagAutocomplete/TagAutocomplete.js +2 -2
- package/lib/esm/components/ToastNotifications/ToastNotifications.js +9 -0
- package/lib/esm/components/UserCreatedCoursesWidget/Skeleton.d.ts +21 -0
- package/lib/esm/components/UserCreatedCoursesWidget/Skeleton.js +39 -0
- package/lib/esm/components/UserCreatedCoursesWidget/UserCreatedCoursesWidget.d.ts +63 -0
- package/lib/esm/components/UserCreatedCoursesWidget/UserCreatedCoursesWidget.js +151 -0
- package/lib/esm/components/UserCreatedCoursesWidget/constants.d.ts +1 -0
- package/lib/esm/components/UserCreatedCoursesWidget/constants.js +1 -0
- package/lib/esm/components/UserCreatedCoursesWidget/index.d.ts +4 -0
- package/lib/esm/components/UserCreatedCoursesWidget/index.js +4 -0
- package/lib/esm/constants/Course.d.ts +6 -0
- package/lib/esm/constants/Course.js +7 -0
- package/lib/esm/constants/PubSub.d.ts +14 -0
- package/lib/esm/constants/PubSub.js +15 -0
- package/lib/esm/index.d.ts +23 -2
- package/lib/esm/index.js +26 -5
- package/lib/esm/shared/AccordionLessons/AccordionLessons.d.ts +8 -0
- package/lib/esm/shared/AccordionLessons/AccordionLessons.js +61 -0
- package/lib/esm/shared/AccordionLessons/Skeleton.d.ts +1 -0
- package/lib/esm/shared/AccordionLessons/Skeleton.js +18 -0
- package/lib/esm/shared/AccordionLessons/constants.d.ts +1 -0
- package/lib/esm/shared/AccordionLessons/constants.js +1 -0
- package/lib/esm/shared/AccordionLessons/index.d.ts +4 -0
- package/lib/esm/shared/AccordionLessons/index.js +4 -0
- package/lib/esm/shared/AddUsersButton/AddUsersButton.d.ts +29 -0
- package/lib/esm/shared/AddUsersButton/AddUsersButton.js +134 -0
- package/lib/esm/shared/AddUsersButton/index.d.ts +3 -0
- package/lib/esm/shared/AddUsersButton/index.js +2 -0
- package/lib/esm/shared/CourseTypePopover/CourseTypePopover.d.ts +9 -0
- package/lib/esm/shared/CourseTypePopover/CourseTypePopover.js +45 -0
- package/lib/esm/shared/CourseTypePopover/index.d.ts +3 -0
- package/lib/esm/shared/CourseTypePopover/index.js +2 -0
- package/lib/esm/shared/CourseUsersTable/ChangeUsersStatus.d.ts +9 -0
- package/lib/esm/shared/CourseUsersTable/ChangeUsersStatus.js +56 -0
- package/lib/esm/shared/CourseUsersTable/CourseUsersTable.d.ts +21 -0
- package/lib/esm/shared/CourseUsersTable/CourseUsersTable.js +152 -0
- package/lib/esm/shared/CourseUsersTable/RemoveButton.d.ts +10 -0
- package/lib/esm/shared/CourseUsersTable/RemoveButton.js +48 -0
- package/lib/esm/shared/CourseUsersTable/RequestButton.d.ts +10 -0
- package/lib/esm/shared/CourseUsersTable/RequestButton.js +76 -0
- package/lib/esm/shared/CourseUsersTable/RowSkeleton.d.ts +8 -0
- package/lib/esm/shared/CourseUsersTable/RowSkeleton.js +11 -0
- package/lib/esm/shared/CourseUsersTable/SeeProgressButton.d.ts +9 -0
- package/lib/esm/shared/CourseUsersTable/SeeProgressButton.js +53 -0
- package/lib/esm/shared/CourseUsersTable/Skeleton.d.ts +1 -0
- package/lib/esm/shared/CourseUsersTable/Skeleton.js +15 -0
- package/lib/esm/shared/CourseUsersTable/constants.d.ts +1 -0
- package/lib/esm/shared/CourseUsersTable/constants.js +1 -0
- package/lib/esm/shared/CourseUsersTable/index.d.ts +4 -0
- package/lib/esm/shared/CourseUsersTable/index.js +4 -0
- package/lib/esm/shared/DateTimeAgo/index.d.ts +1 -1
- package/lib/esm/shared/EmptyStatus/EmptyStatus.d.ts +11 -0
- package/lib/esm/shared/EmptyStatus/EmptyStatus.js +23 -0
- package/lib/esm/shared/EmptyStatus/index.d.ts +3 -0
- package/lib/esm/shared/EmptyStatus/index.js +2 -0
- package/lib/esm/shared/LessonCommentActionsMenu/index.d.ts +41 -0
- package/lib/esm/shared/LessonCommentActionsMenu/index.js +194 -0
- package/lib/esm/shared/LessonFilePreview/index.d.ts +12 -0
- package/lib/esm/shared/LessonFilePreview/index.js +25 -0
- package/lib/esm/shared/Media/Link/UrlTextField/index.js +3 -4
- package/lib/esm/types/course.d.ts +40 -0
- package/lib/esm/types/course.js +30 -0
- package/lib/esm/types/index.d.ts +2 -1
- package/lib/esm/types/index.js +2 -1
- package/lib/esm/utils/course.d.ts +14 -0
- package/lib/esm/utils/course.js +32 -0
- package/lib/umd/578.js +2 -0
- package/lib/umd/60a7fdeaadfe844bc015.woff2 +0 -0
- package/lib/umd/assets/icons.svg +9 -3
- package/lib/umd/{c3528e120c4e831db2ae.woff → b6dbec3d5816ff8baef1.woff} +0 -0
- package/lib/umd/{a221d3aba0f6753cfbb7.ttf → ba74e493633796d551d1.ttf} +0 -0
- package/lib/umd/{2aa155858f48b8f3911a.eot → c473ce30406a3dad83e1.eot} +0 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +9 -8
- package/lib/umd/239.js +0 -2
- package/lib/umd/36f3af7f155d916c26ff.woff2 +0 -0
- /package/lib/umd/{239.js.LICENSE.txt → 578.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button, Icon } from '@mui/material';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { useThemeProps } from '@mui/system';
|
|
6
|
+
import { SCPreferences, SCUserContext, useSCPreferences } from '@selfcommunity/react-core';
|
|
7
|
+
import { SCFeatureName } from '@selfcommunity/types';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import React, { useContext, useMemo } from 'react';
|
|
10
|
+
import { FormattedMessage } from 'react-intl';
|
|
11
|
+
import CourseFormDialog from '../CourseFormDialog';
|
|
12
|
+
const PREFIX = 'SCCreateCourseButton';
|
|
13
|
+
const classes = {
|
|
14
|
+
root: `${PREFIX}-root`
|
|
15
|
+
};
|
|
16
|
+
const Root = styled(Button, {
|
|
17
|
+
name: PREFIX,
|
|
18
|
+
slot: 'Root',
|
|
19
|
+
overridesResolver: (props, styles) => styles.root
|
|
20
|
+
})(() => ({}));
|
|
21
|
+
/**
|
|
22
|
+
*> API documentation for the Community-JS Create Group Button component. Learn about the available props and the CSS API.
|
|
23
|
+
*
|
|
24
|
+
#### Import
|
|
25
|
+
```jsx
|
|
26
|
+
import {CreateCourseButton} from '@selfcommunity/react-ui';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### Component Name
|
|
30
|
+
The name `SCCreateCourseButton` can be used when providing style overrides in the theme.
|
|
31
|
+
|
|
32
|
+
#### CSS
|
|
33
|
+
|
|
34
|
+
|Rule Name|Global class|Description|
|
|
35
|
+
|---|---|---|
|
|
36
|
+
|root|.SCCreateCourseButton-root|Styles applied to the root element.|
|
|
37
|
+
|
|
38
|
+
* @param inProps
|
|
39
|
+
*/
|
|
40
|
+
export default function CreateCourseButton(inProps) {
|
|
41
|
+
var _a;
|
|
42
|
+
//PROPS
|
|
43
|
+
const props = useThemeProps({
|
|
44
|
+
props: inProps,
|
|
45
|
+
name: PREFIX
|
|
46
|
+
});
|
|
47
|
+
const { className, CourseFormDialogComponentProps = {}, children } = props, rest = __rest(props, ["className", "CourseFormDialogComponentProps", "children"]);
|
|
48
|
+
// CONTEXT
|
|
49
|
+
const scUserContext = useContext(SCUserContext);
|
|
50
|
+
// STATE
|
|
51
|
+
const [open, setOpen] = React.useState(false);
|
|
52
|
+
// CONST
|
|
53
|
+
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
54
|
+
const { preferences, features } = useSCPreferences();
|
|
55
|
+
const coursesEnabled = useMemo(() => preferences &&
|
|
56
|
+
features &&
|
|
57
|
+
features.includes(SCFeatureName.TAGGING) &&
|
|
58
|
+
SCPreferences.CONFIGURATIONS_COURSES_ENABLED in preferences &&
|
|
59
|
+
preferences[SCPreferences.CONFIGURATIONS_COURSES_ENABLED].value, [preferences, features]);
|
|
60
|
+
const onlyStaffEnabled = useMemo(() => { var _a; return (_a = preferences[SCPreferences.CONFIGURATIONS_COURSES_ONLY_STAFF_ENABLED]) === null || _a === void 0 ? void 0 : _a.value; }, [preferences]);
|
|
61
|
+
const canCreateCourse = useMemo(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_course; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
|
|
62
|
+
/**
|
|
63
|
+
* Handle click on button
|
|
64
|
+
*/
|
|
65
|
+
const handleClick = () => {
|
|
66
|
+
setOpen((o) => !o);
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* If there's no authUserId, component is hidden.
|
|
70
|
+
*/
|
|
71
|
+
if (!coursesEnabled || (!canCreateCourse && onlyStaffEnabled) || !authUserId) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Renders root object
|
|
76
|
+
*/
|
|
77
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleClick, variant: "contained", color: "primary", startIcon: _jsx(Icon, Object.assign({ fontSize: "small" }, { children: "add" })) }, rest, { children: children !== null && children !== void 0 ? children : _jsx(FormattedMessage, { id: "ui.createCourseButton", defaultMessage: "ui.createCourseButton" }) })), open && _jsx(CourseFormDialog, Object.assign({}, CourseFormDialogComponentProps, { open: true, onClose: handleClick }))] }));
|
|
78
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SCCourseType } from '@selfcommunity/types';
|
|
3
|
+
interface CustomizeProps {
|
|
4
|
+
course: SCCourseType;
|
|
5
|
+
setCourse: (course: SCCourseType) => void;
|
|
6
|
+
}
|
|
7
|
+
declare function Customize(props: CustomizeProps): JSX.Element;
|
|
8
|
+
declare const _default: import("react").MemoExoticComponent<typeof Customize>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import CourseForm from '../CourseForm';
|
|
3
|
+
import { memo, useCallback } from 'react';
|
|
4
|
+
import { useSnackbar } from 'notistack';
|
|
5
|
+
import { FormattedMessage } from 'react-intl';
|
|
6
|
+
import { SCCourseFormStepType } from '../../constants/Course';
|
|
7
|
+
function Customize(props) {
|
|
8
|
+
// PROPS
|
|
9
|
+
const { course, setCourse } = props;
|
|
10
|
+
// HOOKS
|
|
11
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
12
|
+
// HANDLERS
|
|
13
|
+
const handleSuccess = useCallback((data) => {
|
|
14
|
+
setCourse(Object.assign(Object.assign({}, course), data));
|
|
15
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.editCourse.tab.customize.snackbar.save", defaultMessage: "ui.editCourse.tab.customize.snackbar.save" }), {
|
|
16
|
+
variant: 'success',
|
|
17
|
+
autoHideDuration: 3000
|
|
18
|
+
});
|
|
19
|
+
}, [course]);
|
|
20
|
+
const handleError = useCallback(() => {
|
|
21
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
22
|
+
variant: 'error',
|
|
23
|
+
autoHideDuration: 3000
|
|
24
|
+
});
|
|
25
|
+
}, []);
|
|
26
|
+
return _jsx(CourseForm, { course: course, step: SCCourseFormStepType.CUSTOMIZATION, onSuccess: handleSuccess, onError: handleError });
|
|
27
|
+
}
|
|
28
|
+
export default memo(Customize);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { SCCourseType } from '@selfcommunity/types';
|
|
3
|
+
import { SCCourseEditTabType } from '../../types/course';
|
|
4
|
+
export interface EditCourseProps {
|
|
5
|
+
courseId?: number;
|
|
6
|
+
course?: SCCourseType;
|
|
7
|
+
tab?: SCCourseEditTabType;
|
|
8
|
+
onTabChange?: (tab: SCCourseEditTabType) => void;
|
|
9
|
+
onTabSelect?: (tab: SCCourseEditTabType) => void;
|
|
10
|
+
className?: HTMLAttributes<HTMLDivElement>['className'];
|
|
11
|
+
[p: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export default function EditCourse(inProps: EditCourseProps): JSX.Element;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Box, Icon, IconButton, Stack, styled, Tab, Typography, useMediaQuery, useTheme, useThemeProps } from '@mui/material';
|
|
4
|
+
import { PREFIX } from './constants';
|
|
5
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { TabContext, TabList, TabPanel } from '@mui/lab';
|
|
8
|
+
import { FormattedMessage } from 'react-intl';
|
|
9
|
+
import Lessons from './Lessons';
|
|
10
|
+
import Customize from './Customize';
|
|
11
|
+
import Users from './Users';
|
|
12
|
+
import Options from './Options';
|
|
13
|
+
import { SCRoutes, useSCFetchCourse, useSCRouting } from '@selfcommunity/react-core';
|
|
14
|
+
import { CourseInfoViewType } from '@selfcommunity/api-services';
|
|
15
|
+
import Requests from './Requests';
|
|
16
|
+
import { SCCourseEditTabType } from '../../types/course';
|
|
17
|
+
import EditCourseSkeleton from './Skeleton';
|
|
18
|
+
const classes = {
|
|
19
|
+
root: `${PREFIX}-root`,
|
|
20
|
+
header: `${PREFIX}-header`,
|
|
21
|
+
tabList: `${PREFIX}-tab-list`,
|
|
22
|
+
tab: `${PREFIX}-tab`,
|
|
23
|
+
tabPanel: `${PREFIX}-tab-panel`,
|
|
24
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
25
|
+
};
|
|
26
|
+
const TAB_DATA = [
|
|
27
|
+
{
|
|
28
|
+
label: 'ui.editCourse.tab.lessons',
|
|
29
|
+
value: SCCourseEditTabType.LESSONS
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: 'ui.editCourse.tab.customize',
|
|
33
|
+
value: SCCourseEditTabType.CUSTOMIZE
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: 'ui.editCourse.tab.users',
|
|
37
|
+
value: SCCourseEditTabType.USERS
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'ui.editCourse.tab.requests',
|
|
41
|
+
value: SCCourseEditTabType.REQUESTS
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'ui.editCourse.tab.options',
|
|
45
|
+
value: SCCourseEditTabType.OPTIONS
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
const Root = styled(Box, {
|
|
49
|
+
name: PREFIX,
|
|
50
|
+
slot: 'Root',
|
|
51
|
+
overridesResolver: (_props, styles) => styles.root
|
|
52
|
+
})(() => ({}));
|
|
53
|
+
export default function EditCourse(inProps) {
|
|
54
|
+
// PROPS
|
|
55
|
+
const props = useThemeProps({
|
|
56
|
+
props: inProps,
|
|
57
|
+
name: PREFIX
|
|
58
|
+
});
|
|
59
|
+
const { courseId, course, tab = SCCourseEditTabType.LESSONS, onTabChange, onTabSelect, className } = props, rest = __rest(props, ["courseId", "course", "tab", "onTabChange", "onTabSelect", "className"]);
|
|
60
|
+
// STATES
|
|
61
|
+
const [tabValue, setTabValue] = useState(tab);
|
|
62
|
+
// CONTEXTS
|
|
63
|
+
const scRoutingContext = useSCRouting();
|
|
64
|
+
// HOOKS
|
|
65
|
+
const { scCourse, setSCCourse } = useSCFetchCourse({ id: courseId, course, params: { view: CourseInfoViewType.EDIT } });
|
|
66
|
+
const theme = useTheme();
|
|
67
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
68
|
+
// HANDLERS
|
|
69
|
+
const handleTabChange = useCallback((_e, newTabValue) => {
|
|
70
|
+
if (onTabSelect) {
|
|
71
|
+
onTabSelect(newTabValue);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
setTabValue(newTabValue);
|
|
75
|
+
onTabChange === null || onTabChange === void 0 ? void 0 : onTabChange(newTabValue);
|
|
76
|
+
}
|
|
77
|
+
}, [setTabValue, onTabChange, onTabSelect]);
|
|
78
|
+
// MEMOS
|
|
79
|
+
const panelData = useMemo(() => {
|
|
80
|
+
return [
|
|
81
|
+
{
|
|
82
|
+
value: SCCourseEditTabType.LESSONS,
|
|
83
|
+
children: _jsx(Lessons, { course: scCourse, setCourse: setSCCourse, handleTabChange: handleTabChange })
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
value: SCCourseEditTabType.CUSTOMIZE,
|
|
87
|
+
children: _jsx(Customize, { course: scCourse, setCourse: setSCCourse })
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
value: SCCourseEditTabType.USERS,
|
|
91
|
+
children: _jsx(Users, { course: scCourse, handleTabChange: handleTabChange })
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
value: SCCourseEditTabType.REQUESTS,
|
|
95
|
+
children: _jsx(Requests, { course: scCourse, handleTabChange: handleTabChange })
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
value: SCCourseEditTabType.OPTIONS,
|
|
99
|
+
children: _jsx(Options, { course: scCourse, setCourse: setSCCourse })
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
}, [scCourse, handleTabChange]);
|
|
103
|
+
if (!scCourse) {
|
|
104
|
+
return _jsx(EditCourseSkeleton, { tab: tab });
|
|
105
|
+
}
|
|
106
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsxs(Stack, Object.assign({ className: classes.header }, { children: [_jsx(IconButton, Object.assign({ href: scRoutingContext.url(SCRoutes.COURSE_DASHBOARD_ROUTE_NAME, scCourse), size: "small" }, { children: _jsx(Icon, Object.assign({ className: classes.contrastColor }, { children: "arrow_back" })) })), _jsx(Typography, Object.assign({ variant: "h5", className: classes.contrastColor }, { children: scCourse.name }))] })), _jsxs(TabContext, Object.assign({ value: tabValue }, { children: [_jsx(TabList, Object.assign({ className: classes.tabList, onChange: handleTabChange, textColor: "primary", indicatorColor: "primary", variant: isMobile ? 'scrollable' : 'standard', scrollButtons: isMobile, centered: !isMobile }, { children: TAB_DATA.map((data, i) => (_jsx(Tab, { label: _jsx(Typography, Object.assign({ variant: "h6" }, { children: _jsx(FormattedMessage, { id: data.label, defaultMessage: data.label }) })), value: data.value, className: classNames(classes.tab, classes.contrastColor) }, i))) })), panelData.map((data, i) => (_jsx(TabPanel, Object.assign({ className: classes.tabPanel, value: data.value }, { children: data.children }), i)))] }))] })));
|
|
107
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ButtonProps } from '@mui/material';
|
|
3
|
+
interface AddButtonProps extends ButtonProps {
|
|
4
|
+
label: string;
|
|
5
|
+
handleAddRow: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare function AddButton(props: AddButtonProps): JSX.Element;
|
|
8
|
+
declare const _default: import("react").MemoExoticComponent<typeof AddButton>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Button, Icon, IconButton, Typography, useMediaQuery, useTheme } from '@mui/material';
|
|
4
|
+
import { FormattedMessage } from 'react-intl';
|
|
5
|
+
import { PREFIX } from '../constants';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import PubSub from 'pubsub-js';
|
|
8
|
+
import { SCGroupEventType, SCTopicType } from '../../../constants/PubSub';
|
|
9
|
+
import { Fragment, memo, useCallback } from 'react';
|
|
10
|
+
const classes = {
|
|
11
|
+
sectionButton: `${PREFIX}-section-button`,
|
|
12
|
+
sectionButtonTypography: `${PREFIX}-section-button-typography`
|
|
13
|
+
};
|
|
14
|
+
function AddButton(props) {
|
|
15
|
+
// PROPS
|
|
16
|
+
const { label, handleAddRow, className } = props, rest = __rest(props, ["label", "handleAddRow", "className"]);
|
|
17
|
+
// HOOKS
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
20
|
+
// HANDLERS
|
|
21
|
+
const handleClick = useCallback(() => {
|
|
22
|
+
handleAddRow();
|
|
23
|
+
PubSub.publish(`${SCTopicType.COURSE}.${SCGroupEventType.UPDATE}`, true);
|
|
24
|
+
}, [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
|
+
}
|
|
27
|
+
export default memo(AddButton);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SCCourseLessonType, SCCourseSectionType, SCCourseType } from '@selfcommunity/types';
|
|
3
|
+
import { ActionLessonType } from '../types';
|
|
4
|
+
interface ChangeLessonStatusProps {
|
|
5
|
+
course: SCCourseType;
|
|
6
|
+
section: SCCourseSectionType;
|
|
7
|
+
lesson: SCCourseLessonType;
|
|
8
|
+
onChange: (lesson: SCCourseLessonType, type: ActionLessonType) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function ChangeLessonStatus(props: ChangeLessonStatusProps): JSX.Element;
|
|
12
|
+
declare const _default: import("react").MemoExoticComponent<typeof ChangeLessonStatus>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Icon, MenuItem, Select, Typography, useMediaQuery, useTheme } from '@mui/material';
|
|
3
|
+
import { Fragment, memo, useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { FormattedMessage } from 'react-intl';
|
|
5
|
+
import { PREFIX } from '../constants';
|
|
6
|
+
import MenuRow from '../MenuRow';
|
|
7
|
+
import { Logger } from '@selfcommunity/utils';
|
|
8
|
+
import { SCOPE_SC_UI } from '../../../constants/Errors';
|
|
9
|
+
import { LoadingButton } from '@mui/lab';
|
|
10
|
+
import { useSnackbar } from 'notistack';
|
|
11
|
+
import { SCCourseLessonStatusType } from '@selfcommunity/types';
|
|
12
|
+
import { CourseService } from '@selfcommunity/api-services';
|
|
13
|
+
import { ActionLessonType } from '../types';
|
|
14
|
+
const OPTIONS = [
|
|
15
|
+
{
|
|
16
|
+
id: 'ui.editCourse.tab.lessons.table.select.draft',
|
|
17
|
+
value: 'ui.editCourse.tab.lessons.table.select.draft'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 'ui.editCourse.tab.lessons.table.select.published',
|
|
21
|
+
value: 'ui.editCourse.tab.lessons.table.select.published'
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
const classes = {
|
|
25
|
+
changeLessonStatusPublishedWrapper: `${PREFIX}-change-lesson-status-published-wrapper`,
|
|
26
|
+
changeLessonStatusIconDraft: `${PREFIX}-change-lesson-status-icon-draft`
|
|
27
|
+
};
|
|
28
|
+
function ChangeLessonStatus(props) {
|
|
29
|
+
// PROPS
|
|
30
|
+
const { course, section, lesson, onChange, disabled } = props;
|
|
31
|
+
// HOOKS
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
34
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
35
|
+
// STATES
|
|
36
|
+
const [value, setValue] = useState('');
|
|
37
|
+
const [loading, setLoading] = useState(false);
|
|
38
|
+
// EFFECTS
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setValue(`ui.editCourse.tab.lessons.table.select.${lesson.status || 'draft'}`);
|
|
41
|
+
}, [lesson, setValue]);
|
|
42
|
+
// MEMOS
|
|
43
|
+
const hasPublished = useMemo(() => value === 'ui.editCourse.tab.lessons.table.select.published', [value]);
|
|
44
|
+
const icon = useMemo(() => value === 'ui.editCourse.tab.lessons.table.select.draft' ? (_jsx(Box, { className: classes.changeLessonStatusIconDraft })) : (_jsx(Icon, { children: "circle_checked" })), [value]);
|
|
45
|
+
// HANDLERS
|
|
46
|
+
const handleAction = useCallback((newValue) => {
|
|
47
|
+
setLoading(true);
|
|
48
|
+
const newStatus = newValue.endsWith(SCCourseLessonStatusType.DRAFT) ? SCCourseLessonStatusType.DRAFT : SCCourseLessonStatusType.PUBLISHED;
|
|
49
|
+
const data = {
|
|
50
|
+
status: newStatus
|
|
51
|
+
};
|
|
52
|
+
CourseService.patchCourseLesson(course.id, section.id, lesson.id, data)
|
|
53
|
+
.then(() => {
|
|
54
|
+
setValue(newValue);
|
|
55
|
+
setLoading(false);
|
|
56
|
+
onChange(Object.assign(Object.assign({}, lesson), { status: newStatus }), ActionLessonType.UPDATE);
|
|
57
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.snackbar.save", defaultMessage: "ui.editCourse.tab.lessons.table.snackbar.save" }), {
|
|
58
|
+
variant: 'success',
|
|
59
|
+
autoHideDuration: 3000
|
|
60
|
+
});
|
|
61
|
+
})
|
|
62
|
+
.catch((error) => {
|
|
63
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
64
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
65
|
+
variant: 'error',
|
|
66
|
+
autoHideDuration: 3000
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}, [course, section, lesson, setLoading, setValue]);
|
|
70
|
+
const handleChange = useCallback((e) => handleAction(e.target.value), [handleAction]);
|
|
71
|
+
const handleClick = useCallback((e) => {
|
|
72
|
+
const newValue = e.currentTarget.getAttribute('data-value');
|
|
73
|
+
if (newValue !== value) {
|
|
74
|
+
handleAction(newValue);
|
|
75
|
+
}
|
|
76
|
+
}, [handleAction, value]);
|
|
77
|
+
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(LoadingButton, Object.assign({ size: "small", color: "inherit", onClick: handleClick, loading: loading, disabled: loading, "data-value": option.value, sx: {
|
|
78
|
+
padding: 0,
|
|
79
|
+
':hover': {
|
|
80
|
+
backgroundColor: 'unset'
|
|
81
|
+
}
|
|
82
|
+
} }, { 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(LoadingButton, Object.assign({ size: "small", color: "inherit", loading: loading, disabled: loading, sx: {
|
|
83
|
+
padding: 0,
|
|
84
|
+
':hover': {
|
|
85
|
+
backgroundColor: 'unset'
|
|
86
|
+
}
|
|
87
|
+
} }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: option.id, defaultMessage: option.id }) })) })) }), i))) }))) }));
|
|
88
|
+
}
|
|
89
|
+
export default memo(ChangeLessonStatus);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SCCourseSectionType } from '@selfcommunity/types';
|
|
3
|
+
import { EndpointType } from '@selfcommunity/api-services';
|
|
4
|
+
import { ActionLessonType } from '../types';
|
|
5
|
+
interface FieldNameProps<T> {
|
|
6
|
+
endpoint: EndpointType;
|
|
7
|
+
row: T;
|
|
8
|
+
isNewRow: boolean;
|
|
9
|
+
handleManageRow: (section: SCCourseSectionType, type: ActionLessonType, newRow?: boolean) => void;
|
|
10
|
+
editMode: boolean;
|
|
11
|
+
handleDisableEditMode: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare function FieldName<T extends SCCourseSectionType>(props: FieldNameProps<T>): JSX.Element;
|
|
14
|
+
declare const _default: import("react").MemoExoticComponent<typeof FieldName>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LoadingButton } from '@mui/lab';
|
|
3
|
+
import { debounce, Icon, IconButton, Stack, TextField, Typography } from '@mui/material';
|
|
4
|
+
import { Fragment, memo, useCallback, useState } from 'react';
|
|
5
|
+
import { PREFIX } from '../constants';
|
|
6
|
+
import { Logger } from '@selfcommunity/utils';
|
|
7
|
+
import { SCOPE_SC_UI } from '../../../constants/Errors';
|
|
8
|
+
import { FormattedMessage } from 'react-intl';
|
|
9
|
+
import { useSnackbar } from 'notistack';
|
|
10
|
+
import { SCCourseLessonTypologyType } from '@selfcommunity/types';
|
|
11
|
+
import { http } from '@selfcommunity/api-services';
|
|
12
|
+
import { ActionLessonType } from '../types';
|
|
13
|
+
import PubSub from 'pubsub-js';
|
|
14
|
+
import { SCGroupEventType, SCTopicType } from '../../../constants/PubSub';
|
|
15
|
+
const classes = {
|
|
16
|
+
editModeWrapper: `${PREFIX}-edit-mode-wrapper`,
|
|
17
|
+
editModeSaveButton: `${PREFIX}-edit-mode-save-button`,
|
|
18
|
+
editModeCloseButton: `${PREFIX}-edit-mode-close-button`
|
|
19
|
+
};
|
|
20
|
+
function FieldName(props) {
|
|
21
|
+
// PROPS
|
|
22
|
+
const { endpoint, row, isNewRow, handleManageRow, editMode, handleDisableEditMode } = props;
|
|
23
|
+
// STATES
|
|
24
|
+
const [loading, setLoading] = useState(false);
|
|
25
|
+
const [name, setName] = useState(row.name);
|
|
26
|
+
// HOOKS
|
|
27
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
28
|
+
// DEBOUNCE
|
|
29
|
+
const debounceSetData = debounce((newName) => {
|
|
30
|
+
setName(newName);
|
|
31
|
+
}, 300);
|
|
32
|
+
// HANDLERS
|
|
33
|
+
const handleChange = useCallback((e) => {
|
|
34
|
+
debounceSetData(e.target.value);
|
|
35
|
+
}, [debounceSetData]);
|
|
36
|
+
const handleSubmit = useCallback(() => {
|
|
37
|
+
setLoading(true);
|
|
38
|
+
http
|
|
39
|
+
.request({
|
|
40
|
+
url: endpoint.url(),
|
|
41
|
+
method: endpoint.method,
|
|
42
|
+
data: {
|
|
43
|
+
name,
|
|
44
|
+
type: SCCourseLessonTypologyType.LESSON
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
.then((response) => {
|
|
48
|
+
handleManageRow(response.data, isNewRow ? ActionLessonType.ADD : ActionLessonType.RENAME);
|
|
49
|
+
setName(null);
|
|
50
|
+
setLoading(false);
|
|
51
|
+
handleDisableEditMode();
|
|
52
|
+
if (isNewRow) {
|
|
53
|
+
PubSub.publish(`${SCTopicType.COURSE}.${SCGroupEventType.UPDATE}`, false);
|
|
54
|
+
}
|
|
55
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.snackbar.save", defaultMessage: "ui.editCourse.tab.lessons.table.snackbar.save" }), {
|
|
56
|
+
variant: 'success',
|
|
57
|
+
autoHideDuration: 3000
|
|
58
|
+
});
|
|
59
|
+
})
|
|
60
|
+
.catch((error) => {
|
|
61
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
62
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
63
|
+
variant: 'error',
|
|
64
|
+
autoHideDuration: 3000
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}, [isNewRow, name, endpoint, setLoading, handleDisableEditMode, handleManageRow]);
|
|
68
|
+
const handleClose = useCallback(() => {
|
|
69
|
+
if (isNewRow) {
|
|
70
|
+
handleManageRow(row, ActionLessonType.DELETE, true);
|
|
71
|
+
PubSub.publish(`${SCTopicType.COURSE}.${SCGroupEventType.UPDATE}`, false);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
setName(null);
|
|
75
|
+
handleDisableEditMode();
|
|
76
|
+
}
|
|
77
|
+
}, [row, isNewRow, handleManageRow, setName, handleDisableEditMode]);
|
|
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(LoadingButton, Object.assign({ size: "small", color: "primary", variant: "outlined", 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" }, { children: row.name }))) }));
|
|
79
|
+
}
|
|
80
|
+
export default memo(FieldName);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DraggableProvided } from '@hello-pangea/dnd';
|
|
3
|
+
import { SCCourseLessonType, SCCourseSectionType, SCCourseType } from '@selfcommunity/types';
|
|
4
|
+
import { ActionLessonType, DeleteRowRef } from '../types';
|
|
5
|
+
interface LessonRowProps {
|
|
6
|
+
provider: DraggableProvided;
|
|
7
|
+
course: SCCourseType;
|
|
8
|
+
section: SCCourseSectionType;
|
|
9
|
+
lesson: SCCourseLessonType;
|
|
10
|
+
isNewRow: boolean;
|
|
11
|
+
handleManageLesson: (lesson: SCCourseLessonType, type: ActionLessonType, newRow?: boolean) => void;
|
|
12
|
+
handleOpenDialog: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<LessonRowProps & import("react").RefAttributes<DeleteRowRef>>>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon, MenuItem, Stack, TableCell, TableRow, Typography } from '@mui/material';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { PREFIX } from '../constants';
|
|
5
|
+
import { forwardRef, memo, useCallback, useImperativeHandle, useState } from 'react';
|
|
6
|
+
import MenuRow from '../MenuRow';
|
|
7
|
+
import { FormattedMessage } from 'react-intl';
|
|
8
|
+
import FieldName from './FieldName';
|
|
9
|
+
import ChangeLessonStatus from './ChangeLessonStatus';
|
|
10
|
+
import { CourseService, Endpoints } from '@selfcommunity/api-services';
|
|
11
|
+
import { Logger } from '@selfcommunity/utils';
|
|
12
|
+
import { useSnackbar } from 'notistack';
|
|
13
|
+
import { Link, SCRoutes, useSCRouting } from '@selfcommunity/react-core';
|
|
14
|
+
import { SCOPE_SC_UI } from '../../../constants/Errors';
|
|
15
|
+
import { ActionLessonType } from '../types';
|
|
16
|
+
import { useIsDisabled } from '../hooks';
|
|
17
|
+
import { getUrlLesson } from '../../../utils/course';
|
|
18
|
+
const classes = {
|
|
19
|
+
cellWidth: `${PREFIX}-cell-width`,
|
|
20
|
+
cellAlignRight: `${PREFIX}-cell-align-right`,
|
|
21
|
+
cellPadding: `${PREFIX}-cell-padding`,
|
|
22
|
+
tableBodyIconWrapper: `${PREFIX}-table-body-icon-wrapper`,
|
|
23
|
+
actionsWrapper: `${PREFIX}-actions-wrapper`
|
|
24
|
+
};
|
|
25
|
+
function LessonRow(props, ref) {
|
|
26
|
+
// PROPS
|
|
27
|
+
const { provider, course, section, lesson, isNewRow, handleManageLesson, handleOpenDialog } = props;
|
|
28
|
+
// STATES
|
|
29
|
+
const [editMode, setEditMode] = useState(false);
|
|
30
|
+
// CONTEXTS
|
|
31
|
+
const scRoutingContext = useSCRouting();
|
|
32
|
+
// HOOKS
|
|
33
|
+
const { isDisabled } = useIsDisabled();
|
|
34
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
35
|
+
// HANDLERS
|
|
36
|
+
const handleAbleEditMode = useCallback(() => setTimeout(() => setEditMode(true)), [setEditMode]);
|
|
37
|
+
const handleDisableEditMode = useCallback(() => setEditMode(false), [setEditMode]);
|
|
38
|
+
const handleDeleteLesson = useCallback((deleteSection, deleteLesson) => {
|
|
39
|
+
CourseService.deleteCourseLesson(course.id, deleteSection.id, deleteLesson.id)
|
|
40
|
+
.then(() => {
|
|
41
|
+
handleManageLesson(deleteLesson, ActionLessonType.DELETE);
|
|
42
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.snackbar.delete", defaultMessage: "ui.editCourse.tab.lessons.table.snackbar.delete" }), {
|
|
43
|
+
variant: 'success',
|
|
44
|
+
autoHideDuration: 3000
|
|
45
|
+
});
|
|
46
|
+
})
|
|
47
|
+
.catch((error) => {
|
|
48
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
49
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
50
|
+
variant: 'error',
|
|
51
|
+
autoHideDuration: 3000
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}, [course, handleManageLesson]);
|
|
55
|
+
useImperativeHandle(ref, () => ({
|
|
56
|
+
handleDeleteLesson: (deleteSection, deleteLesson) => handleDeleteLesson(deleteSection, deleteLesson)
|
|
57
|
+
}), [handleDeleteLesson]);
|
|
58
|
+
return (_jsxs(TableRow, Object.assign({}, provider.draggableProps, { ref: provider.innerRef }, { children: [_jsx(TableCell, { width: "4%" }), _jsx(TableCell, Object.assign({ component: "th", scope: "row" }, provider.dragHandleProps, { className: classNames(classes.cellWidth, classes.cellPadding) }, { children: _jsx(Stack, Object.assign({ className: classes.tableBodyIconWrapper }, { children: _jsx(Icon, Object.assign({ color: "disabled" }, { children: "drag" })) })) })), _jsx(TableCell, { children: _jsx(FieldName, { endpoint: {
|
|
59
|
+
url: () => isNewRow
|
|
60
|
+
? Endpoints.CreateCourseLesson.url({ id: course.id, section_id: section.id })
|
|
61
|
+
: Endpoints.PatchCourseLesson.url({ id: course.id, section_id: section.id, lesson_id: lesson.id }),
|
|
62
|
+
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
|
+
}
|
|
65
|
+
export default memo(forwardRef(LessonRow));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DraggableProvided } from '@hello-pangea/dnd';
|
|
3
|
+
import { SCCourseSectionType, SCCourseType } from '@selfcommunity/types';
|
|
4
|
+
import { ActionLessonType, DeleteRowProps, DeleteRowRef } from '../types';
|
|
5
|
+
interface SectionRowProps {
|
|
6
|
+
course: SCCourseType;
|
|
7
|
+
provider: DraggableProvided;
|
|
8
|
+
section: SCCourseSectionType;
|
|
9
|
+
isNewRow: boolean;
|
|
10
|
+
handleManageSection: (section: SCCourseSectionType, type: ActionLessonType, newRow?: boolean) => void;
|
|
11
|
+
handleOpenDialog: (row: DeleteRowProps) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<SectionRowProps & import("react").RefAttributes<DeleteRowRef>>>;
|
|
14
|
+
export default _default;
|