@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,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
8
|
+
const react_intl_1 = require("react-intl");
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const Bullet_1 = tslib_1.__importDefault(require("../../shared/Bullet"));
|
|
11
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
12
|
+
const Errors_1 = require("../../constants/Errors");
|
|
13
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
14
|
+
const CommentObjectReply_1 = tslib_1.__importDefault(require("../CommentObjectReply"));
|
|
15
|
+
const DateTimeAgo_1 = tslib_1.__importDefault(require("../../shared/DateTimeAgo"));
|
|
16
|
+
const contribution_1 = require("../../utils/contribution");
|
|
17
|
+
const notistack_1 = require("notistack");
|
|
18
|
+
const system_1 = require("@mui/system");
|
|
19
|
+
const BaseItem_1 = tslib_1.__importDefault(require("../../shared/BaseItem"));
|
|
20
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
21
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
22
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
23
|
+
const UserDeletedSnackBar_1 = tslib_1.__importDefault(require("../../shared/UserDeletedSnackBar"));
|
|
24
|
+
const UserAvatar_1 = tslib_1.__importDefault(require("../../shared/UserAvatar"));
|
|
25
|
+
const constants_1 = require("./constants");
|
|
26
|
+
const LessonCommentActionsMenu_1 = tslib_1.__importDefault(require("../../shared/LessonCommentActionsMenu"));
|
|
27
|
+
const LessonFilePreview_1 = tslib_1.__importDefault(require("../../shared/LessonFilePreview"));
|
|
28
|
+
const classes = {
|
|
29
|
+
root: `${constants_1.PREFIX}-root`,
|
|
30
|
+
comment: `${constants_1.PREFIX}-comment`,
|
|
31
|
+
avatar: `${constants_1.PREFIX}-avatar`,
|
|
32
|
+
content: `${constants_1.PREFIX}-content`,
|
|
33
|
+
author: `${constants_1.PREFIX}-author`,
|
|
34
|
+
textContent: `${constants_1.PREFIX}-text-content`,
|
|
35
|
+
mediaContent: `${constants_1.PREFIX}-media-content`,
|
|
36
|
+
commentActionsMenu: `${constants_1.PREFIX}-comment-actions-menu`
|
|
37
|
+
};
|
|
38
|
+
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
39
|
+
name: constants_1.PREFIX,
|
|
40
|
+
slot: 'Root'
|
|
41
|
+
})(() => ({}));
|
|
42
|
+
/**
|
|
43
|
+
* > API documentation for the Community-JS Comment Object component. Learn about the available props and the CSS API.
|
|
44
|
+
*
|
|
45
|
+
*
|
|
46
|
+
* This component renders a comment item.
|
|
47
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/CommentObject)
|
|
48
|
+
|
|
49
|
+
#### Import
|
|
50
|
+
|
|
51
|
+
```jsx
|
|
52
|
+
import {CommentObject} from '@selfcommunity/react-ui';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### Component Name
|
|
56
|
+
|
|
57
|
+
The name `SCCommentObject` can be used when providing style overrides in the theme.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
#### CSS
|
|
61
|
+
|
|
62
|
+
|Rule Name|Global class|Description|
|
|
63
|
+
|---|---|---|
|
|
64
|
+
|root|.SCCommentObject-root|Styles applied to the root element.|
|
|
65
|
+
|comment|.SCCommentObject-comment|Styles applied to comment element.|
|
|
66
|
+
|avatar|.SCCommentObject-avatar|Styles applied to the avatar element.|
|
|
67
|
+
|author|.SCCommentObject-author|Styles applied to the author section.|
|
|
68
|
+
|content|.SCCommentObject-content|Styles applied to content section.|
|
|
69
|
+
|textContent|.SCCommentObject-text-content|Styles applied to text content section.|
|
|
70
|
+
|mediaContent|.SCCommentObject-media-content|Styles applied to media content section.|
|
|
71
|
+
|commentActionsMenu|.SCCommentObject-comment-actions-menu|Styles applied to comment action menu element.|
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
* @param inProps
|
|
75
|
+
*/
|
|
76
|
+
function LessonCommentObject(inProps) {
|
|
77
|
+
// PROPS
|
|
78
|
+
const props = (0, system_1.useThemeProps)({
|
|
79
|
+
props: inProps,
|
|
80
|
+
name: constants_1.PREFIX
|
|
81
|
+
});
|
|
82
|
+
const { id = `lesson_comment_object_${props.commentObjectId ? props.commentObjectId : props.commentObject ? props.commentObject.id : ''}`, className, commentObjectId, commentObject, isEditing, lessonObjectId, lessonObject, onDelete, elevation = 0, CommentObjectSkeletonProps = { elevation }, CommentObjectReplyProps = { elevation }, cacheStrategy = utils_1.CacheStrategies.NETWORK_ONLY } = props, rest = tslib_1.__rest(props, ["id", "className", "commentObjectId", "commentObject", "isEditing", "lessonObjectId", "lessonObject", "onDelete", "elevation", "CommentObjectSkeletonProps", "CommentObjectReplyProps", "cacheStrategy"]);
|
|
83
|
+
// CONTEXT
|
|
84
|
+
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
85
|
+
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
86
|
+
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
87
|
+
// STATE
|
|
88
|
+
const { obj, setObj } = (0, react_core_1.useSCFetchLessonCommentObject)({ id: commentObjectId, commentObject: commentObject, lesson: lessonObject, cacheStrategy });
|
|
89
|
+
const [isSavingComment, setIsSavingComment] = (0, react_1.useState)(false);
|
|
90
|
+
const [editComment, setEditComment] = (0, react_1.useState)(null);
|
|
91
|
+
const [openAlert, setOpenAlert] = (0, react_1.useState)(false);
|
|
92
|
+
// HANDLERS
|
|
93
|
+
/**
|
|
94
|
+
* Update state object
|
|
95
|
+
* @param newObj
|
|
96
|
+
*/
|
|
97
|
+
function updateObject(newObj) {
|
|
98
|
+
utils_1.LRUCache.set(react_core_1.SCCache.getLessonCommentCacheKey(obj.id), newObj);
|
|
99
|
+
setObj(newObj);
|
|
100
|
+
utils_1.LRUCache.deleteKeysWithPrefix(react_core_1.SCCache.getLessonCommentsCachePrefixKeys(lessonObject.id));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Handle comment delete
|
|
104
|
+
*/
|
|
105
|
+
function handleDelete(comment) {
|
|
106
|
+
updateObject(comment);
|
|
107
|
+
onDelete && onDelete(comment);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Handle edit comment
|
|
111
|
+
*/
|
|
112
|
+
function handleEdit(comment) {
|
|
113
|
+
setEditComment(comment);
|
|
114
|
+
isEditing && isEditing(true);
|
|
115
|
+
}
|
|
116
|
+
function handleCancel() {
|
|
117
|
+
setEditComment(null);
|
|
118
|
+
isEditing && isEditing(false);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Perform save/update comment
|
|
122
|
+
*/
|
|
123
|
+
const performUpdate = (comment, medias) => {
|
|
124
|
+
const mediaIds = medias ? medias.map((media) => media.id) : [];
|
|
125
|
+
return api_services_1.http
|
|
126
|
+
.request({
|
|
127
|
+
url: api_services_1.Endpoints.UpdateCourseComment.url({
|
|
128
|
+
id: lessonObject.course_id,
|
|
129
|
+
section_id: lessonObject.section_id,
|
|
130
|
+
lesson_id: lessonObject.id,
|
|
131
|
+
comment_id: commentObject.id
|
|
132
|
+
}),
|
|
133
|
+
method: api_services_1.Endpoints.UpdateCourseComment.method,
|
|
134
|
+
data: { text: comment, medias: mediaIds }
|
|
135
|
+
})
|
|
136
|
+
.then((res) => {
|
|
137
|
+
if (res.status >= 300) {
|
|
138
|
+
return Promise.reject(res);
|
|
139
|
+
}
|
|
140
|
+
return Promise.resolve(res.data);
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Handle save comment
|
|
145
|
+
*/
|
|
146
|
+
function handleUpdate(comment, medias) {
|
|
147
|
+
if (react_core_1.UserUtils.isBlocked(scUserContext.user)) {
|
|
148
|
+
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.userBlocked", defaultMessage: "ui.common.userBlocked" }), {
|
|
149
|
+
variant: 'warning',
|
|
150
|
+
autoHideDuration: 3000
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
setIsSavingComment(true);
|
|
155
|
+
performUpdate(comment, medias)
|
|
156
|
+
.then((data) => {
|
|
157
|
+
const newObj = Object.assign({}, obj, {
|
|
158
|
+
text: data.text,
|
|
159
|
+
html: data.html,
|
|
160
|
+
created_at: data.created_at,
|
|
161
|
+
medias: medias
|
|
162
|
+
});
|
|
163
|
+
updateObject(newObj);
|
|
164
|
+
setEditComment(null);
|
|
165
|
+
setIsSavingComment(false);
|
|
166
|
+
isEditing && isEditing(false);
|
|
167
|
+
})
|
|
168
|
+
.catch((error) => {
|
|
169
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
|
|
170
|
+
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
171
|
+
variant: 'error',
|
|
172
|
+
autoHideDuration: 3000
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Render comment & latest activities
|
|
179
|
+
* @param comment
|
|
180
|
+
*/
|
|
181
|
+
function renderComment(comment) {
|
|
182
|
+
const summaryHtml = (0, contribution_1.getCommentContributionHtml)(comment.html, scRoutingContext.url);
|
|
183
|
+
return ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: editComment && editComment.id === comment.id ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.comment }, { children: (0, jsx_runtime_1.jsx)(CommentObjectReply_1.default, Object.assign({ text: comment.html, medias: comment.medias, autoFocus: true, id: `edit-${comment.id}`, onSave: handleUpdate, onCancel: handleCancel, editable: !isSavingComment, EditorProps: { uploadFile: true, uploadImage: false, isLessonCommentEditor: true } }, CommentObjectReplyProps)) }))) : ((0, jsx_runtime_1.jsx)(BaseItem_1.default, { elevation: 0, className: classes.comment, image: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!comment.created_by.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, comment.created_by) }), { onClick: comment.created_by.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !obj.created_by.community_badge }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: obj.created_by.username, variant: "circular", src: comment.created_by.avatar, className: classes.avatar }) })) })), disableTypography: true, primary: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(Widget_1.default, Object.assign({ className: classes.content, elevation: elevation }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ className: classes.author }, (!comment.created_by.deleted && { to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, comment.created_by) }), { onClick: comment.created_by.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: comment.created_by.username })) })), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: comment.created_at, showStartIcon: false })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { className: classes.textContent, variant: "body2", gutterBottom: true, dangerouslySetInnerHTML: { __html: summaryHtml } }), obj.medias && obj.medias.length > 0 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: obj.medias.map((media) => {
|
|
184
|
+
return (0, jsx_runtime_1.jsx)(LessonFilePreview_1.default, { className: classes.mediaContent, media: media }, media.id);
|
|
185
|
+
}) }))] }), scUserContext.user && scUserContext.user.id === comment.created_by.id && ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.commentActionsMenu }, { children: (0, jsx_runtime_1.jsx)(LessonCommentActionsMenu_1.default, { lesson: lessonObject, commentObject: comment, onDelete: handleDelete, onEdit: handleEdit }) })))] })) }) })) }, comment.id));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Render comments
|
|
189
|
+
*/
|
|
190
|
+
let comment;
|
|
191
|
+
if (obj) {
|
|
192
|
+
comment = renderComment(obj);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
comment = (0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({}, CommentObjectSkeletonProps));
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Render object
|
|
199
|
+
*/
|
|
200
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, { children: comment })), openAlert && (0, jsx_runtime_1.jsx)(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
201
|
+
}
|
|
202
|
+
exports.default = LessonCommentObject;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* > API documentation for the Community-JS Lesson Comment Object Skeleton component. Learn about the available props and the CSS API.
|
|
3
|
+
|
|
4
|
+
#### Import
|
|
5
|
+
|
|
6
|
+
```jsx
|
|
7
|
+
import {LessonCommentObjectSkeleton} from '@selfcommunity/react-ui';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
#### Component Name
|
|
11
|
+
|
|
12
|
+
The name `SCLessonCommentObject-skeleton-root` can be used when providing style overrides in the theme.
|
|
13
|
+
|
|
14
|
+
#### CSS
|
|
15
|
+
|
|
16
|
+
|Rule Name|Global class|Description|
|
|
17
|
+
|---|---|---|
|
|
18
|
+
|root|.SCLessonCommentObject-skeleton-root|Styles applied to the root element.|
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export default function LessonCommentObjectSkeleton(props: any): JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const Skeleton_1 = tslib_1.__importDefault(require("@mui/material/Skeleton"));
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
9
|
+
const BaseItem_1 = tslib_1.__importDefault(require("../../shared/BaseItem"));
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
const classes = {
|
|
12
|
+
root: `${constants_1.PREFIX}-skeleton-root`,
|
|
13
|
+
avatar: `${constants_1.PREFIX}-avatar`,
|
|
14
|
+
primaryContent: `${constants_1.PREFIX}-primary-content`,
|
|
15
|
+
secondaryContent: `${constants_1.PREFIX}-secondary-content`
|
|
16
|
+
};
|
|
17
|
+
const Root = (0, styles_1.styled)(BaseItem_1.default, {
|
|
18
|
+
name: constants_1.PREFIX,
|
|
19
|
+
slot: 'SkeletonRoot'
|
|
20
|
+
})(() => ({}));
|
|
21
|
+
/**
|
|
22
|
+
* > API documentation for the Community-JS Lesson Comment Object Skeleton component. Learn about the available props and the CSS API.
|
|
23
|
+
|
|
24
|
+
#### Import
|
|
25
|
+
|
|
26
|
+
```jsx
|
|
27
|
+
import {LessonCommentObjectSkeleton} from '@selfcommunity/react-ui';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
#### Component Name
|
|
31
|
+
|
|
32
|
+
The name `SCLessonCommentObject-skeleton-root` can be used when providing style overrides in the theme.
|
|
33
|
+
|
|
34
|
+
#### CSS
|
|
35
|
+
|
|
36
|
+
|Rule Name|Global class|Description|
|
|
37
|
+
|---|---|---|
|
|
38
|
+
|root|.SCLessonCommentObject-skeleton-root|Styles applied to the root element.|
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
function LessonCommentObjectSkeleton(props) {
|
|
42
|
+
const { WidgetProps } = props, rest = tslib_1.__rest(props, ["WidgetProps"]);
|
|
43
|
+
const theme = (0, material_1.useTheme)();
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root, disableTypography: true }, rest, { image: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: theme.selfcommunity.user.avatar.sizeMedium, height: theme.selfcommunity.user.avatar.sizeMedium, className: classes.avatar }), primary: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "25%", className: classes.primaryContent }), secondary: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Widget_1.default, Object.assign({}, WidgetProps, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.secondaryContent }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "80%" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "70%" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: "60%" })] })) })) }) })));
|
|
45
|
+
}
|
|
46
|
+
exports.default = LessonCommentObjectSkeleton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCLessonCommentObject";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LessonCommentObjectSkeleton = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const LessonCommentObject_1 = tslib_1.__importDefault(require("./LessonCommentObject"));
|
|
6
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
7
|
+
exports.LessonCommentObjectSkeleton = Skeleton_1.default;
|
|
8
|
+
exports.default = LessonCommentObject_1.default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { LessonCommentObjectProps } from '../LessonCommentObject';
|
|
2
|
+
import { SCCourseLessonType } from '@selfcommunity/types';
|
|
3
|
+
import { CacheStrategies } from '@selfcommunity/utils';
|
|
4
|
+
export interface LessonCommentObjectsProps {
|
|
5
|
+
/**
|
|
6
|
+
* Id of the LessonCommentObjects
|
|
7
|
+
* @default `lesson_comments_object_<lessonObjectId | lessonObject.id>`
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Overrides or extends the styles applied to the component.
|
|
12
|
+
* @default null
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Id of lesson object
|
|
17
|
+
* @default null
|
|
18
|
+
*/
|
|
19
|
+
lessonObjectId?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Lesson object
|
|
22
|
+
* @default null
|
|
23
|
+
*/
|
|
24
|
+
lessonObject?: SCCourseLessonType;
|
|
25
|
+
/**
|
|
26
|
+
* Props to spread to single comment object
|
|
27
|
+
* @default {}
|
|
28
|
+
*/
|
|
29
|
+
CommentComponentProps?: LessonCommentObjectProps;
|
|
30
|
+
/**
|
|
31
|
+
* Props to spread to CommentsObjectSkeleton
|
|
32
|
+
* @default {}
|
|
33
|
+
*/
|
|
34
|
+
CommentsObjectSkeletonProps?: any;
|
|
35
|
+
/**
|
|
36
|
+
* Props to spread to single comment object skeleton
|
|
37
|
+
* @default {elevation: 0},
|
|
38
|
+
*/
|
|
39
|
+
CommentObjectSkeletonProps?: any;
|
|
40
|
+
/**
|
|
41
|
+
* Caching strategies
|
|
42
|
+
* @default CacheStrategies.CACHE_FIRST
|
|
43
|
+
*/
|
|
44
|
+
cacheStrategy?: CacheStrategies;
|
|
45
|
+
/**
|
|
46
|
+
* Other props
|
|
47
|
+
*/
|
|
48
|
+
[p: string]: any;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* > API documentation for the Community-JS Comments Object component. Learn about the available props and the CSS API.
|
|
52
|
+
|
|
53
|
+
#### Import
|
|
54
|
+
|
|
55
|
+
```jsx
|
|
56
|
+
import {LessonCommentObjects} from '@selfcommunity/react-ui';
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Component Name
|
|
60
|
+
|
|
61
|
+
The name `SCLessonCommentObjects` can be used when providing style overrides in the theme.
|
|
62
|
+
|
|
63
|
+
#### CSS
|
|
64
|
+
|
|
65
|
+
|Rule Name|Global class|Description|
|
|
66
|
+
|---|---|---|
|
|
67
|
+
|root|.SCLessonCommentObjects-root|Styles applied to the root element.|
|
|
68
|
+
|pagination|.SCLessonCommentObjects-pagination|Styles applied to the pagination controls.|
|
|
69
|
+
|paginationLink|.SCLessonCommentObjects-pagination-link|Styles applied to the pagination link.|
|
|
70
|
+
|loadNextCommentsButton|.SCLessonCommentObjects-load-next-comments-button|Styles applied to the load next comments button.|
|
|
71
|
+
|loadPreviousCommentsButton|.SCLessonCommentObjects-load-previous-comments-button|Styles applied to the load previous comments button.|
|
|
72
|
+
|commentsCounter|.SCLessonCommentObjects-comments-counter|Styles applied to the comments counter element.|
|
|
73
|
+
|
|
74
|
+
* @param inProps
|
|
75
|
+
*/
|
|
76
|
+
export default function LessonCommentObjects(inProps: LessonCommentObjectsProps): JSX.Element;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const react_intl_1 = require("react-intl");
|
|
8
|
+
const LessonCommentObject_1 = tslib_1.__importStar(require("../LessonCommentObject"));
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
11
|
+
const system_1 = require("@mui/system");
|
|
12
|
+
const types_1 = require("@selfcommunity/types");
|
|
13
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
14
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
15
|
+
const constants_1 = require("./constants");
|
|
16
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
17
|
+
const CommentObjectReply_1 = tslib_1.__importDefault(require("../CommentObjectReply"));
|
|
18
|
+
const notistack_1 = require("notistack");
|
|
19
|
+
const Errors_1 = require("../../constants/Errors");
|
|
20
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
21
|
+
const InfiniteScroll_1 = tslib_1.__importDefault(require("../../shared/InfiniteScroll"));
|
|
22
|
+
const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
|
|
23
|
+
const messages = (0, react_intl_1.defineMessages)({
|
|
24
|
+
commentEditorPlaceholder: {
|
|
25
|
+
id: 'ui.lessonCommentObjects.editor.placeholder',
|
|
26
|
+
defaultMessage: 'ui.lessonCommentObjects.editor.placeholder'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const classes = {
|
|
30
|
+
root: `${constants_1.PREFIX}-root`,
|
|
31
|
+
loadNextCommentsButton: `${constants_1.PREFIX}-load-more-comments-button`,
|
|
32
|
+
loadPreviousCommentsButton: `${constants_1.PREFIX}-load-previous-comments-button`,
|
|
33
|
+
paginationLink: `${constants_1.PREFIX}-pagination-link`,
|
|
34
|
+
pagination: `${constants_1.PREFIX}-pagination`,
|
|
35
|
+
commentsCounter: `${constants_1.PREFIX}-comments-counter`,
|
|
36
|
+
commentNotFound: `${constants_1.PREFIX}-comment-not-found`,
|
|
37
|
+
noOtherComments: `${constants_1.PREFIX}-no-other-comment`
|
|
38
|
+
};
|
|
39
|
+
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
40
|
+
name: constants_1.PREFIX,
|
|
41
|
+
slot: 'Root'
|
|
42
|
+
})(() => ({}));
|
|
43
|
+
/**
|
|
44
|
+
* > API documentation for the Community-JS Comments Object component. Learn about the available props and the CSS API.
|
|
45
|
+
|
|
46
|
+
#### Import
|
|
47
|
+
|
|
48
|
+
```jsx
|
|
49
|
+
import {LessonCommentObjects} from '@selfcommunity/react-ui';
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### Component Name
|
|
53
|
+
|
|
54
|
+
The name `SCLessonCommentObjects` can be used when providing style overrides in the theme.
|
|
55
|
+
|
|
56
|
+
#### CSS
|
|
57
|
+
|
|
58
|
+
|Rule Name|Global class|Description|
|
|
59
|
+
|---|---|---|
|
|
60
|
+
|root|.SCLessonCommentObjects-root|Styles applied to the root element.|
|
|
61
|
+
|pagination|.SCLessonCommentObjects-pagination|Styles applied to the pagination controls.|
|
|
62
|
+
|paginationLink|.SCLessonCommentObjects-pagination-link|Styles applied to the pagination link.|
|
|
63
|
+
|loadNextCommentsButton|.SCLessonCommentObjects-load-next-comments-button|Styles applied to the load next comments button.|
|
|
64
|
+
|loadPreviousCommentsButton|.SCLessonCommentObjects-load-previous-comments-button|Styles applied to the load previous comments button.|
|
|
65
|
+
|commentsCounter|.SCLessonCommentObjects-comments-counter|Styles applied to the comments counter element.|
|
|
66
|
+
|
|
67
|
+
* @param inProps
|
|
68
|
+
*/
|
|
69
|
+
function LessonCommentObjects(inProps) {
|
|
70
|
+
const props = (0, system_1.useThemeProps)({
|
|
71
|
+
props: inProps,
|
|
72
|
+
name: constants_1.PREFIX
|
|
73
|
+
});
|
|
74
|
+
// PROPS
|
|
75
|
+
const { id = `lesson_comment_objects_lesson_${props.lessonObjectId ? props.lessonObjectId : props.lessonObject ? props.lessonObject.id : ''}`, className, lessonObjectId, lessonObject, CommentComponentProps = {}, CommentObjectSkeletonProps = { elevation: 0 }, CommentsObjectSkeletonProps = {}, cacheStrategy = utils_1.CacheStrategies.STALE_WHILE_REVALIDATE } = props, rest = tslib_1.__rest(props, ["id", "className", "lessonObjectId", "lessonObject", "CommentComponentProps", "CommentObjectSkeletonProps", "CommentsObjectSkeletonProps", "cacheStrategy"]);
|
|
76
|
+
//STATE
|
|
77
|
+
const [commenting, setIsCommenting] = (0, react_1.useState)(false);
|
|
78
|
+
const [editing, setIsEditing] = (0, react_1.useState)(false);
|
|
79
|
+
const [replyKey, setReplyKey] = (0, react_1.useState)(0);
|
|
80
|
+
// CONTEXT
|
|
81
|
+
const scUserContext = (0, react_core_1.useSCUser)();
|
|
82
|
+
// INTL
|
|
83
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
84
|
+
// REF
|
|
85
|
+
const commentsEndRef = (0, react_1.useRef)(null);
|
|
86
|
+
// STATE
|
|
87
|
+
const commentsObject = (0, react_core_1.useSCFetchLessonCommentObjects)({
|
|
88
|
+
id: lessonObject.id,
|
|
89
|
+
lessonObject: lessonObject,
|
|
90
|
+
orderBy: types_1.SCCommentsOrderBy.ADDED_AT_ASC,
|
|
91
|
+
cacheStrategy
|
|
92
|
+
});
|
|
93
|
+
// EFFECTS
|
|
94
|
+
(0, react_1.useEffect)(() => {
|
|
95
|
+
if (commentsObject.lessonObject) {
|
|
96
|
+
commentsObject.getNextPage();
|
|
97
|
+
}
|
|
98
|
+
}, [commentsObject.lessonObject]);
|
|
99
|
+
//HANDLERS
|
|
100
|
+
function handleNext() {
|
|
101
|
+
commentsObject.getNextPage();
|
|
102
|
+
}
|
|
103
|
+
const scrollToBottom = () => {
|
|
104
|
+
var _a;
|
|
105
|
+
(_a = commentsEndRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'end', behavior: 'smooth' });
|
|
106
|
+
};
|
|
107
|
+
(0, react_1.useEffect)(() => {
|
|
108
|
+
if (commentsObject.comments.length > 0) {
|
|
109
|
+
scrollToBottom();
|
|
110
|
+
}
|
|
111
|
+
}, [commentsObject.comments]);
|
|
112
|
+
/**
|
|
113
|
+
* Perform save/update comment
|
|
114
|
+
*/
|
|
115
|
+
const performComment = (comment, medias) => {
|
|
116
|
+
const mediaIds = medias ? medias.map((media) => media.id) : [];
|
|
117
|
+
return api_services_1.http
|
|
118
|
+
.request({
|
|
119
|
+
url: api_services_1.Endpoints.CreateCourseComment.url({ id: lessonObject.course_id, section_id: lessonObject.section_id, lesson_id: lessonObject.id }),
|
|
120
|
+
method: api_services_1.Endpoints.CreateCourseComment.method,
|
|
121
|
+
data: { text: comment, medias: mediaIds }
|
|
122
|
+
})
|
|
123
|
+
.then((res) => {
|
|
124
|
+
if (res.status >= 300) {
|
|
125
|
+
return Promise.reject(res);
|
|
126
|
+
}
|
|
127
|
+
return Promise.resolve(res.data);
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Handle save comment
|
|
132
|
+
*/
|
|
133
|
+
function handleCommentAction(comment, medias) {
|
|
134
|
+
if (react_core_1.UserUtils.isBlocked(scUserContext.user)) {
|
|
135
|
+
(0, notistack_1.enqueueSnackbar)((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.userBlocked", defaultMessage: "ui.common.userBlocked" }), {
|
|
136
|
+
variant: 'warning',
|
|
137
|
+
autoHideDuration: 3000
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
setIsCommenting(true);
|
|
142
|
+
performComment(comment, medias)
|
|
143
|
+
.then((data) => {
|
|
144
|
+
handleCommentsUpdate(data);
|
|
145
|
+
setReplyKey(comment.id);
|
|
146
|
+
setIsCommenting(false);
|
|
147
|
+
})
|
|
148
|
+
.catch((error) => {
|
|
149
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
|
|
150
|
+
(0, notistack_1.enqueueSnackbar)((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
151
|
+
variant: 'error',
|
|
152
|
+
autoHideDuration: 3000
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const handleCommentsUpdate = (comment, forDeletion) => {
|
|
158
|
+
let updated;
|
|
159
|
+
if (forDeletion) {
|
|
160
|
+
updated = commentsObject.comments.filter((c) => c.id !== comment.id);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
updated = [...commentsObject.comments, comment];
|
|
164
|
+
}
|
|
165
|
+
commentsObject.updateLessonComments([...updated]);
|
|
166
|
+
utils_1.LRUCache.set(react_core_1.SCCache.getLessonCommentCacheKey(lessonObject.id), updated);
|
|
167
|
+
utils_1.LRUCache.deleteKeysWithPrefix(react_core_1.SCCache.getLessonCommentsCachePrefixKeys(lessonObject.id));
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Renders root object(if obj)
|
|
171
|
+
*/
|
|
172
|
+
if (!commentsObject.lessonObject) {
|
|
173
|
+
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
174
|
+
}
|
|
175
|
+
if (!commentsObject.comments.length && commentsObject.isLoadingNext) {
|
|
176
|
+
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({ count: 5 }, CommentsObjectSkeletonProps));
|
|
177
|
+
}
|
|
178
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: commentsObject.comments.length > 0 ? ((0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ height: '100%', dataLength: commentsObject.comments.length, next: handleNext, hasMoreNext: Boolean(commentsObject.next), loaderNext: (0, jsx_runtime_1.jsx)(LessonCommentObject_1.LessonCommentObjectSkeleton, Object.assign({}, CommentObjectSkeletonProps, { count: 1 })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ ref: commentsEndRef }, { children: commentsObject.comments.map((c, index) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(LessonCommentObject_1.default, Object.assign({ commentObject: c, lessonObject: commentsObject.lessonObject, onDelete: (comment) => handleCommentsUpdate(comment, true), isEditing: (editing) => setIsEditing(editing) }, CommentComponentProps, { CommentObjectSkeletonProps: CommentObjectSkeletonProps }), c.id) }, index))) })) }))) : null }), !editing && ((0, jsx_runtime_1.jsx)(CommentObjectReply_1.default, { id: `reply-lessonCommentObjects`, showAvatar: false, replyIcon: true, editable: !commenting, onReply: handleCommentAction, EditorProps: {
|
|
179
|
+
placeholder: intl.formatMessage(messages.commentEditorPlaceholder),
|
|
180
|
+
uploadFile: true,
|
|
181
|
+
uploadImage: false,
|
|
182
|
+
isLessonCommentEditor: true
|
|
183
|
+
} }, replyKey))] }) })));
|
|
184
|
+
}
|
|
185
|
+
exports.default = LessonCommentObjects;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* > API documentation for the Community-JS Comments Object Skeleton component. Learn about the available props and the CSS API.
|
|
3
|
+
|
|
4
|
+
#### Import
|
|
5
|
+
|
|
6
|
+
```jsx
|
|
7
|
+
import {LessonCommentObjectsSkeleton} from '@selfcommunity/react-ui';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
#### Component Name
|
|
11
|
+
|
|
12
|
+
The name `SCLessonCommentObjects-skeleton-root` can be used when providing style overrides in the theme.
|
|
13
|
+
|
|
14
|
+
#### CSS
|
|
15
|
+
|
|
16
|
+
|Rule Name|Global class|Description|
|
|
17
|
+
|---|---|---|
|
|
18
|
+
|root|.SCLessonCommentObjects-skeleton-root|Styles applied to the root element.|
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export default function LessonCommentObjectsSkeleton(props: {
|
|
22
|
+
count?: number;
|
|
23
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const Skeleton_1 = tslib_1.__importDefault(require("../LessonCommentObject/Skeleton"));
|
|
9
|
+
const classes = {
|
|
10
|
+
root: `${constants_1.PREFIX}-skeleton-root`
|
|
11
|
+
};
|
|
12
|
+
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
13
|
+
name: constants_1.PREFIX,
|
|
14
|
+
slot: 'SkeletonRoot'
|
|
15
|
+
})(() => ({}));
|
|
16
|
+
/**
|
|
17
|
+
* > API documentation for the Community-JS Comments Object Skeleton component. Learn about the available props and the CSS API.
|
|
18
|
+
|
|
19
|
+
#### Import
|
|
20
|
+
|
|
21
|
+
```jsx
|
|
22
|
+
import {LessonCommentObjectsSkeleton} from '@selfcommunity/react-ui';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
#### Component Name
|
|
26
|
+
|
|
27
|
+
The name `SCLessonCommentObjects-skeleton-root` can be used when providing style overrides in the theme.
|
|
28
|
+
|
|
29
|
+
#### CSS
|
|
30
|
+
|
|
31
|
+
|Rule Name|Global class|Description|
|
|
32
|
+
|---|---|---|
|
|
33
|
+
|root|.SCLessonCommentObjects-skeleton-root|Styles applied to the root element.|
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
function LessonCommentObjectsSkeleton(props) {
|
|
37
|
+
const { count = 3 } = props, rest = tslib_1.__rest(props, ["count"]);
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, rest, { children: [...Array(count)].map((comment, index) => ((0, jsx_runtime_1.jsx)(Skeleton_1.default, { elevation: 0 }, index))) })));
|
|
39
|
+
}
|
|
40
|
+
exports.default = LessonCommentObjectsSkeleton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCLessonCommentObjects";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LessonCommentObjectsSkeleton = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const LessonCommentObjects_1 = tslib_1.__importDefault(require("./LessonCommentObjects"));
|
|
6
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
7
|
+
exports.LessonCommentObjectsSkeleton = Skeleton_1.default;
|
|
8
|
+
exports.default = LessonCommentObjects_1.default;
|