@selfcommunity/react-ui 0.11.0-alpha.68 → 0.11.0-alpha.69
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/NavigationSettingsIconButton/NavigationSettingsIconButton.js +12 -4
- package/lib/cjs/components/PdfPreview/PdfPreview.js +6 -4
- package/lib/cjs/components/PdfPreviewDialog/PdfPreviewDialog.js +3 -3
- package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +12 -4
- package/lib/esm/components/PdfPreview/PdfPreview.js +7 -5
- package/lib/esm/components/PdfPreviewDialog/PdfPreviewDialog.js +3 -3
- package/lib/umd/react-ui.js +1 -1
- package/package.json +3 -3
|
@@ -145,9 +145,13 @@ function NavigationSettingsIconButton(inProps) {
|
|
|
145
145
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED] && ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsx)(material_1.ListItemButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWERS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.followers", defaultMessage: "ui.navigationSettingsIconButton.followers" }) })) }), "followers")),
|
|
146
146
|
connectionEnabled && ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsx)(material_1.ListItemButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_CONNECTIONS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.connections", defaultMessage: "ui.navigationSettingsIconButton.connections" }) })) }), "connections")),
|
|
147
147
|
preferences[react_core_1.SCPreferences.ADDONS_LOYALTY_POINTS_COLLECTION] && ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsx)(material_1.ListItemButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.LOYALTY_ROUTE_NAME, {}) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.loyalty", defaultMessage: "ui.navigationSettingsIconButton.loyalty" }) })) }), "loyaltyProgram")),
|
|
148
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] &&
|
|
148
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] &&
|
|
149
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_SCHEDULED_POSTS_ENABLED] &&
|
|
150
|
+
(react_core_1.UserUtils.isStaff(scUserContext.user) || react_core_1.UserUtils.isPublisher(scUserContext.user)) && ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsx)(material_1.ListItemButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_SCHEDULED_POSTS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.postsScheduled", defaultMessage: "ui.navigationSettingsIconButton.postsScheduled" }) })) }), "scheduledPosts")),
|
|
149
151
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] && ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsx)(material_1.ListItemButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.postsFollowed", defaultMessage: "ui.navigationSettingsIconButton.postsFollowed" }) })) }), "followedPosts")),
|
|
150
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] &&
|
|
152
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] &&
|
|
153
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_SCHEDULED_POSTS_ENABLED] &&
|
|
154
|
+
(react_core_1.UserUtils.isStaff(scUserContext.user) || react_core_1.UserUtils.isPublisher(scUserContext.user)) && ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsx)(material_1.ListItemButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_SCHEDULED_DISCUSSIONS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.discussionsScheduled", defaultMessage: "ui.navigationSettingsIconButton.discussionsScheduled" }) })) }), "scheduledDiscussions")),
|
|
151
155
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] && ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsx)(material_1.ListItemButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.discussionsFollowed", defaultMessage: "ui.navigationSettingsIconButton.discussionsFollowed" }) })) }), "followedDiscussions")),
|
|
152
156
|
preferences[react_core_1.SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED] && ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsx)(material_1.ListItemButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.privateMessages", defaultMessage: "ui.navigationSettingsIconButton.privateMessages" }) })) }), "privateMessages")),
|
|
153
157
|
...items.map((item, index) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsx)(material_1.ListItemButton, Object.assign({ component: react_core_1.Link, to: item.href }, { children: item.label })) }), `custom_item_${index}`))),
|
|
@@ -185,9 +189,13 @@ function NavigationSettingsIconButton(inProps) {
|
|
|
185
189
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED] && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWERS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.followers", defaultMessage: "ui.navigationSettingsIconButton.followers" }) }), "followers")),
|
|
186
190
|
connectionEnabled && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_CONNECTIONS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.connections", defaultMessage: "ui.navigationSettingsIconButton.connections" }) }), "connections")),
|
|
187
191
|
preferences[react_core_1.SCPreferences.ADDONS_LOYALTY_POINTS_COLLECTION] && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.LOYALTY_ROUTE_NAME, {}) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.loyalty", defaultMessage: "ui.navigationSettingsIconButton.loyalty" }) }), "loyaltyProgram")),
|
|
188
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] &&
|
|
192
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] &&
|
|
193
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_SCHEDULED_POSTS_ENABLED] &&
|
|
194
|
+
(react_core_1.UserUtils.isStaff(scUserContext.user) || react_core_1.UserUtils.isPublisher(scUserContext.user)) && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_SCHEDULED_POSTS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.postsScheduled", defaultMessage: "ui.navigationSettingsIconButton.postsScheduled" }) }), "scheduledPosts")),
|
|
189
195
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.postsFollowed", defaultMessage: "ui.navigationSettingsIconButton.postsFollowed" }) }), "followedPosts")),
|
|
190
|
-
preferences[react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] &&
|
|
196
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] &&
|
|
197
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_SCHEDULED_POSTS_ENABLED] &&
|
|
198
|
+
(react_core_1.UserUtils.isStaff(scUserContext.user) || react_core_1.UserUtils.isPublisher(scUserContext.user)) && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_SCHEDULED_DISCUSSIONS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.discussionsScheduled", defaultMessage: "ui.navigationSettingsIconButton.discussionsScheduled" }) }), "scheduledDiscussions")),
|
|
191
199
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME, scUserContext.user) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.discussionsFollowed", defaultMessage: "ui.navigationSettingsIconButton.discussionsFollowed" }) }), "followedDiscussions")),
|
|
192
200
|
preferences[react_core_1.SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED] && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.navigationSettingsIconButton.privateMessages", defaultMessage: "ui.navigationSettingsIconButton.privateMessages" }) }), "privateMessages")),
|
|
193
201
|
...items.map((item, index) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, component: react_core_1.Link, to: item.href }, { children: item.label }), `custom_item_${index}`))),
|
|
@@ -27,8 +27,8 @@ const classes = {
|
|
|
27
27
|
const Root = (0, material_1.styled)(material_1.Box, {
|
|
28
28
|
name: PREFIX,
|
|
29
29
|
slot: 'Root',
|
|
30
|
-
overridesResolver: (
|
|
31
|
-
})((
|
|
30
|
+
overridesResolver: (_props, styles) => styles.root
|
|
31
|
+
})(() => ({}));
|
|
32
32
|
// Default options conf PDFViewer
|
|
33
33
|
const options = {
|
|
34
34
|
cMapUrl: '/cmaps/',
|
|
@@ -51,6 +51,8 @@ function PdfPreview(inProps) {
|
|
|
51
51
|
const [numPages, setNumPages] = (0, react_1.useState)();
|
|
52
52
|
const [containerRef, setContainerRef] = (0, react_1.useState)(null);
|
|
53
53
|
const [containerWidth, setContainerWidth] = (0, react_1.useState)(maxWidth);
|
|
54
|
+
const theme = (0, material_1.useTheme)();
|
|
55
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
54
56
|
// CONTEXT
|
|
55
57
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
56
58
|
const onResize = (0, react_1.useCallback)((entries) => {
|
|
@@ -83,8 +85,8 @@ function PdfPreview(inProps) {
|
|
|
83
85
|
}
|
|
84
86
|
}, [scUserContext.user, scUserContext.session]);
|
|
85
87
|
function renderDocument() {
|
|
86
|
-
return ((0, jsx_runtime_1.jsx)(react_pdf_1.Document, Object.assign({ onLoadSuccess: onDocumentLoadSuccess, loading: (0, jsx_runtime_1.jsx)(Skeleton_1.default, {}), file: url, className: classes.documentPdf, options: options }, { children: Array.from({ length: numPages }, (
|
|
87
|
-
return ((0, jsx_runtime_1.jsx)(react_pdf_1.Page, { className: classes.documentPdfPage, pageNumber: index + 1, width: containerWidth ? Math.min(containerWidth, maxWidth) : maxWidth, renderTextLayer: false }, `page_${index + 1}`));
|
|
88
|
+
return ((0, jsx_runtime_1.jsx)(react_pdf_1.Document, Object.assign({ onLoadSuccess: onDocumentLoadSuccess, loading: (0, jsx_runtime_1.jsx)(Skeleton_1.default, {}), file: url, className: classes.documentPdf, options: options }, { children: Array.from({ length: numPages }, (_el, index) => {
|
|
89
|
+
return ((0, jsx_runtime_1.jsx)(react_pdf_1.Page, { className: classes.documentPdfPage, pageNumber: index + 1, width: containerWidth ? Math.min(containerWidth, maxWidth) : maxWidth, renderTextLayer: false, scale: !isMobile ? 0.7 : undefined }, `page_${index + 1}`));
|
|
88
90
|
}) })));
|
|
89
91
|
}
|
|
90
92
|
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.documentPdfWrapper, ref: setContainerRef }, { children: isLoading || !pdfUrl ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.documentPdfPage }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { maxWidth: maxWidth }) }))) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: renderDocument() })) })) })));
|
|
@@ -20,11 +20,11 @@ const classes = {
|
|
|
20
20
|
const Root = (0, material_1.styled)(BaseDialog_1.default, {
|
|
21
21
|
slot: 'Root',
|
|
22
22
|
name: PREFIX
|
|
23
|
-
})((
|
|
23
|
+
})(() => ({}));
|
|
24
24
|
const Transition = react_1.default.forwardRef(function Transition(props, ref) {
|
|
25
25
|
return (0, jsx_runtime_1.jsx)(material_1.Slide, Object.assign({ direction: "up", ref: ref }, props));
|
|
26
26
|
});
|
|
27
|
-
const NoTransition = react_1.default.forwardRef(function NoTransition(props
|
|
27
|
+
const NoTransition = react_1.default.forwardRef(function NoTransition(props) {
|
|
28
28
|
return (0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [" ", props.children, " "] });
|
|
29
29
|
});
|
|
30
30
|
function PdfPreviewDialog(inProps) {
|
|
@@ -58,6 +58,6 @@ function PdfPreviewDialog(inProps) {
|
|
|
58
58
|
if (!isPaymentsEnabled) {
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ fullScreen: true, scroll:
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ fullScreen: true, scroll: "paper", open: true, maxWidth: "md" }, (disableInitialTransition ? { TransitionComponent: NoTransition } : { TransitionComponent: Transition }), { className: (0, classnames_1.default)(classes.root, className), TransitionComponent: Transition, DialogContentProps: { sx: { overflow: 'hidden' } } }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.AppBar, Object.assign({ sx: { position: 'fixed', top: 0 } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Toolbar, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6", component: "div", sx: { flexGrow: 1 } }, { children: title })), pdfUrl && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ edge: "end", color: "inherit", onClick: handleDownload, "aria-label": "close" }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "download" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ edge: "end", color: "inherit", onClick: onClose, "aria-label": "close", sx: { ml: 2 } }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, className: classes.content }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, justifyContent: "center", alignContent: "center" }, { children: (0, jsx_runtime_1.jsx)(PdfPreview_1.default, Object.assign({}, PdfPreviewComponentProps, { pdfUrl: pdfUrl })) })) }))] })));
|
|
62
62
|
}
|
|
63
63
|
exports.default = PdfPreviewDialog;
|
|
@@ -143,9 +143,13 @@ export default function NavigationSettingsIconButton(inProps) {
|
|
|
143
143
|
preferences[SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED] && (_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsx(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_FOLLOWERS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.followers", defaultMessage: "ui.navigationSettingsIconButton.followers" }) })) }), "followers")),
|
|
144
144
|
connectionEnabled && (_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsx(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_CONNECTIONS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.connections", defaultMessage: "ui.navigationSettingsIconButton.connections" }) })) }), "connections")),
|
|
145
145
|
preferences[SCPreferences.ADDONS_LOYALTY_POINTS_COLLECTION] && (_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsx(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.LOYALTY_ROUTE_NAME, {}) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.loyalty", defaultMessage: "ui.navigationSettingsIconButton.loyalty" }) })) }), "loyaltyProgram")),
|
|
146
|
-
preferences[SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] &&
|
|
146
|
+
preferences[SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] &&
|
|
147
|
+
preferences[SCPreferences.CONFIGURATIONS_SCHEDULED_POSTS_ENABLED] &&
|
|
148
|
+
(UserUtils.isStaff(scUserContext.user) || UserUtils.isPublisher(scUserContext.user)) && (_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsx(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_SCHEDULED_POSTS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.postsScheduled", defaultMessage: "ui.navigationSettingsIconButton.postsScheduled" }) })) }), "scheduledPosts")),
|
|
147
149
|
preferences[SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] && (_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsx(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.postsFollowed", defaultMessage: "ui.navigationSettingsIconButton.postsFollowed" }) })) }), "followedPosts")),
|
|
148
|
-
preferences[SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] &&
|
|
150
|
+
preferences[SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] &&
|
|
151
|
+
preferences[SCPreferences.CONFIGURATIONS_SCHEDULED_POSTS_ENABLED] &&
|
|
152
|
+
(UserUtils.isStaff(scUserContext.user) || UserUtils.isPublisher(scUserContext.user)) && (_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsx(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_SCHEDULED_DISCUSSIONS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.discussionsScheduled", defaultMessage: "ui.navigationSettingsIconButton.discussionsScheduled" }) })) }), "scheduledDiscussions")),
|
|
149
153
|
preferences[SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] && (_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsx(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.discussionsFollowed", defaultMessage: "ui.navigationSettingsIconButton.discussionsFollowed" }) })) }), "followedDiscussions")),
|
|
150
154
|
preferences[SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED] && (_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsx(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.privateMessages", defaultMessage: "ui.navigationSettingsIconButton.privateMessages" }) })) }), "privateMessages")),
|
|
151
155
|
...items.map((item, index) => (_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsx(ListItemButton, Object.assign({ component: Link, to: item.href }, { children: item.label })) }), `custom_item_${index}`))),
|
|
@@ -183,9 +187,13 @@ export default function NavigationSettingsIconButton(inProps) {
|
|
|
183
187
|
preferences[SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED] && (_jsx(MenuItem, Object.assign({ className: classes.item, component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_FOLLOWERS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.followers", defaultMessage: "ui.navigationSettingsIconButton.followers" }) }), "followers")),
|
|
184
188
|
connectionEnabled && (_jsx(MenuItem, Object.assign({ className: classes.item, component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_CONNECTIONS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.connections", defaultMessage: "ui.navigationSettingsIconButton.connections" }) }), "connections")),
|
|
185
189
|
preferences[SCPreferences.ADDONS_LOYALTY_POINTS_COLLECTION] && (_jsx(MenuItem, Object.assign({ className: classes.item, component: Link, to: scRoutingContext.url(SCRoutes.LOYALTY_ROUTE_NAME, {}) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.loyalty", defaultMessage: "ui.navigationSettingsIconButton.loyalty" }) }), "loyaltyProgram")),
|
|
186
|
-
preferences[SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] &&
|
|
190
|
+
preferences[SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] &&
|
|
191
|
+
preferences[SCPreferences.CONFIGURATIONS_SCHEDULED_POSTS_ENABLED] &&
|
|
192
|
+
(UserUtils.isStaff(scUserContext.user) || UserUtils.isPublisher(scUserContext.user)) && (_jsx(MenuItem, Object.assign({ className: classes.item, component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_SCHEDULED_POSTS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.postsScheduled", defaultMessage: "ui.navigationSettingsIconButton.postsScheduled" }) }), "scheduledPosts")),
|
|
187
193
|
preferences[SCPreferences.CONFIGURATIONS_POST_TYPE_ENABLED] && (_jsx(MenuItem, Object.assign({ className: classes.item, component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.postsFollowed", defaultMessage: "ui.navigationSettingsIconButton.postsFollowed" }) }), "followedPosts")),
|
|
188
|
-
preferences[SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] &&
|
|
194
|
+
preferences[SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] &&
|
|
195
|
+
preferences[SCPreferences.CONFIGURATIONS_SCHEDULED_POSTS_ENABLED] &&
|
|
196
|
+
(UserUtils.isStaff(scUserContext.user) || UserUtils.isPublisher(scUserContext.user)) && (_jsx(MenuItem, Object.assign({ className: classes.item, component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_SCHEDULED_DISCUSSIONS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.discussionsScheduled", defaultMessage: "ui.navigationSettingsIconButton.discussionsScheduled" }) }), "scheduledDiscussions")),
|
|
189
197
|
preferences[SCPreferences.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED] && (_jsx(MenuItem, Object.assign({ className: classes.item, component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME, scUserContext.user) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.discussionsFollowed", defaultMessage: "ui.navigationSettingsIconButton.discussionsFollowed" }) }), "followedDiscussions")),
|
|
190
198
|
preferences[SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED] && (_jsx(MenuItem, Object.assign({ className: classes.item, component: Link, to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}) }, { children: _jsx(FormattedMessage, { id: "ui.navigationSettingsIconButton.privateMessages", defaultMessage: "ui.navigationSettingsIconButton.privateMessages" }) }), "privateMessages")),
|
|
191
199
|
...items.map((item, index) => (_jsx(MenuItem, Object.assign({ className: classes.item, component: Link, to: item.href }, { children: item.label }), `custom_item_${index}`))),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useState } from 'react';
|
|
4
|
-
import { Box, styled } from '@mui/material';
|
|
4
|
+
import { Box, styled, useMediaQuery, useTheme } from '@mui/material';
|
|
5
5
|
import { useThemeProps } from '@mui/system';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { Document, Page, pdfjs } from 'react-pdf';
|
|
@@ -24,8 +24,8 @@ const classes = {
|
|
|
24
24
|
const Root = styled(Box, {
|
|
25
25
|
name: PREFIX,
|
|
26
26
|
slot: 'Root',
|
|
27
|
-
overridesResolver: (
|
|
28
|
-
})((
|
|
27
|
+
overridesResolver: (_props, styles) => styles.root
|
|
28
|
+
})(() => ({}));
|
|
29
29
|
// Default options conf PDFViewer
|
|
30
30
|
const options = {
|
|
31
31
|
cMapUrl: '/cmaps/',
|
|
@@ -48,6 +48,8 @@ export default function PdfPreview(inProps) {
|
|
|
48
48
|
const [numPages, setNumPages] = useState();
|
|
49
49
|
const [containerRef, setContainerRef] = useState(null);
|
|
50
50
|
const [containerWidth, setContainerWidth] = useState(maxWidth);
|
|
51
|
+
const theme = useTheme();
|
|
52
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
51
53
|
// CONTEXT
|
|
52
54
|
const scUserContext = useSCUser();
|
|
53
55
|
const onResize = useCallback((entries) => {
|
|
@@ -80,8 +82,8 @@ export default function PdfPreview(inProps) {
|
|
|
80
82
|
}
|
|
81
83
|
}, [scUserContext.user, scUserContext.session]);
|
|
82
84
|
function renderDocument() {
|
|
83
|
-
return (_jsx(Document, Object.assign({ onLoadSuccess: onDocumentLoadSuccess, loading: _jsx(Skeleton, {}), file: url, className: classes.documentPdf, options: options }, { children: Array.from({ length: numPages }, (
|
|
84
|
-
return (_jsx(Page, { className: classes.documentPdfPage, pageNumber: index + 1, width: containerWidth ? Math.min(containerWidth, maxWidth) : maxWidth, renderTextLayer: false }, `page_${index + 1}`));
|
|
85
|
+
return (_jsx(Document, Object.assign({ onLoadSuccess: onDocumentLoadSuccess, loading: _jsx(Skeleton, {}), file: url, className: classes.documentPdf, options: options }, { children: Array.from({ length: numPages }, (_el, index) => {
|
|
86
|
+
return (_jsx(Page, { className: classes.documentPdfPage, pageNumber: index + 1, width: containerWidth ? Math.min(containerWidth, maxWidth) : maxWidth, renderTextLayer: false, scale: !isMobile ? 0.7 : undefined }, `page_${index + 1}`));
|
|
85
87
|
}) })));
|
|
86
88
|
}
|
|
87
89
|
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(Box, Object.assign({ className: classes.documentPdfWrapper, ref: setContainerRef }, { children: isLoading || !pdfUrl ? (_jsx(Box, Object.assign({ className: classes.documentPdfPage }, { children: _jsx(Skeleton, { maxWidth: maxWidth }) }))) : (_jsx(_Fragment, { children: renderDocument() })) })) })));
|
|
@@ -18,11 +18,11 @@ const classes = {
|
|
|
18
18
|
const Root = styled(BaseDialog, {
|
|
19
19
|
slot: 'Root',
|
|
20
20
|
name: PREFIX
|
|
21
|
-
})((
|
|
21
|
+
})(() => ({}));
|
|
22
22
|
const Transition = React.forwardRef(function Transition(props, ref) {
|
|
23
23
|
return _jsx(Slide, Object.assign({ direction: "up", ref: ref }, props));
|
|
24
24
|
});
|
|
25
|
-
const NoTransition = React.forwardRef(function NoTransition(props
|
|
25
|
+
const NoTransition = React.forwardRef(function NoTransition(props) {
|
|
26
26
|
return _jsxs(React.Fragment, { children: [" ", props.children, " "] });
|
|
27
27
|
});
|
|
28
28
|
export default function PdfPreviewDialog(inProps) {
|
|
@@ -56,5 +56,5 @@ export default function PdfPreviewDialog(inProps) {
|
|
|
56
56
|
if (!isPaymentsEnabled) {
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
|
-
return (_jsxs(Root, Object.assign({ fullScreen: true, scroll:
|
|
59
|
+
return (_jsxs(Root, Object.assign({ fullScreen: true, scroll: "paper", open: true, maxWidth: "md" }, (disableInitialTransition ? { TransitionComponent: NoTransition } : { TransitionComponent: Transition }), { className: classNames(classes.root, className), TransitionComponent: Transition, DialogContentProps: { sx: { overflow: 'hidden' } } }, rest, { children: [_jsx(AppBar, Object.assign({ sx: { position: 'fixed', top: 0 } }, { children: _jsxs(Toolbar, { children: [_jsx(Typography, Object.assign({ variant: "h6", component: "div", sx: { flexGrow: 1 } }, { children: title })), pdfUrl && (_jsx(IconButton, Object.assign({ edge: "end", color: "inherit", onClick: handleDownload, "aria-label": "close" }, { children: _jsx(Icon, { children: "download" }) }))), _jsx(IconButton, Object.assign({ edge: "end", color: "inherit", onClick: onClose, "aria-label": "close", sx: { ml: 2 } }, { children: _jsx(Icon, { children: "close" }) }))] }) })), _jsx(Grid, Object.assign({ container: true, className: classes.content }, { children: _jsx(Grid, Object.assign({ item: true, xs: 12, justifyContent: "center", alignContent: "center" }, { children: _jsx(PdfPreview, Object.assign({}, PdfPreviewComponentProps, { pdfUrl: pdfUrl })) })) }))] })));
|
|
60
60
|
}
|