@selfcommunity/react-ui 0.7.50-events.44 → 0.7.50-events.47
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/CreateEventButton/CreateEventButton.js +6 -4
- package/lib/cjs/components/CreateEventWidget/CreateEventWidget.d.ts +14 -0
- package/lib/cjs/components/CreateEventWidget/CreateEventWidget.js +63 -0
- package/lib/cjs/components/CreateEventWidget/Skeleton.d.ts +1 -0
- package/lib/cjs/components/CreateEventWidget/Skeleton.js +25 -0
- package/lib/cjs/components/CreateEventWidget/constants.d.ts +1 -0
- package/lib/cjs/components/CreateEventWidget/constants.js +4 -0
- package/lib/cjs/components/CreateEventWidget/index.d.ts +4 -0
- package/lib/cjs/components/CreateEventWidget/index.js +8 -0
- package/lib/cjs/components/Event/Event.d.ts +28 -0
- package/lib/cjs/components/Event/Event.js +64 -8
- package/lib/cjs/components/Event/Skeleton.d.ts +9 -3
- package/lib/cjs/components/Event/Skeleton.js +48 -6
- package/lib/cjs/components/EventHeader/EventHeader.js +10 -3
- package/lib/cjs/components/EventInfoWidget/EventInfoWidget.js +2 -1
- package/lib/cjs/components/EventInfoWidget/Skeleton.js +1 -1
- package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +8 -3
- package/lib/cjs/components/EventPartecipantsButton/EventPartecipantsButton.js +7 -8
- package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +3 -2
- package/lib/cjs/components/Events/Events.d.ts +6 -1
- package/lib/cjs/components/Events/Events.js +3 -3
- package/lib/cjs/components/FeedObjectMediaPreview/FeedObjectMediaPreview.d.ts +1 -1
- package/lib/cjs/components/FeedObjectMediaPreview/FeedObjectMediaPreview.js +1 -1
- package/lib/cjs/components/MyEventsWidget/MyEventsWidget.js +19 -10
- package/lib/cjs/components/MyEventsWidget/Skeleton.js +6 -26
- package/lib/cjs/components/Notification/Event/Event.d.ts +15 -0
- package/lib/cjs/components/Notification/Event/Event.js +71 -0
- package/lib/cjs/components/Notification/Event/index.d.ts +3 -0
- package/lib/cjs/components/Notification/Event/index.js +5 -0
- package/lib/cjs/components/Notification/Notification.js +26 -0
- package/lib/cjs/components/SnippetNotifications/SnippetNotifications.js +7 -0
- package/lib/cjs/components/SuggestedEventsWidget/Skeleton.d.ts +2 -0
- package/lib/cjs/components/SuggestedEventsWidget/Skeleton.js +28 -0
- package/lib/cjs/components/SuggestedEventsWidget/SuggestedEventsWidget.d.ts +14 -0
- package/lib/cjs/components/SuggestedEventsWidget/SuggestedEventsWidget.js +80 -0
- package/lib/cjs/components/SuggestedEventsWidget/constants.d.ts +1 -0
- package/lib/cjs/components/SuggestedEventsWidget/constants.js +4 -0
- package/lib/cjs/components/SuggestedEventsWidget/index.d.ts +4 -0
- package/lib/cjs/components/SuggestedEventsWidget/index.js +8 -0
- package/lib/cjs/components/ToastNotifications/ToastNotifications.js +7 -0
- package/lib/cjs/constants/EventActionsMenu.d.ts +6 -0
- package/lib/cjs/constants/EventActionsMenu.js +9 -0
- package/lib/cjs/constants/Media.d.ts +2 -0
- package/lib/cjs/constants/Media.js +3 -1
- package/lib/cjs/index.d.ts +4 -1
- package/lib/cjs/index.js +12 -4
- package/lib/cjs/shared/Calendar/index.js +1 -1
- package/lib/cjs/shared/EventActionsMenu/index.d.ts +49 -0
- package/lib/cjs/shared/EventActionsMenu/index.js +154 -0
- package/lib/cjs/shared/EventInfoDetails/index.d.ts +12 -0
- package/lib/cjs/shared/EventInfoDetails/index.js +3 -3
- package/lib/cjs/shared/Media/Event/DisplayComponent.d.ts +15 -0
- package/lib/cjs/shared/Media/Event/DisplayComponent.js +31 -0
- package/lib/cjs/shared/Media/Event/constants.d.ts +1 -0
- package/lib/cjs/shared/Media/Event/constants.js +4 -0
- package/lib/cjs/shared/Media/Event/filter.d.ts +3 -0
- package/lib/cjs/shared/Media/Event/filter.js +4 -0
- package/lib/cjs/shared/Media/Event/index.d.ts +3 -0
- package/lib/cjs/shared/Media/Event/index.js +14 -0
- package/lib/cjs/shared/Media/Link/PreviewComponent.js +1 -1
- package/lib/cjs/shared/Media/index.d.ts +2 -1
- package/lib/cjs/shared/Media/index.js +3 -1
- package/lib/cjs/types/event.d.ts +5 -0
- package/lib/cjs/types/event.js +9 -0
- package/lib/esm/components/CreateEventButton/CreateEventButton.js +6 -4
- package/lib/esm/components/CreateEventWidget/CreateEventWidget.d.ts +14 -0
- package/lib/esm/components/CreateEventWidget/CreateEventWidget.js +60 -0
- package/lib/esm/components/CreateEventWidget/Skeleton.d.ts +1 -0
- package/lib/esm/components/CreateEventWidget/Skeleton.js +21 -0
- package/lib/esm/components/CreateEventWidget/constants.d.ts +1 -0
- package/lib/esm/components/CreateEventWidget/constants.js +1 -0
- package/lib/esm/components/CreateEventWidget/index.d.ts +4 -0
- package/lib/esm/components/CreateEventWidget/index.js +4 -0
- package/lib/esm/components/Event/Event.d.ts +28 -0
- package/lib/esm/components/Event/Event.js +66 -10
- package/lib/esm/components/Event/Skeleton.d.ts +9 -3
- package/lib/esm/components/Event/Skeleton.js +50 -7
- package/lib/esm/components/EventHeader/EventHeader.js +11 -4
- package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +2 -1
- package/lib/esm/components/EventInfoWidget/Skeleton.js +1 -1
- package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +8 -3
- package/lib/esm/components/EventPartecipantsButton/EventPartecipantsButton.js +8 -9
- package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +3 -2
- package/lib/esm/components/Events/Events.d.ts +6 -1
- package/lib/esm/components/Events/Events.js +3 -3
- package/lib/esm/components/FeedObjectMediaPreview/FeedObjectMediaPreview.d.ts +1 -1
- package/lib/esm/components/FeedObjectMediaPreview/FeedObjectMediaPreview.js +2 -2
- package/lib/esm/components/MyEventsWidget/MyEventsWidget.js +23 -14
- package/lib/esm/components/MyEventsWidget/Skeleton.js +7 -27
- package/lib/esm/components/Notification/Event/Event.d.ts +15 -0
- package/lib/esm/components/Notification/Event/Event.js +68 -0
- package/lib/esm/components/Notification/Event/index.d.ts +3 -0
- package/lib/esm/components/Notification/Event/index.js +2 -0
- package/lib/esm/components/Notification/Notification.js +26 -0
- package/lib/esm/components/SnippetNotifications/SnippetNotifications.js +7 -0
- package/lib/esm/components/SuggestedEventsWidget/Skeleton.d.ts +2 -0
- package/lib/esm/components/SuggestedEventsWidget/Skeleton.js +24 -0
- package/lib/esm/components/SuggestedEventsWidget/SuggestedEventsWidget.d.ts +14 -0
- package/lib/esm/components/SuggestedEventsWidget/SuggestedEventsWidget.js +77 -0
- package/lib/esm/components/SuggestedEventsWidget/constants.d.ts +1 -0
- package/lib/esm/components/SuggestedEventsWidget/constants.js +1 -0
- package/lib/esm/components/SuggestedEventsWidget/index.d.ts +4 -0
- package/lib/esm/components/SuggestedEventsWidget/index.js +4 -0
- package/lib/esm/components/ToastNotifications/ToastNotifications.js +7 -0
- package/lib/esm/constants/EventActionsMenu.d.ts +6 -0
- package/lib/esm/constants/EventActionsMenu.js +6 -0
- package/lib/esm/constants/Media.d.ts +2 -0
- package/lib/esm/constants/Media.js +2 -0
- package/lib/esm/index.d.ts +4 -1
- package/lib/esm/index.js +6 -3
- package/lib/esm/shared/Calendar/index.js +1 -1
- package/lib/esm/shared/EventActionsMenu/index.d.ts +49 -0
- package/lib/esm/shared/EventActionsMenu/index.js +151 -0
- package/lib/esm/shared/EventInfoDetails/index.d.ts +12 -0
- package/lib/esm/shared/EventInfoDetails/index.js +3 -3
- package/lib/esm/shared/Media/Event/DisplayComponent.d.ts +15 -0
- package/lib/esm/shared/Media/Event/DisplayComponent.js +29 -0
- package/lib/esm/shared/Media/Event/constants.d.ts +1 -0
- package/lib/esm/shared/Media/Event/constants.js +1 -0
- package/lib/esm/shared/Media/Event/filter.d.ts +3 -0
- package/lib/esm/shared/Media/Event/filter.js +2 -0
- package/lib/esm/shared/Media/Event/index.d.ts +3 -0
- package/lib/esm/shared/Media/Event/index.js +11 -0
- package/lib/esm/shared/Media/Link/PreviewComponent.js +1 -1
- package/lib/esm/shared/Media/index.d.ts +2 -1
- package/lib/esm/shared/Media/index.js +2 -1
- package/lib/esm/types/event.d.ts +5 -0
- package/lib/esm/types/event.js +6 -0
- package/lib/umd/224.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
- package/lib/umd/84.js +0 -2
- /package/lib/umd/{84.js.LICENSE.txt → 224.js.LICENSE.txt} +0 -0
|
@@ -4,7 +4,6 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const styles_1 = require("@mui/material/styles");
|
|
7
|
-
const useMediaQuery_1 = tslib_1.__importDefault(require("@mui/material/useMediaQuery"));
|
|
8
7
|
const system_1 = require("@mui/system");
|
|
9
8
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
10
9
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
@@ -21,19 +20,22 @@ const User_1 = tslib_1.__importStar(require("../User"));
|
|
|
21
20
|
const PREFIX = 'SCEventPartecipantsButton';
|
|
22
21
|
const classes = {
|
|
23
22
|
root: `${PREFIX}-root`,
|
|
23
|
+
avatar: `${PREFIX}-avatar`,
|
|
24
|
+
partecipants: `${PREFIX}-partecipants`,
|
|
24
25
|
dialogRoot: `${PREFIX}-dialog-root`,
|
|
26
|
+
infiniteScroll: `${PREFIX}-infinite-scroll`,
|
|
25
27
|
endMessage: `${PREFIX}-end-message`
|
|
26
28
|
};
|
|
27
29
|
const Root = (0, styles_1.styled)(material_1.Button, {
|
|
28
30
|
name: PREFIX,
|
|
29
31
|
slot: 'Root',
|
|
30
32
|
overridesResolver: (_props, styles) => styles.root
|
|
31
|
-
})();
|
|
33
|
+
})(() => ({}));
|
|
32
34
|
const DialogRoot = (0, styles_1.styled)(BaseDialog_1.default, {
|
|
33
35
|
name: PREFIX,
|
|
34
|
-
slot: '
|
|
36
|
+
slot: 'DialogRoot',
|
|
35
37
|
overridesResolver: (_props, styles) => styles.dialogRoot
|
|
36
|
-
})();
|
|
38
|
+
})(() => ({}));
|
|
37
39
|
/**
|
|
38
40
|
*> API documentation for the Community-JS Event Partecipants Button component. Learn about the available props and the CSS API.
|
|
39
41
|
*
|
|
@@ -122,9 +124,6 @@ function EventPartecipantsButton(inProps) {
|
|
|
122
124
|
const handleToggleDialogOpen = (0, react_1.useCallback)(() => {
|
|
123
125
|
setOpen((prev) => !prev);
|
|
124
126
|
}, [setOpen]);
|
|
125
|
-
|
|
126
|
-
const theme = (0, material_1.useTheme)();
|
|
127
|
-
const isMobile = (0, useMediaQuery_1.default)(theme.breakpoints.down('md'));
|
|
128
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleToggleDialogOpen, disabled: loading || !scEvent || scEvent.goings_counter === 0 }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary", variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.eventPartecipantsButton.partecipants", id: "ui.eventPartecipantsButton.partecipants" }) })), loading || !scEvent ? ((0, jsx_runtime_1.jsx)(AvatarGroupSkeleton_1.default, Object.assign({}, rest))) : ((0, jsx_runtime_1.jsx)(material_1.AvatarGroup, Object.assign({ total: scEvent.goings_counter }, { children: followers.map((c) => ((0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: c.username, src: c.avatar }, c.id))) })))] })), open && ((0, jsx_runtime_1.jsx)(DialogRoot, Object.assign({ className: classes.dialogRoot, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.eventPartecipantsButton.dialogTitle", id: "ui.eventPartecipantsButton.dialogTitle", values: { total: scEvent.goings_counter } }), onClose: handleToggleDialogOpen, open: open }, DialogProps, { children: (0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ dataLength: followers.length, next: fetchFollowers, hasMoreNext: next !== null || loading, loaderNext: (0, jsx_runtime_1.jsx)(User_1.UserSkeleton, { elevation: 0 }), height: isMobile ? '100%' : 400, endMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.endMessage }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventPartecipantsButton.noOtherPartecipants", defaultMessage: "ui.eventPartecipantsButton.noOtherPartecipants" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: followers.map((follower) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(User_1.default, { elevation: 0, user: follower }) }, follower.id))) }) })) })))] }));
|
|
127
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), onClick: handleToggleDialogOpen, disabled: loading || !scEvent || scEvent.goings_counter === 0 }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.partecipants, variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.eventPartecipantsButton.partecipants", id: "ui.eventPartecipantsButton.partecipants" }) })), loading || !scEvent ? ((0, jsx_runtime_1.jsx)(AvatarGroupSkeleton_1.default, Object.assign({}, rest))) : ((0, jsx_runtime_1.jsx)(material_1.AvatarGroup, Object.assign({ total: scEvent.goings_counter }, { children: followers.map((c) => ((0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: c.username, src: c.avatar, className: classes.avatar }, c.id))) })))] })), open && ((0, jsx_runtime_1.jsx)(DialogRoot, Object.assign({ className: classes.dialogRoot, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.eventPartecipantsButton.dialogTitle", id: "ui.eventPartecipantsButton.dialogTitle", values: { total: scEvent.goings_counter } }), onClose: handleToggleDialogOpen, open: open }, DialogProps, { children: (0, jsx_runtime_1.jsx)(InfiniteScroll_1.default, Object.assign({ dataLength: followers.length, next: fetchFollowers, hasMoreNext: next !== null || loading, loaderNext: (0, jsx_runtime_1.jsx)(User_1.UserSkeleton, { elevation: 0 }), className: classes.infiniteScroll, endMessage: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.endMessage }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventPartecipantsButton.noOtherPartecipants", defaultMessage: "ui.eventPartecipantsButton.noOtherPartecipants" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: followers.map((follower) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: (0, jsx_runtime_1.jsx)(User_1.default, { elevation: 0, user: follower }) }, follower.id))) }) })) })))] }));
|
|
129
128
|
}
|
|
130
129
|
exports.default = EventPartecipantsButton;
|
|
@@ -181,10 +181,11 @@ function EventSubscribeButton(inProps) {
|
|
|
181
181
|
}
|
|
182
182
|
return _status;
|
|
183
183
|
}, [status, scEvent]);
|
|
184
|
-
if (!scEvent || (isEventAdmin && (user === null || user === void 0 ? void 0 : user.id) === scUserContext.user.id) || (isEventAdmin && !(user === null || user === void 0 ? void 0 : user.id))) {
|
|
184
|
+
if (!scEvent || (isEventAdmin && (user === null || user === void 0 ? void 0 : user.id) === scUserContext.user.id) || (isEventAdmin && !(user === null || user === void 0 ? void 0 : user.id)) || scEventsManager.isLoading(scEvent)) {
|
|
185
185
|
return null;
|
|
186
186
|
}
|
|
187
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) !== types_1.SCEventPrivacyType.PRIVATE
|
|
187
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) !== types_1.SCEventPrivacyType.PRIVATE ||
|
|
188
|
+
((scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) !== types_1.SCEventPrivacyType.PRIVATE && status && status !== types_1.SCEventSubscriptionStatusType.REQUESTED) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SelectRoot, Object.assign({ className: (0, classnames_1.default)(classes.selectRoot, className, { [classes.going]: status && status === types_1.SCEventSubscriptionStatusType.GOING }, { [classes.notGoing]: status && status === types_1.SCEventSubscriptionStatusType.NOT_GOING }), onClick: handleOpen, endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: open ? 'expand_less' : 'expand_more' }), startIcon: status &&
|
|
188
189
|
status !== types_1.SCEventSubscriptionStatusType.SUBSCRIBED && ((0, jsx_runtime_1.jsx)(material_1.Icon, { children: status === types_1.SCEventSubscriptionStatusType.GOING ? 'circle_checked' : 'circle_closed' })) }, rest, { children: getStatus })), isMobile ? ((0, jsx_runtime_1.jsx)(SwipeableDrawerRoot, Object.assign({ className: classes.drawerRoot, PaperProps: { className: classes.paper }, open: open, onClose: handleClose, onOpen: handleOpen, anchor: "bottom", disableSwipeToOpen: true }, { children: renderMenuItems() }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ className: classes.menuRoot, anchorEl: anchorEl, open: open, onClose: handleClose }, { children: renderMenuItems() })))] })) : ((0, jsx_runtime_1.jsx)(RequestRoot, Object.assign({ className: (0, classnames_1.default)(classes.requestRoot, className), variant: "outlined", size: "small", loading: scUserContext.user ? scEventsManager.isLoading(scEvent) : null, disabled: status === types_1.SCEventSubscriptionStatusType.REQUESTED }, rest, { children: getStatus }))) }));
|
|
189
190
|
}
|
|
190
191
|
exports.default = EventSubscribeButton;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventProps } from '../Event';
|
|
1
|
+
import { EventProps, EventSkeletonProps } from '../Event';
|
|
2
2
|
export interface EventsProps {
|
|
3
3
|
/**
|
|
4
4
|
* Overrides or extends the styles applied to the component.
|
|
@@ -15,6 +15,11 @@ export interface EventsProps {
|
|
|
15
15
|
* @default {}
|
|
16
16
|
*/
|
|
17
17
|
EventComponentProps?: EventProps;
|
|
18
|
+
/**
|
|
19
|
+
* Props to spread to single event skeleton object
|
|
20
|
+
* @default {}
|
|
21
|
+
*/
|
|
22
|
+
EventSkeletonComponentProps?: EventSkeletonProps;
|
|
18
23
|
/**
|
|
19
24
|
* Show/Hide filters
|
|
20
25
|
* @default true
|
|
@@ -76,7 +76,7 @@ function Events(inProps) {
|
|
|
76
76
|
props: inProps,
|
|
77
77
|
name: constants_1.PREFIX
|
|
78
78
|
});
|
|
79
|
-
const { endpointQueryParams = { limit: 8, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, className, EventComponentProps = {}, showFilters = false, filters, general =
|
|
79
|
+
const { endpointQueryParams = { limit: 8, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, className, EventComponentProps = { elevation: 0, square: true }, EventSkeletonComponentProps = { elevation: 0, square: true }, showFilters = false, filters, general = true } = props, rest = tslib_1.__rest(props, ["endpointQueryParams", "className", "EventComponentProps", "EventSkeletonComponentProps", "showFilters", "filters", "general"]);
|
|
80
80
|
// STATE
|
|
81
81
|
const [events, setEvents] = (0, react_1.useState)([]);
|
|
82
82
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
@@ -188,7 +188,7 @@ function Events(inProps) {
|
|
|
188
188
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
189
189
|
// @ts-ignore
|
|
190
190
|
selected: selected, deleteIcon: selected ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: selected ? handleDeleteClick : null }) }))] })) }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !events.length ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.noResults }, { children: (onlyStaffEnabled && !react_core_1.UserUtils.isStaff(scUserContext.user)) ||
|
|
191
|
-
(onlyStaffEnabled && react_core_1.UserUtils.isStaff(scUserContext.user) && general) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, {
|
|
191
|
+
(onlyStaffEnabled && react_core_1.UserUtils.isStaff(scUserContext.user) && general) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps)), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { actions: (0, jsx_runtime_1.jsx)(CreateEventButton_1.default, {}) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.noEvents.title.onlyStaff", defaultMessage: "ui.events.noEvents.title.onlyStaff" }) }))] })) }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.events }, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [filteredEvents.map((event) => ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 8, md: 6, className: classes.item }, { children: (0, jsx_runtime_1.jsx)(Event_1.default, Object.assign({ event: event, eventId: event.id }, EventComponentProps)) }), event.id))), filteredEvents.length % 2 !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, sm: 8, md: 6, className: classes.itemSkeleton }, { children: (0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { actions: (0, jsx_runtime_1.jsx)(CreateEventButton_1.default, Object.assign({ variant: "outlined", color: "primary", size: "small" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.skeleton.action.add", defaultMessage: "ui.events.skeleton.action.add" }) })) })) }), 'skeleton-item'))] }) })), Boolean(next) && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", variant: "text", onClick: handleNext, className: classes.showMore }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.button.seeMore", defaultMessage: "ui.events.button.seeMore" }) })))] })) })] }));
|
|
192
192
|
/**
|
|
193
193
|
* Renders root object (if content availability community option is false and user is anonymous, component is hidden)
|
|
194
194
|
*/
|
|
@@ -196,7 +196,7 @@ function Events(inProps) {
|
|
|
196
196
|
return null;
|
|
197
197
|
}
|
|
198
198
|
if (loading) {
|
|
199
|
-
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
199
|
+
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, { EventSkeletonProps: EventSkeletonComponentProps });
|
|
200
200
|
}
|
|
201
201
|
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: c })));
|
|
202
202
|
}
|
|
@@ -8,7 +8,7 @@ export interface FeedObjectMediaPreviewProps extends BoxProps {
|
|
|
8
8
|
medias: SCMediaType[];
|
|
9
9
|
/**
|
|
10
10
|
* Media types
|
|
11
|
-
* @default 'image', 'document', 'link', 'share'
|
|
11
|
+
* @default 'image', 'document', 'link', 'share', 'Event'
|
|
12
12
|
*/
|
|
13
13
|
mediaObjectTypes?: SCMediaObjectType[];
|
|
14
14
|
}
|
|
@@ -44,7 +44,7 @@ exports.default = (inProps) => {
|
|
|
44
44
|
props: inProps,
|
|
45
45
|
name: PREFIX
|
|
46
46
|
});
|
|
47
|
-
const { className, medias, mediaObjectTypes = [Media_1.File, Media_1.Link, Media_1.Share] } = props, rest = tslib_1.__rest(props, ["className", "medias", "mediaObjectTypes"]);
|
|
47
|
+
const { className, medias, mediaObjectTypes = [Media_1.File, Media_1.Link, Media_1.Share, Media_1.Event] } = props, rest = tslib_1.__rest(props, ["className", "medias", "mediaObjectTypes"]);
|
|
48
48
|
const { handleMediaClick } = (0, react_core_1.useSCMediaClick)();
|
|
49
49
|
if (!medias.length) {
|
|
50
50
|
/**
|
|
@@ -7,24 +7,28 @@ const styles_1 = require("@mui/material/styles");
|
|
|
7
7
|
const system_1 = require("@mui/system");
|
|
8
8
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
9
9
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
10
|
+
const types_1 = require("@selfcommunity/types");
|
|
10
11
|
const utils_1 = require("@selfcommunity/utils");
|
|
11
12
|
const react_1 = require("react");
|
|
12
13
|
const react_intl_1 = require("react-intl");
|
|
13
14
|
const Errors_1 = require("../../constants/Errors");
|
|
14
15
|
const Pagination_1 = require("../../constants/Pagination");
|
|
15
|
-
const Calendar_1 = tslib_1.__importDefault(require("../../shared/Calendar"));
|
|
16
|
-
const EventInfoDetails_1 = tslib_1.__importDefault(require("../../shared/EventInfoDetails"));
|
|
17
16
|
const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
|
|
18
17
|
const widget_1 = require("../../utils/widget");
|
|
19
|
-
const EventPartecipantsButton_1 = tslib_1.__importDefault(require("../EventPartecipantsButton"));
|
|
20
|
-
const User_1 = tslib_1.__importDefault(require("../User"));
|
|
21
18
|
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
22
19
|
const constants_1 = require("./constants");
|
|
23
20
|
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
21
|
+
const event_1 = require("../../types/event");
|
|
22
|
+
const Event_1 = tslib_1.__importDefault(require("../Event"));
|
|
24
23
|
const classes = {
|
|
25
24
|
root: `${constants_1.PREFIX}-root`,
|
|
26
25
|
titleWrapper: `${constants_1.PREFIX}-title-wrapper`,
|
|
26
|
+
imageWrapper: `${constants_1.PREFIX}-image-wrapper`,
|
|
27
|
+
image: `${constants_1.PREFIX}-image`,
|
|
27
28
|
content: `${constants_1.PREFIX}-content`,
|
|
29
|
+
nameWrapper: `${constants_1.PREFIX}-name-wrapper`,
|
|
30
|
+
name: `${constants_1.PREFIX}-name`,
|
|
31
|
+
user: `${constants_1.PREFIX}-user`,
|
|
28
32
|
firstDivider: `${constants_1.PREFIX}-first-divider`,
|
|
29
33
|
secondDivider: `${constants_1.PREFIX}-second-divider`,
|
|
30
34
|
actions: `${constants_1.PREFIX}-actions`,
|
|
@@ -35,14 +39,14 @@ const Root = (0, styles_1.styled)(Widget_1.default, {
|
|
|
35
39
|
name: constants_1.PREFIX,
|
|
36
40
|
slot: 'Root',
|
|
37
41
|
overridesResolver: (_props, styles) => styles.root
|
|
38
|
-
})();
|
|
42
|
+
})(() => ({}));
|
|
39
43
|
function MyEventsWidget(inProps) {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f;
|
|
41
44
|
// PROPS
|
|
42
45
|
const props = (0, system_1.useThemeProps)({
|
|
43
46
|
props: inProps,
|
|
44
47
|
name: constants_1.PREFIX
|
|
45
48
|
});
|
|
49
|
+
// CONST
|
|
46
50
|
const { endpointQueryParams = { limit: Pagination_1.DEFAULT_PAGINATION_LIMIT, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, cacheStrategy } = props, rest = tslib_1.__rest(props, ["endpointQueryParams", "cacheStrategy"]);
|
|
47
51
|
// STATE
|
|
48
52
|
const [state, dispatch] = (0, react_1.useReducer)(widget_1.dataWidgetReducer, {
|
|
@@ -56,6 +60,8 @@ function MyEventsWidget(inProps) {
|
|
|
56
60
|
// CONTEXT
|
|
57
61
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
58
62
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
63
|
+
const { features } = (0, react_core_1.useSCPreferences)();
|
|
64
|
+
const eventsEnabled = (0, react_1.useMemo)(() => features && features.includes(types_1.SCFeatureName.EVENT) && features.includes(types_1.SCFeatureName.TAGGING), [features]);
|
|
59
65
|
/**
|
|
60
66
|
* Initialize component
|
|
61
67
|
* Fetch data only if the component is not initialized and it is not loading data
|
|
@@ -92,13 +98,13 @@ function MyEventsWidget(inProps) {
|
|
|
92
98
|
// EFFECTS
|
|
93
99
|
(0, react_1.useEffect)(() => {
|
|
94
100
|
let _t;
|
|
95
|
-
if (scUserContext.user) {
|
|
101
|
+
if (eventsEnabled && scUserContext.user) {
|
|
96
102
|
_t = setTimeout(_initComponent);
|
|
97
103
|
return () => {
|
|
98
104
|
clearTimeout(_t);
|
|
99
105
|
};
|
|
100
106
|
}
|
|
101
|
-
}, [scUserContext.user]);
|
|
107
|
+
}, [scUserContext.user, eventsEnabled]);
|
|
102
108
|
const handlePrev = (0, react_1.useCallback)(() => {
|
|
103
109
|
setEventIndex(eventIndex - 1);
|
|
104
110
|
}, [eventIndex]);
|
|
@@ -110,14 +116,17 @@ function MyEventsWidget(inProps) {
|
|
|
110
116
|
_fetchNext();
|
|
111
117
|
}
|
|
112
118
|
}, [eventIndex, state.results]);
|
|
119
|
+
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
113
120
|
// RENDER
|
|
121
|
+
if (!eventsEnabled) {
|
|
122
|
+
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
123
|
+
}
|
|
114
124
|
if (!state.initialized || state.isLoadingNext) {
|
|
115
125
|
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
116
126
|
}
|
|
117
127
|
if (state.count === 0) {
|
|
118
128
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
119
129
|
}
|
|
120
|
-
|
|
121
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, rest, { children: [(0, jsx_runtime_1.jsx)(system_1.Box, Object.assign({ className: classes.titleWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.myEventsWidget.title", defaultMessage: "ui.myEventsWidget.title" }) })) })), (0, jsx_runtime_1.jsxs)(system_1.Box, Object.assign({ position: "relative" }, { children: [(0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", height: "170px", image: ((_a = state.results[eventIndex]) === null || _a === void 0 ? void 0 : _a.emotional_image) || ((_b = state.results[eventIndex]) === null || _b === void 0 ? void 0 : _b.image_medium), alt: (_c = state.results[eventIndex]) === null || _c === void 0 ? void 0 : _c.name }), (0, jsx_runtime_1.jsx)(Calendar_1.default, { day: new Date((_d = state.results[eventIndex]) === null || _d === void 0 ? void 0 : _d.start_date).getDate() })] })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3", marginBottom: "10px" }, { children: (_e = state.results[eventIndex]) === null || _e === void 0 ? void 0 : _e.name })), (0, jsx_runtime_1.jsx)(EventInfoDetails_1.default, { event: state.results[eventIndex] }), (0, jsx_runtime_1.jsx)(User_1.default, { user: (_f = state.results[eventIndex]) === null || _f === void 0 ? void 0 : _f.managed_by, elevation: 0, secondary: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.myEventsWidget.planner", defaultMessage: "ui.myEventsWidget.planner" }) })) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.firstDivider }), (0, jsx_runtime_1.jsx)(EventPartecipantsButton_1.default, { event: state.results[eventIndex], eventId: state.results[eventIndex].id }), (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.secondDivider })] })), (0, jsx_runtime_1.jsxs)(material_1.CardActions, Object.assign({ className: classes.actions }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "small", disabled: eventIndex === 0, className: classes.arrows, onClick: handlePrev }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "chevron_left" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ href: scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, {}), className: classes.actionButton }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.myEventsWidget.showAll", defaultMessage: "ui.myEventsWidget.showAll" }) })) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "small", disabled: eventIndex === state.count - 1, className: classes.arrows, onClick: handleNext }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "chevron_right" }) }))] }))] })));
|
|
130
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, rest, { children: [(0, jsx_runtime_1.jsx)(system_1.Box, Object.assign({ className: classes.titleWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.myEventsWidget.title", defaultMessage: "ui.myEventsWidget.title" }) })) })), (0, jsx_runtime_1.jsx)(Event_1.default, { event: state.results[eventIndex], template: event_1.SCEventTemplateType.DETAIL, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), elevation: 0, square: true }), (0, jsx_runtime_1.jsxs)(material_1.CardActions, Object.assign({ className: classes.actions }, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "small", disabled: eventIndex === 0, className: classes.arrows, onClick: handlePrev }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "chevron_left" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ href: scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, {}), className: classes.actionButton }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.myEventsWidget.showAll", defaultMessage: "ui.myEventsWidget.showAll" }) })) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "small", disabled: eventIndex === state.count - 1, className: classes.arrows, onClick: handleNext }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "chevron_right" }) }))] }))] })));
|
|
122
131
|
}
|
|
123
132
|
exports.default = MyEventsWidget;
|
|
@@ -7,6 +7,8 @@ const Skeleton_1 = tslib_1.__importDefault(require("@mui/material/Skeleton"));
|
|
|
7
7
|
const styles_1 = require("@mui/material/styles");
|
|
8
8
|
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
9
9
|
const constants_1 = require("./constants");
|
|
10
|
+
const event_1 = require("../../types/event");
|
|
11
|
+
const Event_1 = require("../Event");
|
|
10
12
|
const classes = {
|
|
11
13
|
root: `${constants_1.PREFIX}-skeleton-root`,
|
|
12
14
|
calendar: `${constants_1.PREFIX}-calendar`,
|
|
@@ -17,32 +19,10 @@ const classes = {
|
|
|
17
19
|
};
|
|
18
20
|
const Root = (0, styles_1.styled)(Widget_1.default, {
|
|
19
21
|
name: constants_1.PREFIX,
|
|
20
|
-
slot: 'SkeletonRoot'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
position: 'absolute',
|
|
24
|
-
bottom: '-36px',
|
|
25
|
-
left: '24px',
|
|
26
|
-
boxShadow: '0px 3px 8px #00000040'
|
|
27
|
-
},
|
|
28
|
-
[`& .${classes.content}`]: {
|
|
29
|
-
padding: `52px ${theme.spacing(3)} 0 !important`,
|
|
30
|
-
[`& .${classes.firstDivider}`]: {
|
|
31
|
-
marginTop: '18px',
|
|
32
|
-
marginBottom: '16px'
|
|
33
|
-
},
|
|
34
|
-
[`& .${classes.secondDivider}`]: {
|
|
35
|
-
marginTop: '16px',
|
|
36
|
-
marginBottom: '18px'
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
[`& .${classes.actions}`]: {
|
|
40
|
-
padding: `0 ${theme.spacing(3)} 18px`,
|
|
41
|
-
justifyContent: 'center',
|
|
42
|
-
gap: '56px'
|
|
43
|
-
}
|
|
44
|
-
}));
|
|
22
|
+
slot: 'SkeletonRoot',
|
|
23
|
+
overridesResolver: (_props, styles) => styles.skeletonRoot
|
|
24
|
+
})(() => ({}));
|
|
45
25
|
function MyEventsWidgetSkeleton() {
|
|
46
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ padding: "12px 16px" }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "141px", height: "
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ padding: "12px 16px" }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "141px", height: "33px" }) })), (0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, { template: event_1.SCEventTemplateType.DETAIL, elevation: 0, square: true }), (0, jsx_runtime_1.jsxs)(material_1.CardActions, Object.assign({ className: classes.actions }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "rounded", width: "14px", height: "14px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "52px", height: "20px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "rounded", width: "14px", height: "14px" })] }))] })));
|
|
47
27
|
}
|
|
48
28
|
exports.default = MyEventsWidgetSkeleton;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SCNotificationEventActivityType } from '@selfcommunity/types';
|
|
2
|
+
import { NotificationItemProps } from '../../../shared/NotificationItem';
|
|
3
|
+
export interface NotificationEventProps extends Pick<NotificationItemProps, Exclude<keyof NotificationItemProps, 'image' | 'disableTypography' | 'primary' | 'primaryTypographyProps' | 'secondary' | 'secondaryTypographyProps' | 'actions' | 'footer' | 'isNew'>> {
|
|
4
|
+
/**
|
|
5
|
+
* Notification obj
|
|
6
|
+
* @default null
|
|
7
|
+
*/
|
|
8
|
+
notificationObject: SCNotificationEventActivityType;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* This component render the content of the notification of type event
|
|
12
|
+
* @constructor
|
|
13
|
+
* @param props
|
|
14
|
+
*/
|
|
15
|
+
export default function EventNotification(props: NotificationEventProps): JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
9
|
+
const types_1 = require("@selfcommunity/types");
|
|
10
|
+
const react_intl_1 = require("react-intl");
|
|
11
|
+
const DateTimeAgo_1 = tslib_1.__importDefault(require("../../../shared/DateTimeAgo"));
|
|
12
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
13
|
+
const types_2 = require("../../../types");
|
|
14
|
+
const NotificationItem_1 = tslib_1.__importDefault(require("../../../shared/NotificationItem"));
|
|
15
|
+
const lab_1 = require("@mui/lab");
|
|
16
|
+
const UserDeletedSnackBar_1 = tslib_1.__importDefault(require("../../../shared/UserDeletedSnackBar"));
|
|
17
|
+
const UserAvatar_1 = tslib_1.__importDefault(require("../../../shared/UserAvatar"));
|
|
18
|
+
const constants_1 = require("../constants");
|
|
19
|
+
const Event_1 = tslib_1.__importDefault(require("../../Event"));
|
|
20
|
+
const classes = {
|
|
21
|
+
root: `${constants_1.PREFIX}-event-root`,
|
|
22
|
+
avatar: `${constants_1.PREFIX}-avatar`,
|
|
23
|
+
actions: `${constants_1.PREFIX}-actions`,
|
|
24
|
+
seeButton: `${constants_1.PREFIX}see-button`,
|
|
25
|
+
activeAt: `${constants_1.PREFIX}-active-at`,
|
|
26
|
+
snippetTime: `${constants_1.PREFIX}-snippet-time`,
|
|
27
|
+
username: `${constants_1.PREFIX}-username`
|
|
28
|
+
};
|
|
29
|
+
const Root = (0, styles_1.styled)(NotificationItem_1.default, {
|
|
30
|
+
name: constants_1.PREFIX,
|
|
31
|
+
slot: 'EventRoot'
|
|
32
|
+
})(() => ({}));
|
|
33
|
+
/**
|
|
34
|
+
* This component render the content of the notification of type event
|
|
35
|
+
* @constructor
|
|
36
|
+
* @param props
|
|
37
|
+
*/
|
|
38
|
+
function EventNotification(props) {
|
|
39
|
+
// PROPS
|
|
40
|
+
const { notificationObject, id = `n_${props.notificationObject['sid']}`, className, template = types_2.SCNotificationObjectTemplateType.DETAIL } = props, rest = tslib_1.__rest(props, ["notificationObject", "id", "className", "template"]);
|
|
41
|
+
// CONTEXT
|
|
42
|
+
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
43
|
+
// STATE
|
|
44
|
+
const [openAlert, setOpenAlert] = (0, react_1.useState)(false);
|
|
45
|
+
// CONST
|
|
46
|
+
const isSnippetTemplate = template === types_2.SCNotificationObjectTemplateType.SNIPPET;
|
|
47
|
+
const isToastTemplate = template === types_2.SCNotificationObjectTemplateType.TOAST;
|
|
48
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
49
|
+
// RENDER
|
|
50
|
+
if (isSnippetTemplate || isToastTemplate) {
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className, `${constants_1.PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, image: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!notificationObject.user.deleted && {
|
|
52
|
+
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
|
|
53
|
+
}), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !notificationObject.user.community_badge, smaller: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: notificationObject.user.username, variant: "circular", src: notificationObject.user.avatar, classes: { root: classes.avatar } }) })) })), primary: (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!notificationObject.user.deleted && {
|
|
54
|
+
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
|
|
55
|
+
}), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: notificationObject.user.username })), ' ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.notification.event.${notificationObject.type}`, defaultMessage: `ui.notification.event.${notificationObject.type}`, values: {
|
|
56
|
+
icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, { children: chunks }),
|
|
57
|
+
event: notificationObject.event.name,
|
|
58
|
+
link: (...chunks) => (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: chunks }))
|
|
59
|
+
} })] }), secondary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.notification.event.dateTime", defaultMessage: "ui.notification.event.dateTime", values: {
|
|
60
|
+
date: intl.formatDate(notificationObject.event.start_date, {
|
|
61
|
+
weekday: 'long',
|
|
62
|
+
day: 'numeric',
|
|
63
|
+
year: 'numeric',
|
|
64
|
+
month: 'long'
|
|
65
|
+
}),
|
|
66
|
+
hour: intl.formatDate(notificationObject.event.start_date, { hour: 'numeric', minute: 'numeric' })
|
|
67
|
+
} }) })), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ component: "p", variant: "body2" }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.notification.event.privacy.${notificationObject.event.privacy}`, defaultMessage: `ui.notification.event.privacy.${notificationObject.event.privacy}` }), ' ', "-", ' ', notificationObject.event.location === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.notification.event.address.live.label`, defaultMessage: `ui.notification.event.address.live.label` })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.notification.event.address.online.label`, defaultMessage: `ui.notification.event.address.online.label` }))] }))] }), footer: isToastTemplate ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.notification.event.button.see", defaultMessage: "ui.notification.event.button.see" }) })) }))] }))) : ((0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.snippetTime })) }, rest)));
|
|
68
|
+
}
|
|
69
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className, `${constants_1.PREFIX}-${template}`), template: template, isNew: notificationObject.is_new, disableTypography: true, primary: (0, jsx_runtime_1.jsx)(Event_1.default, { event: notificationObject.event, showActions: false }), actions: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2 }, { children: [(0, jsx_runtime_1.jsx)(DateTimeAgo_1.default, { date: notificationObject.active_at, className: classes.activeAt }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ color: 'primary', variant: "outlined", size: "small", classes: { root: classes.seeButton }, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, notificationObject.event) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.notification.event.button.see", defaultMessage: "ui.notification.event.button.see" }) }))] })) }, rest)), openAlert && (0, jsx_runtime_1.jsx)(UserDeletedSnackBar_1.default, { open: openAlert, handleClose: () => setOpenAlert(false) })] }));
|
|
70
|
+
}
|
|
71
|
+
exports.default = EventNotification;
|
|
@@ -37,6 +37,7 @@ const UserDeletedSnackBar_1 = tslib_1.__importDefault(require("../../shared/User
|
|
|
37
37
|
const UserAvatar_1 = tslib_1.__importDefault(require("../../shared/UserAvatar"));
|
|
38
38
|
const constants_1 = require("./constants");
|
|
39
39
|
const Group_1 = tslib_1.__importDefault(require("./Group"));
|
|
40
|
+
const Event_1 = tslib_1.__importDefault(require("./Event/Event"));
|
|
40
41
|
const messages = (0, react_intl_1.defineMessages)({
|
|
41
42
|
receivePrivateMessage: {
|
|
42
43
|
id: 'ui.notification.receivePrivateMessage',
|
|
@@ -193,6 +194,25 @@ function UserNotification(inProps) {
|
|
|
193
194
|
b: (...chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|
|
194
195
|
})] }) }));
|
|
195
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Event notifications header
|
|
199
|
+
*/
|
|
200
|
+
if (notificationObject.aggregated &&
|
|
201
|
+
(notificationObject.aggregated[0].type === types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_EVENT ||
|
|
202
|
+
notificationObject.aggregated[0].type === types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_EVENT ||
|
|
203
|
+
notificationObject.aggregated[0].type === types_1.SCNotificationTypologyType.USER_ADDED_TO_EVENT ||
|
|
204
|
+
notificationObject.aggregated[0].type === types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT)) {
|
|
205
|
+
let eventNotification = notificationObject.aggregated[0];
|
|
206
|
+
return ((0, jsx_runtime_1.jsx)(material_1.CardHeader, { className: classes.header, avatar: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!eventNotification.user.deleted && {
|
|
207
|
+
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, eventNotification.user)
|
|
208
|
+
}), { onClick: eventNotification.user.deleted ? () => setOpenAlert(true) : null }, { children: (0, jsx_runtime_1.jsx)(UserAvatar_1.default, Object.assign({ hide: !eventNotification.user.community_badge, smaller: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { className: classes.avatar, alt: eventNotification.user.username, variant: "circular", src: eventNotification.user.avatar }) })) })), titleTypographyProps: { className: classes.title, variant: 'subtitle1' }, title: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({}, (!eventNotification.user.deleted && {
|
|
209
|
+
to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, eventNotification.user)
|
|
210
|
+
}), { onClick: eventNotification.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }, { children: eventNotification.user.username })), ' ', (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.notification.${notificationObject.aggregated[0].type}`, defaultMessage: `ui.notification.${notificationObject.aggregated[0].type}`, values: {
|
|
211
|
+
icon: (...chunks) => (0, jsx_runtime_1.jsx)(Icon_1.default, { children: chunks }),
|
|
212
|
+
event: eventNotification.event.name,
|
|
213
|
+
link: (...chunks) => (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, eventNotification.event) }, { children: chunks }))
|
|
214
|
+
} })] }) }));
|
|
215
|
+
}
|
|
196
216
|
/**
|
|
197
217
|
* Group notifications header
|
|
198
218
|
*/
|
|
@@ -301,6 +321,12 @@ function UserNotification(inProps) {
|
|
|
301
321
|
n.type === types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP) {
|
|
302
322
|
return (0, jsx_runtime_1.jsx)(Group_1.default, { notificationObject: n }, i);
|
|
303
323
|
}
|
|
324
|
+
else if (n.type === types_1.SCNotificationTypologyType.USER_ADDED_TO_EVENT ||
|
|
325
|
+
n.type === types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_EVENT ||
|
|
326
|
+
n.type === types_1.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_EVENT ||
|
|
327
|
+
n.type === types_1.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT) {
|
|
328
|
+
return (0, jsx_runtime_1.jsx)(Event_1.default, { notificationObject: n }, i);
|
|
329
|
+
}
|
|
304
330
|
return null;
|
|
305
331
|
}
|
|
306
332
|
/**
|
|
@@ -35,6 +35,7 @@ const Contribution_1 = tslib_1.__importDefault(require("../Notification/Contribu
|
|
|
35
35
|
const NotificationItem_1 = tslib_1.__importDefault(require("../../shared/NotificationItem"));
|
|
36
36
|
const constants_1 = require("./constants");
|
|
37
37
|
const Group_1 = tslib_1.__importDefault(require("../Notification/Group"));
|
|
38
|
+
const Event_1 = tslib_1.__importDefault(require("../Notification/Event/Event"));
|
|
38
39
|
const classes = {
|
|
39
40
|
root: `${constants_1.PREFIX}-root`,
|
|
40
41
|
notificationsWrap: `${constants_1.PREFIX}-notifications-wrap`,
|
|
@@ -262,6 +263,12 @@ function SnippetNotifications(inProps) {
|
|
|
262
263
|
n.type === types_2.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP) {
|
|
263
264
|
return (0, jsx_runtime_1.jsx)(Group_1.default, { notificationObject: n, template: types_1.SCNotificationObjectTemplateType.SNIPPET }, i);
|
|
264
265
|
}
|
|
266
|
+
else if (n.type === types_2.SCNotificationTypologyType.USER_ADDED_TO_EVENT ||
|
|
267
|
+
n.type === types_2.SCNotificationTypologyType.USER_INVITED_TO_JOIN_EVENT ||
|
|
268
|
+
n.type === types_2.SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_EVENT ||
|
|
269
|
+
n.type === types_2.SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT) {
|
|
270
|
+
return (0, jsx_runtime_1.jsx)(Event_1.default, { notificationObject: n, template: types_1.SCNotificationObjectTemplateType.SNIPPET }, i);
|
|
271
|
+
}
|
|
265
272
|
if (type && handleNotification) {
|
|
266
273
|
/** Override content */
|
|
267
274
|
content = handleNotification(type, n, content);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const system_1 = require("@mui/system");
|
|
7
|
+
require("swiper/css");
|
|
8
|
+
const react_1 = require("swiper/react");
|
|
9
|
+
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
const Event_1 = require("../Event");
|
|
12
|
+
const event_1 = require("../../types/event");
|
|
13
|
+
const classes = {
|
|
14
|
+
root: `${constants_1.PREFIX}-skeleton-root`,
|
|
15
|
+
content: `${constants_1.PREFIX}-content`,
|
|
16
|
+
title: `${constants_1.PREFIX}-title`,
|
|
17
|
+
swiper: `${constants_1.PREFIX}-swiper`,
|
|
18
|
+
actions: `${constants_1.PREFIX}-actions`
|
|
19
|
+
};
|
|
20
|
+
const Root = (0, system_1.styled)(Widget_1.default, {
|
|
21
|
+
name: constants_1.PREFIX,
|
|
22
|
+
slot: 'SkeletonRoot',
|
|
23
|
+
overridesResolver: (_props, styles) => styles.skeletonRoot
|
|
24
|
+
})(() => ({}));
|
|
25
|
+
function SuggestedEventsWidgetSkeleton() {
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { className: classes.title, animation: "wave", width: "141px", height: "23px" }), (0, jsx_runtime_1.jsx)(react_1.Swiper, Object.assign({ spaceBetween: 8, slidesPerView: "auto" }, { children: [1, 2, 3, 4, 5, 6, 7].map((_element, i) => ((0, jsx_runtime_1.jsx)(react_1.SwiperSlide, Object.assign({ className: classes.swiper }, { children: (0, jsx_runtime_1.jsx)(Event_1.EventSkeleton, { template: event_1.SCEventTemplateType.PREVIEW, variant: "outlined", actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}) }) }), i))) }))] })), (0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", width: "52px", height: "20px" }) }))] })));
|
|
27
|
+
}
|
|
28
|
+
exports.default = SuggestedEventsWidgetSkeleton;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'swiper/css';
|
|
2
|
+
import { WidgetProps } from '../Widget';
|
|
3
|
+
export interface SuggestedEventsWidgetProps extends WidgetProps {
|
|
4
|
+
/**
|
|
5
|
+
* Feed API Query Params
|
|
6
|
+
* @default [{'limit': 20, 'offset': 0}]
|
|
7
|
+
*/
|
|
8
|
+
endpointQueryParams?: Record<string, string | number>;
|
|
9
|
+
/**
|
|
10
|
+
* Other props
|
|
11
|
+
*/
|
|
12
|
+
[p: string]: any;
|
|
13
|
+
}
|
|
14
|
+
export default function SuggestedEventsWidget(inProps: SuggestedEventsWidgetProps): JSX.Element;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const system_1 = require("@mui/system");
|
|
7
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
8
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
9
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const react_intl_1 = require("react-intl");
|
|
12
|
+
require("swiper/css");
|
|
13
|
+
const react_2 = require("swiper/react");
|
|
14
|
+
const Errors_1 = require("../../constants/Errors");
|
|
15
|
+
const Pagination_1 = require("../../constants/Pagination");
|
|
16
|
+
const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
|
|
17
|
+
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
18
|
+
const constants_1 = require("./constants");
|
|
19
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
20
|
+
const event_1 = require("../../types/event");
|
|
21
|
+
const Event_1 = tslib_1.__importDefault(require("../Event"));
|
|
22
|
+
const classes = {
|
|
23
|
+
root: `${constants_1.PREFIX}-root`,
|
|
24
|
+
content: `${constants_1.PREFIX}-content`,
|
|
25
|
+
title: `${constants_1.PREFIX}-title`,
|
|
26
|
+
swiper: `${constants_1.PREFIX}-swiper`,
|
|
27
|
+
event: `${constants_1.PREFIX}-event`,
|
|
28
|
+
actions: `${constants_1.PREFIX}-actions`,
|
|
29
|
+
actionButton: `${constants_1.PREFIX}-action-button`
|
|
30
|
+
};
|
|
31
|
+
const Root = (0, system_1.styled)(Widget_1.default, {
|
|
32
|
+
name: constants_1.PREFIX,
|
|
33
|
+
slot: 'Root',
|
|
34
|
+
overridesResolver: (_props, styles) => styles.root
|
|
35
|
+
})(() => ({}));
|
|
36
|
+
function SuggestedEventsWidget(inProps) {
|
|
37
|
+
// PROPS
|
|
38
|
+
const props = (0, material_1.useThemeProps)({
|
|
39
|
+
props: inProps,
|
|
40
|
+
name: constants_1.PREFIX
|
|
41
|
+
});
|
|
42
|
+
const { endpointQueryParams = { limit: Pagination_1.DEFAULT_PAGINATION_LIMIT, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET } } = props, rest = tslib_1.__rest(props, ["endpointQueryParams"]);
|
|
43
|
+
// STATE
|
|
44
|
+
const [eventsData, setEventsData] = (0, react_1.useState)(null);
|
|
45
|
+
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
46
|
+
// CONTEXT
|
|
47
|
+
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
48
|
+
(0, react_1.useEffect)(() => {
|
|
49
|
+
api_services_1.SuggestionService.getEventSuggestion(Object.assign({}, endpointQueryParams))
|
|
50
|
+
.then((payload) => {
|
|
51
|
+
setEventsData(payload);
|
|
52
|
+
setLoading(false);
|
|
53
|
+
})
|
|
54
|
+
.catch((error) => {
|
|
55
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
|
|
56
|
+
});
|
|
57
|
+
}, []);
|
|
58
|
+
const handleReachEnd = (0, react_1.useCallback)(() => {
|
|
59
|
+
if (eventsData.count > eventsData.results.length) {
|
|
60
|
+
api_services_1.http
|
|
61
|
+
.request({
|
|
62
|
+
url: eventsData.next,
|
|
63
|
+
method: api_services_1.Endpoints.GetEventSuggestedUsers.method
|
|
64
|
+
})
|
|
65
|
+
.then((res) => console.log('*** res ***', res))
|
|
66
|
+
.catch((error) => {
|
|
67
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}, [eventsData]);
|
|
71
|
+
// RENDER
|
|
72
|
+
if (!eventsData && loading) {
|
|
73
|
+
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
74
|
+
}
|
|
75
|
+
if (!eventsData) {
|
|
76
|
+
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
77
|
+
}
|
|
78
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.suggestedEventsWidget.title", defaultMessage: "ui.suggestedEventsWidget.title" }) })), (0, jsx_runtime_1.jsx)(react_2.Swiper, Object.assign({ spaceBetween: 8, slidesPerView: "auto", onReachEnd: handleReachEnd }, { children: eventsData === null || eventsData === void 0 ? void 0 : eventsData.results.map((event, i) => ((0, jsx_runtime_1.jsx)(react_2.SwiperSlide, Object.assign({ className: classes.swiper }, { children: (0, jsx_runtime_1.jsx)(Event_1.default, { event: event, template: event_1.SCEventTemplateType.PREVIEW, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), variant: "outlined", className: classes.event }) }), i))) }))] })), (0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, {}), className: classes.actionButton }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.suggestedEventsWidget.showAll", defaultMessage: "ui.suggestedEventsWidget.showAll" }) })) })) }))] })));
|
|
79
|
+
}
|
|
80
|
+
exports.default = SuggestedEventsWidget;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCSuggestedEventsWidget";
|