@selfcommunity/react-ui 1.2.0-alpha.0 → 1.2.0-alpha.2
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 +8 -7
- package/lib/cjs/components/CategoryAutocomplete/constants.d.ts +1 -0
- package/lib/cjs/components/CategoryAutocomplete/constants.js +4 -0
- package/lib/cjs/components/CourseCompletedDialog/CourseCompletedDialog.js +11 -9
- package/lib/cjs/components/CourseCompletedDialog/constants.d.ts +1 -0
- package/lib/cjs/components/CourseCompletedDialog/constants.js +4 -0
- package/lib/cjs/components/CourseContentMenu/CourseContentMenu.js +1 -1
- package/lib/cjs/components/CourseDashboard/Student.d.ts +2 -2
- package/lib/cjs/components/CourseDashboard/Student.js +6 -6
- package/lib/cjs/components/CourseDashboard/Teacher/Comments.js +2 -2
- package/lib/cjs/components/CourseDashboard/Teacher/Info.js +3 -2
- package/lib/cjs/components/CourseForm/CourseForm.js +5 -4
- package/lib/cjs/components/CourseForm/Dialog.js +5 -1
- package/lib/cjs/components/CourseForm/Edit.js +5 -4
- package/lib/cjs/components/CourseParticipantsButton/CourseParticipantsButton.js +4 -4
- package/lib/cjs/components/EditCourse/Lessons/AddButton.js +3 -2
- package/lib/cjs/components/EditCourse/Lessons/ChangeLessonStatus.js +6 -4
- package/lib/cjs/components/EditCourse/Lessons/FieldName.js +3 -2
- package/lib/cjs/components/EditCourse/Lessons/LessonRow.js +3 -2
- package/lib/cjs/components/EditCourse/Lessons/SectionRow.js +3 -2
- package/lib/cjs/components/EditCourse/Lessons.js +3 -3
- package/lib/cjs/components/EditCourse/Options/SwitchForm.js +5 -1
- package/lib/cjs/components/EditCourse/Options.js +3 -2
- package/lib/cjs/components/LessonDrawer/LessonDrawer.js +3 -2
- package/lib/cjs/components/LessonEditForm/LessonEditForm.js +3 -2
- package/lib/cjs/components/LessonReleaseMenu/LessonReleaseMenu.js +4 -3
- package/lib/cjs/shared/AccordionLessons/AccordionLessons.js +5 -4
- package/lib/cjs/shared/ConfirmDialog/ConfirmDialog.js +11 -3
- package/lib/cjs/shared/CourseUsersTable/ChangeUsersStatus.js +5 -1
- package/lib/cjs/shared/CourseUsersTable/CourseUsersTable.js +5 -4
- package/lib/cjs/shared/CourseUsersTable/RemoveButton.js +1 -1
- package/lib/cjs/shared/CourseUsersTable/RequestButton.js +1 -1
- package/lib/cjs/shared/CourseUsersTable/SeeProgressButton.js +5 -3
- package/lib/cjs/shared/EmptyStatus/EmptyStatus.js +3 -2
- package/lib/cjs/shared/Media/File/DocComponent.js +3 -2
- package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +8 -7
- package/lib/esm/components/CategoryAutocomplete/constants.d.ts +1 -0
- package/lib/esm/components/CategoryAutocomplete/constants.js +1 -0
- package/lib/esm/components/CourseCompletedDialog/CourseCompletedDialog.js +5 -3
- package/lib/esm/components/CourseCompletedDialog/constants.d.ts +1 -0
- package/lib/esm/components/CourseCompletedDialog/constants.js +1 -0
- package/lib/esm/components/CourseContentMenu/CourseContentMenu.js +1 -1
- package/lib/esm/components/CourseDashboard/Student.d.ts +2 -2
- package/lib/esm/components/CourseDashboard/Student.js +6 -6
- package/lib/esm/components/CourseDashboard/Teacher/Comments.js +2 -2
- package/lib/esm/components/CourseDashboard/Teacher/Info.js +3 -2
- package/lib/esm/components/CourseForm/CourseForm.js +5 -4
- package/lib/esm/components/CourseForm/Dialog.js +5 -1
- package/lib/esm/components/CourseForm/Edit.js +5 -4
- package/lib/esm/components/CourseParticipantsButton/CourseParticipantsButton.js +4 -4
- package/lib/esm/components/EditCourse/Lessons/AddButton.js +3 -2
- package/lib/esm/components/EditCourse/Lessons/ChangeLessonStatus.js +6 -4
- package/lib/esm/components/EditCourse/Lessons/FieldName.js +3 -2
- package/lib/esm/components/EditCourse/Lessons/LessonRow.js +3 -2
- package/lib/esm/components/EditCourse/Lessons/SectionRow.js +3 -2
- package/lib/esm/components/EditCourse/Lessons.js +3 -3
- package/lib/esm/components/EditCourse/Options/SwitchForm.js +5 -1
- package/lib/esm/components/EditCourse/Options.js +3 -2
- package/lib/esm/components/LessonDrawer/LessonDrawer.js +3 -2
- package/lib/esm/components/LessonEditForm/LessonEditForm.js +4 -3
- package/lib/esm/components/LessonReleaseMenu/LessonReleaseMenu.js +4 -3
- package/lib/esm/shared/AccordionLessons/AccordionLessons.js +5 -4
- package/lib/esm/shared/ConfirmDialog/ConfirmDialog.js +12 -4
- package/lib/esm/shared/CourseUsersTable/ChangeUsersStatus.js +5 -1
- package/lib/esm/shared/CourseUsersTable/CourseUsersTable.js +5 -4
- package/lib/esm/shared/CourseUsersTable/RemoveButton.js +1 -1
- package/lib/esm/shared/CourseUsersTable/RequestButton.js +1 -1
- package/lib/esm/shared/CourseUsersTable/SeeProgressButton.js +6 -4
- package/lib/esm/shared/EmptyStatus/EmptyStatus.js +3 -2
- package/lib/esm/shared/Media/File/DocComponent.js +3 -2
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
|
@@ -27,7 +27,8 @@ const classes = {
|
|
|
27
27
|
avatarWrapper: `${PREFIX}-avatar-wrapper`,
|
|
28
28
|
progressWrapper: `${PREFIX}-progress-wrapper`,
|
|
29
29
|
progress: `${PREFIX}-progress`,
|
|
30
|
-
loadingButton: `${PREFIX}-loading-button
|
|
30
|
+
loadingButton: `${PREFIX}-loading-button`,
|
|
31
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
31
32
|
};
|
|
32
33
|
const Root = styled(Box, {
|
|
33
34
|
name: PREFIX,
|
|
@@ -144,10 +145,10 @@ function CourseUsersTable(inProps) {
|
|
|
144
145
|
if (i === array.length - 1) {
|
|
145
146
|
return _jsx(TableCell, { width: "14%" }, i);
|
|
146
147
|
}
|
|
147
|
-
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));
|
|
148
|
+
return (_jsx(TableCell, Object.assign({ width: mode === SCCourseUsersTableModeType.DASHBOARD ? '20%' : '25%' }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: cell.id, defaultMessage: cell.id }) })) }), i));
|
|
148
149
|
}) }) }), _jsxs(TableBody, { children: [users.length > 0 &&
|
|
149
|
-
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: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.joined_at || new Date() }) })) }), _jsx(TableCell, { children: _jsx(Typography, Object.assign({ variant: "body2" }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.last_active_at || new Date() }) })) }), mode === SCCourseUsersTableModeType.EDIT &&
|
|
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.contrastColor }, { 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.contrastColor }, { 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.contrastColor }, { 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.contrastColor }, { 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.contrastColor }, { children: _jsx(FormattedDate, { value: mode === SCCourseUsersTableModeType.REQUESTS ? user.date_joined : user.last_active_at || new Date() }) })) }), mode === SCCourseUsersTableModeType.EDIT &&
|
|
150
151
|
user.join_status !== SCCourseJoinStatusType.CREATOR &&
|
|
151
|
-
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: "
|
|
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 || !state.next, className: classes.loadingButton, onClick: handleNext }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { 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 })), dialog && _jsx(ConfirmDialog, { open: true, onClose: () => handleOpenDialog(null), onConfirm: handleConfirm })] })));
|
|
152
153
|
}
|
|
153
154
|
export default memo(CourseUsersTable);
|
|
@@ -42,6 +42,6 @@ function RemoveButton(props, ref) {
|
|
|
42
42
|
useImperativeHandle(ref, () => ({
|
|
43
43
|
handleManageUser: (userToRemove) => handleSubmit(userToRemove)
|
|
44
44
|
}), [handleSubmit]);
|
|
45
|
-
return (_jsx(Button, Object.assign({ size: "small", color: "inherit", variant: "
|
|
45
|
+
return (_jsx(Button, Object.assign({ size: "small", color: "inherit", variant: "contained", onClick: () => handleOpenDialog({ tab: SCCourseEditTabType.USERS, user }), loading: loading, disabled: loading }, { children: _jsx(Icon, { children: "close" }) })));
|
|
46
46
|
}
|
|
47
47
|
export default memo(forwardRef(RemoveButton));
|
|
@@ -70,6 +70,6 @@ function RequestButton(props, ref) {
|
|
|
70
70
|
useImperativeHandle(ref, () => ({
|
|
71
71
|
handleManageUser: (userToReject) => handleReject(userToReject)
|
|
72
72
|
}), [handleReject]);
|
|
73
|
-
return (_jsxs(Stack, Object.assign({ className: classes.requestButtonWrapper }, { children: [_jsx(Button, Object.assign({ size: "small", color: "primary", variant: "
|
|
73
|
+
return (_jsxs(Stack, Object.assign({ className: classes.requestButtonWrapper }, { children: [_jsx(Button, Object.assign({ size: "small", color: "primary", variant: "contained", onClick: handleAccept, loading: acceptLoading, disabled: acceptLoading }, { children: _jsx(Icon, { children: "check" }) })), _jsx(Button, Object.assign({ size: "small", color: "inherit", variant: "contained", onClick: () => handleOpenDialog({ tab: SCCourseEditTabType.REQUESTS, request: user }), loading: rejectLoading, disabled: rejectLoading }, { children: _jsx(Icon, { children: "close" }) }))] })));
|
|
74
74
|
}
|
|
75
75
|
export default memo(forwardRef(RequestButton));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Avatar, Button, Icon, IconButton, Skeleton, Stack, styled, Typography, useMediaQuery, useTheme } from '@mui/material';
|
|
3
3
|
import { Fragment, memo, useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
5
5
|
import BaseDialog from '../BaseDialog';
|
|
6
6
|
import { Link, SCPreferences, SCRoutes, useSCPreferences, useSCRouting } from '@selfcommunity/react-core';
|
|
7
7
|
import { PREFIX } from './constants';
|
|
@@ -16,7 +16,8 @@ const classes = {
|
|
|
16
16
|
infoOuterWrapper: `${PREFIX}-info-outer-wrapper`,
|
|
17
17
|
infoInnerWrapper: `${PREFIX}-info-inner-wrapper`,
|
|
18
18
|
avatarWrapper: `${PREFIX}-avatar-wrapper`,
|
|
19
|
-
avatar: `${PREFIX}-avatar
|
|
19
|
+
avatar: `${PREFIX}-avatar`,
|
|
20
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
20
21
|
};
|
|
21
22
|
const DialogRoot = styled(BaseDialog, {
|
|
22
23
|
name: PREFIX,
|
|
@@ -35,6 +36,7 @@ function SeeProgressButton(props) {
|
|
|
35
36
|
// HOOKS
|
|
36
37
|
const theme = useTheme();
|
|
37
38
|
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
39
|
+
const intl = useIntl();
|
|
38
40
|
const privateMessagingEnabled = useMemo(() => SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED in preferences && preferences[SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED].value, [preferences]);
|
|
39
41
|
// EFFECTS
|
|
40
42
|
useEffect(() => {
|
|
@@ -48,8 +50,8 @@ function SeeProgressButton(props) {
|
|
|
48
50
|
const handleToggleOpen = useCallback(() => {
|
|
49
51
|
setOpen((prev) => !prev);
|
|
50
52
|
}, [setOpen]);
|
|
51
|
-
return (_jsxs(Fragment, { children: [isMobile ? (_jsx(IconButton, Object.assign({ size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Icon, { children: "chevron_right" }) }))) : (_jsx(Button, Object.assign({ variant: "
|
|
53
|
+
return (_jsxs(Fragment, { children: [isMobile ? (_jsx(IconButton, Object.assign({ size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Icon, { children: "chevron_right" }) }))) : (_jsx(Button, Object.assign({ variant: "contained", size: "small", color: "inherit", onClick: handleToggleOpen }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.action.btn.label", defaultMessage: "ui.courseUsersTable.action.btn.label" }) })) }))), open && (_jsx(DialogRoot, Object.assign({ DialogContentProps: { dividers: isMobile }, open: true, scroll: "paper", onClose: handleToggleOpen, title: intl.formatMessage({ id: 'ui.courseUsersTable.dialog.title', defaultMessage: 'ui.courseUsersTable.dialog.title' }), className: classes.dialogRoot }, { children: _jsxs(Stack, Object.assign({ className: classes.contentWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoOuterWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.infoInnerWrapper }, { children: [_jsxs(Stack, Object.assign({ className: classes.avatarWrapper }, { children: [_jsx(Link, Object.assign({}, (!course.created_by.deleted && {
|
|
52
54
|
to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, course.created_by)
|
|
53
|
-
}), { children: _jsx(UserAvatar, Object.assign({ hide: !course.created_by.community_badge, smaller: true }, { children: _jsx(Avatar, { className: classes.avatar, src: user.avatar, alt: user.username }) })) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: user.username }))] })), privateMessagingEnabled && (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, user), variant: "
|
|
55
|
+
}), { children: _jsx(UserAvatar, Object.assign({ hide: !course.created_by.community_badge, smaller: true }, { children: _jsx(Avatar, { className: classes.avatar, src: user.avatar, alt: user.username }) })) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: user.username }))] })), privateMessagingEnabled && (_jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, user), variant: "contained", size: "small", color: "inherit" }, { children: _jsx(Typography, Object.assign({ variant: "body2", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.btn.label", defaultMessage: "ui.courseUsersTable.dialog.btn.label" }) })) })))] })), student ? (_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text1", defaultMessage: "ui.courseUsersTable.dialog.info.text1", values: { lessonsCompleted: student.num_lessons_completed } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" })), student ? (_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: "ui.courseUsersTable.dialog.info.text2", defaultMessage: "ui.courseUsersTable.dialog.info.text2", values: { courseCompleted: student.user_completion_rate } }) }))) : (_jsx(Skeleton, { animation: "wave", variant: "text", width: "100px", height: "21px" }))] })), _jsx(AccordionLessons, { course: student, viewerJoinStatus: course.join_status })] })) })))] }));
|
|
54
56
|
}
|
|
55
57
|
export default memo(SeeProgressButton);
|
|
@@ -8,7 +8,8 @@ const classes = {
|
|
|
8
8
|
root: `${PREFIX}-root`,
|
|
9
9
|
box: `${PREFIX}-box`,
|
|
10
10
|
rotatedBox: `${PREFIX}-rotated-box`,
|
|
11
|
-
icon: `${PREFIX}-icon
|
|
11
|
+
icon: `${PREFIX}-icon`,
|
|
12
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
12
13
|
};
|
|
13
14
|
const Root = styled(Stack, {
|
|
14
15
|
name: PREFIX,
|
|
@@ -18,6 +19,6 @@ const Root = styled(Stack, {
|
|
|
18
19
|
function EmptyStatus(props) {
|
|
19
20
|
// PROPS
|
|
20
21
|
const { icon, title, description, actions, className } = props;
|
|
21
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Stack, Object.assign({ className: classes.box }, { children: _jsx(Stack, Object.assign({ className: classes.rotatedBox }, { children: _jsx(Icon, Object.assign({ className: classes.icon, color: "disabled", fontSize: "large" }, { children: icon })) })) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })), description && (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: description, defaultMessage: description }) }))), actions] })));
|
|
22
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Stack, Object.assign({ className: classes.box }, { children: _jsx(Stack, Object.assign({ className: classes.rotatedBox }, { children: _jsx(Icon, Object.assign({ className: classes.icon, color: "disabled", fontSize: "large" }, { children: icon })) })) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })), description && (_jsx(Typography, Object.assign({ variant: "body1", className: classes.contrastColor }, { children: _jsx(FormattedMessage, { id: description, defaultMessage: description }) }))), actions] })));
|
|
22
23
|
}
|
|
23
24
|
export default memo(EmptyStatus);
|
|
@@ -18,7 +18,8 @@ const classes = {
|
|
|
18
18
|
title: `${PREFIX}-title`,
|
|
19
19
|
subtitle: `${PREFIX}-subtitle`,
|
|
20
20
|
actionWrapper: `${PREFIX}-action-wrapper`,
|
|
21
|
-
action: `${PREFIX}-action
|
|
21
|
+
action: `${PREFIX}-action`,
|
|
22
|
+
contrastColor: `${PREFIX}-contrast-color`
|
|
22
23
|
};
|
|
23
24
|
const Root = styled(Stack, {
|
|
24
25
|
name: PREFIX,
|
|
@@ -69,5 +70,5 @@ export default function DocComponent(props) {
|
|
|
69
70
|
return fallback;
|
|
70
71
|
}
|
|
71
72
|
}, [document.mimetype]);
|
|
72
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.docRoot, className) }, { children: [_jsx(Box, { component: "img", alt: document.title, src: getImage() }), _jsxs(Stack, Object.assign({ className: classes.textWrapper }, { children: [_jsx(Typography, Object.assign({ className: classes.title }, { children: document.title })), document.size && _jsx(Typography, Object.assign({ className: classes.subtitle }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && (_jsxs(Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && (_jsx(IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: _jsx(Icon, { children: "delete" }) }))), handleDownload && (_jsxs(_Fragment, { children: [document.mimetype === SCMimeTypes.PDF && (_jsx(IconButton, Object.assign({ className: classes.action, component: Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: _jsx(Icon, { children: "visibility" }) }))), _jsx(IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: _jsx(Icon, { children: "download" }) }))] }))] })))] })));
|
|
73
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.docRoot, className) }, { children: [_jsx(Box, { component: "img", alt: document.title, src: getImage() }), _jsxs(Stack, Object.assign({ className: classes.textWrapper }, { children: [_jsx(Typography, Object.assign({ className: classNames(classes.title, classes.contrastColor) }, { children: document.title })), document.size && _jsx(Typography, Object.assign({ className: classNames(classes.subtitle, classes.contrastColor) }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && (_jsxs(Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && (_jsx(IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: _jsx(Icon, { children: "delete" }) }))), handleDownload && (_jsxs(_Fragment, { children: [document.mimetype === SCMimeTypes.PDF && (_jsx(IconButton, Object.assign({ className: classes.action, component: Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: _jsx(Icon, { children: "visibility" }) }))), _jsx(IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: _jsx(Icon, { children: "download" }) }))] }))] })))] })));
|
|
73
74
|
}
|