@selfcommunity/react-ui 1.2.0-alpha.2 → 1.2.0-alpha.4
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/CategoryAutocomplete/CategoryAutocomplete.js +6 -5
- package/lib/cjs/components/CourseDashboard/Header.d.ts +2 -2
- package/lib/cjs/components/CourseDashboard/Header.js +4 -10
- package/lib/cjs/components/CourseDashboard/Student/ActionButton.js +6 -2
- package/lib/cjs/components/CourseDashboard/Student.js +6 -5
- package/lib/cjs/components/CourseDashboard/Teacher/Comments.js +3 -3
- package/lib/cjs/components/CourseDashboard/Teacher/Info.js +2 -2
- package/lib/cjs/components/CourseDashboard/Teacher.js +2 -2
- package/lib/cjs/components/CourseForm/CourseForm.js +11 -6
- package/lib/cjs/components/CourseForm/Edit.js +4 -4
- package/lib/cjs/components/CourseParticipantsButton/CourseParticipantsButton.js +3 -2
- package/lib/cjs/components/EditCourse/EditCourse.js +2 -2
- package/lib/cjs/components/EditCourse/Lessons/ChangeLessonStatus.js +10 -5
- package/lib/cjs/components/EditCourse/Lessons/FieldName.js +2 -2
- package/lib/cjs/components/EditCourse/Lessons/LessonRow.js +3 -3
- package/lib/cjs/components/EditCourse/Lessons/SectionRow.js +3 -3
- package/lib/cjs/components/EditCourse/Lessons.js +5 -4
- package/lib/cjs/components/EditCourse/Options/SwitchForm.js +2 -2
- package/lib/cjs/components/EditCourse/Options.js +2 -2
- package/lib/cjs/components/EditCourse/Status.js +3 -5
- package/lib/cjs/components/EditCourse/Users.js +2 -2
- package/lib/cjs/components/EventHeader/EventHeader.js +1 -1
- package/lib/cjs/components/FeedObject/Contributors/Contributors.js +1 -1
- package/lib/cjs/components/PaywallsConfigurator/PaywallsConfigurator.js +1 -1
- package/lib/cjs/components/PrivateMessageSnippetItem/PrivateMessageSnippetItem.js +4 -3
- package/lib/cjs/components/PrivateMessageSnippets/PrivateMessageSnippets.js +1 -1
- package/lib/cjs/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +2 -1
- package/lib/cjs/components/User/User.js +5 -4
- package/lib/cjs/shared/AccordionLessons/AccordionLessons.js +4 -4
- package/lib/cjs/shared/AddUsersButton/AddUsersButton.js +14 -6
- package/lib/cjs/shared/ConfirmDialog/ConfirmDialog.js +11 -7
- package/lib/cjs/shared/CourseUsersTable/ChangeUsersStatus.js +3 -5
- package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.js +6 -4
- package/lib/cjs/shared/CourseUsersTable/SeeProgressButton.js +4 -3
- package/lib/cjs/types/course.d.ts +5 -0
- package/lib/cjs/utils/course.d.ts +2 -1
- package/lib/cjs/utils/course.js +9 -1
- package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +7 -6
- package/lib/esm/components/CourseDashboard/Header.d.ts +2 -2
- package/lib/esm/components/CourseDashboard/Header.js +4 -10
- package/lib/esm/components/CourseDashboard/Student/ActionButton.js +6 -2
- package/lib/esm/components/CourseDashboard/Student.js +6 -5
- package/lib/esm/components/CourseDashboard/Teacher/Comments.js +3 -3
- package/lib/esm/components/CourseDashboard/Teacher/Info.js +2 -2
- package/lib/esm/components/CourseDashboard/Teacher.js +2 -2
- package/lib/esm/components/CourseForm/CourseForm.js +12 -7
- package/lib/esm/components/CourseForm/Edit.js +4 -4
- package/lib/esm/components/CourseParticipantsButton/CourseParticipantsButton.js +3 -2
- package/lib/esm/components/EditCourse/EditCourse.js +2 -2
- package/lib/esm/components/EditCourse/Lessons/ChangeLessonStatus.js +10 -5
- package/lib/esm/components/EditCourse/Lessons/FieldName.js +2 -2
- package/lib/esm/components/EditCourse/Lessons/LessonRow.js +4 -4
- package/lib/esm/components/EditCourse/Lessons/SectionRow.js +4 -4
- package/lib/esm/components/EditCourse/Lessons.js +5 -4
- package/lib/esm/components/EditCourse/Options/SwitchForm.js +2 -2
- package/lib/esm/components/EditCourse/Options.js +2 -2
- package/lib/esm/components/EditCourse/Status.js +3 -4
- package/lib/esm/components/EditCourse/Users.js +2 -2
- package/lib/esm/components/EventHeader/EventHeader.js +1 -1
- package/lib/esm/components/FeedObject/Contributors/Contributors.js +1 -1
- package/lib/esm/components/PaywallsConfigurator/PaywallsConfigurator.js +1 -1
- package/lib/esm/components/PrivateMessageSnippetItem/PrivateMessageSnippetItem.js +4 -3
- package/lib/esm/components/PrivateMessageSnippets/PrivateMessageSnippets.js +1 -1
- package/lib/esm/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +2 -1
- package/lib/esm/components/User/User.js +6 -5
- package/lib/esm/shared/AccordionLessons/AccordionLessons.js +4 -4
- package/lib/esm/shared/AddUsersButton/AddUsersButton.js +15 -7
- package/lib/esm/shared/ConfirmDialog/ConfirmDialog.js +12 -8
- package/lib/esm/shared/CourseUsersTable/ChangeUsersStatus.js +4 -6
- package/lib/esm/shared/CourseUsersTable/CourseUsersTable.js +7 -5
- package/lib/esm/shared/CourseUsersTable/SeeProgressButton.js +4 -3
- package/lib/esm/types/course.d.ts +5 -0
- package/lib/esm/utils/course.d.ts +2 -1
- package/lib/esm/utils/course.js +7 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DragDropContext, Draggable, Droppable } from '@hello-pangea/dnd';
|
|
3
3
|
import { forwardRef, Fragment, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { Collapse, Icon, IconButton, MenuItem, Stack, Table, TableBody, TableCell, TableRow, Typography } from '@mui/material';
|
|
4
|
+
import { Collapse, Icon, IconButton, MenuItem, Stack, Table, TableBody, TableCell, TableRow, Typography, useTheme } from '@mui/material';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { PREFIX } from '../constants';
|
|
7
7
|
import LessonRow from './LessonRow';
|
|
@@ -25,8 +25,7 @@ const classes = {
|
|
|
25
25
|
cellWidth: `${PREFIX}-cell-width`,
|
|
26
26
|
cellAlignRight: `${PREFIX}-cell-align-right`,
|
|
27
27
|
cellAlignCenter: `${PREFIX}-cell-align-center`,
|
|
28
|
-
cellPadding: `${PREFIX}-cell-padding
|
|
29
|
-
contrastColor: `${PREFIX}-contrast-color`
|
|
28
|
+
cellPadding: `${PREFIX}-cell-padding`
|
|
30
29
|
};
|
|
31
30
|
function SectionRow(props, ref) {
|
|
32
31
|
// PROPS
|
|
@@ -41,6 +40,7 @@ function SectionRow(props, ref) {
|
|
|
41
40
|
const { isDisabled } = useIsDisabled();
|
|
42
41
|
const intl = useIntl();
|
|
43
42
|
const { enqueueSnackbar } = useSnackbar();
|
|
43
|
+
const theme = useTheme();
|
|
44
44
|
// EFFECTS
|
|
45
45
|
useEffect(() => {
|
|
46
46
|
if (section.lessons) {
|
|
@@ -151,6 +151,6 @@ function SectionRow(props, ref) {
|
|
|
151
151
|
? Endpoints.CreateCourseSection.url({ id: course.id })
|
|
152
152
|
: Endpoints.PatchCourseSection.url({ id: course.id, section_id: section.id }),
|
|
153
153
|
method: isNewRow ? Endpoints.CreateCourseSection.method : Endpoints.PatchCourseSection.method
|
|
154
|
-
}, row: section, isNewRow: isNewRow, handleManageRow: handleManageSection, editMode: editMode, handleDisableEditMode: handleDisableEditMode }) }), course.type !== SCCourseTypologyType.SELF && (_jsx(TableCell, Object.assign({ className: classes.cellAlignCenter }, { children: _jsx(LessonReleaseMenu, { course: course, section: section }) }))), _jsx(TableCell, Object.assign({ className: classes.cellAlignRight }, { children: _jsxs(Stack, Object.assign({ className: classes.actionsWrapper }, { children: [_jsx(AddButton, { label: "ui.editCourse.tab.lessons.table.lesson", handleAddRow: handleAddTempLesson, color: "primary", variant: "contained", disabled: isDisabled }), _jsxs(MenuRow, Object.assign({ disabled: isDisabled }, { children: [_jsx(MenuItem, Object.assign({ onClick: handleAbleEditMode }, { children: _jsx(Typography, Object.assign({ variant: "body1",
|
|
154
|
+
}, row: section, isNewRow: isNewRow, handleManageRow: handleManageSection, editMode: editMode, handleDisableEditMode: handleDisableEditMode }) }), course.type !== SCCourseTypologyType.SELF && (_jsx(TableCell, Object.assign({ className: classes.cellAlignCenter }, { children: _jsx(LessonReleaseMenu, { course: course, section: section }) }))), _jsx(TableCell, Object.assign({ className: classes.cellAlignRight }, { children: _jsxs(Stack, Object.assign({ className: classes.actionsWrapper }, { children: [_jsx(AddButton, { label: "ui.editCourse.tab.lessons.table.lesson", handleAddRow: handleAddTempLesson, color: "primary", variant: "contained", disabled: isDisabled }), _jsxs(MenuRow, Object.assign({ disabled: isDisabled }, { children: [_jsx(MenuItem, Object.assign({ onClick: handleAbleEditMode }, { children: _jsx(Typography, Object.assign({ variant: "body1", sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.rename", defaultMessage: "ui.editCourse.tab.lessons.table.menu.rename" }) })) })), _jsx(MenuItem, Object.assign({ onClick: () => handleOpenDialog({ row: RowType.SECTION, section }) }, { children: _jsx(Typography, Object.assign({ variant: "body1", sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.lessons.table.menu.delete", defaultMessage: "ui.editCourse.tab.lessons.table.menu.delete" }) })) }))] }))] })) }))] })), _jsx(TableRow, { children: _jsx(TableCell, Object.assign({ className: classes.tableBodyCollapseWrapper, colSpan: 4 }, { children: _jsx(Collapse, Object.assign({ in: expand, timeout: "auto", unmountOnExit: true }, { children: _jsx(DragDropContext, Object.assign({ onDragEnd: handleDragEnd }, { children: _jsx(Table, { children: _jsx(Droppable, Object.assign({ droppableId: "droppable-2" }, { children: (outerProvider) => (_jsxs(TableBody, Object.assign({ ref: outerProvider.innerRef }, outerProvider.droppableProps, { children: [lessons.map((lesson, i, array) => (_jsx(Draggable, Object.assign({ draggableId: i.toString(), index: i, isDragDisabled: isDisabled }, { children: (innerProvider) => (_jsx(LessonRow, { provider: innerProvider, course: course, section: section, lesson: lesson, isNewRow: isNewLocalRow && i + 1 === array.length, handleManageLesson: handleManageLesson, handleOpenDialog: () => handleOpenDialog({ row: RowType.LESSON, section, lesson }), ref: innerRef }, i)) }), i))), outerProvider.placeholder] }))) })) }) })) })) })) })] }));
|
|
155
155
|
}
|
|
156
156
|
export default memo(forwardRef(SectionRow));
|
|
@@ -35,7 +35,8 @@ const classes = {
|
|
|
35
35
|
cellAlignCenter: `${PREFIX}-cell-align-center`,
|
|
36
36
|
lessonEmptyStatus: `${PREFIX}-lesson-empty-status`,
|
|
37
37
|
emptyStatusButton: `${PREFIX}-empty-status-button`,
|
|
38
|
-
|
|
38
|
+
defaultContrastColor: `${PREFIX}-default-contrast-color`,
|
|
39
|
+
paperContrastColor: `${PREFIX}-paper-contrast-color`
|
|
39
40
|
};
|
|
40
41
|
function Lessons(props) {
|
|
41
42
|
// PROPS
|
|
@@ -184,10 +185,10 @@ function Lessons(props) {
|
|
|
184
185
|
}
|
|
185
186
|
handleOpenDialog(null);
|
|
186
187
|
}, [dialog, handleOpenDialog]);
|
|
187
|
-
return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ className: classNames(classes.lessonTitle, classes.
|
|
188
|
+
return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ className: classNames(classes.lessonTitle, classes.defaultContrastColor), 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(Box, Object.assign({ className: classes.lessonsInnerWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.lessonsSectionsWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.lessonsSections }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.table.sections.title", defaultMessage: "ui.course.table.sections.title", values: {
|
|
188
189
|
sectionsNumber: course.num_sections
|
|
189
|
-
} }) })), _jsx(Box, { className: classes.circle }), _jsx(Typography, Object.assign({ variant: "h5", className: classes.
|
|
190
|
+
} }) })), _jsx(Box, { className: classes.circle }), _jsx(Typography, Object.assign({ variant: "h5", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
|
|
190
191
|
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: 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: classNames(classes.tableHeaderTypography, classes.
|
|
192
|
+
} }) }))] })), _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: classNames(classes.tableHeaderTypography, classes.paperContrastColor), 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
193
|
}
|
|
193
194
|
export default memo(Lessons);
|
|
@@ -4,7 +4,7 @@ import { memo, useCallback, useState } from 'react';
|
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
import { PREFIX } from '../constants';
|
|
6
6
|
const classes = {
|
|
7
|
-
|
|
7
|
+
paperContrastColor: `${PREFIX}-paper-contrast-color`
|
|
8
8
|
};
|
|
9
9
|
function SwitchForm(props) {
|
|
10
10
|
// PROPS
|
|
@@ -17,6 +17,6 @@ function SwitchForm(props) {
|
|
|
17
17
|
setValue(_checked);
|
|
18
18
|
handleChangeOptions(name, _checked);
|
|
19
19
|
}, [setValue]);
|
|
20
|
-
return (_jsxs(FormControl, Object.assign({ component: "fieldset", variant: "standard" }, { children: [_jsx(FormLabel, Object.assign({ component: "legend" }, { children: _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })) })), _jsx(FormControlLabel, { control: _jsx(Switch, { color: "primary", checked: value, name: name, onChange: handleChange }), label: _jsx(Typography, Object.assign({ variant: "body1", className: classes.
|
|
20
|
+
return (_jsxs(FormControl, Object.assign({ component: "fieldset", variant: "standard" }, { children: [_jsx(FormLabel, Object.assign({ component: "legend" }, { children: _jsx(Typography, Object.assign({ variant: "h5", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })) })), _jsx(FormControlLabel, { control: _jsx(Switch, { color: "primary", checked: value, name: name, onChange: handleChange }), label: _jsx(Typography, Object.assign({ variant: "body1", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: description, defaultMessage: description }) })) })] })));
|
|
21
21
|
}
|
|
22
22
|
export default memo(SwitchForm);
|
|
@@ -14,7 +14,7 @@ const classes = {
|
|
|
14
14
|
optionsWrapper: `${PREFIX}-options-wrapper`,
|
|
15
15
|
optionsDivider: `${PREFIX}-options-divider`,
|
|
16
16
|
optionsButtonWrapper: `${PREFIX}-options-button-wrapper`,
|
|
17
|
-
|
|
17
|
+
paperContrastColor: `${PREFIX}-paper-contrast-color`
|
|
18
18
|
};
|
|
19
19
|
const OPTIONS = {
|
|
20
20
|
enforce_lessons_order: {
|
|
@@ -88,6 +88,6 @@ function Options(props) {
|
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
90
|
}, [course, tempOptions, setCanSave, setLoading]);
|
|
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(Button, Object.assign({ size: "small", variant: "contained", disabled: !canSave, onClick: handleSubmit, loading: loading }, { children: _jsx(Typography, Object.assign({ variant: "body1"
|
|
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(Button, 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" }) })) })) }))] })));
|
|
92
92
|
}
|
|
93
93
|
export default memo(Options);
|
|
@@ -3,12 +3,11 @@ 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
|
-
import classNames from 'classnames';
|
|
7
6
|
import { useCallback } from 'react';
|
|
8
7
|
import { SCCourseEditTabType } from '../../types';
|
|
9
8
|
const classes = {
|
|
10
9
|
status: `${PREFIX}-status`,
|
|
11
|
-
|
|
10
|
+
defaultContrastColor: `${PREFIX}-default-contrast-color`
|
|
12
11
|
};
|
|
13
12
|
export default function Status(props) {
|
|
14
13
|
// STATES
|
|
@@ -19,11 +18,11 @@ export default function Status(props) {
|
|
|
19
18
|
const handleClick = useCallback(() => {
|
|
20
19
|
handleTabChange(null, SCCourseEditTabType.CUSTOMIZE);
|
|
21
20
|
}, [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' }, {
|
|
21
|
+
return (_jsx(Chip, { label: _jsx(Button, Object.assign({ size: "small", variant: "text", color: "inherit", onClick: handleClick }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.defaultContrastColor }, { children: intl.formatMessage({ id: 'ui.editCourse.tab.lessons.status', defaultMessage: 'ui.editCourse.tab.lessons.status' }, {
|
|
23
22
|
status: intl.formatMessage({
|
|
24
23
|
id: `ui.course.privacy.${course.privacy === SCCoursePrivacyType.DRAFT ? 'draft' : course.privacy}`,
|
|
25
24
|
defaultMessage: `ui.course.privacy.${course.privacy === SCCoursePrivacyType.DRAFT ? 'draft' : course.privacy}`
|
|
26
25
|
}),
|
|
27
26
|
b: (chunks) => (_jsx(Typography, Object.assign({ component: "b", fontWeight: "bold" }, { children: chunks }), "ui.editCourse.tab.lessons.status.b"))
|
|
28
|
-
}) })) })), className:
|
|
27
|
+
}) })) })), className: classes.status }));
|
|
29
28
|
}
|
|
@@ -19,7 +19,7 @@ import { SCCourseEventType, SCTopicType } from '../../constants/PubSub';
|
|
|
19
19
|
import { SCCourseUsersTableModeType } from '../../types/course';
|
|
20
20
|
const classes = {
|
|
21
21
|
usersStatusWrapper: `${PREFIX}-users-status-wrapper`,
|
|
22
|
-
|
|
22
|
+
defaultContrastColor: `${PREFIX}-default-contrast-color`
|
|
23
23
|
};
|
|
24
24
|
const headerCells = [
|
|
25
25
|
{
|
|
@@ -124,7 +124,7 @@ function Users(props) {
|
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
126
|
}, [course, dispatch]);
|
|
127
|
-
return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classes.
|
|
127
|
+
return (_jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h6", className: classes.defaultContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.editCourse.tab.users.title", defaultMessage: "ui.editCourse.tab.users.title", values: { usersNumber: state.count } }) })), _jsxs(Stack, Object.assign({ className: classes.usersStatusWrapper }, { children: [_jsx(Status, { course: course, handleTabChange: handleTabChange }), _jsx(AddUsersButton, { label: "ui.editCourse.tab.users.addUsersButton.label", endpoint: {
|
|
128
128
|
url: () => Endpoints.GetCourseSuggestedUsers.url({ id: course.id }),
|
|
129
129
|
method: Endpoints.GetCourseSuggestedUsers.method
|
|
130
130
|
}, onConfirm: handleConfirm })] })), _jsx(CourseUsersTable, { state: state, dispatch: dispatch, course: course, endpointSearch: {
|
|
@@ -111,7 +111,7 @@ export default function EventHeader(inProps) {
|
|
|
111
111
|
return (
|
|
112
112
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
113
113
|
// @ts-ignore
|
|
114
|
-
_jsxs(Root, Object.assign({ id: id, className: classNames(classes.root, className), isEventAdmin: isEventAdmin, isEventFinished: isEventFinished }, rest, { children: [_jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(Box, Object.assign({ className: classes.calendar }, { children: _jsx(Calendar, { day: new Date(scEvent.start_date).getDate() }) })) })), _jsxs(Box, Object.assign({ className: classes.info }, { children: [scEvent.running && (_jsx(Typography, Object.assign({ variant: "body1", className: classes.inProgress }, { children: _jsx(FormattedMessage, { id: "ui.eventHeader.inProgress", defaultMessage: "ui.eventHeader.inProgress" }) }))), isEventFinished && (_jsx(Chip, { icon: _jsx(Icon, Object.assign({ fontSize: "small", className: classes.chipIcon }, { children: "calendar_off" })), label: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.eventHeader.finished", defaultMessage: "ui.eventHeader.finished" }) })), variant: "
|
|
114
|
+
_jsxs(Root, Object.assign({ id: id, className: classNames(classes.root, className), isEventAdmin: isEventAdmin, isEventFinished: isEventFinished }, rest, { children: [_jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(Box, Object.assign({ className: classes.calendar }, { children: _jsx(Calendar, { day: new Date(scEvent.start_date).getDate() }) })) })), _jsxs(Box, Object.assign({ className: classes.info }, { children: [scEvent.running && (_jsx(Typography, Object.assign({ variant: "body1", className: classes.inProgress }, { children: _jsx(FormattedMessage, { id: "ui.eventHeader.inProgress", defaultMessage: "ui.eventHeader.inProgress" }) }))), isEventFinished && (_jsx(Chip, { icon: _jsx(Icon, Object.assign({ fontSize: "small", className: classes.chipIcon }, { children: "calendar_off" })), label: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.eventHeader.finished", defaultMessage: "ui.eventHeader.finished" }) })), variant: "filled", size: "medium", color: "secondary", className: classes.chip })), _jsx(Typography, Object.assign({ className: classes.time }, { children: scEvent.end_date && scEvent.end_date !== scEvent.start_date ? (new Date(scEvent.start_date).getDate() !== new Date(scEvent.end_date).getDate() ? (_jsx(FormattedMessage, { id: "ui.eventHeader.startEndTimeDiff", defaultMessage: "ui.eventHeader.startEndTimeDiff", values: {
|
|
115
115
|
startDate: intl.formatDate(scEvent.start_date, {
|
|
116
116
|
weekday: 'long',
|
|
117
117
|
day: 'numeric',
|
|
@@ -47,5 +47,5 @@ export default function ContributorsFeedObject(props) {
|
|
|
47
47
|
if (!contributorsObject.feedObject) {
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(Box, { children: contributorsObject.isLoadingNext && !openContributorsDialog ? (_jsx(ContributorsSkeleton, Object.assign({}, ContributorsSkeletonProps))) : (_jsx(_Fragment, { children: contributorsObject.contributors.length > 0 ? (_jsxs(_Fragment, { children: [_jsxs(Button, Object.assign({ variant: "text", onClick: () => setOpenContributorsDialog(true), classes: { root: classes.btnParticipants }, color: "inherit" }, { children: [_jsx(FormattedMessage, { id: "ui.feedObject.contributors.participants", defaultMessage: "ui.feedObject.contributors.participants" }), ":", _jsxs(AvatarGroup, Object.assign({}, rest, { children: [contributorsObject.contributors.map((c, i) => (_jsx(Avatar, { alt: c.username, src: c.avatar }, i))), [...Array(Math.max(contributorsObject.total - contributorsObject.contributors.length, 0))].map((
|
|
50
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(Box, { children: contributorsObject.isLoadingNext && !openContributorsDialog ? (_jsx(ContributorsSkeleton, Object.assign({}, ContributorsSkeletonProps))) : (_jsx(_Fragment, { children: contributorsObject.contributors.length > 0 ? (_jsxs(_Fragment, { children: [_jsxs(Button, Object.assign({ variant: "text", onClick: () => setOpenContributorsDialog(true), classes: { root: classes.btnParticipants }, color: "inherit" }, { children: [_jsxs(Typography, Object.assign({ component: "span", sx: { '&': { all: 'unset' } } }, { children: [_jsx(FormattedMessage, { id: "ui.feedObject.contributors.participants", defaultMessage: "ui.feedObject.contributors.participants" }), ":"] })), _jsxs(AvatarGroup, Object.assign({}, rest, { children: [contributorsObject.contributors.map((c, i) => (_jsx(Avatar, { alt: c.username, src: c.avatar }, i))), [...Array(Math.max(contributorsObject.total - contributorsObject.contributors.length, 0))].map((_x, i) => (_jsx(Avatar, {}, i)))] }))] })), openContributorsDialog && (_jsx(BaseDialog, Object.assign({ title: _jsx(FormattedMessage, { defaultMessage: "ui.feedObject.contributors.title", id: "ui.feedObject.contributors.title", values: { total: contributorsObject.total } }), onClose: () => setOpenContributorsDialog(false), open: openContributorsDialog }, { children: contributorsObject.isLoadingNext ? (_jsx(CentralProgress, { size: 50 })) : (_jsx(InfiniteScroll, Object.assign({ dataLength: contributorsObject.contributors.length, next: contributorsObject.getNextPage(), hasMoreNext: Boolean(contributorsObject.next), loaderNext: _jsx(CentralProgress, { size: 30 }), height: 400, endMessage: _jsx(Typography, Object.assign({ variant: "body2", align: "center", fontWeight: "bold" }, { children: _jsx(FormattedMessage, { id: "ui.feedObject.contributors.noOtherContributors", defaultMessage: "ui.feedObject.contributors.noOtherContributors" }) })) }, { children: _jsx(List, { children: contributorsObject.contributors.map((c, i) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: c, sx: { m: 0 }, onClick: () => setOpenContributorsDialog(false) }, c.id) }, i))) }) }))) })))] })) : null })) }) })));
|
|
51
51
|
}
|
|
@@ -242,7 +242,7 @@ export default function PaywallsConfigurator(inProps) {
|
|
|
242
242
|
setPendingValue(newValue);
|
|
243
243
|
}, disableCloseOnSelect: true, slots: {
|
|
244
244
|
popper: PopperComponent
|
|
245
|
-
},
|
|
245
|
+
}, renderValue: () => null, noOptionsText: _jsx(FormattedMessage, { id: "ui.paywallsConfigurator.noProducts", defaultMessage: "ui.paywallsConfigurator.noProducts" }), renderOption: renderOption, options: getOptions, isOptionEqualToValue: (option, value) => option.id === value.id, getOptionLabel: (option) => option.name.toString(), renderInput: (params) => (_jsx(FilterInputRoot, { disabled: loadingProducts || loading, ref: params.InputProps.ref, inputProps: params.inputProps, autoFocus: true, placeholder: intl.formatMessage({
|
|
246
246
|
id: 'ui.paywallsConfigurator.filterByName',
|
|
247
247
|
defaultMessage: 'ui.paywallsConfigurator.filterByName'
|
|
248
248
|
}) })) }), _jsx(Box, Object.assign({ className: classes.paymentProductsPopperFooter }, { children: _jsx(Button, Object.assign({ variant: "contained", size: "small", disableRipple: true, onClick: handleClose, startIcon: _jsx(Icon, { children: "check" }) }, { children: _jsx(FormattedMessage, { id: "ui.paywallsConfigurator.popper.btnConfirm", defaultMessage: "ui.paywallsConfigurator.popper.btnConfirm" }) })) }))] }) })) })))] })] }))] }))) })));
|
|
@@ -16,7 +16,8 @@ const classes = {
|
|
|
16
16
|
badgeLabel: `${PREFIX}-badge-label`,
|
|
17
17
|
time: `${PREFIX}-time`,
|
|
18
18
|
menuItem: `${PREFIX}-menu-item`,
|
|
19
|
-
unread: `${PREFIX}-unread
|
|
19
|
+
unread: `${PREFIX}-unread`,
|
|
20
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
20
21
|
};
|
|
21
22
|
const Root = styled(ListItem, {
|
|
22
23
|
name: PREFIX,
|
|
@@ -85,7 +86,7 @@ export default function PrivateMessageSnippetItem(inProps) {
|
|
|
85
86
|
/**
|
|
86
87
|
* Renders root object
|
|
87
88
|
*/
|
|
88
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { secondaryAction: secondaryAction, disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ onClick: onItemClick, classes: { root: classNames({ [classes.unread]: message.thread_status === SCPrivateMessageStatusType.NEW }) } }, { children: [_jsx(ListItemAvatar, { children: _jsx(UserAvatar, Object.assign({ hide: !hasBadge() }, { children: message.group ? (_jsx(Avatar, { alt: message.group.name, src: message.group.image_big })) : (_jsx(Avatar, { alt: ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.username) === message.receiver.username ? message.sender.username : message.receiver.username, src: ((_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.username) === message.receiver.username ? message.sender.avatar : message.receiver.avatar })) })) }), _jsx(ListItemText, { primary: _jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ component: "span", className: classes.username }, { children: message.group
|
|
89
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { secondaryAction: secondaryAction, disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ onClick: onItemClick, classes: { root: classNames({ [classes.unread]: message.thread_status === SCPrivateMessageStatusType.NEW }) } }, { children: [_jsx(ListItemAvatar, { children: _jsx(UserAvatar, Object.assign({ hide: !hasBadge() }, { children: message.group ? (_jsx(Avatar, { alt: message.group.name, src: message.group.image_big })) : (_jsx(Avatar, { alt: ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.username) === message.receiver.username ? message.sender.username : message.receiver.username, src: ((_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.username) === message.receiver.username ? message.sender.avatar : message.receiver.avatar })) })) }), _jsx(ListItemText, { primary: _jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ component: "span", className: classNames(classes.username, classes.contrastColor) }, { children: message.group
|
|
89
90
|
? message.group.name
|
|
90
91
|
: ((_c = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _c === void 0 ? void 0 : _c.username) === message.receiver.username
|
|
91
92
|
? message.sender.username
|
|
@@ -93,5 +94,5 @@ export default function PrivateMessageSnippetItem(inProps) {
|
|
|
93
94
|
day: '2-digit',
|
|
94
95
|
month: '2-digit',
|
|
95
96
|
year: '2-digit'
|
|
96
|
-
})}` }))] }), secondary: _jsx(_Fragment, { children: _jsx(Typography, { component: "span", color: "text.secondary", dangerouslySetInnerHTML: { __html: (_d = message.headline) !== null && _d !== void 0 ? _d : message.message } }) }) })] })) })));
|
|
97
|
+
})}` }))] }), secondary: _jsx(_Fragment, { children: _jsx(Typography, { component: "span", color: "text.secondary", dangerouslySetInnerHTML: { __html: (_d = message.headline) !== null && _d !== void 0 ? _d : message.message }, className: classes.contrastColor }) }) })] })) })));
|
|
97
98
|
}
|
|
@@ -232,7 +232,7 @@ export default function PrivateMessageSnippets(inProps) {
|
|
|
232
232
|
/**
|
|
233
233
|
* Renders the component
|
|
234
234
|
*/
|
|
235
|
-
return (_jsx(Root, Object.assign({}, rest, { className: classNames(classes.root, className) }, { children: _jsxs(CardContent, { children: [_jsx(Button, Object.assign({ variant: "
|
|
235
|
+
return (_jsx(Root, Object.assign({}, rest, { className: classNames(classes.root, className) }, { children: _jsxs(CardContent, { children: [_jsx(Button, Object.assign({ variant: "contained", size: "medium", className: classes.newMessageButton, onClick: handleOpenNewMessage }, { children: _jsx(FormattedMessage, { id: "ui.privateMessage.snippets.button.newMessage", defaultMessage: "ui.privateMessage.snippets.button.newMessage" }) })), data.snippets.length !== 0 && (_jsxs(_Fragment, { children: [_jsx(TextField, { className: classes.searchBar, variant: "outlined", margin: "normal", fullWidth: true, id: `${PREFIX}-search`, placeholder: `${intl.formatMessage(messages.placeholder)}`, size: "small", onChange: handleChange, value: search, slotProps: {
|
|
236
236
|
input: {
|
|
237
237
|
className: classes.input,
|
|
238
238
|
startAdornment: _jsx(Icon, Object.assign({ className: classes.icon }, { children: "search" })),
|
|
@@ -28,6 +28,7 @@ const classes = {
|
|
|
28
28
|
messageTime: `${PREFIX}-message-time`,
|
|
29
29
|
menuItem: `${PREFIX}-menu-item`,
|
|
30
30
|
downloadButton: `${PREFIX}-download-button`,
|
|
31
|
+
paperContrastColor: `${PREFIX}-paper-contrast-color`,
|
|
31
32
|
dialogRoot: `${PREFIX}-dialog-root`
|
|
32
33
|
};
|
|
33
34
|
const DialogRoot = styled(BaseDialog, {
|
|
@@ -156,7 +157,7 @@ export default function PrivateMessageThreadItem(inProps) {
|
|
|
156
157
|
*/
|
|
157
158
|
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, getMouseEvents(mouseEvents.onMouseEnter, mouseEvents.onMouseLeave), rest, { secondaryAction: (isHovering || isMobile) &&
|
|
158
159
|
showMenuIcon &&
|
|
159
|
-
message.status !== SCPrivateMessageStatusType.HIDDEN && _jsx(PrivateMessageSettingsIconButton, { onMenuItemDeleteClick: handleMenuItemClick }) }, { children: [message.group && ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.username) !== message.sender.username && (_jsx(Typography, Object.assign({ color: "secondary", variant: "h4", className: classes.username }, { children: message.sender.username }))), _jsxs(_Fragment, { children: [hasFile && message.status !== SCPrivateMessageStatusType.HIDDEN ? (renderMessageFile(message)) : (_jsx(Box, Object.assign({ className: classes.text }, { children: _jsx(Typography, { component: "span", dangerouslySetInnerHTML: { __html: message.message } }) }))), _jsx(Typography, Object.assign({ className: classes.messageTime, color: "text.secondary" }, { children: `${intl.formatDate(message.created_at, {
|
|
160
|
+
message.status !== SCPrivateMessageStatusType.HIDDEN && _jsx(PrivateMessageSettingsIconButton, { onMenuItemDeleteClick: handleMenuItemClick }) }, { children: [message.group && ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.username) !== message.sender.username && (_jsx(Typography, Object.assign({ color: "secondary", variant: "h4", className: classes.username }, { children: message.sender.username }))), _jsxs(_Fragment, { children: [hasFile && message.status !== SCPrivateMessageStatusType.HIDDEN ? (renderMessageFile(message)) : (_jsx(Box, Object.assign({ className: classes.text }, { children: _jsx(Typography, { component: "span", dangerouslySetInnerHTML: { __html: message.message }, className: classes.paperContrastColor }) }))), _jsx(Typography, Object.assign({ className: classNames(classes.messageTime, classes.paperContrastColor), color: "text.secondary" }, { children: `${intl.formatDate(message.created_at, {
|
|
160
161
|
hour: 'numeric',
|
|
161
162
|
minute: 'numeric'
|
|
162
163
|
})}` }))] }), openDialog && (_jsx(_Fragment, { children: (message === null || message === void 0 ? void 0 : message.file.mimetype.startsWith(SCMessageFileType.VIDEO)) ? (_jsx(DialogRoot, Object.assign({ open: openDialog, onClose: () => setOpenDialog(false), className: classes.dialogRoot }, { children: _jsx(AutoPlayer, { url: message === null || message === void 0 ? void 0 : message.file.url, width: "100%" }) }))) : (_jsx(LightBox, { images: [{ src: message === null || message === void 0 ? void 0 : message.file.url, key: message.file.uuid }], onClose: () => setOpenDialog(false), toolbarButtons: _jsx(IconButton, Object.assign({ onClick: () => handleDownload(message === null || message === void 0 ? void 0 : message.file), className: classes.downloadButton }, { children: _jsx(Icon, { children: "download" }) }), "download") })) }))] })));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Avatar, Badge, Button, Chip, styled } from '@mui/material';
|
|
3
|
+
import { Avatar, Badge, Button, Chip, styled, Typography } from '@mui/material';
|
|
4
4
|
import { useThemeProps } from '@mui/system';
|
|
5
5
|
import { Link, SCPreferences, SCRoutes, useSCFetchUser, useSCPreferences, useSCRouting } from '@selfcommunity/react-core';
|
|
6
6
|
import classNames from 'classnames';
|
|
@@ -22,13 +22,14 @@ const classes = {
|
|
|
22
22
|
root: `${PREFIX}-root`,
|
|
23
23
|
avatar: `${PREFIX}-avatar`,
|
|
24
24
|
staffBadgeLabel: `${PREFIX}-staff-badge-label`,
|
|
25
|
-
groupAdminBadgeLabel: `${PREFIX}-group-admin-badge-label
|
|
25
|
+
groupAdminBadgeLabel: `${PREFIX}-group-admin-badge-label`,
|
|
26
|
+
paperContrastColor: `${PREFIX}-paper-contrast-color`
|
|
26
27
|
};
|
|
27
28
|
const Root = styled(BaseItemButton, {
|
|
28
29
|
name: PREFIX,
|
|
29
30
|
slot: 'Root',
|
|
30
|
-
overridesResolver: (
|
|
31
|
-
})((
|
|
31
|
+
overridesResolver: (_props, styles) => styles.root
|
|
32
|
+
})(() => ({}));
|
|
32
33
|
const PREFERENCES = [SCPreferences.STAFF_STAFF_BADGE_LABEL, SCPreferences.STAFF_STAFF_BADGE_ICON];
|
|
33
34
|
/**
|
|
34
35
|
* > API documentation for the Community-JS User component. Learn about the available props and the CSS API.
|
|
@@ -99,5 +100,5 @@ export default function User(inProps) {
|
|
|
99
100
|
*/
|
|
100
101
|
return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ elevation: elevation }, rest, { className: classNames(classes.root, className), ButtonBaseProps: buttonProps !== null && buttonProps !== void 0 ? buttonProps : (scUser.deleted
|
|
101
102
|
? { onClick: () => setOpenAlert(true) }
|
|
102
|
-
: { component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUser) }), image: badgeContent ? (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: badgeContent }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))) : (_jsx(UserAvatar, Object.assign({ hide: !hasBadge }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))), primary: (hasBadge && preferences) || isGroupAdmin ? (_jsxs(_Fragment, { children: [scUser.username, _jsx(Chip, { component: "span", className: isGroupAdmin ? classes.groupAdminBadgeLabel : classes.staffBadgeLabel, size: "small", label: isGroupAdmin ? (_jsx(FormattedMessage, { defaultMessage: "ui.user.group.admin", id: "ui.user.group.admin" })) : (preferences[SCPreferences.STAFF_STAFF_BADGE_LABEL]) })] })) : (scUser.username), secondary: secondary || (showFollowers ? `${intl.formatMessage(messages.userFollowers, { total: scUser.followers_counter })}` : scUser.description), actions: actions !== null && actions !== void 0 ? actions : renderAuthenticatedActions() })), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
103
|
+
: { component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUser) }), image: badgeContent ? (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: badgeContent }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))) : (_jsx(UserAvatar, Object.assign({ hide: !hasBadge }, { children: _jsx(Avatar, { alt: scUser.username, src: scUser.avatar, className: classes.avatar }) }))), primary: (hasBadge && preferences) || isGroupAdmin ? (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: scUser.username })), _jsx(Chip, { component: "span", className: classNames(isGroupAdmin ? classes.groupAdminBadgeLabel : classes.staffBadgeLabel), size: "small", label: _jsx(Typography, Object.assign({ component: "span", sx: { '&': { all: 'unset' } }, className: classes.paperContrastColor }, { children: isGroupAdmin ? (_jsx(FormattedMessage, { defaultMessage: "ui.user.group.admin", id: "ui.user.group.admin" })) : (preferences[SCPreferences.STAFF_STAFF_BADGE_LABEL]) })) })] })) : (_jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: scUser.username }))), secondary: _jsx(Typography, Object.assign({ component: "span", className: classes.paperContrastColor }, { children: secondary || (showFollowers ? `${intl.formatMessage(messages.userFollowers, { total: scUser.followers_counter })}` : scUser.description) })), actions: actions !== null && actions !== void 0 ? actions : renderAuthenticatedActions() })), openAlert && _jsx(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
103
104
|
}
|
|
@@ -19,7 +19,7 @@ const classes = {
|
|
|
19
19
|
details: `${PREFIX}-details`,
|
|
20
20
|
circle: `${PREFIX}-circle`,
|
|
21
21
|
link: `${PREFIX}-link`,
|
|
22
|
-
|
|
22
|
+
paperContrastColor: `${PREFIX}-paper-contrast-color`
|
|
23
23
|
};
|
|
24
24
|
const Root = styled(Box, {
|
|
25
25
|
name: PREFIX,
|
|
@@ -50,13 +50,13 @@ export default function AccordionLessons(inProps) {
|
|
|
50
50
|
if (!course) {
|
|
51
51
|
return _jsx(AccordionLessonSkeleton, {});
|
|
52
52
|
}
|
|
53
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, { children: ((_a = course.sections) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (course.sections.map((section) => (_jsxs(Accordion, Object.assign({ className: classes.accordion, expanded: expanded === section.id, onChange: handleChange(section.id), disableGutters: true, elevation: 0, square: true }, { children: [_jsxs(AccordionSummary, Object.assign({ className: classes.summary, expandIcon: _jsx(Icon, { children: "expand_more" }) }, { children: [_jsxs(Stack, Object.assign({ className: classes.nameWrapper }, { children: [_jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.
|
|
53
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, { children: ((_a = course.sections) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (course.sections.map((section) => (_jsxs(Accordion, Object.assign({ className: classes.accordion, expanded: expanded === section.id, onChange: handleChange(section.id), disableGutters: true, elevation: 0, square: true }, { children: [_jsxs(AccordionSummary, Object.assign({ className: classes.summary, expandIcon: _jsx(Icon, { children: "expand_more" }) }, { children: [_jsxs(Stack, Object.assign({ className: classes.nameWrapper }, { children: [_jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.paperContrastColor }, { children: section.name })), viewerJoinStatus !== SCCourseJoinStatusType.CREATOR && viewerJoinStatus !== SCCourseJoinStatusType.MANAGER && section.locked && (_jsxs(Fragment, { children: [_jsx(Bullet, {}), _jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.date", defaultMessage: "ui.course.accordionLessons.date", values: {
|
|
54
54
|
date: intl.formatDate(section.available_date, { day: 'numeric', month: 'numeric', year: 'numeric' }),
|
|
55
55
|
hour: intl.formatDate(section.available_date, { hour: 'numeric', minute: 'numeric' })
|
|
56
|
-
} }) }))] }))] })), !isMobile && (_jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.
|
|
56
|
+
} }) }))] }))] })), !isMobile && (_jsx(Typography, Object.assign({ component: "span", variant: "body1", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.course.table.lessons.title", defaultMessage: "ui.course.table.lessons.title", values: {
|
|
57
57
|
lessonsNumber: section.lessons.length
|
|
58
58
|
} }) })))] })), section.lessons.map((lesson) => (_jsxs(AccordionDetails, Object.assign({ className: classes.details }, { children: [lesson.completion_status === SCCourseLessonCompletionStatusType.COMPLETED ? (_jsx(Icon, Object.assign({ fontSize: "small", color: "primary" }, { children: "circle_checked" }))) : lesson.locked ? (_jsx(Icon, { children: "private" })) : (_jsx(Box, { className: classes.circle })), course.join_status === null ||
|
|
59
59
|
viewerJoinStatus === SCCourseJoinStatusType.CREATOR ||
|
|
60
60
|
viewerJoinStatus === SCCourseJoinStatusType.MANAGER ||
|
|
61
|
-
lesson.locked ? (_jsx(Typography, Object.assign({ className: classes.
|
|
61
|
+
lesson.locked ? (_jsx(Typography, Object.assign({ className: classes.paperContrastColor }, { children: lesson.name }))) : (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_LESSON_ROUTE_NAME, getUrlLesson(course, lesson, section)), variant: "text", color: "inherit", className: classes.link }, { children: _jsx(Typography, Object.assign({ className: classes.paperContrastColor }, { children: lesson.name })) })))] }), lesson.id)))] }), section.id)))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classNames(classes.empty, classes.paperContrastColor) }, { children: _jsx(FormattedMessage, { id: "ui.course.accordionLessons.empty", defaultMessage: "ui.course.accordionLessons.empty" }) }))) })));
|
|
62
62
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Autocomplete, Avatar, Button, Chip, Stack, styled, TextField, Typography, useThemeProps } from '@mui/material';
|
|
3
|
+
import { Autocomplete, Avatar, Button, Chip, Stack, styled, TextField, Typography, useTheme, useThemeProps } from '@mui/material';
|
|
4
4
|
import { Fragment, memo, useCallback, useEffect, useState } from 'react';
|
|
5
5
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
6
6
|
import BaseDialog from '../BaseDialog';
|
|
@@ -13,11 +13,12 @@ import classNames from 'classnames';
|
|
|
13
13
|
const PREFIX = 'SCAddUsersButton';
|
|
14
14
|
const classes = {
|
|
15
15
|
root: `${PREFIX}-root`,
|
|
16
|
+
defaultContrastColor: `${PREFIX}-default-contrast-color`,
|
|
16
17
|
dialogRoot: `${PREFIX}-dialog-root`,
|
|
17
18
|
dialogAutocompleteWrapper: `${PREFIX}-dialog-autocomplete-wrapper`,
|
|
18
19
|
dialogUserWrapper: `${PREFIX}-dialog-user-wrapper`,
|
|
19
20
|
dialogChipWrapper: `${PREFIX}-dialog-chip-wrapper`,
|
|
20
|
-
|
|
21
|
+
dialogPaperContrastColor: `${PREFIX}-dialog-paper-contrast-color`
|
|
21
22
|
};
|
|
22
23
|
const messages = defineMessages({
|
|
23
24
|
placeholder: {
|
|
@@ -41,16 +42,18 @@ function AddUsersButton(inProps) {
|
|
|
41
42
|
props: inProps,
|
|
42
43
|
name: PREFIX
|
|
43
44
|
});
|
|
44
|
-
const { label, variant = '
|
|
45
|
+
const { label, variant = 'contained', color = 'inherit', size = 'small', endpoint = Endpoints.GetCourseSuggestedUsers, endpointQueryParams = { limit: DEFAULT_PAGINATION_LIMIT, offset: DEFAULT_PAGINATION_OFFSET, search: '' }, onConfirm, className } = props, rest = __rest(props, ["label", "variant", "color", "size", "endpoint", "endpointQueryParams", "onConfirm", "className"]);
|
|
45
46
|
// STATES
|
|
46
47
|
const [openDialog, setOpenDialog] = useState(false);
|
|
47
48
|
const [invited, setInvited] = useState([]);
|
|
48
49
|
const [suggested, setSuggested] = useState([]);
|
|
49
50
|
const [value, setValue] = useState('');
|
|
50
51
|
const [loading, setLoading] = useState(false);
|
|
52
|
+
// CONTEXTS
|
|
53
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
51
54
|
// HOOKS
|
|
52
55
|
const intl = useIntl();
|
|
53
|
-
const
|
|
56
|
+
const theme = useTheme();
|
|
54
57
|
// CALLBACKS
|
|
55
58
|
const fetchUsers = useCallback((newValue) => {
|
|
56
59
|
setLoading(true);
|
|
@@ -126,9 +129,14 @@ function AddUsersButton(inProps) {
|
|
|
126
129
|
const handleDelete = useCallback((userToDelete) => {
|
|
127
130
|
setInvited((prev) => prev.filter((user) => user.id !== userToDelete.id));
|
|
128
131
|
}, [setInvited]);
|
|
129
|
-
return (_jsxs(Fragment, { children: [_jsx(Root, Object.assign({ onClick: handleToggleDialogOpen, variant: variant, color: color, size: size, className: classNames(classes.root, classes.
|
|
130
|
-
input: Object.assign({}, params.InputProps)
|
|
131
|
-
|
|
132
|
+
return (_jsxs(Fragment, { children: [_jsx(Root, Object.assign({ onClick: handleToggleDialogOpen, variant: variant, color: color, size: size, className: classNames(classes.root, classes.defaultContrastColor, 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", className: classes.dialogPaperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.dialog.title", defaultMessage: "ui.addUserButton.dialog.title" }) })), actions: _jsx(Button, 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(Typography, Object.assign({ component: "span", sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.autocomplete.loading", defaultMessage: "ui.addUserButton.autocomplete.loading" }) })), noOptionsText: _jsx(Typography, Object.assign({ component: "span", sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: _jsx(FormattedMessage, { id: "ui.addUserButton.autocomplete.noResults", defaultMessage: "ui.addUserButton.autocomplete.noResults" }) })), renderValue: () => 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, Object.assign({ sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: option.username }))] }))), renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { variant: "outlined", placeholder: `${intl.formatMessage(messages.placeholder)}`, slotProps: {
|
|
133
|
+
input: Object.assign(Object.assign({}, params.InputProps), { sx: {
|
|
134
|
+
'&::placeholder': {
|
|
135
|
+
color: theme.palette.getContrastText(theme.palette.background.paper)
|
|
136
|
+
},
|
|
137
|
+
color: theme.palette.getContrastText(theme.palette.background.paper)
|
|
138
|
+
} })
|
|
139
|
+
} }))) }), _jsx(Stack, Object.assign({ className: classes.dialogChipWrapper }, { children: invited.map((option, index) => (_jsx(Chip, { avatar: _jsx(Avatar, { alt: option.username, src: option.avatar }), label: _jsx(Typography, Object.assign({ component: "span", sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: option.username })), onDelete: () => {
|
|
132
140
|
handleDelete(option);
|
|
133
141
|
} }, index))) }))] })) })))] }));
|
|
134
142
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { styled, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Card,
|
|
3
|
+
import { styled, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Card, getContrastRatio, lighten } from '@mui/material';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
const PREFIX = 'SCConfirmDialog';
|
|
6
6
|
const classes = {
|
|
7
|
-
|
|
7
|
+
paperContrastColor: `${PREFIX}-paper-contrast-color`
|
|
8
8
|
};
|
|
9
9
|
const Root = styled(Card, {
|
|
10
10
|
name: PREFIX,
|
|
@@ -12,11 +12,15 @@ const Root = styled(Card, {
|
|
|
12
12
|
overridesResolver: (_props, styles) => styles.root
|
|
13
13
|
})(({ theme }) => ({
|
|
14
14
|
maxWidth: 800,
|
|
15
|
-
marginBottom: theme.spacing(2)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
marginBottom: theme.spacing(2)
|
|
16
|
+
}));
|
|
17
|
+
const DialogRoot = styled(Dialog, {
|
|
18
|
+
name: PREFIX,
|
|
19
|
+
slot: 'DialogRoot',
|
|
20
|
+
overridesResolver: (_props, styles) => styles.dialogRoot
|
|
21
|
+
})(({ theme }) => ({
|
|
22
|
+
[`& .${classes.paperContrastColor}`]: {
|
|
23
|
+
color: getContrastRatio(theme.palette.background.paper, theme.palette.common.white) > 4.5 ? lighten(theme.palette.common.white, 0.5) : undefined
|
|
20
24
|
}
|
|
21
25
|
}));
|
|
22
26
|
export default function ConfirmDialog(props) {
|
|
@@ -43,5 +47,5 @@ export default function ConfirmDialog(props) {
|
|
|
43
47
|
/**
|
|
44
48
|
* Renders root object
|
|
45
49
|
*/
|
|
46
|
-
return (_jsx(Root, { children: _jsxs(
|
|
50
|
+
return (_jsx(Root, { children: _jsxs(DialogRoot, Object.assign({ open: open, onClose: handleClose }, rest, { children: [_jsx(DialogTitle, Object.assign({ className: classes.paperContrastColor }, { children: title || _jsx(FormattedMessage, { id: "ui.confirmDialog.title", defaultMessage: "ui.confirmDialog.title" }) })), content && (_jsx(DialogContent, { children: _jsx(DialogContentText, Object.assign({ component: "div", className: classes.paperContrastColor }, { children: content })) })), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ onClick: handleClose }, { children: btnCancel || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnCancel", defaultMessage: "ui.confirmDialog.btnCancel" }) })), _jsx(Button, Object.assign({ onClick: handleConfirm, variant: "contained", autoFocus: true, loading: isUpdating }, { children: btnConfirm || _jsx(FormattedMessage, { id: "ui.confirmDialog.btnConfirm", defaultMessage: "ui.confirmDialog.btnConfirm" }) }))] })] })) }));
|
|
47
51
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, MenuItem, Select, Typography } from '@mui/material';
|
|
2
|
+
import { Button, MenuItem, Select, Typography, useTheme } from '@mui/material';
|
|
3
3
|
import { memo, useCallback, useEffect, useState } from 'react';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
import { SCCourseJoinStatusType } from '@selfcommunity/types';
|
|
@@ -7,11 +7,7 @@ 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 { PREFIX } from './constants';
|
|
11
10
|
const OPTIONS = ['ui.editCourse.tab.users.table.select.joined', 'ui.editCourse.tab.users.table.select.manager'];
|
|
12
|
-
const classes = {
|
|
13
|
-
contrastColor: `${PREFIX}-contrast-color`
|
|
14
|
-
};
|
|
15
11
|
function ChangeUserStatus(props) {
|
|
16
12
|
// PROPS
|
|
17
13
|
const { course, user } = props;
|
|
@@ -20,6 +16,8 @@ function ChangeUserStatus(props) {
|
|
|
20
16
|
const [loading, setLoading] = useState(false);
|
|
21
17
|
// CONTEXTS
|
|
22
18
|
const { enqueueSnackbar } = useSnackbar();
|
|
19
|
+
// HOOKS
|
|
20
|
+
const theme = useTheme();
|
|
23
21
|
// EFFECTS
|
|
24
22
|
useEffect(() => {
|
|
25
23
|
setValue(`ui.editCourse.tab.users.table.select.${user.join_status || 'joined'}`);
|
|
@@ -54,6 +52,6 @@ function ChangeUserStatus(props) {
|
|
|
54
52
|
':hover': {
|
|
55
53
|
backgroundColor: 'unset'
|
|
56
54
|
}
|
|
57
|
-
} }, { children: _jsx(Typography, Object.assign({ variant: "body1",
|
|
55
|
+
} }, { children: _jsx(Typography, Object.assign({ variant: "body1", sx: { color: theme.palette.getContrastText(theme.palette.background.paper) } }, { children: _jsx(FormattedMessage, { id: option, defaultMessage: option }) })) })) }), i))) })));
|
|
58
56
|
}
|
|
59
57
|
export default memo(ChangeUserStatus);
|
|
@@ -13,12 +13,13 @@ import { http } from '@selfcommunity/api-services';
|
|
|
13
13
|
import { Logger } from '@selfcommunity/utils';
|
|
14
14
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
15
15
|
import ChangeUserStatus from './ChangeUsersStatus';
|
|
16
|
-
import { useSCUser } from '@selfcommunity/react-core';
|
|
16
|
+
import { Link, SCRoutes, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
17
17
|
import RequestButton from './RequestButton';
|
|
18
18
|
import { SCCourseUsersTableModeType } from '../../types/course';
|
|
19
19
|
import RemoveButton from './RemoveButton';
|
|
20
20
|
import ConfirmDialog from '../ConfirmDialog/ConfirmDialog';
|
|
21
21
|
import { SCCourseEditTabType } from '../../types/course';
|
|
22
|
+
import { getUrlEditDashboard } from '../../utils/course';
|
|
22
23
|
const classes = {
|
|
23
24
|
root: `${PREFIX}-root`,
|
|
24
25
|
search: `${PREFIX}-search`,
|
|
@@ -28,7 +29,7 @@ const classes = {
|
|
|
28
29
|
progressWrapper: `${PREFIX}-progress-wrapper`,
|
|
29
30
|
progress: `${PREFIX}-progress`,
|
|
30
31
|
loadingButton: `${PREFIX}-loading-button`,
|
|
31
|
-
|
|
32
|
+
paperContrastColor: `${PREFIX}-paper-contrast-color`
|
|
32
33
|
};
|
|
33
34
|
const Root = styled(Box, {
|
|
34
35
|
name: PREFIX,
|
|
@@ -52,6 +53,7 @@ function CourseUsersTable(inProps) {
|
|
|
52
53
|
const inputRef = useRef(null);
|
|
53
54
|
// CONTEXTS
|
|
54
55
|
const scUserContext = useSCUser();
|
|
56
|
+
const scRoutingContext = useSCRouting();
|
|
55
57
|
// INTL
|
|
56
58
|
const intl = useIntl();
|
|
57
59
|
// HANDLERS
|
|
@@ -145,10 +147,10 @@ function CourseUsersTable(inProps) {
|
|
|
145
147
|
if (i === array.length - 1) {
|
|
146
148
|
return _jsx(TableCell, { width: "14%" }, i);
|
|
147
149
|
}
|
|
148
|
-
return (_jsx(TableCell, Object.assign({ width: mode === SCCourseUsersTableModeType.DASHBOARD ? '20%' : '25%' }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.
|
|
150
|
+
return (_jsx(TableCell, Object.assign({ width: mode === SCCourseUsersTableModeType.DASHBOARD ? '20%' : '25%' }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i));
|
|
149
151
|
}) }) }), _jsxs(TableBody, { children: [users.length > 0 &&
|
|
150
|
-
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", className: classes.
|
|
152
|
+
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", className: classes.paperContrastColor }, { 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", className: classes.paperContrastColor }, { 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", className: classes.paperContrastColor }, { 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", className: classes.paperContrastColor }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.joined_at || new Date() }) })) }), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.last_active_at || new Date() }) })) }), mode === SCCourseUsersTableModeType.EDIT &&
|
|
151
153
|
user.join_status !== SCCourseJoinStatusType.CREATOR &&
|
|
152
|
-
scUserContext.user.id !== user.id ? (_jsx(TableCell, { children: _jsx(RemoveButton, { ref: buttonRef, course: course, user: user, handleOpenDialog: handleOpenDialog }) })) : (mode === SCCourseUsersTableModeType.EDIT && _jsx(TableCell, {})), mode === SCCourseUsersTableModeType.DASHBOARD && (_jsx(TableCell, { children: _jsx(SeeProgressButton, { course: course, user: user }) })), mode === SCCourseUsersTableModeType.REQUESTS && (_jsx(TableCell, { children: _jsx(RequestButton, { ref: buttonRef, course: course, user: user, handleOpenDialog: handleOpenDialog }) }))] }, i))), state.isLoadingNext && _jsx(RowSkeleton, { editMode: mode !== SCCourseUsersTableModeType.DASHBOARD })] })] }) }), users.length > 0 && (_jsx(Button, Object.assign({ size: "small", variant: "contained", color: "inherit", loading: state.isLoadingNext, disabled: value.length > 0
|
|
154
|
+
scUserContext.user.id !== user.id ? (_jsx(TableCell, { children: _jsx(RemoveButton, { ref: buttonRef, course: course, user: user, handleOpenDialog: handleOpenDialog }) })) : (mode === SCCourseUsersTableModeType.EDIT && _jsx(TableCell, {})), mode === SCCourseUsersTableModeType.DASHBOARD && (_jsx(TableCell, { children: _jsx(SeeProgressButton, { course: course, user: user }) })), mode === SCCourseUsersTableModeType.REQUESTS && (_jsx(TableCell, { children: _jsx(RequestButton, { ref: buttonRef, course: course, user: user, handleOpenDialog: handleOpenDialog }) }))] }, i))), state.isLoadingNext && _jsx(RowSkeleton, { editMode: mode !== SCCourseUsersTableModeType.DASHBOARD })] })] }) }), users.length > 0 && state.next && (_jsx(Button, Object.assign({ size: "small", variant: "contained", color: "inherit", loading: state.isLoadingNext, disabled: value.length > 0, className: classes.loadingButton, onClick: handleNext }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.paperContrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.btn.label", defaultMessage: "ui.courseUsersTable.btn.label" }) })) }))), users.length === 0 && (_jsx(EmptyStatus, { icon: "face", title: value.length > 0 ? 'ui.courseUsersTable.empty.search.title' : emptyStatusTitle, description: value.length > 0 ? 'ui.courseUsersTable.empty.search.description' : emptyStatusDescription, actions: value.length === 0 && (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.COURSE_EDIT_ROUTE_NAME, getUrlEditDashboard(course, SCCourseEditTabType.USERS)), size: "small", variant: "contained", color: "primary" }, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.empty.btn.label", defaultMessage: "ui.courseUsersTable.empty.btn.label" }) })) }))) })), dialog && _jsx(ConfirmDialog, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleConfirm })] })));
|
|
153
155
|
}
|
|
154
156
|
export default memo(CourseUsersTable);
|