@selfcommunity/react-ui 0.11.0-alpha.60 → 0.11.0-alpha.61
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,48 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { LoadingButton } from '@mui/lab';
|
|
3
|
+
import { Icon } from '@mui/material';
|
|
4
|
+
import { CourseService } from '@selfcommunity/api-services';
|
|
5
|
+
import { forwardRef, memo, useCallback, useImperativeHandle, useState } from 'react';
|
|
6
|
+
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
7
|
+
import { Logger } from '@selfcommunity/utils';
|
|
8
|
+
import { FormattedMessage } from 'react-intl';
|
|
9
|
+
import { useSnackbar } from 'notistack';
|
|
10
|
+
import PubSub from 'pubsub-js';
|
|
11
|
+
import { SCCourseEventType, SCTopicType } from '../../constants/PubSub';
|
|
12
|
+
import { SCCourseEditTabType } from '../../types/course';
|
|
13
|
+
function RemoveButton(props, ref) {
|
|
14
|
+
// PROPS
|
|
15
|
+
const { course, user, handleOpenDialog } = props;
|
|
16
|
+
// STATES
|
|
17
|
+
const [loading, setLoading] = useState(false);
|
|
18
|
+
// HOOKS
|
|
19
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
20
|
+
// HANDLERS
|
|
21
|
+
const handleSubmit = useCallback((userToRemove) => {
|
|
22
|
+
setLoading(true);
|
|
23
|
+
const params = {
|
|
24
|
+
user: userToRemove.id
|
|
25
|
+
};
|
|
26
|
+
CourseService.leaveOrRemoveCourseRequest(course.id, params)
|
|
27
|
+
.then(() => {
|
|
28
|
+
setLoading(false);
|
|
29
|
+
PubSub.publish(`${SCTopicType.COURSE}.${SCCourseEventType.REMOVE_MEMBER}`, userToRemove);
|
|
30
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.editCourse.tab.users.table.snackbar.removed", defaultMessage: "ui.editCourse.tab.users.table.snackbar.removed" }), {
|
|
31
|
+
variant: 'success',
|
|
32
|
+
autoHideDuration: 3000
|
|
33
|
+
});
|
|
34
|
+
})
|
|
35
|
+
.catch((error) => {
|
|
36
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
37
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
38
|
+
variant: 'error',
|
|
39
|
+
autoHideDuration: 3000
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}, [course, setLoading]);
|
|
43
|
+
useImperativeHandle(ref, () => ({
|
|
44
|
+
handleManageUser: (userToRemove) => handleSubmit(userToRemove)
|
|
45
|
+
}), [handleSubmit]);
|
|
46
|
+
return (_jsx(LoadingButton, Object.assign({ size: "small", color: "inherit", variant: "outlined", onClick: () => handleOpenDialog({ tab: SCCourseEditTabType.USERS, user }), loading: loading, disabled: loading }, { children: _jsx(Icon, { children: "close" }) })));
|
|
47
|
+
}
|
|
48
|
+
export default memo(forwardRef(RemoveButton));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SCCourseType, SCUserType } from '@selfcommunity/types';
|
|
3
|
+
import { SCCourseEditManageUserProps, SCCourseEditManageUserRef } from '../../types/course';
|
|
4
|
+
interface RequestButtonProps {
|
|
5
|
+
course: SCCourseType;
|
|
6
|
+
user: SCUserType;
|
|
7
|
+
handleOpenDialog: (tab: SCCourseEditManageUserProps) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<RequestButtonProps & import("react").RefAttributes<SCCourseEditManageUserRef>>>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LoadingButton } from '@mui/lab';
|
|
3
|
+
import { Icon, Stack } from '@mui/material';
|
|
4
|
+
import { CourseService } from '@selfcommunity/api-services';
|
|
5
|
+
import { forwardRef, memo, useCallback, useImperativeHandle, useState } from 'react';
|
|
6
|
+
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
7
|
+
import { Logger } from '@selfcommunity/utils';
|
|
8
|
+
import { FormattedMessage } from 'react-intl';
|
|
9
|
+
import { useSnackbar } from 'notistack';
|
|
10
|
+
import { PREFIX } from './constants';
|
|
11
|
+
import PubSub from 'pubsub-js';
|
|
12
|
+
import { SCCourseEventType, SCTopicType } from '../../constants/PubSub';
|
|
13
|
+
import { SCCourseEditTabType } from '../../types/course';
|
|
14
|
+
const classes = {
|
|
15
|
+
requestButtonWrapper: `${PREFIX}-request-button-wrapper`
|
|
16
|
+
};
|
|
17
|
+
function RequestButton(props, ref) {
|
|
18
|
+
// PROPS
|
|
19
|
+
const { course, user, handleOpenDialog } = props;
|
|
20
|
+
// STATES
|
|
21
|
+
const [acceptLoading, setAcceptLoading] = useState(false);
|
|
22
|
+
const [rejectLoading, setRejectLoading] = useState(false);
|
|
23
|
+
// HOOKS
|
|
24
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
25
|
+
// HANDLERS
|
|
26
|
+
const handleAccept = useCallback(() => {
|
|
27
|
+
setAcceptLoading(true);
|
|
28
|
+
const data = {
|
|
29
|
+
users: [user.id]
|
|
30
|
+
};
|
|
31
|
+
CourseService.inviteOrAcceptUsersToCourse(course.id, data)
|
|
32
|
+
.then(() => {
|
|
33
|
+
setAcceptLoading(false);
|
|
34
|
+
PubSub.publish(`${SCTopicType.COURSE}.${SCCourseEventType.ADD_MEMBER}`, user);
|
|
35
|
+
PubSub.publish(`${SCTopicType.COURSE}.${SCCourseEventType.REJECT_MEMBER}`, user);
|
|
36
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.editCourse.tab.requests.table.snackbar.accepted", defaultMessage: "ui.editCourse.tab.requests.table.snackbar.accepted" }), {
|
|
37
|
+
variant: 'success',
|
|
38
|
+
autoHideDuration: 3000
|
|
39
|
+
});
|
|
40
|
+
})
|
|
41
|
+
.catch((error) => {
|
|
42
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
43
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
44
|
+
variant: 'error',
|
|
45
|
+
autoHideDuration: 3000
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}, [course, user, setAcceptLoading]);
|
|
49
|
+
const handleReject = useCallback((userToReject) => {
|
|
50
|
+
setRejectLoading(true);
|
|
51
|
+
const params = {
|
|
52
|
+
user: userToReject.id
|
|
53
|
+
};
|
|
54
|
+
CourseService.leaveOrRemoveCourseRequest(course.id, params)
|
|
55
|
+
.then(() => {
|
|
56
|
+
setRejectLoading(false);
|
|
57
|
+
PubSub.publish(`${SCTopicType.COURSE}.${SCCourseEventType.REJECT_MEMBER}`, userToReject);
|
|
58
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.editCourse.tab.requests.table.snackbar.rejected", defaultMessage: "ui.editCourse.tab.requests.table.snackbar.rejected" }), {
|
|
59
|
+
variant: 'success',
|
|
60
|
+
autoHideDuration: 3000
|
|
61
|
+
});
|
|
62
|
+
})
|
|
63
|
+
.catch((error) => {
|
|
64
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
65
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
66
|
+
variant: 'error',
|
|
67
|
+
autoHideDuration: 3000
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}, [course, setRejectLoading]);
|
|
71
|
+
useImperativeHandle(ref, () => ({
|
|
72
|
+
handleManageUser: (userToReject) => handleReject(userToReject)
|
|
73
|
+
}), [handleReject]);
|
|
74
|
+
return (_jsxs(Stack, Object.assign({ className: classes.requestButtonWrapper }, { children: [_jsx(LoadingButton, Object.assign({ size: "small", color: "primary", variant: "outlined", onClick: handleAccept, loading: acceptLoading, disabled: acceptLoading }, { children: _jsx(Icon, { children: "check" }) })), _jsx(LoadingButton, Object.assign({ size: "small", color: "inherit", variant: "outlined", onClick: () => handleOpenDialog({ tab: SCCourseEditTabType.REQUESTS, request: user }), loading: rejectLoading, disabled: rejectLoading }, { children: _jsx(Icon, { children: "close" }) }))] })));
|
|
75
|
+
}
|
|
76
|
+
export default memo(forwardRef(RequestButton));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SkeletonOwnProps } from '@mui/material';
|
|
2
|
+
interface CourseUsersTableRowSkeletonProps {
|
|
3
|
+
header?: boolean;
|
|
4
|
+
animation?: SkeletonOwnProps['animation'];
|
|
5
|
+
editMode?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export default function CourseUsersTableRowSkeleton(props: CourseUsersTableRowSkeletonProps): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Skeleton, Stack, TableCell, TableRow } from '@mui/material';
|
|
3
|
+
export default function CourseUsersTableRowSkeleton(props) {
|
|
4
|
+
const { header = false, animation = 'wave', editMode = false } = props;
|
|
5
|
+
return (_jsx(TableRow, { children: Array.from(new Array(editMode ? 4 : 5)).map((_, i, array) => {
|
|
6
|
+
if (!editMode && i === array.length - 1) {
|
|
7
|
+
return (_jsx(TableCell, Object.assign({ width: "14%" }, { children: _jsx(Skeleton, { animation: animation, variant: "rounded", width: "139px", height: "29px" }) }), i));
|
|
8
|
+
}
|
|
9
|
+
return (_jsxs(TableCell, Object.assign({ width: !editMode ? '20%' : '25%' }, { children: [!header && i === 0 && (_jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "16px" }, { children: [_jsx(Skeleton, { animation: animation, variant: "circular", width: "30px", height: "30px" }), _jsx(Skeleton, { animation: animation, variant: "text", width: "118px", height: "24px" })] }))), ((!header && i > 0) || header) && _jsx(Skeleton, { animation: animation, variant: "text", width: "78px", height: "24px" })] }), i));
|
|
10
|
+
}) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SCCourseType, SCUserType } from '@selfcommunity/types';
|
|
3
|
+
interface SeeProgressButtonProps {
|
|
4
|
+
course: SCCourseType;
|
|
5
|
+
user: SCUserType;
|
|
6
|
+
}
|
|
7
|
+
declare function SeeProgressButton(props: SeeProgressButtonProps): JSX.Element;
|
|
8
|
+
declare const _default: import("react").MemoExoticComponent<typeof SeeProgressButton>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar, Button, Icon, IconButton, Skeleton, Stack, styled, Typography, useMediaQuery, useTheme } from '@mui/material';
|
|
3
|
+
import { Fragment, memo, useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import { FormattedMessage } from 'react-intl';
|
|
5
|
+
import BaseDialog from '../BaseDialog';
|
|
6
|
+
import { Link, SCRoutes, useSCRouting } from '@selfcommunity/react-core';
|
|
7
|
+
import { PREFIX } from './constants';
|
|
8
|
+
import AccordionLessons from '../AccordionLessons';
|
|
9
|
+
import { CourseService } from '@selfcommunity/api-services';
|
|
10
|
+
import { Logger } from '@selfcommunity/utils';
|
|
11
|
+
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
12
|
+
import UserAvatar from '../UserAvatar';
|
|
13
|
+
const classes = {
|
|
14
|
+
dialogRoot: `${PREFIX}-dialog-root`,
|
|
15
|
+
contentWrapper: `${PREFIX}-content-wrapper`,
|
|
16
|
+
infoOuterWrapper: `${PREFIX}-info-outer-wrapper`,
|
|
17
|
+
infoInnerWrapper: `${PREFIX}-info-inner-wrapper`,
|
|
18
|
+
avatarWrapper: `${PREFIX}-avatar-wrapper`,
|
|
19
|
+
avatar: `${PREFIX}-avatar`
|
|
20
|
+
};
|
|
21
|
+
const DialogRoot = styled(BaseDialog, {
|
|
22
|
+
name: PREFIX,
|
|
23
|
+
slot: 'DialogRoot',
|
|
24
|
+
overridesResolver: (_props, styles) => styles.dialogRoot
|
|
25
|
+
})(() => ({}));
|
|
26
|
+
function SeeProgressButton(props) {
|
|
27
|
+
// PROPS
|
|
28
|
+
const { course, user } = props;
|
|
29
|
+
// STATES
|
|
30
|
+
const [open, setOpen] = useState(false);
|
|
31
|
+
const [student, setStudent] = useState(null);
|
|
32
|
+
// CONTEXTS
|
|
33
|
+
const scRoutingContext = useSCRouting();
|
|
34
|
+
// HOOKS
|
|
35
|
+
const theme = useTheme();
|
|
36
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
37
|
+
// EFFECTS
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (open && !student) {
|
|
40
|
+
CourseService.getSpecificCourseInfo(course.id, { user: user.id })
|
|
41
|
+
.then((data) => setStudent(data))
|
|
42
|
+
.catch((error) => Logger.error(SCOPE_SC_UI, error));
|
|
43
|
+
}
|
|
44
|
+
}, [open, student, course, user]);
|
|
45
|
+
// HANDLERS
|
|
46
|
+
const handleToggleOpen = useCallback(() => {
|
|
47
|
+
setOpen((prev) => !prev);
|
|
48
|
+
}, [setOpen]);
|
|
49
|
+
return (_jsxs(Fragment, { children: [isMobile ? (_jsx(IconButton, Object.assign({ size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Icon, { children: "chevron_right" }) }))) : (_jsx(Button, Object.assign({ variant: "outlined", size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.action.btn.label", defaultMessage: "ui.courseUsersTable.action.btn.label" }) })) }))), open && (_jsx(DialogRoot, Object.assign({ DialogContentProps: { dividers: isMobile }, open: true, scroll: "paper", onClose: handleToggleOpen, title: _jsx(Typography, Object.assign({ variant: "h3" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.title", defaultMessage: "ui.courseUsersTable.dialog.title" }) })), className: classes.dialogRoot }, { children: _jsxs(Stack, Object.assign({ className: classes.contentWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoOuterWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoInnerWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Link, Object.assign({}, (!course.created_by.deleted && {
|
|
50
|
+
to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, course.created_by)
|
|
51
|
+
}), { children: _jsx(UserAvatar, Object.assign({ hide: !course.created_by.community_badge, smaller: true }, { children: _jsx(Avatar, { className: classes.avatar, src: user.avatar, alt: user.username }) })) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: user.username }))] })), _jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, user), variant: "outlined", size: "small", color: "inherit" }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.btn.label", defaultMessage: "ui.courseUsersTable.dialog.btn.label" }) })) }))] })), student ? (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text1", defaultMessage: "ui.courseUsersTable.dialog.info.text1", values: { lessonsCompleted: student.num_lessons_completed } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" })), student ? (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text2", defaultMessage: "ui.courseUsersTable.dialog.info.text2", values: { courseCompleted: student.user_completion_rate } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" }))] })), _jsx(AccordionLessons, { course: student, viewerJoinStatus: course.join_status })] })) })))] }));
|
|
52
|
+
}
|
|
53
|
+
export default memo(SeeProgressButton);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CourseUsersTableSkeleton(): JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Skeleton, styled, Table, TableBody, TableContainer, TableHead } from '@mui/material';
|
|
3
|
+
import CourseUsersTableRowSkeleton from './RowSkeleton';
|
|
4
|
+
import { PREFIX } from './constants';
|
|
5
|
+
const classes = {
|
|
6
|
+
root: `${PREFIX}-skeleton-root`
|
|
7
|
+
};
|
|
8
|
+
const Root = styled(Box, {
|
|
9
|
+
name: PREFIX,
|
|
10
|
+
slot: 'SkeletonRoot',
|
|
11
|
+
overridesResolver: (_props, styles) => styles.skeletonRoot
|
|
12
|
+
})(() => ({}));
|
|
13
|
+
export default function CourseUsersTableSkeleton() {
|
|
14
|
+
return (_jsxs(Root, Object.assign({ className: classes.root }, { children: [_jsx(Skeleton, { animation: "wave", variant: "rectangular", width: "100%", height: "53px" }), _jsx(TableContainer, { children: _jsxs(Table, { children: [_jsx(TableHead, { children: _jsx(CourseUsersTableRowSkeleton, { header: true, editMode: true }) }), _jsx(TableBody, { children: _jsx(CourseUsersTableRowSkeleton, { editMode: true }) })] }) })] })));
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCCourseUsersTable";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PREFIX = 'SCCourseUsersTable';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface EmptyStatusProps {
|
|
3
|
+
icon: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
actions?: ReactNode;
|
|
7
|
+
className?: HTMLAttributes<HTMLDivElement>['className'];
|
|
8
|
+
}
|
|
9
|
+
declare function EmptyStatus(props: EmptyStatusProps): JSX.Element;
|
|
10
|
+
declare const _default: import("react").MemoExoticComponent<typeof EmptyStatus>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon, Stack, styled, Typography } from '@mui/material';
|
|
3
|
+
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
const PREFIX = 'SCEmptyStatus';
|
|
7
|
+
const classes = {
|
|
8
|
+
root: `${PREFIX}-root`,
|
|
9
|
+
box: `${PREFIX}-box`,
|
|
10
|
+
rotatedBox: `${PREFIX}-rotated-box`,
|
|
11
|
+
icon: `${PREFIX}-icon`
|
|
12
|
+
};
|
|
13
|
+
const Root = styled(Stack, {
|
|
14
|
+
name: PREFIX,
|
|
15
|
+
slot: 'Root',
|
|
16
|
+
overridesResolver: (_props, styles) => styles.root
|
|
17
|
+
})(() => ({}));
|
|
18
|
+
function EmptyStatus(props) {
|
|
19
|
+
// PROPS
|
|
20
|
+
const { icon, title, description, actions, className } = props;
|
|
21
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Stack, Object.assign({ className: classes.box }, { children: _jsx(Stack, Object.assign({ className: classes.rotatedBox }, { children: _jsx(Icon, Object.assign({ className: classes.icon, color: "disabled", fontSize: "large" }, { children: icon })) })) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })), description && (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: description, defaultMessage: description }) }))), actions] })));
|
|
22
|
+
}
|
|
23
|
+
export default memo(EmptyStatus);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SCCourseCommentType, SCCourseLessonType } from '@selfcommunity/types';
|
|
2
|
+
export interface LessonCommentActionsMenuProps {
|
|
3
|
+
/**
|
|
4
|
+
* Overrides or extends the styles applied to the component.
|
|
5
|
+
* @default null
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Course Lesson obj
|
|
10
|
+
* @default null
|
|
11
|
+
*/
|
|
12
|
+
lesson: SCCourseLessonType;
|
|
13
|
+
/**
|
|
14
|
+
* Course CommentObject id
|
|
15
|
+
* @default null
|
|
16
|
+
*/
|
|
17
|
+
commentObjectId?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Course Comment obj
|
|
20
|
+
* @default null
|
|
21
|
+
*/
|
|
22
|
+
commentObject: SCCourseCommentType;
|
|
23
|
+
/**
|
|
24
|
+
* Handle edit obj
|
|
25
|
+
*/
|
|
26
|
+
onEdit?: (obj: SCCourseCommentType) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Handle delete obj
|
|
29
|
+
*/
|
|
30
|
+
onDelete?: (obj: SCCourseCommentType) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Props to spread to popper
|
|
33
|
+
* @default empty object
|
|
34
|
+
*/
|
|
35
|
+
PopperProps?: any;
|
|
36
|
+
/**
|
|
37
|
+
* Any other properties
|
|
38
|
+
*/
|
|
39
|
+
[p: string]: any;
|
|
40
|
+
}
|
|
41
|
+
export default function LessonCommentActionsMenu(props: LessonCommentActionsMenuProps): JSX.Element;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { FormattedMessage } from 'react-intl';
|
|
6
|
+
import Popper from '@mui/material/Popper';
|
|
7
|
+
import Icon from '@mui/material/Icon';
|
|
8
|
+
import CentralProgress from '../CentralProgress';
|
|
9
|
+
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
10
|
+
import { Logger } from '@selfcommunity/utils';
|
|
11
|
+
import { useSnackbar } from 'notistack';
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import ConfirmDialog from '../ConfirmDialog/ConfirmDialog';
|
|
14
|
+
import { Box, CircularProgress, ClickAwayListener, Grow, IconButton, ListItemIcon, ListItemText, MenuItem, MenuList, Paper, SwipeableDrawer, useMediaQuery, useTheme } from '@mui/material';
|
|
15
|
+
import { Endpoints, http } from '@selfcommunity/api-services';
|
|
16
|
+
import { SCContext, SCUserContext, UserUtils, useSCFetchLessonCommentObject } from '@selfcommunity/react-core';
|
|
17
|
+
const EDIT_COMMENT = '_edit_comment';
|
|
18
|
+
const DELETE_COMMENT = '_delete_comment';
|
|
19
|
+
const PREFIX = 'SCLessonCommentActionsMenu';
|
|
20
|
+
const classes = {
|
|
21
|
+
root: `${PREFIX}-root`,
|
|
22
|
+
button: `${PREFIX}-button`,
|
|
23
|
+
popperRoot: `${PREFIX}-popper-root`,
|
|
24
|
+
paper: `${PREFIX}-paper`,
|
|
25
|
+
item: `${PREFIX}-item`,
|
|
26
|
+
itemText: `${PREFIX}-item-text`,
|
|
27
|
+
subItem: `${PREFIX}-sub-item`
|
|
28
|
+
};
|
|
29
|
+
const PopperRoot = styled(Popper, {
|
|
30
|
+
name: PREFIX,
|
|
31
|
+
slot: 'Root',
|
|
32
|
+
overridesResolver: (props, styles) => styles.popperRoot
|
|
33
|
+
})(() => ({}));
|
|
34
|
+
const Root = styled(Box, {
|
|
35
|
+
name: PREFIX,
|
|
36
|
+
slot: 'Root',
|
|
37
|
+
overridesResolver: (props, styles) => styles.root
|
|
38
|
+
})(() => ({}));
|
|
39
|
+
export default function LessonCommentActionsMenu(props) {
|
|
40
|
+
// PROPS
|
|
41
|
+
const { className, lesson, commentObjectId, commentObject, onEdit, onDelete, PopperProps = {} } = props, rest = __rest(props, ["className", "lesson", "commentObjectId", "commentObject", "onEdit", "onDelete", "PopperProps"]);
|
|
42
|
+
// CONTEXT
|
|
43
|
+
const theme = useTheme();
|
|
44
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
45
|
+
const scContext = useContext(SCContext);
|
|
46
|
+
const scUserContext = useContext(SCUserContext);
|
|
47
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
48
|
+
// COMMENT STATE
|
|
49
|
+
const { obj: commentObj, setObj: setCommentObj } = useSCFetchLessonCommentObject({ id: commentObjectId, commentObject: commentObject, lesson: lesson });
|
|
50
|
+
// GENERAL POPPER STATE
|
|
51
|
+
const [open, setOpen] = useState(false);
|
|
52
|
+
// CONFIRM ACTION DIALOG STATE
|
|
53
|
+
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
|
54
|
+
const [currentAction, setCurrentAction] = useState(null);
|
|
55
|
+
const [currentActionLoading, setCurrentActionLoading] = useState(null);
|
|
56
|
+
// CONST
|
|
57
|
+
let popperRef = useRef(null);
|
|
58
|
+
/**
|
|
59
|
+
* Handles open popup
|
|
60
|
+
*/
|
|
61
|
+
function handleOpen() {
|
|
62
|
+
if (scUserContext.user) {
|
|
63
|
+
setOpen(true);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
scContext.settings.handleAnonymousAction();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Closes popup
|
|
71
|
+
*/
|
|
72
|
+
function handleClose() {
|
|
73
|
+
if (popperRef.current && popperRef.current.contains(event.target)) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
setOpen(false);
|
|
77
|
+
if (rest.onClose) {
|
|
78
|
+
rest.onClose();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Perform delete comment
|
|
83
|
+
*/
|
|
84
|
+
const performDeleteComment = useMemo(() => () => {
|
|
85
|
+
return http
|
|
86
|
+
.request({
|
|
87
|
+
url: Endpoints.DeleteCourseComment.url({
|
|
88
|
+
id: lesson.course_id,
|
|
89
|
+
section_id: lesson.section_id,
|
|
90
|
+
lesson_id: lesson.id,
|
|
91
|
+
comment_id: commentObject.id
|
|
92
|
+
}),
|
|
93
|
+
method: Endpoints.DeleteCourseComment.method
|
|
94
|
+
})
|
|
95
|
+
.then((res) => {
|
|
96
|
+
if (res.status >= 300) {
|
|
97
|
+
return Promise.reject(res);
|
|
98
|
+
}
|
|
99
|
+
return Promise.resolve(res.data);
|
|
100
|
+
});
|
|
101
|
+
}, [commentObj, lesson]);
|
|
102
|
+
/**
|
|
103
|
+
* handle action
|
|
104
|
+
*/
|
|
105
|
+
function handleAction(action) {
|
|
106
|
+
if (UserUtils.isBlocked(scUserContext.user) && [EDIT_COMMENT].includes(action)) {
|
|
107
|
+
// if user is blocked, deny edit and moderate
|
|
108
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.userBlocked", defaultMessage: "ui.common.userBlocked" }), {
|
|
109
|
+
variant: 'warning',
|
|
110
|
+
autoHideDuration: 3000
|
|
111
|
+
});
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (action === EDIT_COMMENT) {
|
|
115
|
+
onEdit && onEdit(commentObj);
|
|
116
|
+
handleClose();
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
setCurrentAction(DELETE_COMMENT);
|
|
120
|
+
setOpenConfirmDialog(true);
|
|
121
|
+
handleClose();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Perform additional operations at the end of single action
|
|
126
|
+
*/
|
|
127
|
+
function performPostConfirmAction(success) {
|
|
128
|
+
if (success) {
|
|
129
|
+
setCurrentActionLoading(null);
|
|
130
|
+
setCurrentAction(null);
|
|
131
|
+
setOpenConfirmDialog(false);
|
|
132
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.lessonCommentActionMenu.actionSuccess", defaultMessage: "ui.lessonCommentActionMenu.actionSuccess" }), {
|
|
133
|
+
variant: 'success',
|
|
134
|
+
autoHideDuration: 3000
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
setCurrentActionLoading(null);
|
|
139
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.lessonCommentActionMenu.actionError", defaultMessage: "ui.lessonCommentActionMenu.actionError" }), {
|
|
140
|
+
variant: 'error',
|
|
141
|
+
autoHideDuration: 3000
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Deletes a comment
|
|
147
|
+
*/
|
|
148
|
+
function handleConfirmedAction() {
|
|
149
|
+
if (commentObj && !currentActionLoading) {
|
|
150
|
+
if (currentAction === DELETE_COMMENT) {
|
|
151
|
+
setCurrentActionLoading(DELETE_COMMENT);
|
|
152
|
+
performDeleteComment()
|
|
153
|
+
.then(() => {
|
|
154
|
+
onDelete && onDelete(commentObj);
|
|
155
|
+
performPostConfirmAction(true);
|
|
156
|
+
})
|
|
157
|
+
.catch((error) => {
|
|
158
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
159
|
+
performPostConfirmAction(false);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* CIf the authenticated user can modify the comment
|
|
166
|
+
*/
|
|
167
|
+
function canModifyContribution() {
|
|
168
|
+
return scUserContext.user && scUserContext.user.id === commentObj.created_by.id;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* If the authenticated user can delete the comment
|
|
172
|
+
*/
|
|
173
|
+
function canDeleteContribution() {
|
|
174
|
+
return scUserContext.user && scUserContext.user.id === commentObj.created_by.id;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Renders comment menu content
|
|
178
|
+
*/
|
|
179
|
+
function renderContent() {
|
|
180
|
+
return (_jsx(Box, { children: !commentObj ? (_jsx(CentralProgress, { size: 30 })) : (_jsxs(MenuList, { children: [canModifyContribution() && (_jsxs(MenuItem, Object.assign({ className: classes.subItem }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "edit" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.lessonCommentActionMenu.edit", defaultMessage: "ui.lessonCommentActionMenu.edit" }), onClick: () => handleAction(EDIT_COMMENT), classes: { root: classes.itemText } })] }))), canDeleteContribution() && (_jsxs(MenuItem, Object.assign({ className: classes.subItem }, { children: [_jsx(ListItemIcon, { children: currentActionLoading === DELETE_COMMENT ? _jsx(CircularProgress, { size: 20 }) : _jsx(Icon, { children: "delete" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.lessonCommentActionMenu.delete", defaultMessage: "ui.lessonCommentActionMenu.delete" }), onClick: () => handleAction(DELETE_COMMENT), classes: { root: classes.itemText } })] })))] })) }));
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Renders component
|
|
184
|
+
*/
|
|
185
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(IconButton
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
187
|
+
// @ts-ignore
|
|
188
|
+
, Object.assign({
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
190
|
+
// @ts-ignore
|
|
191
|
+
ref: (ref) => {
|
|
192
|
+
popperRef.current = ref;
|
|
193
|
+
}, "aria-haspopup": "true", onClick: handleOpen, className: classes.button, size: "small" }, { children: _jsx(Icon, { children: "more_vert" }) })), open && (_jsx(_Fragment, { children: isMobile ? (_jsx(SwipeableDrawer, Object.assign({ open: true, onClose: handleClose, onOpen: handleOpen, anchor: "bottom", disableSwipeToOpen: true }, { children: renderContent() }))) : (_jsx(PopperRoot, Object.assign({ open: true, anchorEl: popperRef.current, role: undefined, transition: true, className: classes.popperRoot }, PopperProps, { placement: "bottom-end" }, { children: ({ TransitionProps, placement }) => (_jsx(Grow, Object.assign({}, TransitionProps, { style: { transformOrigin: placement === 'bottom' ? 'center top' : 'center bottom' } }, { children: _jsx(Paper, Object.assign({ variant: 'outlined', className: classes.paper }, { children: _jsx(ClickAwayListener, Object.assign({ onClickAway: handleClose }, { children: renderContent() })) })) }))) }))) })), openConfirmDialog && (_jsx(ConfirmDialog, { open: openConfirmDialog, onConfirm: handleConfirmedAction, isUpdating: Boolean(currentActionLoading), onClose: () => setOpenConfirmDialog(false) }))] })));
|
|
194
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface LessonFilePreviewProps {
|
|
2
|
+
/**
|
|
3
|
+
* Overrides or extends the styles applied to the component.
|
|
4
|
+
* @default null
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The media object to show
|
|
9
|
+
*/
|
|
10
|
+
media: any;
|
|
11
|
+
}
|
|
12
|
+
export default function LessonFilePreview(props: LessonFilePreviewProps): JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { Box, Link, Typography } from '@mui/material';
|
|
5
|
+
import Icon from '@mui/material/Icon';
|
|
6
|
+
import { MEDIA_TYPE_DOCUMENT } from '../../constants/Media';
|
|
7
|
+
const PREFIX = 'SCLessonFilePreview';
|
|
8
|
+
const classes = {
|
|
9
|
+
root: `${PREFIX}-root`,
|
|
10
|
+
item: `${PREFIX}-item`,
|
|
11
|
+
title: `${PREFIX}-title`
|
|
12
|
+
};
|
|
13
|
+
const Root = styled(Box, {
|
|
14
|
+
name: PREFIX,
|
|
15
|
+
slot: 'Root',
|
|
16
|
+
overridesResolver: (props, styles) => styles.root
|
|
17
|
+
})(() => ({}));
|
|
18
|
+
export default function LessonFilePreview(props) {
|
|
19
|
+
// PROPS
|
|
20
|
+
const { className, media } = props;
|
|
21
|
+
/**
|
|
22
|
+
* Renders component
|
|
23
|
+
*/
|
|
24
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className), sx: { backgroundImage: `url(${(media === null || media === void 0 ? void 0 : media.image_thumbnail) ? media.image_thumbnail.url : media.image})` } }, { children: media.title && (_jsx(Link, Object.assign({ href: media.url, target: "_blank", rel: "noopener noreferrer" }, { children: _jsxs(Typography, Object.assign({ className: classes.title }, { children: [media.type === MEDIA_TYPE_DOCUMENT && _jsx(Icon, { children: "picture_as_pdf" }), media.title] })) }))) }), media.id));
|
|
25
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import React, { useEffect, useState } from 'react';
|
|
4
4
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
5
5
|
import IconButton from '@mui/material/IconButton';
|
|
@@ -14,6 +14,7 @@ const INITIAL_STATE = {
|
|
|
14
14
|
urlError: null
|
|
15
15
|
};
|
|
16
16
|
export default (props) => {
|
|
17
|
+
var _a, _b;
|
|
17
18
|
// STATE
|
|
18
19
|
const [isCreating, setIsCreating] = useState(false);
|
|
19
20
|
const [state, setState] = useState(Object.assign({}, INITIAL_STATE));
|
|
@@ -73,7 +74,5 @@ export default (props) => {
|
|
|
73
74
|
* Renders url text field
|
|
74
75
|
*/
|
|
75
76
|
return (_jsx("form", Object.assign({ method: "post", onSubmit: handleSubmit }, { children: _jsx(TextField, Object.assign({ value: url, type: "url", onChange: handleChange, onPaste: handlePaste, error: error || Boolean(urlError), helperText: helperText ||
|
|
76
|
-
(urlError && (_jsx(FormattedMessage, { id: `ui.composer.media.link.add.error.${urlError}`, defaultMessage: `ui.composer.media.link.add.error.${urlError}` }))) || _jsx(FormattedMessage, { id: "ui.composer.media.link.add.help", defaultMessage: "ui.composer.media.link.add.help" }), disabled: isCreating }, rest, { InputProps: {
|
|
77
|
-
endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(Fade, Object.assign({ in: urlError === null && url !== '' }, { children: _jsx(IconButton, Object.assign({ size: "small", disabled: isCreating, type: "submit" }, { children: isCreating ? _jsx(CircularProgress, { color: "primary", size: 20 }) : _jsx(FormattedMessage, { id: "ui.composer.media.link.add.submit", defaultMessage: "ui.composer.media.link.add.submit" }) })) })) })))
|
|
78
|
-
} })) })));
|
|
77
|
+
(urlError && (_jsx(FormattedMessage, { id: `ui.composer.media.link.add.error.${urlError}`, defaultMessage: `ui.composer.media.link.add.error.${urlError}` }))) || _jsx(FormattedMessage, { id: "ui.composer.media.link.add.help", defaultMessage: "ui.composer.media.link.add.help" }), disabled: isCreating }, rest, { InputProps: Object.assign(Object.assign({}, rest.InputProps), { endAdornment: (_jsx(_Fragment, { children: url === '' && ((_a = rest.InputProps) === null || _a === void 0 ? void 0 : _a.endAdornment) ? ((_b = rest.InputProps) === null || _b === void 0 ? void 0 : _b.endAdornment) : (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(Fade, Object.assign({ in: urlError === null && url !== '' }, { children: _jsx(IconButton, Object.assign({ size: "small", disabled: isCreating, type: "submit" }, { children: isCreating ? (_jsx(CircularProgress, { color: "primary", size: 20 })) : (_jsx(FormattedMessage, { id: "ui.composer.media.link.add.submit", defaultMessage: "ui.composer.media.link.add.submit" })) })) })) }))) })) }) })) })));
|
|
79
78
|
};
|