@selfcommunity/react-ui 0.10.2-courses.186 → 0.10.2-courses.187
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/Course/Course.js +12 -4
- package/lib/cjs/components/CourseDashboard/Header.js +2 -22
- package/lib/cjs/components/CourseDashboard/Student.js +4 -5
- package/lib/cjs/components/CourseDashboard/Teacher/Comments.js +7 -10
- package/lib/cjs/components/CourseDashboard/Teacher/Info.js +2 -4
- package/lib/cjs/components/CourseDashboard/Teacher/Students.js +2 -1
- package/lib/cjs/components/CourseForm/CourseForm.js +6 -7
- package/lib/cjs/components/Courses/Courses.js +16 -19
- package/lib/cjs/components/EditCourse/EditCourse.js +27 -26
- package/lib/cjs/components/EditCourse/Lessons/Skeleton.js +1 -2
- package/lib/cjs/components/EditCourse/Lessons.d.ts +3 -1
- package/lib/cjs/components/EditCourse/Lessons.js +6 -12
- package/lib/cjs/components/EditCourse/Options.js +3 -4
- package/lib/cjs/components/EditCourse/Requests.d.ts +3 -1
- package/lib/cjs/components/EditCourse/Requests.js +5 -3
- package/lib/cjs/components/EditCourse/Status.d.ts +3 -0
- package/lib/cjs/components/EditCourse/Status.js +15 -9
- package/lib/cjs/components/EditCourse/Users.d.ts +3 -1
- package/lib/cjs/components/EditCourse/Users.js +5 -5
- package/lib/cjs/index.d.ts +2 -1
- package/lib/cjs/index.js +8 -6
- package/lib/cjs/shared/AddUsersButton/AddUsersButton.js +3 -2
- 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/CourseUsersTable.d.ts +2 -1
- package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.js +6 -7
- package/lib/cjs/types/course.d.ts +5 -0
- package/lib/cjs/types/course.js +7 -1
- package/lib/cjs/utils/course.js +2 -1
- package/lib/esm/components/Course/Course.js +12 -4
- package/lib/esm/components/CourseDashboard/Header.js +4 -24
- package/lib/esm/components/CourseDashboard/Student.js +4 -5
- package/lib/esm/components/CourseDashboard/Teacher/Comments.js +7 -9
- package/lib/esm/components/CourseDashboard/Teacher/Info.js +2 -4
- package/lib/esm/components/CourseDashboard/Teacher/Students.js +2 -1
- package/lib/esm/components/CourseForm/CourseForm.js +6 -7
- package/lib/esm/components/Courses/Courses.js +16 -19
- package/lib/esm/components/EditCourse/EditCourse.js +28 -27
- package/lib/esm/components/EditCourse/Lessons/Skeleton.js +2 -3
- package/lib/esm/components/EditCourse/Lessons.d.ts +3 -1
- package/lib/esm/components/EditCourse/Lessons.js +7 -13
- package/lib/esm/components/EditCourse/Options.js +5 -6
- package/lib/esm/components/EditCourse/Requests.d.ts +3 -1
- package/lib/esm/components/EditCourse/Requests.js +5 -3
- package/lib/esm/components/EditCourse/Status.d.ts +3 -0
- package/lib/esm/components/EditCourse/Status.js +16 -10
- package/lib/esm/components/EditCourse/Users.d.ts +3 -1
- package/lib/esm/components/EditCourse/Users.js +5 -5
- package/lib/esm/index.d.ts +2 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/shared/AddUsersButton/AddUsersButton.js +3 -2
- 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/CourseUsersTable.d.ts +2 -1
- package/lib/esm/shared/CourseUsersTable/CourseUsersTable.js +6 -7
- package/lib/esm/types/course.d.ts +5 -0
- package/lib/esm/types/course.js +6 -0
- package/lib/esm/utils/course.js +2 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +8 -8
|
@@ -7,19 +7,19 @@ import { CourseService } from '@selfcommunity/api-services';
|
|
|
7
7
|
import { Logger } from '@selfcommunity/utils';
|
|
8
8
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
9
9
|
import { useSnackbar } from 'notistack';
|
|
10
|
-
import { Box,
|
|
10
|
+
import { Box, Stack, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Typography } from '@mui/material';
|
|
11
11
|
import Status from './Status';
|
|
12
12
|
import EmptyStatus from '../../shared/EmptyStatus';
|
|
13
13
|
import AddButton from './Lessons/AddButton';
|
|
14
14
|
import SectionRow from './Lessons/SectionRow';
|
|
15
15
|
import { ActionLessonType, RowType } from './types';
|
|
16
16
|
import { useIsDisabled } from './hooks';
|
|
17
|
-
import classNames from 'classnames';
|
|
18
17
|
import ConfirmDialog from '../../shared/ConfirmDialog/ConfirmDialog';
|
|
18
|
+
import CourseTypePopover from '../../shared/CourseTypePopover';
|
|
19
|
+
import classNames from 'classnames';
|
|
19
20
|
const classes = {
|
|
20
21
|
lessonTitle: `${PREFIX}-lesson-title`,
|
|
21
22
|
lessonInfoWrapper: `${PREFIX}-lesson-info-wrapper`,
|
|
22
|
-
lessonInfo: `${PREFIX}-lesson-info`,
|
|
23
23
|
lessonsSectionsWrapper: `${PREFIX}-lessons-sections-wrapper`,
|
|
24
24
|
lessonsSections: `${PREFIX}-lessons-sections`,
|
|
25
25
|
circle: `${PREFIX}-circle`,
|
|
@@ -33,8 +33,7 @@ const classes = {
|
|
|
33
33
|
cellAlignCenter: `${PREFIX}-cell-align-center`,
|
|
34
34
|
lessonEmptyStatus: `${PREFIX}-lesson-empty-status`,
|
|
35
35
|
emptyStatusButton: `${PREFIX}-empty-status-button`,
|
|
36
|
-
contrastColor: `${PREFIX}-contrast-color
|
|
37
|
-
contrastBgColor: `${PREFIX}-contrast-bg-color`
|
|
36
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
38
37
|
};
|
|
39
38
|
const headerCells = [
|
|
40
39
|
{
|
|
@@ -52,7 +51,7 @@ const headerCells = [
|
|
|
52
51
|
];
|
|
53
52
|
function Lessons(props) {
|
|
54
53
|
// PROPS
|
|
55
|
-
const { course, setCourse } = props;
|
|
54
|
+
const { course, setCourse, handleTabChange } = props;
|
|
56
55
|
// STATES
|
|
57
56
|
const [sections, setSections] = useState([]);
|
|
58
57
|
const [dialog, setDialog] = useState(null);
|
|
@@ -179,15 +178,10 @@ function Lessons(props) {
|
|
|
179
178
|
}
|
|
180
179
|
handleOpenDialog(null);
|
|
181
180
|
}, [dialog, handleOpenDialog]);
|
|
182
|
-
return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ className: classNames(classes.lessonTitle, classes.contrastColor), variant: "h4" }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons", defaultMessage: "ui.editCourse.tab.lessons" }) })), _jsxs(Stack, Object.assign({ className: classes.lessonInfoWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.
|
|
183
|
-
typeOfCourse: intl.formatMessage({
|
|
184
|
-
id: `ui.course.type.${course.type}`,
|
|
185
|
-
defaultMessage: `ui.course.type.${course.type}`
|
|
186
|
-
})
|
|
187
|
-
} }) }))] })), _jsx(Status, { course: course })] })), sections.length === 0 && (_jsx(EmptyStatus, { icon: "courses", title: "ui.editCourse.tab.lessons.table.empty.title", description: "ui.editCourse.tab.lessons.table.empty.description", actions: _jsx(AddButton, { className: classes.emptyStatusButton, label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "inherit", variant: "outlined" }), className: classNames(classes.lessonEmptyStatus, classes.contrastBgColor) })), sections.length > 0 && (_jsxs(Fragment, { children: [_jsxs(Stack, Object.assign({ className: classNames(classes.lessonsSectionsWrapper, classes.contrastBgColor) }, { children: [_jsxs(Stack, Object.assign({ className: classes.lessonsSections }, { children: [_jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.course.table.sections.title", defaultMessage: "ui.course.table.sections.title", values: {
|
|
181
|
+
return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ className: classNames(classes.lessonTitle, classes.contrastColor), variant: "h4" }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons", defaultMessage: "ui.editCourse.tab.lessons" }) })), _jsxs(Stack, Object.assign({ className: classes.lessonInfoWrapper }, { children: [_jsx(CourseTypePopover, { course: course }), _jsx(Status, { course: course, handleTabChange: handleTabChange })] })), sections.length === 0 && (_jsx(EmptyStatus, { icon: "courses", title: "ui.editCourse.tab.lessons.table.empty.title", description: "ui.editCourse.tab.lessons.table.empty.description", actions: _jsx(AddButton, { className: classes.emptyStatusButton, label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "inherit", variant: "outlined" }), className: classes.lessonEmptyStatus })), sections.length > 0 && (_jsxs(Fragment, { children: [_jsxs(Stack, Object.assign({ className: classes.lessonsSectionsWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.lessonsSections }, { children: [_jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.course.table.sections.title", defaultMessage: "ui.course.table.sections.title", values: {
|
|
188
182
|
sectionsNumber: course.num_sections
|
|
189
183
|
} }) })), _jsx(Box, { className: classes.circle }), _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
|
|
190
184
|
lessonsNumber: course.num_lessons
|
|
191
|
-
} }) }))] })), _jsx(AddButton, { label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "primary", variant: "contained", disabled: isDisabled })] })), _jsx(DragDropContext, Object.assign({ onDragEnd: handleDragEnd }, { children: _jsx(TableContainer, Object.assign({ className:
|
|
185
|
+
} }) }))] })), _jsx(AddButton, { label: "ui.editCourse.tab.lessons.table.section", handleAddRow: handleAddTempSection, color: "primary", variant: "contained", disabled: isDisabled })] })), _jsx(DragDropContext, Object.assign({ onDragEnd: handleDragEnd }, { children: _jsx(TableContainer, Object.assign({ className: classes.tableContainer }, { children: _jsxs(Table, Object.assign({ className: classes.table }, { children: [_jsx(TableHead, Object.assign({ className: classes.tableHeader }, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { className: classes.cellWidth }), headerCells.map((cell, i) => (_jsx(TableCell, Object.assign({ className: cell.className }, { children: _jsx(Typography, Object.assign({ className: classes.tableHeaderTypography, variant: "overline" }, { children: _jsx(FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i)))] }) })), _jsx(Droppable, Object.assign({ droppableId: "droppable-1" }, { children: (outerProvider) => (_jsxs(TableBody, Object.assign({ ref: outerProvider.innerRef }, outerProvider.droppableProps, { className: classes.tableBody }, { children: [sections.map((section, i, array) => (_jsx(Draggable, Object.assign({ draggableId: i.toString(), index: i, isDragDisabled: isDisabled }, { children: (innerProvider) => (_jsx(SectionRow, { course: course, provider: innerProvider, section: section, isNewRow: isNewRow && i + 1 === array.length, handleManageSection: handleManageSection, handleOpenDialog: handleOpenDialog, ref: ref }, i)) }), i))), outerProvider.placeholder] }))) }))] })) })) })), dialog && _jsx(ConfirmDialog, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleDeleteRow })] }))] }));
|
|
192
186
|
}
|
|
193
187
|
export default memo(Lessons);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Box, Stack, Typography } from '@mui/material';
|
|
3
3
|
import { FormattedMessage } from 'react-intl';
|
|
4
4
|
import { PREFIX } from './constants';
|
|
5
|
-
import {
|
|
5
|
+
import { memo, useCallback, useState } from 'react';
|
|
6
6
|
import { Logger } from '@selfcommunity/utils';
|
|
7
7
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
8
8
|
import { useSnackbar } from 'notistack';
|
|
@@ -10,12 +10,11 @@ import SwitchForm from './Options/SwitchForm';
|
|
|
10
10
|
import useDeepCompareEffect from 'use-deep-compare-effect';
|
|
11
11
|
import { LoadingButton } from '@mui/lab';
|
|
12
12
|
import { CourseService } from '@selfcommunity/api-services';
|
|
13
|
-
import classNames from 'classnames';
|
|
14
13
|
const classes = {
|
|
14
|
+
optionsContainer: `${PREFIX}-options-container`,
|
|
15
15
|
optionsWrapper: `${PREFIX}-options-wrapper`,
|
|
16
16
|
optionsDivider: `${PREFIX}-options-divider`,
|
|
17
|
-
optionsButtonWrapper: `${PREFIX}-options-button-wrapper
|
|
18
|
-
contrastBgColor: `${PREFIX}-contrast-bg-color`
|
|
17
|
+
optionsButtonWrapper: `${PREFIX}-options-button-wrapper`
|
|
19
18
|
};
|
|
20
19
|
const OPTIONS = {
|
|
21
20
|
enforce_lessons_order: {
|
|
@@ -89,6 +88,6 @@ function Options(props) {
|
|
|
89
88
|
});
|
|
90
89
|
});
|
|
91
90
|
}, [course, tempOptions, setCanSave, setLoading]);
|
|
92
|
-
return (_jsxs(
|
|
91
|
+
return (_jsxs(Box, Object.assign({ className: classes.optionsContainer }, { children: [_jsx(Stack, Object.assign({ className: classes.optionsWrapper }, { children: Object.entries(OPTIONS).map(([key, value], i) => (_jsx(SwitchForm, { name: key, title: value.title, description: value.description, checked: course[key], handleChangeOptions: handleChange }, i))) })), _jsx(Stack, Object.assign({ className: classes.optionsButtonWrapper }, { children: _jsx(LoadingButton, Object.assign({ size: "small", variant: "contained", disabled: !canSave, onClick: handleSubmit, loading: loading }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.options.button.save", defaultMessage: "ui.editCourse.tab.options.button.save" }) })) })) }))] })));
|
|
93
92
|
}
|
|
94
93
|
export default memo(Options);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { SyntheticEvent } from 'react';
|
|
2
2
|
import { SCCourseType } from '@selfcommunity/types';
|
|
3
|
+
import { SCCourseEditTabType } from '../../types/course';
|
|
3
4
|
interface RequestsProps {
|
|
4
5
|
course: SCCourseType;
|
|
5
6
|
endpointQueryParams?: Record<string, string | number>;
|
|
7
|
+
handleTabChange: (_e: SyntheticEvent, newTabValue: SCCourseEditTabType) => void;
|
|
6
8
|
}
|
|
7
9
|
declare function Requests(props: RequestsProps): JSX.Element;
|
|
8
10
|
declare const _default: import("react").MemoExoticComponent<typeof Requests>;
|
|
@@ -13,8 +13,10 @@ import { CourseService } from '@selfcommunity/api-services';
|
|
|
13
13
|
import { PREFIX } from './constants';
|
|
14
14
|
import PubSub from 'pubsub-js';
|
|
15
15
|
import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
|
|
16
|
+
import { SCCourseUsersTableModeType } from '../../types/course';
|
|
16
17
|
const classes = {
|
|
17
|
-
usersStatusWrapper: `${PREFIX}-users-status-wrapper
|
|
18
|
+
usersStatusWrapper: `${PREFIX}-users-status-wrapper`,
|
|
19
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
18
20
|
};
|
|
19
21
|
const headerCells = [
|
|
20
22
|
{
|
|
@@ -33,7 +35,7 @@ function Requests(props) {
|
|
|
33
35
|
const { course, endpointQueryParams = {
|
|
34
36
|
limit: 6,
|
|
35
37
|
offset: DEFAULT_PAGINATION_OFFSET
|
|
36
|
-
} } = props;
|
|
38
|
+
}, handleTabChange } = props;
|
|
37
39
|
// STATES
|
|
38
40
|
const [state, dispatch] = useReducer(dataWidgetReducer, {
|
|
39
41
|
isLoadingPrevious: false,
|
|
@@ -84,6 +86,6 @@ function Requests(props) {
|
|
|
84
86
|
updatedUsers.current && PubSub.unsubscribe(updatedUsers.current);
|
|
85
87
|
};
|
|
86
88
|
}, [handleRemoveUser]);
|
|
87
|
-
return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.requests.title", defaultMessage: "ui.editCourse.tab.requests.title", values: { requestsNumber: state.results.length } }) })), _jsx(Stack, Object.assign({ className: classes.usersStatusWrapper }, { children: _jsx(Status, { course: course }) })), _jsx(CourseUsersTable, { course: course, state: state, dispatch: dispatch, headerCells: headerCells, mode:
|
|
89
|
+
return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.requests.title", defaultMessage: "ui.editCourse.tab.requests.title", values: { requestsNumber: state.results.length } }) })), _jsx(Stack, Object.assign({ className: classes.usersStatusWrapper }, { children: _jsx(Status, { course: course, handleTabChange: handleTabChange }) })), _jsx(CourseUsersTable, { course: course, state: state, dispatch: dispatch, headerCells: headerCells, mode: SCCourseUsersTableModeType.REQUESTS, emptyStatusTitle: "ui.courseUsersTable.empty.requests.title" })] }));
|
|
88
90
|
}
|
|
89
91
|
export default memo(Requests);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { SCCourseType } from '@selfcommunity/types';
|
|
2
|
+
import { SyntheticEvent } from 'react';
|
|
3
|
+
import { SCCourseEditTabType } from '../../types';
|
|
2
4
|
interface StatusProps {
|
|
3
5
|
course: SCCourseType;
|
|
6
|
+
handleTabChange: (_e: SyntheticEvent, newTabValue: SCCourseEditTabType) => void;
|
|
4
7
|
}
|
|
5
8
|
export default function Status(props: StatusProps): JSX.Element;
|
|
6
9
|
export {};
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Chip, Typography } from '@mui/material';
|
|
2
|
+
import { Button, Chip, Typography } from '@mui/material';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
4
|
import { PREFIX } from './constants';
|
|
5
5
|
import { SCCoursePrivacyType } from '@selfcommunity/types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
+
import { useCallback } from 'react';
|
|
8
|
+
import { SCCourseEditTabType } from '../../types';
|
|
7
9
|
const classes = {
|
|
8
10
|
status: `${PREFIX}-status`,
|
|
9
|
-
|
|
11
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
10
12
|
};
|
|
11
13
|
export default function Status(props) {
|
|
12
14
|
// STATES
|
|
13
|
-
const { course } = props;
|
|
15
|
+
const { course, handleTabChange } = props;
|
|
14
16
|
// HOOKS
|
|
15
17
|
const intl = useIntl();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
// HANDLERS
|
|
19
|
+
const handleClick = useCallback(() => {
|
|
20
|
+
handleTabChange(null, SCCourseEditTabType.CUSTOMIZE);
|
|
21
|
+
}, [handleTabChange]);
|
|
22
|
+
return (_jsx(Chip, { label: _jsx(Button, Object.assign({ size: "small", variant: "text", color: "inherit", onClick: handleClick }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: intl.formatMessage({ id: 'ui.editCourse.tab.lessons.status', defaultMessage: 'ui.editCourse.tab.lessons.status' }, {
|
|
23
|
+
status: intl.formatMessage({
|
|
24
|
+
id: `ui.course.privacy.${course.privacy === SCCoursePrivacyType.DRAFT ? 'draft' : course.privacy}`,
|
|
25
|
+
defaultMessage: `ui.course.privacy.${course.privacy === SCCoursePrivacyType.DRAFT ? 'draft' : course.privacy}`
|
|
26
|
+
}),
|
|
27
|
+
b: (chunks) => (_jsx(Typography, Object.assign({ component: "b", fontWeight: "bold" }, { children: chunks })))
|
|
28
|
+
}) })) })), className: classNames(classes.status, classes.contrastColor) }));
|
|
23
29
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { SyntheticEvent } from 'react';
|
|
2
2
|
import { SCCourseType } from '@selfcommunity/types';
|
|
3
|
+
import { SCCourseEditTabType } from '../../types/course';
|
|
3
4
|
interface UsersProps {
|
|
4
5
|
course: SCCourseType;
|
|
5
6
|
endpointQueryParams?: Record<string, string | number>;
|
|
7
|
+
handleTabChange: (_e: SyntheticEvent, newTabValue: SCCourseEditTabType) => void;
|
|
6
8
|
}
|
|
7
9
|
declare function Users(props: UsersProps): JSX.Element;
|
|
8
10
|
declare const _default: import("react").MemoExoticComponent<typeof Users>;
|
|
@@ -15,10 +15,10 @@ import { actionWidgetTypes, dataWidgetReducer, stateWidgetInitializer } from '..
|
|
|
15
15
|
import { CourseService, Endpoints } from '@selfcommunity/api-services';
|
|
16
16
|
import PubSub from 'pubsub-js';
|
|
17
17
|
import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
|
|
18
|
+
import { SCCourseUsersTableModeType } from '../../types/course';
|
|
18
19
|
const classes = {
|
|
19
20
|
usersStatusWrapper: `${PREFIX}-users-status-wrapper`,
|
|
20
|
-
contrastColor: `${PREFIX}-contrast-color
|
|
21
|
-
contrastBgColor: `${PREFIX}-contrast-bg-color`
|
|
21
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
22
22
|
};
|
|
23
23
|
const headerCells = [
|
|
24
24
|
{
|
|
@@ -40,7 +40,7 @@ function Users(props) {
|
|
|
40
40
|
limit: 6,
|
|
41
41
|
offset: DEFAULT_PAGINATION_OFFSET,
|
|
42
42
|
statuses: JSON.stringify(['joined', 'manager', 'creator'])
|
|
43
|
-
} } = props;
|
|
43
|
+
}, handleTabChange } = props;
|
|
44
44
|
// STATES
|
|
45
45
|
const [state, dispatch] = useReducer(dataWidgetReducer, {
|
|
46
46
|
isLoadingNext: false,
|
|
@@ -113,9 +113,9 @@ function Users(props) {
|
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
}, [course, dispatch]);
|
|
116
|
-
return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.users.title", defaultMessage: "ui.editCourse.tab.users.title", values: { usersNumber: state.results.length } }) })), _jsxs(Stack, Object.assign({ className: classes.usersStatusWrapper }, { children: [_jsx(Status, { course: course }), _jsx(AddUsersButton, { label: "ui.editCourse.tab.users.addUsersButton.label", endpoint: {
|
|
116
|
+
return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.users.title", defaultMessage: "ui.editCourse.tab.users.title", values: { usersNumber: state.results.length } }) })), _jsxs(Stack, Object.assign({ className: classes.usersStatusWrapper }, { children: [_jsx(Status, { course: course, handleTabChange: handleTabChange }), _jsx(AddUsersButton, { label: "ui.editCourse.tab.users.addUsersButton.label", endpoint: {
|
|
117
117
|
url: () => Endpoints.GetCourseSuggestedUsers.url({ id: course.id }),
|
|
118
118
|
method: Endpoints.GetCourseSuggestedUsers.method
|
|
119
|
-
}, onConfirm: handleConfirm
|
|
119
|
+
}, onConfirm: handleConfirm })] })), _jsx(CourseUsersTable, { course: course, state: state, dispatch: dispatch, headerCells: headerCells, mode: SCCourseUsersTableModeType.EDIT, emptyStatusTitle: "ui.courseUsersTable.empty.users.title", emptyStatusDescription: "ui.courseUsersTable.empty.users.description" })] }));
|
|
120
120
|
}
|
|
121
121
|
export default memo(Users);
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -159,6 +159,7 @@ import BaseItem, { BaseItemProps } from './shared/BaseItem';
|
|
|
159
159
|
import Calendar, { CalendarProps } from './shared/Calendar';
|
|
160
160
|
import ConfirmDialog from './shared/ConfirmDialog/ConfirmDialog';
|
|
161
161
|
import CourseUsersTable, { CourseUsersTableProps, CourseUsersTableSkeleton } from './shared/CourseUsersTable';
|
|
162
|
+
import CourseTypePopover, { CourseTypePopoverProps } from './shared/CourseTypePopover';
|
|
162
163
|
import EmailTextField from './shared/EmailTextField';
|
|
163
164
|
import EventActionsMenu, { EventActionsMenuProps } from './shared/EventActionsMenu';
|
|
164
165
|
import EventInfoDetails, { EventInfoDetailsProps } from './shared/EventInfoDetails';
|
|
@@ -209,4 +210,4 @@ import DefaultCoverSelfCommunity from './assets/deafultCover';
|
|
|
209
210
|
/**
|
|
210
211
|
* List all exports
|
|
211
212
|
*/
|
|
212
|
-
export { AcceptRequestUserEventButton, AcceptRequestUserEventButtonProps, AccountChangeMailValidation, AccountChangeMailValidationProps, AccountDataPortability, AccountDataPortabilityButton, AccountDataPortabilityButtonProps, AccountDataPortabilityProps, AccountDelete, AccountDeleteButton, AccountDeleteButtonProps, AccountDeleteProps, AccountRecover, AccountRecoverProps, AccountReset, AccountResetProps, AccountVerify, AccountVerifyProps, AvatarGroupSkeleton, BaseDialog, BaseDialogProps, BaseItem, BaseItemProps, BaseLightbox, BaseLightboxProps, BottomNavigation, BottomNavigationProps, BroadcastMessages, BroadcastMessagesProps, BroadcastMessagesSkeleton, bytesToSize, generateRoomId, randomString, decodePassphrase, encodePassphrase, Calendar, CalendarProps, Categories, CategoriesPopularWidget, CategoriesPopularWidgetSkeleton, CategoriesProps, CategoriesSkeleton, CategoriesSkeletonProps, CategoriesSuggestionWidget, CategoriesSuggestionWidgetProps, CategoriesSuggestionWidgetSkeleton, Category, CategoryAutocomplete, CategoryAutocompleteProps, CategoryFollowButton, CategoryFollowButtonProps, CategoryFollowersButton, CategoryFollowersButtonProps, CategoryHeader, CategoryHeaderProps, CategoryHeaderSkeleton, CategoryProps, CategorySkeleton, CategoryTrendingFeedWidget, CategoryTrendingFeedWidgetProps, CategoryTrendingFeedWidgetSkeleton, CategoryTrendingPeopleWidgetSkeleton, CategoryTrendingUsersWidget, CategoryTrendingUsersWidgetProps, CentralProgress, ChangeCover, ChangeCoverProps, ChangeGroupCover, ChangeGroupCoverProps, ChangeGroupPicture, ChangeGroupPictureProps, ChangePicture, ChangePictureProps, CommentObject, CommentObjectProps, CommentObjectReply, CommentObjectReplyProps, CommentObjectSkeleton, CommentsFeedObject, CommentsFeedObjectProps, CommentsFeedObjectSkeleton, CommentsObject, CommentsObjectProps, CommentsObjectSkeleton, Composer, ComposerIconButton, ComposerIconButtonProps, ComposerProps, ConfirmDialog, ConnectionUserButton, ConsentSolution, ConsentSolutionButton, ConsentSolutionButtonProps, ConsentSolutionProps, ConsentSolutionSkeleton, ContributionUtils, SCCourseEditTabType, Course, CourseProps, CourseSkeleton, CourseSkeletonProps, CourseJoinButton, CourseJoinButtonProps, Courses, CreateCourseButton, CreateCourseButtonProps, CoursesProps, CoursesSkeleton, CoursesSkeletonProps, CourseContentMenu, CourseContentMenuProps, CourseDashboard, TeacherCourseDashboardProps, TeacherSkeleton, StudentCourseDashboardProps, StudentSkeleton, CreateEventButton, CreateEventButtonProps, CreateEventWidget, CreateEventWidgetProps, CreateEventWidgetSkeleton, CreateGroupButton, EventForm, EventFormProps, EventFormDialog, EventFormDialogProps, CreateGroupButtonProps, CustomAdv, CustomAdvProps, CustomAdvSkeleton, DEFAULT_FIELDS, DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET, DEFAULT_PAGINATION_QUERY_PARAM_NAME, DEFAULT_PRELOAD_OFFSET_VIEWPORT, DEFAULT_WIDGETS_NUMBER, DefaultDrawerContent, DefaultDrawerContentProps, DefaultHeaderContent, DefaultHeaderContentProps, DefaultDrawerSkeleton, DefaultDrawerSkeletonProps, EditEventButton, EditEventButtonProps, EditGroupButton, EditGroupButtonProps, EditMediaProps, Editor, EditorProps, EditorSkeleton, EmailTextField, EditCourse, EditCourseProps, EditCourseSkeleton, Event, EventActionsMenu, EventActionsMenuProps, EventHeader, EventHeaderProps, EventHeaderSkeleton, EventInfoDetails, EventInfoDetailsProps, EventInfoWidget, EventInfoWidgetProps, EventInviteButton, EventInviteButtonProps, EventLocationWidget, EventLocationWidgetProps, EventLocationWidgetSkeleton, EventMediaWidget, EventMediaWidgetProps, EventMediaWidgetSkeleton, EventMembersWidget, EventMembersWidgetProps, EventMembersWidgetSkeleton, EventParticipantsButton, EventParticipantsButtonProps, EventProps, Events, EventSkeleton, EventSkeletonProps, EventsProps, EventsSkeleton, EventsSkeletonProps, FACEBOOK_SHARE, Feed, FeedObject, FeedObjectMediaPreview, FeedObjectMediaPreviewProps, FeedObjectProps, FeedObjectSkeleton, FeedProps, FeedRef, FeedSidebarProps, FeedSkeleton, FeedUpdatesWidget, FeedUpdatesWidgetProps, FeedUpdatesWidgetSkeleton, File, FollowUserButton, FollowUserButtonProps, Footer, FooterProps, FooterSkeleton, FriendshipButtonProps, FriendshipUserButton, GenericSkeleton, getRelativeTime, getUnseenNotification, getUnseenNotificationCounter, Group, GroupActionsMenu, GroupActionsMenuProps, GroupForm, GroupFormProps, GroupHeader, GroupHeaderProps, GroupHeaderSkeleton, GroupInfoWidget, GroupInfoWidgetProps, GroupInfoWidgetSkeleton, GroupInviteButton, GroupInviteButtonProps, GroupInvitedWidget, GroupInvitedWidgetProps, GroupInvitedWidgetSkeleton, GroupMembersButton, GroupMembersButtonProps, GroupMembersWidget, GroupMembersWidgetProps, GroupMembersWidgetSkeleton, GroupProps, GroupRequestsWidget, GroupRequestsWidgetProps, GroupRequestsWidgetSkeleton, Groups, GroupSettingsIconButton, GroupSettingsIconButtonProps, GroupSkeleton, GroupsProps, GroupsSkeleton, GroupSubscribeButton, GroupSubscribeButtonProps, AccordionLessons, AccordionLessonsProps, AccordionLessonsSkeleton, AddUsersButton, AddUsersButtonProps, CourseUsersTable, CourseUsersTableProps, CourseUsersTableSkeleton, EmptyStatus, EmptyStatusProps, HiddenPlaceholder, Incubator, IncubatorDetail, IncubatorDetailProps, IncubatorListWidget, IncubatorListWidgetProps, IncubatorProps, IncubatorSubscribeButton, IncubatorSubscribeButtonProps, IncubatorSuggestionWidget, IncubatorSuggestionWidgetProps, InfiniteScroll, ScrollContainer, InlineComposerWidget, InlineComposerWidgetProps, InlineComposerWidgetSkeleton, InviteUserEventButton, LessonAppbar, LessonAppbarProps, LessonDrawer, LessonDrawerProps, LessonEditForm, LessonEditFormProps, LessonObject, LessonObjectProps, InviteUserEventButtonProps, LanguageSwitcher, LEGAL_POLICIES, CourseCompletedDialog, CourseCompletedDialogProps, Lightbox, LightboxProps, Link, LINKEDIN_SHARE, LocationAutocomplete, LocationAutocompleteProps, LogoSelfCommunity, DefaultCoverSelfCommunity, LoyaltyProgramWidget, LoyaltyProgramWidgetProps, LoyaltyProgramWidgetSkeleton, MAX_PRELOAD_OFFSET_VIEWPORT, MEDIA_EMBED_SC_LINK_TYPE, MEDIA_EMBED_SC_SHARED_EVENT, MEDIA_EMBED_SC_SHARED_OBJECT, MEDIA_TYPE_DOCUMENT, MEDIA_TYPE_EMBED, MEDIA_TYPE_EVENT, MEDIA_TYPE_IMAGE, MEDIA_TYPE_LINK, MEDIA_TYPE_SHARE, MEDIA_TYPE_URL, MEDIA_TYPE_VIDEO, SCCourseFormStepType, MediaChunkUploader, MediaChunkUploaderProps, MessageUploaderUtils, MetadataField, MetadataFieldProps, MIN_PRELOAD_OFFSET_VIEWPORT, MyEventsWidget, MyEventsWidgetProps, MyEventsWidgetSkeleton, NavigationMenuContent, NavigationMenuDrawer, NavigationMenuDrawerProps, NavigationMenuHeader, NavigationMenuIconButton, NavigationMenuIconButtonProps, NavigationSettingsIconButton, NavigationSettingsIconButtonProps, NavigationSettingsItem, NavigationToolbar, NavigationToolbarMobile, NavigationToolbarMobileProps, NavigationToolbarMobileSkeleton, NavigationToolbarProps, NavigationToolbarSkeleton, Notification, NotificationProps, NotificationSkeleton, OnBoardingWidget, OnBoardingWidgetProps, OnBoardingWidgetSkeleton, PasswordTextField, PhoneTextField, PlatformWidget, PlatformWidgetActionType, PlatformWidgetProps, PlatformWidgetSkeleton, PollSuggestionWidget, PollSuggestionWidgetProps, PrivateMessageComponent, PrivateMessageComponentProps, PrivateMessageComponentSkeleton, PrivateMessageEditor, PrivateMessageEditorProps, PrivateMessageEditorSkeleton, PrivateMessageSettingsIconButton, PrivateMessageSettingsIconButtonProps, PrivateMessageSnippetItem, PrivateMessageSnippetItemProps, PrivateMessageSnippetItemSkeleton, PrivateMessageSnippets, PrivateMessageSnippetsProps, PrivateMessageSnippetsSkeleton, PrivateMessageThread, PrivateMessageThreadItem, PrivateMessageThreadItemProps, PrivateMessageThreadItemSkeleton, PrivateMessageThreadProps, PrivateMessageThreadSkeleton, ProgressBar, ProgressBarProps, RelatedEventsWidget, RelatedEventsWidgetProps, RelatedEventsWidgetSkeleton, RelatedFeedObjectsWidget, RelatedFeedObjectsWidgetSkeleton, RelatedFeedObjectWidgetProps, ReplyComment, SCBroadcastMessageTemplateType, SCCommentsOrderBy, SCEventMembersEventType, SCEventTemplateType, SCFeedObjectActivitiesType, SCFeedObjectTemplateType, SCFeedWidgetType, SCGroupMembersEventType, SCMediaChunkType, SCMediaObjectType, SCNotificationObjectTemplateType, SCUserProfileFields, SCUserProfileSettings, SCUserSocialAssociations, SearchAutocomplete, SearchAutocompleteProps, SearchDialog, SearchDialogProps, Share, SnippetNotifications, SnippetNotificationsProps, SnippetNotificationsSkeleton, StickyBox, StickyBoxComponent, StickyBoxProps, SuggestedEventsWidget, TagAutocomplete, TagAutocompleteProps, SuggestedEventsWidgetProps, SuggestedEventsWidgetSkeleton, TagChip, TagChipProps, ToastNotifications, ToastNotificationsProps, ToastNotificationsSkeleton, UrlTextField, User, UserActionIconButton, UserActionIconButtonProps, UserAvatar, UserAvatarProps, UserConnectionsRequestsSentWidget, UserConnectionsRequestsSentWidgetProps, UserConnectionsRequestsSentWidgetSkeleton, UserConnectionsRequestsWidget, UserConnectionsRequestsWidgetProps, UserConnectionsRequestsWidgetSkeleton, UserConnectionsWidget, UserConnectionsWidgetProps, UserConnectionsWidgetSkeleton, UserCounters, UserCountersProps, UserCreatedCoursesWidget, UserCreatedCoursesWidgetProps, UserCreatedCoursesWidgetSkeleton, UserDeletedSnackBar, UserDeletedSnackBarProps, UserFollowedCategoriesWidget, UserFollowedCategoriesWidgetProps, UserFollowedCategoriesWidgetSkeleton, UserFollowedUsersWidget, UserFollowedUsersWidgetProps, UserFollowedUsersWidgetSkeleton, UserFollowersWidget, UserFollowersWidgetProps, UserFollowersWidgetSkeleton, UserInfo, UserInfoDialog, UserInfoDialogProps, UserInfoProps, UserInfoSkeleton, UsernameTextField, UserProfileBlocked, UserProfileBlockedProps, UserProfileEdit, UserProfileEditProps, UserProfileEditSectionAccount, UserProfileEditSectionAccountProps, UserProfileEditSectionPublicInfo, UserProfileEditSectionPublicInfoProps, UserProfileEditSectionSettings, UserProfileEditSectionSettingsProps, UserProfileEditSkeleton, UserProfileHeader, UserProfileHeaderProps, UserProfileHeaderSkeleton, UserProps, UserSkeleton, UserSocialAssociation, UserSocialAssociationProps, UserSubscribedGroupsWidget, UserSubscribedGroupsWidgetProps, UserSubscribedGroupsWidgetSkeleton, UserSuggestionWidget, UserSuggestionWidgetProps, UserSuggestionWidgetSkeleton, UserLiveStreamWidget, UserLiveStreamWidgetProps, UserLiveStreamWidgetSkeleton, useStickyBox, UseStickyBoxProps, LiveStream, LiveStreamProps, LiveStreamSkeletonProps, LiveStreamSkeleton, LiveStreamInfoDetails, LiveStreamInfoDetailsProps, UpScalingTierBadge, UpScalingTierProps, CreateLiveStreamDialog, CreateLiveStreamDialogProps, CreateLiveStreamButton, CreateLiveStreamButtonProps, LiveStreamForm, LiveStreamFormProps, LiveStreamRoom, LiveStreamRoomProps, LiveStreamVideoConference, LiveStreamVideoConferenceProps, VirtualScrollerItemProps, SCCourseTemplateType, SCLessonActionsType, SCLessonModeType, Widget, WidgetProps, X_SHARE, PROVIDER_ICONS_CONTAINED, PROVIDER_ICONS_OUTLINED };
|
|
213
|
+
export { AcceptRequestUserEventButton, AcceptRequestUserEventButtonProps, AccountChangeMailValidation, AccountChangeMailValidationProps, AccountDataPortability, AccountDataPortabilityButton, AccountDataPortabilityButtonProps, AccountDataPortabilityProps, AccountDelete, AccountDeleteButton, AccountDeleteButtonProps, AccountDeleteProps, AccountRecover, AccountRecoverProps, AccountReset, AccountResetProps, AccountVerify, AccountVerifyProps, AvatarGroupSkeleton, BaseDialog, BaseDialogProps, BaseItem, BaseItemProps, BaseLightbox, BaseLightboxProps, BottomNavigation, BottomNavigationProps, BroadcastMessages, BroadcastMessagesProps, BroadcastMessagesSkeleton, bytesToSize, generateRoomId, randomString, decodePassphrase, encodePassphrase, Calendar, CalendarProps, Categories, CategoriesPopularWidget, CategoriesPopularWidgetSkeleton, CategoriesProps, CategoriesSkeleton, CategoriesSkeletonProps, CategoriesSuggestionWidget, CategoriesSuggestionWidgetProps, CategoriesSuggestionWidgetSkeleton, Category, CategoryAutocomplete, CategoryAutocompleteProps, CategoryFollowButton, CategoryFollowButtonProps, CategoryFollowersButton, CategoryFollowersButtonProps, CategoryHeader, CategoryHeaderProps, CategoryHeaderSkeleton, CategoryProps, CategorySkeleton, CategoryTrendingFeedWidget, CategoryTrendingFeedWidgetProps, CategoryTrendingFeedWidgetSkeleton, CategoryTrendingPeopleWidgetSkeleton, CategoryTrendingUsersWidget, CategoryTrendingUsersWidgetProps, CentralProgress, ChangeCover, ChangeCoverProps, ChangeGroupCover, ChangeGroupCoverProps, ChangeGroupPicture, ChangeGroupPictureProps, ChangePicture, ChangePictureProps, CommentObject, CommentObjectProps, CommentObjectReply, CommentObjectReplyProps, CommentObjectSkeleton, CommentsFeedObject, CommentsFeedObjectProps, CommentsFeedObjectSkeleton, CommentsObject, CommentsObjectProps, CommentsObjectSkeleton, Composer, ComposerIconButton, ComposerIconButtonProps, ComposerProps, ConfirmDialog, ConnectionUserButton, ConsentSolution, ConsentSolutionButton, ConsentSolutionButtonProps, ConsentSolutionProps, ConsentSolutionSkeleton, ContributionUtils, SCCourseEditTabType, Course, CourseProps, CourseSkeleton, CourseSkeletonProps, CourseJoinButton, CourseJoinButtonProps, Courses, CoursesProps, CoursesSkeleton, CoursesSkeletonProps, CourseTypePopover, CourseTypePopoverProps, CreateCourseButton, CreateCourseButtonProps, CourseContentMenu, CourseContentMenuProps, CourseDashboard, TeacherCourseDashboardProps, TeacherSkeleton, StudentCourseDashboardProps, StudentSkeleton, CreateEventButton, CreateEventButtonProps, CreateEventWidget, CreateEventWidgetProps, CreateEventWidgetSkeleton, CreateGroupButton, EventForm, EventFormProps, EventFormDialog, EventFormDialogProps, CreateGroupButtonProps, CustomAdv, CustomAdvProps, CustomAdvSkeleton, DEFAULT_FIELDS, DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET, DEFAULT_PAGINATION_QUERY_PARAM_NAME, DEFAULT_PRELOAD_OFFSET_VIEWPORT, DEFAULT_WIDGETS_NUMBER, DefaultDrawerContent, DefaultDrawerContentProps, DefaultHeaderContent, DefaultHeaderContentProps, DefaultDrawerSkeleton, DefaultDrawerSkeletonProps, EditEventButton, EditEventButtonProps, EditGroupButton, EditGroupButtonProps, EditMediaProps, Editor, EditorProps, EditorSkeleton, EmailTextField, EditCourse, EditCourseProps, EditCourseSkeleton, Event, EventActionsMenu, EventActionsMenuProps, EventHeader, EventHeaderProps, EventHeaderSkeleton, EventInfoDetails, EventInfoDetailsProps, EventInfoWidget, EventInfoWidgetProps, EventInviteButton, EventInviteButtonProps, EventLocationWidget, EventLocationWidgetProps, EventLocationWidgetSkeleton, EventMediaWidget, EventMediaWidgetProps, EventMediaWidgetSkeleton, EventMembersWidget, EventMembersWidgetProps, EventMembersWidgetSkeleton, EventParticipantsButton, EventParticipantsButtonProps, EventProps, Events, EventSkeleton, EventSkeletonProps, EventsProps, EventsSkeleton, EventsSkeletonProps, FACEBOOK_SHARE, Feed, FeedObject, FeedObjectMediaPreview, FeedObjectMediaPreviewProps, FeedObjectProps, FeedObjectSkeleton, FeedProps, FeedRef, FeedSidebarProps, FeedSkeleton, FeedUpdatesWidget, FeedUpdatesWidgetProps, FeedUpdatesWidgetSkeleton, File, FollowUserButton, FollowUserButtonProps, Footer, FooterProps, FooterSkeleton, FriendshipButtonProps, FriendshipUserButton, GenericSkeleton, getRelativeTime, getUnseenNotification, getUnseenNotificationCounter, Group, GroupActionsMenu, GroupActionsMenuProps, GroupForm, GroupFormProps, GroupHeader, GroupHeaderProps, GroupHeaderSkeleton, GroupInfoWidget, GroupInfoWidgetProps, GroupInfoWidgetSkeleton, GroupInviteButton, GroupInviteButtonProps, GroupInvitedWidget, GroupInvitedWidgetProps, GroupInvitedWidgetSkeleton, GroupMembersButton, GroupMembersButtonProps, GroupMembersWidget, GroupMembersWidgetProps, GroupMembersWidgetSkeleton, GroupProps, GroupRequestsWidget, GroupRequestsWidgetProps, GroupRequestsWidgetSkeleton, Groups, GroupSettingsIconButton, GroupSettingsIconButtonProps, GroupSkeleton, GroupsProps, GroupsSkeleton, GroupSubscribeButton, GroupSubscribeButtonProps, AccordionLessons, AccordionLessonsProps, AccordionLessonsSkeleton, AddUsersButton, AddUsersButtonProps, CourseUsersTable, CourseUsersTableProps, CourseUsersTableSkeleton, EmptyStatus, EmptyStatusProps, HiddenPlaceholder, Incubator, IncubatorDetail, IncubatorDetailProps, IncubatorListWidget, IncubatorListWidgetProps, IncubatorProps, IncubatorSubscribeButton, IncubatorSubscribeButtonProps, IncubatorSuggestionWidget, IncubatorSuggestionWidgetProps, InfiniteScroll, ScrollContainer, InlineComposerWidget, InlineComposerWidgetProps, InlineComposerWidgetSkeleton, InviteUserEventButton, LessonAppbar, LessonAppbarProps, LessonDrawer, LessonDrawerProps, LessonEditForm, LessonEditFormProps, LessonObject, LessonObjectProps, InviteUserEventButtonProps, LanguageSwitcher, LEGAL_POLICIES, CourseCompletedDialog, CourseCompletedDialogProps, Lightbox, LightboxProps, Link, LINKEDIN_SHARE, LocationAutocomplete, LocationAutocompleteProps, LogoSelfCommunity, DefaultCoverSelfCommunity, LoyaltyProgramWidget, LoyaltyProgramWidgetProps, LoyaltyProgramWidgetSkeleton, MAX_PRELOAD_OFFSET_VIEWPORT, MEDIA_EMBED_SC_LINK_TYPE, MEDIA_EMBED_SC_SHARED_EVENT, MEDIA_EMBED_SC_SHARED_OBJECT, MEDIA_TYPE_DOCUMENT, MEDIA_TYPE_EMBED, MEDIA_TYPE_EVENT, MEDIA_TYPE_IMAGE, MEDIA_TYPE_LINK, MEDIA_TYPE_SHARE, MEDIA_TYPE_URL, MEDIA_TYPE_VIDEO, SCCourseFormStepType, MediaChunkUploader, MediaChunkUploaderProps, MessageUploaderUtils, MetadataField, MetadataFieldProps, MIN_PRELOAD_OFFSET_VIEWPORT, MyEventsWidget, MyEventsWidgetProps, MyEventsWidgetSkeleton, NavigationMenuContent, NavigationMenuDrawer, NavigationMenuDrawerProps, NavigationMenuHeader, NavigationMenuIconButton, NavigationMenuIconButtonProps, NavigationSettingsIconButton, NavigationSettingsIconButtonProps, NavigationSettingsItem, NavigationToolbar, NavigationToolbarMobile, NavigationToolbarMobileProps, NavigationToolbarMobileSkeleton, NavigationToolbarProps, NavigationToolbarSkeleton, Notification, NotificationProps, NotificationSkeleton, OnBoardingWidget, OnBoardingWidgetProps, OnBoardingWidgetSkeleton, PasswordTextField, PhoneTextField, PlatformWidget, PlatformWidgetActionType, PlatformWidgetProps, PlatformWidgetSkeleton, PollSuggestionWidget, PollSuggestionWidgetProps, PrivateMessageComponent, PrivateMessageComponentProps, PrivateMessageComponentSkeleton, PrivateMessageEditor, PrivateMessageEditorProps, PrivateMessageEditorSkeleton, PrivateMessageSettingsIconButton, PrivateMessageSettingsIconButtonProps, PrivateMessageSnippetItem, PrivateMessageSnippetItemProps, PrivateMessageSnippetItemSkeleton, PrivateMessageSnippets, PrivateMessageSnippetsProps, PrivateMessageSnippetsSkeleton, PrivateMessageThread, PrivateMessageThreadItem, PrivateMessageThreadItemProps, PrivateMessageThreadItemSkeleton, PrivateMessageThreadProps, PrivateMessageThreadSkeleton, ProgressBar, ProgressBarProps, RelatedEventsWidget, RelatedEventsWidgetProps, RelatedEventsWidgetSkeleton, RelatedFeedObjectsWidget, RelatedFeedObjectsWidgetSkeleton, RelatedFeedObjectWidgetProps, ReplyComment, SCBroadcastMessageTemplateType, SCCommentsOrderBy, SCEventMembersEventType, SCEventTemplateType, SCFeedObjectActivitiesType, SCFeedObjectTemplateType, SCFeedWidgetType, SCGroupMembersEventType, SCMediaChunkType, SCMediaObjectType, SCNotificationObjectTemplateType, SCUserProfileFields, SCUserProfileSettings, SCUserSocialAssociations, SearchAutocomplete, SearchAutocompleteProps, SearchDialog, SearchDialogProps, Share, SnippetNotifications, SnippetNotificationsProps, SnippetNotificationsSkeleton, StickyBox, StickyBoxComponent, StickyBoxProps, SuggestedEventsWidget, TagAutocomplete, TagAutocompleteProps, SuggestedEventsWidgetProps, SuggestedEventsWidgetSkeleton, TagChip, TagChipProps, ToastNotifications, ToastNotificationsProps, ToastNotificationsSkeleton, UrlTextField, User, UserActionIconButton, UserActionIconButtonProps, UserAvatar, UserAvatarProps, UserConnectionsRequestsSentWidget, UserConnectionsRequestsSentWidgetProps, UserConnectionsRequestsSentWidgetSkeleton, UserConnectionsRequestsWidget, UserConnectionsRequestsWidgetProps, UserConnectionsRequestsWidgetSkeleton, UserConnectionsWidget, UserConnectionsWidgetProps, UserConnectionsWidgetSkeleton, UserCounters, UserCountersProps, UserCreatedCoursesWidget, UserCreatedCoursesWidgetProps, UserCreatedCoursesWidgetSkeleton, UserDeletedSnackBar, UserDeletedSnackBarProps, UserFollowedCategoriesWidget, UserFollowedCategoriesWidgetProps, UserFollowedCategoriesWidgetSkeleton, UserFollowedUsersWidget, UserFollowedUsersWidgetProps, UserFollowedUsersWidgetSkeleton, UserFollowersWidget, UserFollowersWidgetProps, UserFollowersWidgetSkeleton, UserInfo, UserInfoDialog, UserInfoDialogProps, UserInfoProps, UserInfoSkeleton, UsernameTextField, UserProfileBlocked, UserProfileBlockedProps, UserProfileEdit, UserProfileEditProps, UserProfileEditSectionAccount, UserProfileEditSectionAccountProps, UserProfileEditSectionPublicInfo, UserProfileEditSectionPublicInfoProps, UserProfileEditSectionSettings, UserProfileEditSectionSettingsProps, UserProfileEditSkeleton, UserProfileHeader, UserProfileHeaderProps, UserProfileHeaderSkeleton, UserProps, UserSkeleton, UserSocialAssociation, UserSocialAssociationProps, UserSubscribedGroupsWidget, UserSubscribedGroupsWidgetProps, UserSubscribedGroupsWidgetSkeleton, UserSuggestionWidget, UserSuggestionWidgetProps, UserSuggestionWidgetSkeleton, UserLiveStreamWidget, UserLiveStreamWidgetProps, UserLiveStreamWidgetSkeleton, useStickyBox, UseStickyBoxProps, LiveStream, LiveStreamProps, LiveStreamSkeletonProps, LiveStreamSkeleton, LiveStreamInfoDetails, LiveStreamInfoDetailsProps, UpScalingTierBadge, UpScalingTierProps, CreateLiveStreamDialog, CreateLiveStreamDialogProps, CreateLiveStreamButton, CreateLiveStreamButtonProps, LiveStreamForm, LiveStreamFormProps, LiveStreamRoom, LiveStreamRoomProps, LiveStreamVideoConference, LiveStreamVideoConferenceProps, VirtualScrollerItemProps, SCCourseTemplateType, SCLessonActionsType, SCLessonModeType, Widget, WidgetProps, X_SHARE, PROVIDER_ICONS_CONTAINED, PROVIDER_ICONS_OUTLINED };
|
package/lib/esm/index.js
CHANGED
|
@@ -159,6 +159,7 @@ import BaseItem from './shared/BaseItem';
|
|
|
159
159
|
import Calendar from './shared/Calendar';
|
|
160
160
|
import ConfirmDialog from './shared/ConfirmDialog/ConfirmDialog';
|
|
161
161
|
import CourseUsersTable, { CourseUsersTableSkeleton } from './shared/CourseUsersTable';
|
|
162
|
+
import CourseTypePopover from './shared/CourseTypePopover';
|
|
162
163
|
import EmailTextField from './shared/EmailTextField';
|
|
163
164
|
import EventActionsMenu from './shared/EventActionsMenu';
|
|
164
165
|
import EventInfoDetails from './shared/EventInfoDetails';
|
|
@@ -210,7 +211,7 @@ import DefaultCoverSelfCommunity from './assets/deafultCover';
|
|
|
210
211
|
*/
|
|
211
212
|
export { AcceptRequestUserEventButton, AccountChangeMailValidation, AccountDataPortability, AccountDataPortabilityButton, AccountDelete, AccountDeleteButton, AccountRecover, AccountReset, AccountVerify, AvatarGroupSkeleton, BaseDialog, BaseItem, BaseLightbox, BottomNavigation, BroadcastMessages, BroadcastMessagesSkeleton, bytesToSize, generateRoomId, randomString, decodePassphrase, encodePassphrase, Calendar, Categories, CategoriesPopularWidget, CategoriesPopularWidgetSkeleton, CategoriesSkeleton, CategoriesSuggestionWidget, CategoriesSuggestionWidgetSkeleton, Category, CategoryAutocomplete, CategoryFollowButton, CategoryFollowersButton, CategoryHeader, CategoryHeaderSkeleton, CategorySkeleton, CategoryTrendingFeedWidget, CategoryTrendingFeedWidgetSkeleton, CategoryTrendingPeopleWidgetSkeleton, CategoryTrendingUsersWidget, CentralProgress, ChangeCover, ChangeGroupCover, ChangeGroupPicture, ChangePicture, CommentObject, CommentObjectReply, CommentObjectSkeleton, CommentsFeedObject, CommentsFeedObjectSkeleton, CommentsObject, CommentsObjectSkeleton, Composer, ComposerIconButton, ConfirmDialog, ConnectionUserButton,
|
|
212
213
|
/* SC CONSENT SOLUTION */
|
|
213
|
-
ConsentSolution, ConsentSolutionButton, ConsentSolutionSkeleton, ContributionUtils, SCCourseEditTabType, Course, CourseSkeleton, CourseJoinButton, Courses,
|
|
214
|
+
ConsentSolution, ConsentSolutionButton, ConsentSolutionSkeleton, ContributionUtils, SCCourseEditTabType, Course, CourseSkeleton, CourseJoinButton, Courses, CoursesSkeleton, CourseTypePopover, CreateCourseButton, CourseContentMenu, CourseDashboard, TeacherSkeleton, StudentSkeleton, CreateEventButton, CreateEventWidget, CreateEventWidgetSkeleton, CreateGroupButton, EventForm, EventFormDialog, CustomAdv, CustomAdvSkeleton, DEFAULT_FIELDS, DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET,
|
|
214
215
|
/* SC UI PAGINATION */
|
|
215
216
|
DEFAULT_PAGINATION_QUERY_PARAM_NAME, DEFAULT_PRELOAD_OFFSET_VIEWPORT, DEFAULT_WIDGETS_NUMBER, DefaultDrawerContent, DefaultHeaderContent, DefaultDrawerSkeleton, EditEventButton, EditGroupButton, Editor, EditorSkeleton, EmailTextField, EditCourse, EditCourseSkeleton, Event, EventActionsMenu, EventHeader, EventHeaderSkeleton, EventInfoDetails, EventInfoWidget, EventInviteButton, EventLocationWidget, EventLocationWidgetSkeleton, EventMediaWidget, EventMediaWidgetSkeleton, EventMembersWidget, EventMembersWidgetSkeleton, EventParticipantsButton, Events, EventSkeleton, EventsSkeleton, FACEBOOK_SHARE, Feed, FeedObject, FeedObjectMediaPreview, FeedObjectSkeleton, FeedSkeleton, FeedUpdatesWidget, FeedUpdatesWidgetSkeleton, File, FollowUserButton, Footer, FooterSkeleton, FriendshipUserButton, GenericSkeleton, getRelativeTime, getUnseenNotification, getUnseenNotificationCounter, Group, GroupActionsMenu, GroupForm, GroupHeader, GroupHeaderSkeleton, GroupInfoWidget, GroupInfoWidgetSkeleton, GroupInviteButton, GroupInvitedWidget, GroupInvitedWidgetSkeleton, GroupMembersButton, GroupMembersWidget, GroupMembersWidgetSkeleton, GroupRequestsWidget, GroupRequestsWidgetSkeleton, Groups, GroupSettingsIconButton, GroupSkeleton, GroupsSkeleton, GroupSubscribeButton,
|
|
216
217
|
/* SC UI SHARED */
|
|
@@ -17,7 +17,8 @@ const classes = {
|
|
|
17
17
|
dialogRoot: `${PREFIX}-dialog-root`,
|
|
18
18
|
dialogAutocompleteWrapper: `${PREFIX}-dialog-autocomplete-wrapper`,
|
|
19
19
|
dialogUserWrapper: `${PREFIX}-dialog-user-wrapper`,
|
|
20
|
-
dialogChipWrapper: `${PREFIX}-dialog-chip-wrapper
|
|
20
|
+
dialogChipWrapper: `${PREFIX}-dialog-chip-wrapper`,
|
|
21
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
21
22
|
};
|
|
22
23
|
const messages = defineMessages({
|
|
23
24
|
placeholder: {
|
|
@@ -126,7 +127,7 @@ function AddUsersButton(inProps) {
|
|
|
126
127
|
const handleDelete = useCallback((userToDelete) => {
|
|
127
128
|
setInvited((prev) => prev.filter((user) => user.id !== userToDelete.id));
|
|
128
129
|
}, [setInvited]);
|
|
129
|
-
return (_jsxs(Fragment, { children: [_jsx(Root, Object.assign({ onClick: handleToggleDialogOpen, variant: variant, color: color, size: size, className: classNames(classes.root, className) }, rest, { children: _jsx(FormattedMessage, { id: label, defaultMessage: label }) })), openDialog && (_jsx(DialogRoot, Object.assign({ DialogContentProps: { dividers: false }, open: true, onClose: handleToggleDialogOpen, title: _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.dialog.title", defaultMessage: "ui.addUserButton.dialog.title" }) })), actions: _jsx(LoadingButton, Object.assign({ onClick: handleConfirm, size: "medium", variant: "contained", autoFocus: true, disabled: !invited.length }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.dialog.confirm", defaultMessage: "ui.addUserButton.dialog.confirm" }) })) })), className: classes.dialogRoot }, { children: _jsxs(Stack, Object.assign({ className: classes.dialogAutocompleteWrapper }, { children: [_jsx(Autocomplete, { loading: loading, size: "small", multiple: true, options: suggested, onChange: handleChange, onInputChange: handleInputChange, inputValue: value, filterOptions: filterOptions, value: invited, getOptionLabel: (option) => (option === null || option === void 0 ? void 0 : option.username) || '...', isOptionEqualToValue: (option, value) => (option === null || option === void 0 ? void 0 : option.id) === value.id, loadingText: _jsx(FormattedMessage, { id: "ui.addUserButton.autocomplete.loading", defaultMessage: "ui.addUserButton.autocomplete.loading" }), noOptionsText: _jsx(FormattedMessage, { id: "ui.addUserButton.autocomplete.noResults", defaultMessage: "ui.addUserButton.autocomplete.noResults" }), renderTags: () => null, popupIcon: null, disableClearable: true, renderOption: (props, option) => (_jsxs(Stack, Object.assign({ component: "li", flexDirection: "row", gap: "5px" }, props, { children: [_jsx(Avatar, { alt: option.username, src: option.avatar }), _jsx(Typography, { children: option.username })] }))), renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { variant: "outlined", placeholder: `${intl.formatMessage(messages.placeholder)}`, InputProps: Object.assign({}, params.InputProps) }))) }), _jsx(Stack, Object.assign({ className: classes.dialogChipWrapper }, { children: invited.map((option, index) => (_jsx(Chip, { avatar: _jsx(Avatar, { alt: option.username, src: option.avatar }), label: option.username, onDelete: () => {
|
|
130
|
+
return (_jsxs(Fragment, { children: [_jsx(Root, Object.assign({ onClick: handleToggleDialogOpen, variant: variant, color: color, size: size, className: classNames(classes.root, classes.contrastColor, className) }, rest, { children: _jsx(FormattedMessage, { id: label, defaultMessage: label }) })), openDialog && (_jsx(DialogRoot, Object.assign({ DialogContentProps: { dividers: false }, open: true, onClose: handleToggleDialogOpen, title: _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.dialog.title", defaultMessage: "ui.addUserButton.dialog.title" }) })), actions: _jsx(LoadingButton, Object.assign({ onClick: handleConfirm, size: "medium", variant: "contained", autoFocus: true, disabled: !invited.length }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.dialog.confirm", defaultMessage: "ui.addUserButton.dialog.confirm" }) })) })), className: classes.dialogRoot }, { children: _jsxs(Stack, Object.assign({ className: classes.dialogAutocompleteWrapper }, { children: [_jsx(Autocomplete, { loading: loading, size: "small", multiple: true, options: suggested, onChange: handleChange, onInputChange: handleInputChange, inputValue: value, filterOptions: filterOptions, value: invited, getOptionLabel: (option) => (option === null || option === void 0 ? void 0 : option.username) || '...', isOptionEqualToValue: (option, value) => (option === null || option === void 0 ? void 0 : option.id) === value.id, loadingText: _jsx(FormattedMessage, { id: "ui.addUserButton.autocomplete.loading", defaultMessage: "ui.addUserButton.autocomplete.loading" }), noOptionsText: _jsx(FormattedMessage, { id: "ui.addUserButton.autocomplete.noResults", defaultMessage: "ui.addUserButton.autocomplete.noResults" }), renderTags: () => null, popupIcon: null, disableClearable: true, renderOption: (props, option) => (_jsxs(Stack, Object.assign({ component: "li", flexDirection: "row", gap: "5px" }, props, { children: [_jsx(Avatar, { alt: option.username, src: option.avatar }), _jsx(Typography, { children: option.username })] }))), renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { variant: "outlined", placeholder: `${intl.formatMessage(messages.placeholder)}`, InputProps: Object.assign({}, params.InputProps) }))) }), _jsx(Stack, Object.assign({ className: classes.dialogChipWrapper }, { children: invited.map((option, index) => (_jsx(Chip, { avatar: _jsx(Avatar, { alt: option.username, src: option.avatar }), label: option.username, onDelete: () => {
|
|
130
131
|
handleDelete(option);
|
|
131
132
|
} }, index))) }))] })) })))] }));
|
|
132
133
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SCCourseType } from '@selfcommunity/types';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
export interface CourseTypePopoverProps {
|
|
4
|
+
course: SCCourseType;
|
|
5
|
+
className?: HTMLAttributes<HTMLDivElement>['className'];
|
|
6
|
+
}
|
|
7
|
+
declare function CourseTypePopover(props: CourseTypePopoverProps): JSX.Element;
|
|
8
|
+
declare const _default: import("react").MemoExoticComponent<typeof CourseTypePopover>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Button, Icon, Popover, Stack, styled, Typography } from '@mui/material';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { memo, useCallback, useState } from 'react';
|
|
5
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
6
|
+
const PREFIX = 'SCCourseTypePopover';
|
|
7
|
+
const classes = {
|
|
8
|
+
root: `${PREFIX}-root`,
|
|
9
|
+
button: `${PREFIX}-button`,
|
|
10
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
11
|
+
};
|
|
12
|
+
const Root = styled(Stack, {
|
|
13
|
+
name: PREFIX,
|
|
14
|
+
slot: 'Root',
|
|
15
|
+
overridesResolver: (_props, styles) => styles.root
|
|
16
|
+
})(() => ({}));
|
|
17
|
+
function CourseTypePopover(props) {
|
|
18
|
+
// PROPS
|
|
19
|
+
const { course, className } = props;
|
|
20
|
+
// STATES
|
|
21
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
22
|
+
const open = Boolean(anchorEl);
|
|
23
|
+
// INTL
|
|
24
|
+
const intl = useIntl();
|
|
25
|
+
// HANDLERS
|
|
26
|
+
const handleOpenPopover = useCallback((e) => {
|
|
27
|
+
setAnchorEl(e.currentTarget);
|
|
28
|
+
}, [setAnchorEl]);
|
|
29
|
+
const handlePopoverClose = useCallback(() => {
|
|
30
|
+
setAnchorEl(null);
|
|
31
|
+
}, [setAnchorEl]);
|
|
32
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, classes.contrastColor, className) }, { children: [_jsx(Icon, Object.assign({ fontSize: "small" }, { children: "courses" })), _jsx(Button, Object.assign({ variant: "text", color: "inherit", size: "small", className: classes.button, onClick: handleOpenPopover }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.course.type", defaultMessage: "ui.course.type", values: {
|
|
33
|
+
typeOfCourse: intl.formatMessage({
|
|
34
|
+
id: `ui.course.type.${course.type}`,
|
|
35
|
+
defaultMessage: `ui.course.type.${course.type}`
|
|
36
|
+
})
|
|
37
|
+
} }) })) })), open && (_jsx(Popover, Object.assign({ open: true, anchorEl: anchorEl, anchorOrigin: {
|
|
38
|
+
vertical: 'bottom',
|
|
39
|
+
horizontal: 'left'
|
|
40
|
+
}, transformOrigin: {
|
|
41
|
+
vertical: 'top',
|
|
42
|
+
horizontal: 'left'
|
|
43
|
+
}, onClose: handlePopoverClose }, { children: _jsx(Box, Object.assign({ sx: { padding: '10px' } }, { children: _jsx(Typography, Object.assign({ component: "span", variant: "body2", sx: { whiteSpace: 'pre-line' } }, { children: _jsx(FormattedMessage, { id: `ui.courseForm.${course.type}.info`, defaultMessage: `ui.courseForm.${course.type}.info` }) })) })) })))] })));
|
|
44
|
+
}
|
|
45
|
+
export default memo(CourseTypePopover);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Dispatch } from 'react';
|
|
2
2
|
import { SCCourseType } from '@selfcommunity/types';
|
|
3
|
+
import { SCCourseUsersTableModeType } from '../../types/course';
|
|
3
4
|
type HeaderCellsType = {
|
|
4
5
|
id?: string;
|
|
5
6
|
};
|
|
@@ -8,7 +9,7 @@ export interface CourseUsersTableProps {
|
|
|
8
9
|
dispatch: Dispatch<any>;
|
|
9
10
|
course: SCCourseType;
|
|
10
11
|
headerCells: HeaderCellsType[];
|
|
11
|
-
mode:
|
|
12
|
+
mode: SCCourseUsersTableModeType;
|
|
12
13
|
emptyStatusTitle: string;
|
|
13
14
|
emptyStatusDescription?: string;
|
|
14
15
|
}
|
|
@@ -16,15 +16,14 @@ import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
|
16
16
|
import ChangeUserStatus from './ChangeUsersStatus';
|
|
17
17
|
import { useSCUser } from '@selfcommunity/react-core';
|
|
18
18
|
import RequestButton from './RequestButton';
|
|
19
|
-
import
|
|
19
|
+
import { SCCourseUsersTableModeType } from '../../types/course';
|
|
20
20
|
const classes = {
|
|
21
21
|
root: `${PREFIX}-root`,
|
|
22
22
|
search: `${PREFIX}-search`,
|
|
23
23
|
avatarWrapper: `${PREFIX}-avatar-wrapper`,
|
|
24
24
|
progressWrapper: `${PREFIX}-progress-wrapper`,
|
|
25
25
|
progress: `${PREFIX}-progress`,
|
|
26
|
-
loadingButton: `${PREFIX}-loading-button
|
|
27
|
-
contrastBgColor: `${PREFIX}-contrast-bg-color`
|
|
26
|
+
loadingButton: `${PREFIX}-loading-button`
|
|
28
27
|
};
|
|
29
28
|
const Root = styled(Box, {
|
|
30
29
|
name: PREFIX,
|
|
@@ -89,17 +88,17 @@ function CourseUsersTable(inProps) {
|
|
|
89
88
|
if (!users) {
|
|
90
89
|
return _jsx(CourseUsersTableSkeleton, {});
|
|
91
90
|
}
|
|
92
|
-
return (_jsxs(Root, Object.assign({ className:
|
|
91
|
+
return (_jsxs(Root, Object.assign({ className: classes.root }, { children: [_jsx(TextField, { placeholder: intl.formatMessage({
|
|
93
92
|
id: 'ui.courseUsersTable.searchBar.placeholder',
|
|
94
93
|
defaultMessage: 'ui.courseUsersTable.searchBar.placeholder'
|
|
95
94
|
}), InputProps: {
|
|
96
95
|
startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(Icon, { children: "search" }) })))
|
|
97
96
|
}, value: value, onChange: handleChange, disabled: users.length === 0 && value.length === 0, fullWidth: true, className: classes.search }), _jsx(TableContainer, { children: _jsxs(Table, { children: [_jsx(TableHead, { children: _jsx(TableRow, { children: headerCells.map((cell, i, array) => {
|
|
98
|
-
if (mode !==
|
|
97
|
+
if (mode !== SCCourseUsersTableModeType.EDIT && i === array.length - 1) {
|
|
99
98
|
return _jsx(TableCell, { width: "14%" }, i);
|
|
100
99
|
}
|
|
101
|
-
return (_jsx(TableCell, Object.assign({ width: mode ===
|
|
100
|
+
return (_jsx(TableCell, Object.assign({ width: mode === SCCourseUsersTableModeType.DASHBOARD ? '20%' : '25%' }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i));
|
|
102
101
|
}) }) }), _jsxs(TableBody, { children: [users.length > 0 &&
|
|
103
|
-
users.map((user, i) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Avatar, { alt: user.username, src: user.avatar }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: user.username }))] })) }), mode ===
|
|
102
|
+
users.map((user, i) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Avatar, { alt: user.username, src: user.avatar }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: user.username }))] })) }), mode === SCCourseUsersTableModeType.DASHBOARD && (_jsx(TableCell, { children: _jsxs(Stack, Object.assign({ className: classes.progressWrapper }, { children: [_jsx(LinearProgress, { className: classes.progress, variant: "determinate", value: user.user_completion_rate }), _jsx(Typography, Object.assign({ variant: "body1" }, { children: `${Math.round(user.user_completion_rate)}%` }))] })) })), mode === SCCourseUsersTableModeType.EDIT && (_jsx(TableCell, { children: user.join_status !== SCCourseJoinStatusType.CREATOR && scUserContext.user.id !== user.id ? (_jsx(ChangeUserStatus, { course: course, user: user })) : (_jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: `ui.editCourse.tab.users.table.select.${user.join_status}`, defaultMessage: `ui.editCourse.tab.users.table.select.${user.join_status}` }) }))) })), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: new Date(mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.joined_at || new Date()).toLocaleDateString() })) }), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: new Date(mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.last_active_at || new Date()).toLocaleDateString() })) }), mode === SCCourseUsersTableModeType.DASHBOARD && (_jsx(TableCell, { children: _jsx(SeeProgressButton, { course: course, user: user }) })), mode === SCCourseUsersTableModeType.REQUESTS && (_jsx(TableCell, { children: _jsx(RequestButton, { course: course, user: user }) }))] }, i))), state.isLoadingNext && _jsx(RowSkeleton, { editMode: mode !== SCCourseUsersTableModeType.DASHBOARD })] })] }) }), users.length > 0 && (_jsx(LoadingButton, Object.assign({ size: "small", variant: "outlined", color: "inherit", loading: state.isLoadingNext, disabled: !state.next, className: classes.loadingButton, onClick: handleNext }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.btn.label", defaultMessage: "ui.courseUsersTable.btn.label" }) })) }))), users.length === 0 && value.length === 0 && _jsx(EmptyStatus, { icon: "face", title: emptyStatusTitle, description: emptyStatusDescription })] })));
|
|
104
103
|
}
|
|
105
104
|
export default memo(CourseUsersTable);
|
package/lib/esm/types/course.js
CHANGED
|
@@ -22,3 +22,9 @@ export var SCCourseEditTabType;
|
|
|
22
22
|
SCCourseEditTabType["REQUESTS"] = "requests";
|
|
23
23
|
SCCourseEditTabType["OPTIONS"] = "options";
|
|
24
24
|
})(SCCourseEditTabType || (SCCourseEditTabType = {}));
|
|
25
|
+
export var SCCourseUsersTableModeType;
|
|
26
|
+
(function (SCCourseUsersTableModeType) {
|
|
27
|
+
SCCourseUsersTableModeType["DASHBOARD"] = "dashboard";
|
|
28
|
+
SCCourseUsersTableModeType["EDIT"] = "edit";
|
|
29
|
+
SCCourseUsersTableModeType["REQUESTS"] = "requests";
|
|
30
|
+
})(SCCourseUsersTableModeType || (SCCourseUsersTableModeType = {}));
|
package/lib/esm/utils/course.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { SCCourseJoinStatusType } from '@selfcommunity/types';
|
|
1
2
|
export function isCourseNew(course) {
|
|
2
|
-
if (course && course.
|
|
3
|
+
if (course && course.join_status === SCCourseJoinStatusType.JOINED) {
|
|
3
4
|
const createdAtDate = new Date(course.created_at);
|
|
4
5
|
const twoWeeksAgo = new Date();
|
|
5
6
|
twoWeeksAgo.setDate(twoWeeksAgo.getDate() - 14);
|