@selfcommunity/react-ui 0.10.2-courses.100 → 0.10.2-courses.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.d.ts +9 -3
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.js +38 -9
- package/lib/cjs/components/Course/CreatePlaceholder.d.ts +33 -0
- package/lib/cjs/components/Course/CreatePlaceholder.js +59 -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/CourseForm/CourseForm.d.ts +2 -2
- package/lib/cjs/components/CourseForm/CourseForm.js +23 -11
- package/lib/cjs/components/CourseForm/Dialog.d.ts +8 -0
- package/lib/cjs/components/CourseForm/Dialog.js +19 -0
- package/lib/cjs/components/CourseParticipantsButton/CourseParticipantsButton.js +2 -2
- package/lib/cjs/components/Courses/Courses.js +4 -4
- package/lib/cjs/components/Courses/Skeleton.js +2 -2
- package/lib/cjs/components/EditCourse/MenuRow.js +4 -1
- package/lib/cjs/components/LessonObject/LessonObject.js +14 -6
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +2 -2
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +1 -1
- package/lib/cjs/index.d.ts +2 -2
- package/lib/cjs/index.js +3 -3
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.d.ts +9 -3
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +38 -9
- package/lib/esm/components/Course/CreatePlaceholder.d.ts +33 -0
- package/lib/esm/components/Course/CreatePlaceholder.js +56 -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/CourseForm/CourseForm.d.ts +2 -2
- package/lib/esm/components/CourseForm/CourseForm.js +25 -13
- package/lib/esm/components/CourseForm/Dialog.d.ts +8 -0
- package/lib/esm/components/CourseForm/Dialog.js +16 -0
- package/lib/esm/components/CourseParticipantsButton/CourseParticipantsButton.js +2 -2
- package/lib/esm/components/Courses/Courses.js +4 -4
- package/lib/esm/components/Courses/Skeleton.js +2 -2
- package/lib/esm/components/EditCourse/MenuRow.js +5 -2
- package/lib/esm/components/LessonObject/LessonObject.js +15 -7
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +2 -2
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +1 -1
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +2 -2
- package/lib/umd/react-ui.js +1 -1
- package/package.json +8 -8
- package/lib/cjs/components/Course/Placeholder.d.ts +0 -40
- package/lib/cjs/components/Course/Placeholder.js +0 -65
- package/lib/cjs/components/LessonCompletedDialog/LessonCompletedDialog.d.ts +0 -8
- package/lib/cjs/components/LessonCompletedDialog/LessonCompletedDialog.js +0 -36
- package/lib/cjs/components/LessonCompletedDialog/index.d.ts +0 -3
- package/lib/cjs/components/LessonCompletedDialog/index.js +0 -5
- package/lib/esm/components/Course/Placeholder.d.ts +0 -40
- package/lib/esm/components/Course/Placeholder.js +0 -62
- package/lib/esm/components/LessonCompletedDialog/LessonCompletedDialog.d.ts +0 -8
- package/lib/esm/components/LessonCompletedDialog/LessonCompletedDialog.js +0 -32
- package/lib/esm/components/LessonCompletedDialog/index.d.ts +0 -3
- package/lib/esm/components/LessonCompletedDialog/index.js +0 -2
|
@@ -102,7 +102,7 @@ function BottomNavigation(inProps) {
|
|
|
102
102
|
(!postOnlyStaffEnabled || (react_core_1.UserUtils.isStaff(scUserContext.user) && postOnlyStaffEnabled)) &&
|
|
103
103
|
((groupsEnabled && !eventsEnabled) || (!groupsEnabled && eventsEnabled)) &&
|
|
104
104
|
!exploreStreamEnabled ? ((0, jsx_runtime_1.jsx)(material_1.BottomNavigationAction, { className: (0, classnames_1.default)(classes.composer, classes.action), component: ComposerIconButton_1.default, disableRipple: true }, "composer")) : null,
|
|
105
|
-
coursesEnabled && scUserContext.user ? ((0, jsx_runtime_1.jsx)(material_1.BottomNavigationAction, { className: classes.action, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.
|
|
105
|
+
coursesEnabled && scUserContext.user ? ((0, jsx_runtime_1.jsx)(material_1.BottomNavigationAction, { className: classes.action, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSES_ROUTE_NAME, {}), value: scRoutingContext.url(react_core_1.SCRoutes.COURSES_ROUTE_NAME, {}), icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "courses" }) }, "courses")) : null,
|
|
106
106
|
groupsEnabled && scUserContext.user ? ((0, jsx_runtime_1.jsx)(material_1.BottomNavigationAction, { className: classes.action, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), value: scRoutingContext.url(react_core_1.SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "groups" }) }, "groups")) : null,
|
|
107
107
|
(!postOnlyStaffEnabled || (react_core_1.UserUtils.isStaff(scUserContext.user) && postOnlyStaffEnabled)) &&
|
|
108
108
|
groupsEnabled &&
|
|
@@ -4,6 +4,7 @@ import { ComposerProps } from '../Composer';
|
|
|
4
4
|
import { EventFormDialogProps } from '../EventFormDialog';
|
|
5
5
|
import { GroupFormProps } from '../GroupForm';
|
|
6
6
|
import { CreateLiveStreamDialogProps } from '../CreateLiveStreamDialog';
|
|
7
|
+
import { CourseFormDialogProps } from '../CourseFormDialog';
|
|
7
8
|
export interface ComposerIconButtonProps extends IconButtonProps {
|
|
8
9
|
/**
|
|
9
10
|
* Composer Props
|
|
@@ -20,18 +21,23 @@ export interface ComposerIconButtonProps extends IconButtonProps {
|
|
|
20
21
|
* @default empty object
|
|
21
22
|
*/
|
|
22
23
|
PopperProps?: PopperProps;
|
|
24
|
+
/**
|
|
25
|
+
* Props to spread to CreateCourse component
|
|
26
|
+
* @default empty object
|
|
27
|
+
*/
|
|
28
|
+
CourseFormDialogComponentProps?: CourseFormDialogProps;
|
|
23
29
|
/**
|
|
24
30
|
* Props to spread to CreateGroup component
|
|
25
31
|
* @default empty object
|
|
26
32
|
*/
|
|
27
33
|
GroupFormProps?: GroupFormProps;
|
|
28
34
|
/**
|
|
29
|
-
* Props to spread to
|
|
35
|
+
* Props to spread to CreateEvent component
|
|
30
36
|
* @default empty object
|
|
31
37
|
*/
|
|
32
38
|
EventFormDialogComponentProps?: EventFormDialogProps;
|
|
33
39
|
/**
|
|
34
|
-
* Props to spread to
|
|
40
|
+
* Props to spread to CreateLiveStream component
|
|
35
41
|
* @default empty object
|
|
36
42
|
*/
|
|
37
43
|
CreateLiveStreamDialogComponentProps?: CreateLiveStreamDialogProps;
|
|
@@ -58,5 +64,5 @@ export interface ComposerIconButtonProps extends IconButtonProps {
|
|
|
58
64
|
|
|
59
65
|
* @param inProps
|
|
60
66
|
*/
|
|
61
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<ComposerIconButtonProps, "id" | "role" | "className" | "style" | "classes" | "form" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "component" | "name" | "onClose" | "type" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "action" | "size" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "PopperProps" | "ComposerProps" | "GroupFormProps" | "EventFormDialogComponentProps" | "CreateLiveStreamDialogComponentProps"> & React.RefAttributes<HTMLButtonElement>>;
|
|
67
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<ComposerIconButtonProps, "id" | "role" | "className" | "style" | "classes" | "form" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "component" | "name" | "onClose" | "type" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "action" | "size" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "PopperProps" | "ComposerProps" | "CourseFormDialogComponentProps" | "GroupFormProps" | "EventFormDialogComponentProps" | "CreateLiveStreamDialogComponentProps"> & React.RefAttributes<HTMLButtonElement>>;
|
|
62
68
|
export default _default;
|
|
@@ -14,6 +14,7 @@ const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
|
14
14
|
const GroupForm_1 = tslib_1.__importDefault(require("../GroupForm"));
|
|
15
15
|
const CreateLiveStreamDialog_1 = tslib_1.__importDefault(require("../CreateLiveStreamDialog"));
|
|
16
16
|
const types_1 = require("@selfcommunity/types");
|
|
17
|
+
const CourseFormDialog_1 = tslib_1.__importDefault(require("../CourseFormDialog"));
|
|
17
18
|
const PREFIX = 'SCComposerIconButton';
|
|
18
19
|
const classes = {
|
|
19
20
|
root: `${PREFIX}-root`,
|
|
@@ -51,16 +52,17 @@ const MenuRoot = (0, material_1.styled)(material_1.Menu, {
|
|
|
51
52
|
* @param inProps
|
|
52
53
|
*/
|
|
53
54
|
exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps, ref) {
|
|
54
|
-
var _a, _b, _c;
|
|
55
|
+
var _a, _b, _c, _d;
|
|
55
56
|
// PROPS
|
|
56
57
|
const props = (0, material_1.useThemeProps)({
|
|
57
58
|
props: inProps,
|
|
58
59
|
name: PREFIX
|
|
59
60
|
});
|
|
60
|
-
const { className = null, ComposerProps = {}, onClick, onClose, PopperProps = {}, GroupFormProps = {}, EventFormDialogComponentProps = {}, CreateLiveStreamDialogComponentProps = {} } = props, rest = tslib_1.__rest(props, ["className", "ComposerProps", "onClick", "onClose", "PopperProps", "GroupFormProps", "EventFormDialogComponentProps", "CreateLiveStreamDialogComponentProps"]);
|
|
61
|
+
const { className = null, ComposerProps = {}, onClick, onClose, PopperProps = {}, CourseFormDialogComponentProps = {}, GroupFormProps = {}, EventFormDialogComponentProps = {}, CreateLiveStreamDialogComponentProps = {} } = props, rest = tslib_1.__rest(props, ["className", "ComposerProps", "onClick", "onClose", "PopperProps", "CourseFormDialogComponentProps", "GroupFormProps", "EventFormDialogComponentProps", "CreateLiveStreamDialogComponentProps"]);
|
|
61
62
|
// STATE
|
|
62
63
|
const [openComposer, setOpenComposer] = (0, react_1.useState)(false);
|
|
63
64
|
const [openPopper, setOpenPopper] = (0, react_1.useState)(false);
|
|
65
|
+
const [openCreateCourse, setOpenCreateCourse] = (0, react_1.useState)(false);
|
|
64
66
|
const [openCreateGroup, setOpenCreateGroup] = (0, react_1.useState)(false);
|
|
65
67
|
const [openCreateEvent, setOpenCreateEvent] = (0, react_1.useState)(false);
|
|
66
68
|
const [openCreateLiveStream, setOpenCreateLiveStream] = (0, react_1.useState)(false);
|
|
@@ -86,9 +88,10 @@ exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps
|
|
|
86
88
|
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
87
89
|
const { preferences } = (0, react_core_1.useSCPreferences)();
|
|
88
90
|
// MEMOS
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
const
|
|
91
|
+
const canCreateCourse = (0, react_1.useMemo)(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_course; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
|
|
92
|
+
const canCreateGroup = (0, react_1.useMemo)(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_group; }, [(_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.permission]);
|
|
93
|
+
const canCreateEvent = (0, react_1.useMemo)(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_event; }, [(_c = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _c === void 0 ? void 0 : _c.permission]);
|
|
94
|
+
const canCreateLive = (0, react_1.useMemo)(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_live_stream; }, [(_d = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _d === void 0 ? void 0 : _d.permission]);
|
|
92
95
|
const isCommunityOwner = (0, react_1.useMemo)(() => { var _a; return ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.id) === 1; }, [scUserContext.user]);
|
|
93
96
|
const isFreeTrialTier = (0, react_1.useMemo)(() => preferences &&
|
|
94
97
|
react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
@@ -100,6 +103,19 @@ exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps
|
|
|
100
103
|
}, [listItem]);
|
|
101
104
|
// EFFECTS
|
|
102
105
|
(0, react_1.useEffect)(() => {
|
|
106
|
+
if (canCreateCourse) {
|
|
107
|
+
setListItem((prev) => [
|
|
108
|
+
...prev,
|
|
109
|
+
{
|
|
110
|
+
icon: 'courses',
|
|
111
|
+
text: 'ui.composerIconButton.list.course',
|
|
112
|
+
onClick: () => {
|
|
113
|
+
setOpenCreateCourse(true);
|
|
114
|
+
setOpenPopper(false);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
]);
|
|
118
|
+
}
|
|
103
119
|
if (canCreateGroup) {
|
|
104
120
|
setListItem((prev) => [
|
|
105
121
|
...prev,
|
|
@@ -139,7 +155,7 @@ exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps
|
|
|
139
155
|
}
|
|
140
156
|
]);
|
|
141
157
|
}
|
|
142
|
-
}, [canCreateGroup, setListItem]);
|
|
158
|
+
}, [canCreateCourse, canCreateGroup, canCreateEvent, canCreateLiveStream, setListItem, setOpenPopper, setOpenCreateCourse, setOpenCreateGroup, setOpenCreateEvent, setOpenCreateLiveStream]);
|
|
143
159
|
// HANDLERS
|
|
144
160
|
const handleClick = (0, react_1.useCallback)((event) => {
|
|
145
161
|
if (scUserContext.user) {
|
|
@@ -150,7 +166,7 @@ exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps
|
|
|
150
166
|
});
|
|
151
167
|
}
|
|
152
168
|
else {
|
|
153
|
-
if (canCreateGroup || canCreateEvent || canCreateLiveStream) {
|
|
169
|
+
if (canCreateCourse || canCreateGroup || canCreateEvent || canCreateLiveStream) {
|
|
154
170
|
setOpenPopper(true);
|
|
155
171
|
}
|
|
156
172
|
else {
|
|
@@ -162,7 +178,17 @@ exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps
|
|
|
162
178
|
scContext.settings.handleAnonymousAction();
|
|
163
179
|
}
|
|
164
180
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
165
|
-
}, [
|
|
181
|
+
}, [
|
|
182
|
+
onClick,
|
|
183
|
+
scContext.settings,
|
|
184
|
+
scUserContext.user,
|
|
185
|
+
canCreateCourse,
|
|
186
|
+
canCreateGroup,
|
|
187
|
+
canCreateEvent,
|
|
188
|
+
canCreateLiveStream,
|
|
189
|
+
setOpenPopper,
|
|
190
|
+
setOpenComposer
|
|
191
|
+
]);
|
|
166
192
|
const handleCloseComposer = (0, react_1.useCallback)(() => {
|
|
167
193
|
setOpenComposer(false);
|
|
168
194
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
@@ -170,6 +196,9 @@ exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps
|
|
|
170
196
|
const handleCloseMenu = (0, react_1.useCallback)(() => {
|
|
171
197
|
setOpenPopper(false);
|
|
172
198
|
}, [setOpenPopper]);
|
|
199
|
+
const handleCloseCreateCourse = (0, react_1.useCallback)(() => {
|
|
200
|
+
setOpenCreateCourse(false);
|
|
201
|
+
}, [setOpenCreateCourse]);
|
|
173
202
|
const handleCloseCreateGroup = (0, react_1.useCallback)(() => {
|
|
174
203
|
setOpenCreateGroup(false);
|
|
175
204
|
}, [setOpenCreateGroup]);
|
|
@@ -190,5 +219,5 @@ exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps
|
|
|
190
219
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleClick, ref: (innerRef) => {
|
|
191
220
|
popperRef.current = innerRef;
|
|
192
221
|
return ref;
|
|
193
|
-
} }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "add_circle_outline" }) })), openComposer && (0, jsx_runtime_1.jsx)(Composer_1.default, Object.assign({ open: true, fullWidth: true, onClose: handleCloseComposer, onSuccess: handleSuccess }, ComposerProps)), openPopper && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.SwipeableDrawer, Object.assign({ open: true, onClose: handleCloseMenu, onOpen: () => null, anchor: "bottom", disableSwipeToOpen: true }, { children: renderContent }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ open: true, anchorEl: popperRef.current, role: undefined, className: classes.menuRoot, onClose: handleCloseMenu }, PopperProps, { children: renderContent }))) })), openCreateGroup && (0, jsx_runtime_1.jsx)(GroupForm_1.default, Object.assign({ open: true, onClose: handleCloseCreateGroup }, GroupFormProps)), openCreateEvent && (0, jsx_runtime_1.jsx)(EventFormDialog_1.default, Object.assign({ open: true, onClose: handleCloseCreateEvent }, EventFormDialogComponentProps)), openCreateLiveStream && (0, jsx_runtime_1.jsx)(CreateLiveStreamDialog_1.default, Object.assign({ open: true, onClose: handleCloseCreateLiveStream }, CreateLiveStreamDialogComponentProps))] }));
|
|
222
|
+
} }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "add_circle_outline" }) })), openComposer && (0, jsx_runtime_1.jsx)(Composer_1.default, Object.assign({ open: true, fullWidth: true, onClose: handleCloseComposer, onSuccess: handleSuccess }, ComposerProps)), openPopper && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.SwipeableDrawer, Object.assign({ open: true, onClose: handleCloseMenu, onOpen: () => null, anchor: "bottom", disableSwipeToOpen: true }, { children: renderContent }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ open: true, anchorEl: popperRef.current, role: undefined, className: classes.menuRoot, onClose: handleCloseMenu }, PopperProps, { children: renderContent }))) })), openCreateCourse && (0, jsx_runtime_1.jsx)(CourseFormDialog_1.default, Object.assign({ open: true, onClose: handleCloseCreateCourse }, CourseFormDialogComponentProps)), openCreateGroup && (0, jsx_runtime_1.jsx)(GroupForm_1.default, Object.assign({ open: true, onClose: handleCloseCreateGroup }, GroupFormProps)), openCreateEvent && (0, jsx_runtime_1.jsx)(EventFormDialog_1.default, Object.assign({ open: true, onClose: handleCloseCreateEvent }, EventFormDialogComponentProps)), openCreateLiveStream && (0, jsx_runtime_1.jsx)(CreateLiveStreamDialog_1.default, Object.assign({ open: true, onClose: handleCloseCreateLiveStream }, CreateLiveStreamDialogComponentProps))] }));
|
|
194
223
|
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { WidgetProps } from '../Widget';
|
|
2
|
+
export interface CourseSkeletonProps extends WidgetProps {
|
|
3
|
+
/**
|
|
4
|
+
* Overrides or extends the styles applied to the component.
|
|
5
|
+
* @default null
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* > API documentation for the Community-JS Course Placeholder component. Learn about the available props and the CSS API.
|
|
11
|
+
|
|
12
|
+
#### Import
|
|
13
|
+
|
|
14
|
+
```jsx
|
|
15
|
+
import {CourseCreatePlaceholder} from '@selfcommunity/react-ui';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
#### Component Name
|
|
19
|
+
|
|
20
|
+
The name `SCCourse-placeholder-root` can be used when providing style overrides in the theme.
|
|
21
|
+
|
|
22
|
+
#### CSS
|
|
23
|
+
|
|
24
|
+
|Rule Name|Global class|Description|
|
|
25
|
+
|---|---|---|
|
|
26
|
+
|root|.SCCourse-create-placeholder-root|Styles applied to the root element.|
|
|
27
|
+
|imageWrapper|.SCCourse-create-placeholder-image|Styles applied to the image wrapper section.|
|
|
28
|
+
|image|.SCCourse-create-placeholder-image|Styles applied to the image element.|
|
|
29
|
+
|icon|.SCCourse-create-placeholder-icon|Styles applied to the course icon element.|
|
|
30
|
+
|actions|.SCCourse-create-placeholder-actions|Styles applied to action section.|
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
export default function CourseCreatePlaceholder(inProps: CourseSkeletonProps): JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 material_1 = require("@mui/material");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const system_1 = require("@mui/system");
|
|
8
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
9
|
+
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
12
|
+
const CreateCourseButton_1 = tslib_1.__importDefault(require("../CreateCourseButton"));
|
|
13
|
+
const classes = {
|
|
14
|
+
root: `${constants_1.PREFIX}-create-placeholder-root`,
|
|
15
|
+
imageWrapper: `${constants_1.PREFIX}-create-placeholder-image-wrapper`,
|
|
16
|
+
image: `${constants_1.PREFIX}-create-placeholder-image`,
|
|
17
|
+
icon: `${constants_1.PREFIX}-create-placeholder-icon`,
|
|
18
|
+
actions: `${constants_1.PREFIX}-create-placeholder-actions`
|
|
19
|
+
};
|
|
20
|
+
const Root = (0, styles_1.styled)(Widget_1.default, {
|
|
21
|
+
name: constants_1.PREFIX,
|
|
22
|
+
slot: 'CreatePlaceholderRoot'
|
|
23
|
+
})(() => ({}));
|
|
24
|
+
/**
|
|
25
|
+
* > API documentation for the Community-JS Course Placeholder component. Learn about the available props and the CSS API.
|
|
26
|
+
|
|
27
|
+
#### Import
|
|
28
|
+
|
|
29
|
+
```jsx
|
|
30
|
+
import {CourseCreatePlaceholder} from '@selfcommunity/react-ui';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### Component Name
|
|
34
|
+
|
|
35
|
+
The name `SCCourse-placeholder-root` can be used when providing style overrides in the theme.
|
|
36
|
+
|
|
37
|
+
#### CSS
|
|
38
|
+
|
|
39
|
+
|Rule Name|Global class|Description|
|
|
40
|
+
|---|---|---|
|
|
41
|
+
|root|.SCCourse-create-placeholder-root|Styles applied to the root element.|
|
|
42
|
+
|imageWrapper|.SCCourse-create-placeholder-image|Styles applied to the image wrapper section.|
|
|
43
|
+
|image|.SCCourse-create-placeholder-image|Styles applied to the image element.|
|
|
44
|
+
|icon|.SCCourse-create-placeholder-icon|Styles applied to the course icon element.|
|
|
45
|
+
|actions|.SCCourse-create-placeholder-actions|Styles applied to action section.|
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
function CourseCreatePlaceholder(inProps) {
|
|
49
|
+
// PROPS
|
|
50
|
+
const props = (0, system_1.useThemeProps)({
|
|
51
|
+
props: inProps,
|
|
52
|
+
name: constants_1.PREFIX
|
|
53
|
+
});
|
|
54
|
+
const { className } = props, rest = tslib_1.__rest(props, ["className"]);
|
|
55
|
+
// HOOK
|
|
56
|
+
const { preferences } = (0, react_core_1.useSCPreferences)();
|
|
57
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ position: "relative", className: classes.imageWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", image: `${preferences[react_core_1.SCPreferences.IMAGES_USER_DEFAULT_COVER].value}`, alt: "placeholder image", className: classes.image }), (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.icon, fontSize: "large" }, { children: "courses" }))] })), (0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(CreateCourseButton_1.default, {}) }))] })));
|
|
58
|
+
}
|
|
59
|
+
exports.default = CourseCreatePlaceholder;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SCCourseType } from '@selfcommunity/types';
|
|
3
|
+
export interface CourseCompletedDialogProps {
|
|
4
|
+
course: SCCourseType;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare function CourseCompletedDialog(inProps: CourseCompletedDialogProps): JSX.Element;
|
|
8
|
+
declare const _default: import("react").MemoExoticComponent<typeof CourseCompletedDialog>;
|
|
9
|
+
export default _default;
|
|
@@ -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 BaseDialog_1 = tslib_1.__importDefault(require("../../shared/BaseDialog"));
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_intl_1 = require("react-intl");
|
|
8
|
+
const clapping_1 = require("../../assets/courses/clapping");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
11
|
+
const PREFIX = 'SCCourseCompletedDialog';
|
|
12
|
+
const classes = {
|
|
13
|
+
root: `${PREFIX}-root`,
|
|
14
|
+
wrapper: `${PREFIX}-wrapper`,
|
|
15
|
+
title: `${PREFIX}-title`,
|
|
16
|
+
descriptionPt1: `${PREFIX}-description-pt1`,
|
|
17
|
+
descriptionPt2: `${PREFIX}-description-pt2`
|
|
18
|
+
};
|
|
19
|
+
const Root = (0, material_1.styled)(BaseDialog_1.default, {
|
|
20
|
+
name: PREFIX,
|
|
21
|
+
slot: 'Root',
|
|
22
|
+
overridesResolver: (_props, styles) => styles.root
|
|
23
|
+
})(() => ({}));
|
|
24
|
+
function CourseCompletedDialog(inProps) {
|
|
25
|
+
// PROPS
|
|
26
|
+
const props = (0, material_1.useThemeProps)({
|
|
27
|
+
props: inProps,
|
|
28
|
+
name: PREFIX
|
|
29
|
+
});
|
|
30
|
+
const { course, onClose } = props;
|
|
31
|
+
// CONTEXTS
|
|
32
|
+
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
33
|
+
// HOOKS
|
|
34
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ DialogContentProps: { dividers: false }, open: true, onClose: onClose, actions: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.COURSES_ROUTE_NAME, {}), size: "medium", variant: "contained" }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.completedDialog.btn.label", defaultMessage: "ui.course.completedDialog.btn.label" }) })) })), className: classes.root }, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.wrapper }, { children: [(0, jsx_runtime_1.jsx)("img", { src: clapping_1.CLAPPING, alt: intl.formatMessage({ id: 'ui.course.completedDialog.title', defaultMessage: 'ui.course.completedDialog.title' }), width: 100, height: 100 }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h2", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.completedDialog.title", defaultMessage: "ui.course.completedDialog.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.descriptionPt1 }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.course.completedDialog.description.pt1", defaultMessage: "ui.course.completedDialog.description.pt1" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.descriptionPt2 }, { children: intl.formatMessage({ id: 'ui.course.completedDialog.description.pt2', defaultMessage: 'ui.course.completedDialog.description.pt2' }, {
|
|
36
|
+
courseName: course.name,
|
|
37
|
+
span: (chunks) => ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span", variant: "inherit", color: "primary" }, { children: chunks })))
|
|
38
|
+
}) }))] })) })));
|
|
39
|
+
}
|
|
40
|
+
exports.default = (0, react_1.memo)(CourseCompletedDialog);
|
|
@@ -22,9 +22,9 @@ export interface CourseFormProps extends BoxProps {
|
|
|
22
22
|
onSuccess?: (data: SCCourseType) => void;
|
|
23
23
|
/**
|
|
24
24
|
* step name
|
|
25
|
-
* @default
|
|
25
|
+
* @default `SCCourseFormStepType.ONE`
|
|
26
26
|
*/
|
|
27
|
-
step
|
|
27
|
+
step?: SCCourseFormStepType;
|
|
28
28
|
/**
|
|
29
29
|
* On error callback function
|
|
30
30
|
* @default null
|
|
@@ -22,6 +22,7 @@ const UploadCourseCover_1 = tslib_1.__importDefault(require("./UploadCourseCover
|
|
|
22
22
|
const Course_1 = require("../../constants/Course");
|
|
23
23
|
const CategoryAutocomplete_1 = tslib_1.__importDefault(require("../CategoryAutocomplete"));
|
|
24
24
|
const Edit_1 = tslib_1.__importDefault(require("./Edit"));
|
|
25
|
+
const Dialog_1 = tslib_1.__importDefault(require("./Dialog"));
|
|
25
26
|
const messages = (0, react_intl_1.defineMessages)({
|
|
26
27
|
name: {
|
|
27
28
|
id: 'ui.courseForm.name.placeholder',
|
|
@@ -125,6 +126,7 @@ function CourseForm(inProps) {
|
|
|
125
126
|
const [field, setField] = (0, react_1.useState)(initialFieldState);
|
|
126
127
|
const [_step, setStep] = (0, react_1.useState)(step);
|
|
127
128
|
const [error, setError] = (0, react_1.useState)({});
|
|
129
|
+
const [openDialog, setOpenDialog] = (0, react_1.useState)(false);
|
|
128
130
|
// PREFERENCES
|
|
129
131
|
const scPreferences = (0, react_core_1.useSCPreferences)();
|
|
130
132
|
const _backgroundCover = Object.assign({}, (field.imageOriginal
|
|
@@ -243,19 +245,29 @@ function CourseForm(inProps) {
|
|
|
243
245
|
setError(error);
|
|
244
246
|
}
|
|
245
247
|
}, [setField, error]);
|
|
248
|
+
/**
|
|
249
|
+
* Handles for closing confirm dialog
|
|
250
|
+
*/
|
|
251
|
+
const handleClose = (0, react_1.useCallback)(() => {
|
|
252
|
+
setOpenDialog(false);
|
|
253
|
+
}, [setOpenDialog]);
|
|
246
254
|
/**
|
|
247
255
|
* Renders root object
|
|
248
256
|
*/
|
|
249
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: _step === SCCourseFormStepType.ONE ? classes.stepOne : classes.stepTwo }, { children: [_step === SCCourseFormStepType.ONE && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Object.values(types_1.SCCourseTypologyType).map((option, index) => ((0, jsx_runtime_1.jsx)(material_1.Card, Object.assign({ className: (0, classnames_1.default)(classes.card, { [classes.selected]: option === field.type }) }, { children: (0, jsx_runtime_1.jsx)(material_1.CardActionArea, Object.assign({ onClick: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['type']: option }))) }, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.courseForm.${option}.title`, defaultMessage: `ui.courseForm.${option}.title` }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.courseForm.${option}.info`, defaultMessage: `ui.courseForm.${option}.info` }) }))] }) })) }), index))) })), _step === SCCourseFormStepType.TWO && ((0, jsx_runtime_1.jsxs)(material_1.FormGroup, Object.assign({ className: classes.form }, { children: [course && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.edit.title.general", defaultMessage: "ui.courseForm.edit.title.general" }) }))), (0, jsx_runtime_1.jsx)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: (0, jsx_runtime_1.jsx)(UploadCourseCover_1.default, { isCreationMode: true, onChange: handleChangeCover }) })), (0, jsx_runtime_1.jsx)(material_1.TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: _step === SCCourseFormStepType.ONE ? classes.stepOne : classes.stepTwo }, { children: [_step === SCCourseFormStepType.ONE && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Object.values(types_1.SCCourseTypologyType).map((option, index) => ((0, jsx_runtime_1.jsx)(material_1.Card, Object.assign({ className: (0, classnames_1.default)(classes.card, { [classes.selected]: option === field.type }) }, { children: (0, jsx_runtime_1.jsx)(material_1.CardActionArea, Object.assign({ onClick: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['type']: option }))) }, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.courseForm.${option}.title`, defaultMessage: `ui.courseForm.${option}.title` }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.courseForm.${option}.info`, defaultMessage: `ui.courseForm.${option}.info` }) }))] }) })) }), index))) })), _step === SCCourseFormStepType.TWO && ((0, jsx_runtime_1.jsxs)(material_1.FormGroup, Object.assign({ className: classes.form }, { children: [course && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.edit.title.general", defaultMessage: "ui.courseForm.edit.title.general" }) }))), (0, jsx_runtime_1.jsx)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: (0, jsx_runtime_1.jsx)(UploadCourseCover_1.default, { isCreationMode: true, onChange: handleChangeCover }) })), (0, jsx_runtime_1.jsx)(material_1.TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
|
|
258
|
+
endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: Course_1.COURSE_TITLE_MAX_LENGTH - field.name.length }))
|
|
259
|
+
}, error: Boolean(field.name.length > Course_1.COURSE_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: field.name.length > Course_1.COURSE_TITLE_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.name.error.maxLength", defaultMessage: "ui.courseForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
260
|
+
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_a = field.description) === null || _a === void 0 ? void 0 : _a.length) ? Course_1.COURSE_DESCRIPTION_MAX_LENGTH - field.description.length : Course_1.COURSE_DESCRIPTION_MAX_LENGTH })))
|
|
261
|
+
}, error: Boolean(((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) > Course_1.COURSE_DESCRIPTION_MAX_LENGTH), helperText: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > Course_1.COURSE_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.description.error.maxLength", defaultMessage: "ui.courseForm.description.error.maxLength" })) : null }), (0, jsx_runtime_1.jsx)(CategoryAutocomplete_1.default, { defaultValue: field.categories, TextFieldProps: { label: intl.formatMessage(Object.keys(field.categories).length ? messages.category : messages.categoryEmpty) }, multiple: true, onChange: handleOnChangeCategory }), course && (0, jsx_runtime_1.jsx)(Edit_1.default, { course: course, onPrivacyChange: (privacy) => setField((prev) => (Object.assign(Object.assign({}, prev), { ['privacy']: privacy }))) })] }))), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ size: "small", loading: field.isSubmitting, disabled: _step === SCCourseFormStepType.ONE
|
|
262
|
+
? !field.type || Object.keys(error).length !== 0
|
|
263
|
+
: _step === SCCourseFormStepType.TWO &&
|
|
264
|
+
(!field.name ||
|
|
265
|
+
Object.keys(error).length !== 0 ||
|
|
266
|
+
field.name.length > Course_1.COURSE_TITLE_MAX_LENGTH ||
|
|
267
|
+
field.description.length > Course_1.COURSE_DESCRIPTION_MAX_LENGTH), variant: "contained", onClick: _step === SCCourseFormStepType.ONE
|
|
268
|
+
? () => handleChangeStep(SCCourseFormStepType.TWO)
|
|
269
|
+
: field.privacy !== types_1.SCCoursePrivacyType.DRAFT && course.privacy === types_1.SCCoursePrivacyType.DRAFT
|
|
270
|
+
? () => setOpenDialog(true)
|
|
271
|
+
: handleSubmit, color: "primary" }, { children: course ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.edit.action.save", defaultMessage: "ui.courseForm.edit.action.save" })) : _step === SCCourseFormStepType.ONE ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.button.next", defaultMessage: "ui.courseForm.button.next" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.button.create", defaultMessage: "ui.courseForm.button.create" })) })) }))] })) })), openDialog && (0, jsx_runtime_1.jsx)(Dialog_1.default, { onSubmit: handleSubmit, onClose: handleClose })] }));
|
|
260
272
|
}
|
|
261
273
|
exports.default = CourseForm;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface CoursePublicationDialogProps {
|
|
3
|
+
onSubmit: () => void;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
}
|
|
6
|
+
declare function CoursePublicationDialog(props: CoursePublicationDialogProps): JSX.Element;
|
|
7
|
+
declare const _default: import("react").MemoExoticComponent<typeof CoursePublicationDialog>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 material_1 = require("@mui/material");
|
|
6
|
+
const BaseDialog_1 = tslib_1.__importDefault(require("../../shared/BaseDialog"));
|
|
7
|
+
const react_intl_1 = require("react-intl");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
function CoursePublicationDialog(props) {
|
|
10
|
+
// PROPS
|
|
11
|
+
const { onSubmit, onClose } = props;
|
|
12
|
+
// HANDLERS
|
|
13
|
+
const handleSubmit = (0, react_1.useCallback)(() => {
|
|
14
|
+
onSubmit();
|
|
15
|
+
onClose();
|
|
16
|
+
}, [onSubmit, onClose]);
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(BaseDialog_1.default, Object.assign({ open: true, DialogContentProps: { dividers: false }, onClose: onClose, title: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.edit.dialog.title", defaultMessage: "ui.courseForm.edit.dialog.title" }) })), actions: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", color: "primary", variant: "contained", onClick: handleSubmit }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.edit.dialog.btn", defaultMessage: "ui.courseForm.edit.dialog.btn" }) })) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courseForm.edit.dialog.description", defaultMessage: "ui.courseForm.edit.dialog.description" }) })) })));
|
|
18
|
+
}
|
|
19
|
+
exports.default = (0, react_1.memo)(CoursePublicationDialog);
|
|
@@ -82,7 +82,7 @@ function CourseParticipantsButton(inProps) {
|
|
|
82
82
|
setEnrolled([]);
|
|
83
83
|
setLoading(true);
|
|
84
84
|
}, [scCourse]);
|
|
85
|
-
// FETCH FIRST
|
|
85
|
+
// FETCH FIRST ENROLLED
|
|
86
86
|
(0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
|
|
87
87
|
if (!scCourse) {
|
|
88
88
|
return;
|
|
@@ -138,7 +138,7 @@ function CourseParticipantsButton(inProps) {
|
|
|
138
138
|
/**
|
|
139
139
|
* Rendering
|
|
140
140
|
*/
|
|
141
|
-
if (!participantsAvailable) {
|
|
141
|
+
if (!participantsAvailable || !scCourse.privacy) {
|
|
142
142
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
143
143
|
}
|
|
144
144
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleToggleDialogOpen, disabled: loading || !scCourse || enrolled.length === 0,
|
|
@@ -19,7 +19,7 @@ const Skeleton_1 = tslib_1.__importDefault(require("../Courses/Skeleton"));
|
|
|
19
19
|
const constants_1 = require("./constants");
|
|
20
20
|
const course_1 = require("../../types/course");
|
|
21
21
|
const CategoryAutocomplete_1 = tslib_1.__importDefault(require("../CategoryAutocomplete"));
|
|
22
|
-
const
|
|
22
|
+
const CreatePlaceholder_1 = tslib_1.__importDefault(require("../Course/CreatePlaceholder"));
|
|
23
23
|
const classes = {
|
|
24
24
|
root: `${constants_1.PREFIX}-root`,
|
|
25
25
|
category: `${constants_1.PREFIX}-category`,
|
|
@@ -43,7 +43,7 @@ const Root = (0, material_1.styled)(material_1.Box, {
|
|
|
43
43
|
exports.CoursesChipRoot = (0, material_1.styled)(material_1.Chip, {
|
|
44
44
|
name: constants_1.PREFIX,
|
|
45
45
|
slot: 'CoursesChipRoot',
|
|
46
|
-
shouldForwardProp: (prop) => prop !== 'showForMe'
|
|
46
|
+
shouldForwardProp: (prop) => prop !== 'showForMe' && prop !== 'showMyCourses'
|
|
47
47
|
})(() => ({}));
|
|
48
48
|
/**
|
|
49
49
|
* > API documentation for the Community-JS Courses component. Learn about the available props and the CSS API.
|
|
@@ -222,9 +222,9 @@ function Courses(inProps) {
|
|
|
222
222
|
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "end" }, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: () => fetchCourses(), disabled: loading }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "search" }) }))) : ((0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "contained", color: "secondary", onClick: () => fetchCourses(), endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "search" }), disabled: loading })) })))
|
|
223
223
|
} }) })), ((onlyStaffEnabled && canCreateCourse) || !onlyStaffEnabled) && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.CoursesChipRoot, { color: showMyCourses ? 'primary' : 'default', variant: showMyCourses ? 'filled' : 'outlined', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courses.filterByCreatedByMe", defaultMessage: "ui.courses.filterByCreatedByMe" }), onClick: () => setShowMyCourses(!showMyCourses),
|
|
224
224
|
// @ts-expect-error this is needed to use showForMe into SCCourses
|
|
225
|
-
showForMe: showMyCourses, deleteIcon: showMyCourses ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showMyCourses ?
|
|
225
|
+
showForMe: showMyCourses, deleteIcon: showMyCourses ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showMyCourses ? () => setShowMyCourses(false) : null, disabled: loading || showForMe }) }))), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: "auto" }, { children: (0, jsx_runtime_1.jsx)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(CategoryAutocomplete_1.default, { onChange: handleOnChangeCategory, className: classes.category, size: "small", multiple: true }) })) })), authUserId && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.CoursesChipRoot, { color: showForMe ? 'primary' : 'default', variant: showForMe ? 'filled' : 'outlined', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courses.filterByCoursesForMe", defaultMessage: "ui.courses.filterByCoursesForMe" }), onClick: handleChipClick,
|
|
226
226
|
// @ts-expect-error this is needed to use showForMe into SCCourses
|
|
227
|
-
showForMe: showForMe, deleteIcon: showForMe ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showForMe ? handleDeleteClick : null, disabled: loading }) })))] })) }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: loading ? ((0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({}, CoursesSkeletonComponentProps, { CourseSkeletonProps: CourseSkeletonComponentProps }))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !courses.length ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.noResults }, { children: !canCreateCourse && onlyStaffEnabled ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.studentEmptyView }, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.emptyBox }, { children: (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.emptyRotatedBox }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.emptyIcon, color: "disabled", fontSize: "large" }, { children: "courses" })) })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", textAlign: "center" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courses.empty.title", defaultMessage: "ui.courses.empty.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courses.empty.info", defaultMessage: "ui.courses.empty.info" }) })), (0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({ coursesNumber: 4 }, CoursesSkeletonComponentProps, { CourseSkeletonProps: CourseSkeletonComponentProps
|
|
227
|
+
showForMe: showForMe, deleteIcon: showForMe ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showForMe ? handleDeleteClick : null, disabled: loading || showMyCourses }) })))] })) }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: loading ? ((0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({}, CoursesSkeletonComponentProps, { CourseSkeletonProps: CourseSkeletonComponentProps }))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !courses.length ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.noResults }, { children: !canCreateCourse && onlyStaffEnabled ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.studentEmptyView }, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.emptyBox }, { children: (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ className: classes.emptyRotatedBox }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.emptyIcon, color: "disabled", fontSize: "large" }, { children: "courses" })) })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", textAlign: "center" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courses.empty.title", defaultMessage: "ui.courses.empty.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courses.empty.info", defaultMessage: "ui.courses.empty.info" }) })), (0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({ coursesNumber: 4 }, CoursesSkeletonComponentProps, { CourseSkeletonProps: CourseSkeletonComponentProps }))] }))) : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.teacherEmptyView }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({ teacherView: (onlyStaffEnabled && canCreateCourse) || !onlyStaffEnabled, coursesNumber: 1 }, CoursesSkeletonComponentProps, { CourseSkeletonProps: CourseSkeletonComponentProps })) }))) }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.courses }, GridContainerComponentProps, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [courses.map((course) => ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, lg: 3, className: classes.item }, GridItemComponentProps, { children: (0, jsx_runtime_1.jsx)(Course_1.default, Object.assign({ courseId: course.id }, CourseComponentProps)) }), course.id))), authUserId && courses.length % 2 !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, lg: 3, className: classes.itemPlaceholder }, GridItemComponentProps, { children: (0, jsx_runtime_1.jsx)(CreatePlaceholder_1.default, {}) }), 'placeholder-item'))] }) })), Boolean(next) && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", variant: "text", onClick: handleNext, className: classes.showMore }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.courses.button.seeMore", defaultMessage: "ui.courses.button.seeMore" }) })))] })) })) })] }));
|
|
228
228
|
/**
|
|
229
229
|
* Renders root object (if content availability community option is false and user is anonymous, component is hidden)
|
|
230
230
|
*/
|
|
@@ -7,7 +7,7 @@ const constants_1 = require("./constants");
|
|
|
7
7
|
const material_1 = require("@mui/material");
|
|
8
8
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
9
9
|
const Course_1 = require("../Course");
|
|
10
|
-
const
|
|
10
|
+
const CreatePlaceholder_1 = tslib_1.__importDefault(require("../Course/CreatePlaceholder"));
|
|
11
11
|
const classes = {
|
|
12
12
|
root: `${constants_1.PREFIX}-skeleton-root`,
|
|
13
13
|
courses: `${constants_1.PREFIX}-skeleton-courses`,
|
|
@@ -40,6 +40,6 @@ const Root = (0, styles_1.styled)(material_1.Box, {
|
|
|
40
40
|
*/
|
|
41
41
|
function CoursesSkeleton(inProps) {
|
|
42
42
|
const { className, CourseSkeletonProps = {}, coursesNumber = 8, GridContainerComponentProps = {}, GridItemComponentProps = {}, teacherView = false } = inProps, rest = tslib_1.__rest(inProps, ["className", "CourseSkeletonProps", "coursesNumber", "GridContainerComponentProps", "GridItemComponentProps", "teacherView"]);
|
|
43
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, spacing: { xs: 3 }, className: classes.courses }, GridContainerComponentProps, { children: [...Array(coursesNumber)].map((course, index) => ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6 }, GridItemComponentProps, { className: classes.item }, { children: teacherView ? (0, jsx_runtime_1.jsx)(
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, spacing: { xs: 3 }, className: classes.courses }, GridContainerComponentProps, { children: [...Array(coursesNumber)].map((course, index) => ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, lg: 3 }, GridItemComponentProps, { className: classes.item }, { children: teacherView ? (0, jsx_runtime_1.jsx)(CreatePlaceholder_1.default, {}) : (0, jsx_runtime_1.jsx)(Course_1.CourseSkeleton, Object.assign({}, CourseSkeletonProps)) }), index))) })) })));
|
|
44
44
|
}
|
|
45
45
|
exports.default = CoursesSkeleton;
|
|
@@ -10,6 +10,9 @@ function MenuRow(props) {
|
|
|
10
10
|
const { icon = (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "more_vert" }), buttonClassName, disabled, children } = props;
|
|
11
11
|
// STATES
|
|
12
12
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
13
|
+
// HOOKS
|
|
14
|
+
const theme = (0, material_1.useTheme)();
|
|
15
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
13
16
|
// HANDLERS
|
|
14
17
|
const handleClick = (0, react_1.useCallback)((e) => {
|
|
15
18
|
setAnchorEl(e.currentTarget);
|
|
@@ -17,6 +20,6 @@ function MenuRow(props) {
|
|
|
17
20
|
const handleClose = (0, react_1.useCallback)(() => {
|
|
18
21
|
setAnchorEl(null);
|
|
19
22
|
}, [anchorEl]);
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: buttonClassName, onClick: handleClick, disabled: disabled }, { children: icon })), (0, jsx_runtime_1.jsx)(Menu_1.default, Object.assign({ anchorEl: anchorEl, open: Boolean(anchorEl), onClick: handleClose }, { children: children }))] }));
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: buttonClassName, onClick: handleClick, disabled: disabled }, { children: icon })), isMobile ? ((0, jsx_runtime_1.jsx)(material_1.SwipeableDrawer, Object.assign({ open: Boolean(anchorEl), onClick: handleClose, onClose: handleClose, onOpen: () => null, anchor: "bottom", disableSwipeToOpen: true }, { children: children }))) : ((0, jsx_runtime_1.jsx)(Menu_1.default, Object.assign({ anchorEl: anchorEl, open: Boolean(anchorEl), onClick: handleClose }, { children: children })))] }));
|
|
21
24
|
}
|
|
22
25
|
exports.default = (0, react_1.memo)(MenuRow);
|