@selfcommunity/react-ui 0.7.50-events.46 → 0.7.50-events.48
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/CreateEventWidget/CreateEventWidget.d.ts +6 -0
- package/lib/cjs/components/CreateEventWidget/CreateEventWidget.js +5 -4
- package/lib/cjs/components/CreateEventWidget/Skeleton.js +1 -1
- 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 +11 -9
- package/lib/cjs/components/MyEventsWidget/Skeleton.js +6 -3
- 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 +3 -1
- package/lib/cjs/index.js +9 -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/CreateEventWidget/CreateEventWidget.d.ts +6 -0
- package/lib/esm/components/CreateEventWidget/CreateEventWidget.js +5 -4
- package/lib/esm/components/CreateEventWidget/Skeleton.js +1 -1
- 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 +13 -11
- package/lib/esm/components/MyEventsWidget/Skeleton.js +7 -4
- 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 +3 -1
- package/lib/esm/index.js +4 -2
- 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
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { CreateEventButtonProps } from '../CreateEventButton';
|
|
1
2
|
import { WidgetProps } from '../Widget';
|
|
2
3
|
export interface CreateEventWidgetProps extends WidgetProps {
|
|
4
|
+
/**
|
|
5
|
+
* Props to spread to CreateEventButton component
|
|
6
|
+
* @default {}
|
|
7
|
+
*/
|
|
8
|
+
CreateEventButtonComponentProps?: CreateEventButtonProps;
|
|
3
9
|
/**
|
|
4
10
|
* Other props
|
|
5
11
|
*/
|
|
@@ -23,8 +23,9 @@ const classes = {
|
|
|
23
23
|
};
|
|
24
24
|
const Root = (0, material_1.styled)(Widget_1.default, {
|
|
25
25
|
name: constants_1.PREFIX,
|
|
26
|
-
slot: 'Root'
|
|
27
|
-
|
|
26
|
+
slot: 'Root',
|
|
27
|
+
overridesResolver: (_props, styles) => styles.root
|
|
28
|
+
})(() => ({}));
|
|
28
29
|
function CreateEventWidget(inProps) {
|
|
29
30
|
var _a;
|
|
30
31
|
// PROPS
|
|
@@ -32,7 +33,7 @@ function CreateEventWidget(inProps) {
|
|
|
32
33
|
props: inProps,
|
|
33
34
|
name: constants_1.PREFIX
|
|
34
35
|
});
|
|
35
|
-
const rest = tslib_1.__rest(props, []);
|
|
36
|
+
const { CreateEventButtonComponentProps = {} } = props, rest = tslib_1.__rest(props, ["CreateEventButtonComponentProps"]);
|
|
36
37
|
// STATE
|
|
37
38
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
38
39
|
// CONTEXT
|
|
@@ -57,6 +58,6 @@ function CreateEventWidget(inProps) {
|
|
|
57
58
|
if (!eventsEnabled || (!canCreateEvent && onlyStaffEnabled) || !authUserId) {
|
|
58
59
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
59
60
|
}
|
|
60
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ position: "relative" }, { children: [(0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", image: `${preferences[react_core_1.SCPreferences.IMAGES_USER_DEFAULT_COVER].value}`, alt: "placeholder image", className: classes.image }), (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.calendar, fontSize: "large" }, { children: "CalendarIcon" }))] })), (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.createEvent.title", defaultMessage: "ui.createEvent.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.spaging }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createEvent.description", defaultMessage: "ui.createEvent.description" }) })), (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.spaging })] })), (0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(CreateEventButton_1.default, {}) }))] })));
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ position: "relative" }, { children: [(0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", image: `${preferences[react_core_1.SCPreferences.IMAGES_USER_DEFAULT_COVER].value}`, alt: "placeholder image", className: classes.image }), (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.calendar, fontSize: "large" }, { children: "CalendarIcon" }))] })), (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.createEvent.title", defaultMessage: "ui.createEvent.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.spaging }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.createEvent.description", defaultMessage: "ui.createEvent.description" }) })), (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.spaging })] })), (0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(CreateEventButton_1.default, Object.assign({}, CreateEventButtonComponentProps)) }))] })));
|
|
61
62
|
}
|
|
62
63
|
exports.default = CreateEventWidget;
|
|
@@ -18,7 +18,7 @@ const classes = {
|
|
|
18
18
|
const Root = (0, styles_1.styled)(Widget_1.default, {
|
|
19
19
|
name: constants_1.PREFIX,
|
|
20
20
|
slot: 'SkeletonRoot'
|
|
21
|
-
})();
|
|
21
|
+
})(() => ({}));
|
|
22
22
|
function CreateEventWidgetSkeleton() {
|
|
23
23
|
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ position: "relative" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rectangular", animation: "wave", width: "100%", height: "110px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { className: classes.calendar, variant: "rounded", animation: "wave", width: "50px", height: "50px" })] })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { className: classes.title, animation: "wave", width: "26%", height: "30px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { className: classes.spacing, animation: "wave", width: "100%", height: "20px" }), (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.spacing })] })), (0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "rounded", width: "138px", height: "36px" }) }))] })));
|
|
24
24
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { SCEventType } from '@selfcommunity/types';
|
|
2
3
|
import { WidgetProps } from '../Widget';
|
|
4
|
+
import { EventSkeletonProps } from './Skeleton';
|
|
5
|
+
import { SCEventTemplateType } from '../../types/event';
|
|
3
6
|
export interface EventProps extends WidgetProps {
|
|
4
7
|
/**
|
|
5
8
|
* Event Object
|
|
@@ -11,6 +14,31 @@ export interface EventProps extends WidgetProps {
|
|
|
11
14
|
* @default null
|
|
12
15
|
*/
|
|
13
16
|
eventId?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Event template type
|
|
19
|
+
* @default 'preview'
|
|
20
|
+
*/
|
|
21
|
+
template?: SCEventTemplateType;
|
|
22
|
+
/**
|
|
23
|
+
* Actions
|
|
24
|
+
* @default null
|
|
25
|
+
*/
|
|
26
|
+
actions?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Hide participants
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
hideEventParticipants?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Hide event planner
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
hideEventPlanner?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Props to spread to EventSkeleton component
|
|
39
|
+
* @default {}
|
|
40
|
+
*/
|
|
41
|
+
EventSkeletonComponentProps?: EventSkeletonProps;
|
|
14
42
|
/**
|
|
15
43
|
* Any other properties
|
|
16
44
|
*/
|
|
@@ -10,20 +10,59 @@ const react_intl_1 = require("react-intl");
|
|
|
10
10
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
11
11
|
const system_1 = require("@mui/system");
|
|
12
12
|
const BaseItem_1 = tslib_1.__importDefault(require("../../shared/BaseItem"));
|
|
13
|
+
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
13
14
|
const constants_1 = require("./constants");
|
|
14
15
|
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
16
|
+
const Calendar_1 = tslib_1.__importDefault(require("../../shared/Calendar"));
|
|
17
|
+
const EventInfoDetails_1 = tslib_1.__importDefault(require("../../shared/EventInfoDetails"));
|
|
18
|
+
const User_1 = tslib_1.__importDefault(require("../User"));
|
|
19
|
+
const EventPartecipantsButton_1 = tslib_1.__importDefault(require("../EventPartecipantsButton"));
|
|
20
|
+
const event_1 = require("../../types/event");
|
|
15
21
|
const classes = {
|
|
16
22
|
root: `${constants_1.PREFIX}-root`,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
detailRoot: `${constants_1.PREFIX}-detail-root`,
|
|
24
|
+
previewRoot: `${constants_1.PREFIX}-preview-root`,
|
|
25
|
+
snippetRoot: `${constants_1.PREFIX}-snippet-root`,
|
|
26
|
+
detailImageWrapper: `${constants_1.PREFIX}-detail-image-wrapper`,
|
|
27
|
+
detailImage: `${constants_1.PREFIX}-detail-image`,
|
|
28
|
+
detailNameWrapper: `${constants_1.PREFIX}-detail-name-wrapper`,
|
|
29
|
+
detailName: `${constants_1.PREFIX}-detail-name`,
|
|
30
|
+
detailContent: `${constants_1.PREFIX}-detail-content`,
|
|
31
|
+
detailUser: `${constants_1.PREFIX}-detail-user`,
|
|
32
|
+
detailFirstDivider: `${constants_1.PREFIX}-detail-first-divider`,
|
|
33
|
+
detailSecondDivider: `${constants_1.PREFIX}-detail-second-divider`,
|
|
34
|
+
detailActions: `${constants_1.PREFIX}-detail-actions`,
|
|
35
|
+
previewImageWrapper: `${constants_1.PREFIX}-preview-image-wrapper`,
|
|
36
|
+
previewImage: `${constants_1.PREFIX}-preview-image`,
|
|
37
|
+
previewNameWrapper: `${constants_1.PREFIX}-preview-name-wrapper`,
|
|
38
|
+
previewName: `${constants_1.PREFIX}-preview-name`,
|
|
39
|
+
previewContent: `${constants_1.PREFIX}-preview-content`,
|
|
40
|
+
previewActions: `${constants_1.PREFIX}-preview-actions`,
|
|
41
|
+
snippetAvatar: `${constants_1.PREFIX}-snippet-avatar`,
|
|
42
|
+
snippetPrimary: `${constants_1.PREFIX}-snippet-primary`,
|
|
43
|
+
snippetSecondary: `${constants_1.PREFIX}-snippet-secondary`,
|
|
44
|
+
snippetActions: `${constants_1.PREFIX}-snippet-actions`
|
|
21
45
|
};
|
|
22
|
-
const Root = (0, styles_1.styled)(
|
|
46
|
+
const Root = (0, styles_1.styled)(Widget_1.default, {
|
|
23
47
|
name: constants_1.PREFIX,
|
|
24
48
|
slot: 'Root',
|
|
25
49
|
overridesResolver: (props, styles) => styles.root
|
|
26
50
|
})(() => ({}));
|
|
51
|
+
const DetailRoot = (0, styles_1.styled)(material_1.Box, {
|
|
52
|
+
name: constants_1.PREFIX,
|
|
53
|
+
slot: 'DetailRoot',
|
|
54
|
+
overridesResolver: (props, styles) => styles.detailRoot
|
|
55
|
+
})(() => ({}));
|
|
56
|
+
const PreviewRoot = (0, styles_1.styled)(material_1.Box, {
|
|
57
|
+
name: constants_1.PREFIX,
|
|
58
|
+
slot: 'PreviewRoot',
|
|
59
|
+
overridesResolver: (props, styles) => styles.previewRoot
|
|
60
|
+
})(() => ({}));
|
|
61
|
+
const SnippetRoot = (0, styles_1.styled)(BaseItem_1.default, {
|
|
62
|
+
name: constants_1.PREFIX,
|
|
63
|
+
slot: 'SnippetRoot',
|
|
64
|
+
overridesResolver: (props, styles) => styles.snippetRoot
|
|
65
|
+
})(() => ({}));
|
|
27
66
|
/**
|
|
28
67
|
* > API documentation for the Community-JS Event component. Learn about the available props and the CSS API.
|
|
29
68
|
*
|
|
@@ -62,7 +101,7 @@ function Event(inProps) {
|
|
|
62
101
|
props: inProps,
|
|
63
102
|
name: constants_1.PREFIX
|
|
64
103
|
});
|
|
65
|
-
const { eventId = null, event = null, className = null,
|
|
104
|
+
const { id = `event_object_${props.eventId ? props.eventId : props.event ? props.event.id : ''}`, eventId = null, event = null, className = null, template = event_1.SCEventTemplateType.SNIPPET, hideEventParticipants = false, hideEventPlanner = false, actions, EventSkeletonComponentProps = {} } = props, rest = tslib_1.__rest(props, ["id", "eventId", "event", "className", "template", "hideEventParticipants", "hideEventPlanner", "actions", "EventSkeletonComponentProps"]);
|
|
66
105
|
// STATE
|
|
67
106
|
const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
|
|
68
107
|
// CONTEXT
|
|
@@ -73,11 +112,28 @@ function Event(inProps) {
|
|
|
73
112
|
* Renders event object
|
|
74
113
|
*/
|
|
75
114
|
if (!scEvent) {
|
|
76
|
-
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {
|
|
115
|
+
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, Object.assign({ template: template }, EventSkeletonComponentProps, rest, { actions: actions }));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Renders event object
|
|
119
|
+
*/
|
|
120
|
+
let contentObj;
|
|
121
|
+
if (template === event_1.SCEventTemplateType.DETAIL) {
|
|
122
|
+
contentObj = ((0, jsx_runtime_1.jsxs)(DetailRoot, Object.assign({ className: classes.detailRoot }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.detailImageWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", image: scEvent.image_medium, alt: scEvent.name, className: classes.detailImage }), (0, jsx_runtime_1.jsx)(Calendar_1.default, { day: new Date(scEvent.start_date).getDate() })] })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.detailContent }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.detailNameWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3", className: classes.detailName }, { children: scEvent.name })) })), (0, jsx_runtime_1.jsx)(EventInfoDetails_1.default, { event: scEvent }), !hideEventPlanner && ((0, jsx_runtime_1.jsx)(User_1.default, { user: scEvent.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" }) })), actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), className: classes.detailUser })), !hideEventParticipants && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.detailFirstDivider }), (0, jsx_runtime_1.jsx)(EventPartecipantsButton_1.default, { event: scEvent, eventId: scEvent.id })] })), (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.detailSecondDivider })] })), actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.detailActions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) })))] })));
|
|
123
|
+
}
|
|
124
|
+
else if (template === event_1.SCEventTemplateType.PREVIEW) {
|
|
125
|
+
contentObj = ((0, jsx_runtime_1.jsxs)(PreviewRoot, Object.assign({ className: classes.previewRoot }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ position: "relative", className: classes.previewImageWrapper }, { children: (0, jsx_runtime_1.jsx)(material_1.CardMedia, { component: "img", height: "100px", image: scEvent.image_medium, alt: scEvent.name, className: classes.previewImage }) })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.previewContent }, { children: [(0, jsx_runtime_1.jsx)(EventInfoDetails_1.default, { event: scEvent, hidePrivacyIcon: true, hasLocationInfo: false, beforePrivacyInfo: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: scEvent.name })) }), !hideEventParticipants && (0, jsx_runtime_1.jsx)(EventPartecipantsButton_1.default, { event: scEvent })] })), actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.previewActions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) })))] })));
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
contentObj = ((0, jsx_runtime_1.jsx)(SnippetRoot, { elevation: 0, square: true, disableTypography: true, className: classes.snippetRoot, image: (0, jsx_runtime_1.jsx)(material_1.Avatar, { variant: "square", alt: scEvent.name, src: scEvent.image_medium, className: classes.snippetAvatar }), primary: (0, jsx_runtime_1.jsxs)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.snippetPrimary }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: "span" }, { children: `${intl.formatDate(scEvent.start_date, {
|
|
129
|
+
weekday: 'long',
|
|
130
|
+
month: 'long',
|
|
131
|
+
day: 'numeric'
|
|
132
|
+
})}` })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: scEvent.name }))] })), secondary: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ component: "p", variant: "body2", className: classes.snippetSecondary }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.privacy.${scEvent.privacy}`, defaultMessage: `ui.eventForm.privacy.${scEvent.privacy}` }), " -", ' ', (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.address.live.label`, defaultMessage: `ui.eventForm.address.live.label` })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.eventForm.address.online.label`, defaultMessage: `ui.eventForm.address.online.label` }))] })), actions: actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.snippetActions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) }))) }));
|
|
77
133
|
}
|
|
78
134
|
/**
|
|
79
135
|
* Renders root object
|
|
80
136
|
*/
|
|
81
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({
|
|
137
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className, `${constants_1.PREFIX}-${template}`) }, rest, { children: contentObj })));
|
|
82
138
|
}
|
|
83
139
|
exports.default = Event;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { SCEventTemplateType } from '../../types/event';
|
|
3
|
+
import { WidgetProps } from '../Widget';
|
|
4
|
+
export interface EventSkeletonProps extends WidgetProps {
|
|
4
5
|
/**
|
|
5
6
|
* Overrides or extends the styles applied to the component.
|
|
6
7
|
* @default null
|
|
7
8
|
*/
|
|
8
9
|
className?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Event template type
|
|
12
|
+
* @default 'preview'
|
|
13
|
+
*/
|
|
14
|
+
template?: SCEventTemplateType;
|
|
9
15
|
/**
|
|
10
16
|
* Prop to pass an action to be rendered next to the skeleton
|
|
11
17
|
*/
|
|
12
|
-
|
|
18
|
+
actions?: React.ReactNode;
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
15
21
|
* > API documentation for the Community-JS Event Skeleton component. Learn about the available props and the CSS API.
|
|
@@ -6,17 +6,41 @@ const material_1 = require("@mui/material");
|
|
|
6
6
|
const styles_1 = require("@mui/material/styles");
|
|
7
7
|
const Skeleton_1 = tslib_1.__importDefault(require("@mui/material/Skeleton"));
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
|
-
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
10
9
|
const BaseItem_1 = tslib_1.__importDefault(require("../../shared/BaseItem"));
|
|
10
|
+
const event_1 = require("../../types/event");
|
|
11
|
+
const Widget_1 = tslib_1.__importDefault(require("../Widget"));
|
|
12
|
+
const system_1 = require("@mui/system");
|
|
13
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
11
14
|
const classes = {
|
|
12
15
|
root: `${constants_1.PREFIX}-skeleton-root`,
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
skeletonDetailRoot: `${constants_1.PREFIX}-skeleton-detail-root`,
|
|
17
|
+
skeletonPreviewRoot: `${constants_1.PREFIX}-skeleton-preview-root`,
|
|
18
|
+
skeletonSnippetRoot: `${constants_1.PREFIX}-skeleton-snippet-root`,
|
|
19
|
+
skeletonDetailCalendar: `${constants_1.PREFIX}-skeleton-detail-calendar`,
|
|
20
|
+
skeletonDetailContent: `${constants_1.PREFIX}-skeleton-detail-content`,
|
|
21
|
+
skeletonDetailUser: `${constants_1.PREFIX}-skeleton-detail-user`,
|
|
22
|
+
skeletonDetailFirstDivider: `${constants_1.PREFIX}-skeleton-detail-first-divider`,
|
|
23
|
+
skeletonDetailSecondDivider: `${constants_1.PREFIX}-skeleton-detail-second-divider`,
|
|
24
|
+
skeletonPreviewContent: `${constants_1.PREFIX}-skeleton-preview-content`,
|
|
25
|
+
skeletonSnippetImage: `${constants_1.PREFIX}-skeleton-snippet-image`,
|
|
26
|
+
skeletonSnippetAction: `${constants_1.PREFIX}-skeleton-snippet-action`
|
|
15
27
|
};
|
|
16
|
-
const Root = (0, styles_1.styled)(
|
|
28
|
+
const Root = (0, styles_1.styled)(Widget_1.default, {
|
|
17
29
|
name: constants_1.PREFIX,
|
|
18
30
|
slot: 'SkeletonRoot'
|
|
19
31
|
})(() => ({}));
|
|
32
|
+
const SkeletonDetailRoot = (0, styles_1.styled)(material_1.Box, {
|
|
33
|
+
name: constants_1.PREFIX,
|
|
34
|
+
slot: 'SkeletonDetailRoot'
|
|
35
|
+
})(() => ({}));
|
|
36
|
+
const SkeletonPreviewRoot = (0, styles_1.styled)(material_1.Box, {
|
|
37
|
+
name: constants_1.PREFIX,
|
|
38
|
+
slot: 'SkeletonPreviewRoot'
|
|
39
|
+
})(() => ({}));
|
|
40
|
+
const SkeletonSnippetRoot = (0, styles_1.styled)(BaseItem_1.default, {
|
|
41
|
+
name: constants_1.PREFIX,
|
|
42
|
+
slot: 'SkeletonSnippetRoot'
|
|
43
|
+
})(() => ({}));
|
|
20
44
|
/**
|
|
21
45
|
* > API documentation for the Community-JS Event Skeleton component. Learn about the available props and the CSS API.
|
|
22
46
|
|
|
@@ -40,7 +64,25 @@ const Root = (0, styles_1.styled)(BaseItem_1.default, {
|
|
|
40
64
|
*
|
|
41
65
|
*/
|
|
42
66
|
function EventSkeleton(inProps) {
|
|
43
|
-
|
|
44
|
-
|
|
67
|
+
// PROPS
|
|
68
|
+
const props = (0, system_1.useThemeProps)({
|
|
69
|
+
props: inProps,
|
|
70
|
+
name: constants_1.PREFIX
|
|
71
|
+
});
|
|
72
|
+
const { className, template = event_1.SCEventTemplateType.SNIPPET, actions } = props, rest = tslib_1.__rest(props, ["className", "template", "actions"]);
|
|
73
|
+
/**
|
|
74
|
+
* Renders event object
|
|
75
|
+
*/
|
|
76
|
+
let contentObj;
|
|
77
|
+
if (template === event_1.SCEventTemplateType.DETAIL) {
|
|
78
|
+
contentObj = ((0, jsx_runtime_1.jsxs)(SkeletonDetailRoot, Object.assign({ className: classes.skeletonDetailRoot }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ position: "relative" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rectangular", animation: "wave", width: "100%", height: "170px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { className: classes.skeletonDetailCalendar, variant: "rounded", animation: "wave", width: "60px", height: "60px" })] })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.skeletonDetailContent }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "36%", height: "40px" }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "9px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "50%", height: "20px" })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "9px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "35%", height: "20px" })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "14px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "27%", height: "20px" })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", gap: "8px", className: classes.skeletonDetailUser }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "36px", height: "36px" }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ gap: "1px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "75px", height: "15px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "86px", height: "16px" })] }))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.skeletonDetailFirstDivider }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", gap: "8px", alignItems: "center", height: "28px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "68px", height: "20px" }), (0, jsx_runtime_1.jsxs)(material_1.AvatarGroup, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" })] })] })), (0, jsx_runtime_1.jsx)(material_1.Divider, { className: classes.skeletonDetailSecondDivider })] }))] })));
|
|
79
|
+
}
|
|
80
|
+
else if (template === event_1.SCEventTemplateType.PREVIEW) {
|
|
81
|
+
contentObj = ((0, jsx_runtime_1.jsxs)(SkeletonPreviewRoot, Object.assign({ className: classes.skeletonPreviewRoot }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ position: "relative" }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rectangular", animation: "wave", width: "100%", height: "80px" }) })), (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.skeletonPreviewContent }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "30%", height: "16px" })] })), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "46%", height: "20px" }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "14px" }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "27%", height: "16px" }) })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", gap: "8px", alignItems: "center", height: "28px" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.AvatarGroup, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "circular", width: "21px", height: "21px" })] }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", width: "10%", height: "20px" })] }))] }))] })));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
contentObj = ((0, jsx_runtime_1.jsx)(SkeletonSnippetRoot, { elevation: 0, square: true, disableTypography: true, className: classes.skeletonSnippetRoot, image: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.skeletonSnippetImage }, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "rectangular", width: 100, height: 60 }), " ", (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "large" }, { children: "CalendarIcon" }))] })), primary: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "rectangular", height: 10, width: "40%", style: { marginBottom: 12 } }), secondary: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "rectangular", height: 10, width: "60%", style: { marginBottom: 10, marginRight: 5 } }), (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", variant: "rectangular", height: 10, width: "35%" })] }), actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: actions !== null && actions !== void 0 ? actions : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", disabled: true }, { children: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { animation: "wave", height: 10, width: 30, style: { marginTop: 5, marginBottom: 5 } }) }))) }) }));
|
|
85
|
+
}
|
|
86
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className, `${constants_1.PREFIX}-skeleton-${template}`) }, rest, { children: contentObj })));
|
|
45
87
|
}
|
|
46
88
|
exports.default = EventSkeleton;
|
|
@@ -20,6 +20,7 @@ const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
|
20
20
|
const EditEventButton_1 = tslib_1.__importDefault(require("../EditEventButton"));
|
|
21
21
|
const User_1 = tslib_1.__importDefault(require("../User"));
|
|
22
22
|
const Calendar_1 = tslib_1.__importDefault(require("../../shared/Calendar"));
|
|
23
|
+
const EventActionsMenu_1 = tslib_1.__importDefault(require("../../shared/EventActionsMenu"));
|
|
23
24
|
const classes = {
|
|
24
25
|
root: `${constants_1.PREFIX}-root`,
|
|
25
26
|
cover: `${constants_1.PREFIX}-cover`,
|
|
@@ -33,7 +34,8 @@ const classes = {
|
|
|
33
34
|
};
|
|
34
35
|
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
35
36
|
name: constants_1.PREFIX,
|
|
36
|
-
slot: 'Root'
|
|
37
|
+
slot: 'Root',
|
|
38
|
+
shouldForwardProp: (prop) => prop !== 'isEventAdmin'
|
|
37
39
|
})(() => ({}));
|
|
38
40
|
/**
|
|
39
41
|
* > API documentation for the Community-JS Event Header component. Learn about the available props and the CSS API.
|
|
@@ -88,6 +90,8 @@ function EventHeader(inProps) {
|
|
|
88
90
|
const updatesSubscription = (0, react_1.useRef)(null);
|
|
89
91
|
// CONST
|
|
90
92
|
const isEventAdmin = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
|
|
93
|
+
const theme = (0, material_1.useTheme)();
|
|
94
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
91
95
|
/**
|
|
92
96
|
* Subscriber for pubsub callback
|
|
93
97
|
*/
|
|
@@ -122,7 +126,10 @@ function EventHeader(inProps) {
|
|
|
122
126
|
const _backgroundCover = Object.assign({}, (scEvent.image_bigger
|
|
123
127
|
? { background: `url('${scEvent.image_bigger}') center / cover` }
|
|
124
128
|
: { background: `url('${scPreferences.preferences[react_core_1.SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
|
|
125
|
-
return (
|
|
129
|
+
return (
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
131
|
+
// @ts-ignore
|
|
132
|
+
(0, jsx_runtime_1.jsxs)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className), isEventAdmin: isEventAdmin }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.calendar }, { children: (0, jsx_runtime_1.jsx)(Calendar_1.default, { day: new Date(scEvent.start_date).getDate() }) })) })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.info }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.time }, { children: scEvent.end_date && scEvent.end_date !== scEvent.start_date ? (new Date(scEvent.start_date).getDate() !== new Date(scEvent.end_date).getDate() ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.startEndTimeDiff", defaultMessage: "ui.eventHeader.startEndTimeDiff", values: {
|
|
126
133
|
startDate: intl.formatDate(scEvent.start_date, {
|
|
127
134
|
weekday: 'long',
|
|
128
135
|
day: 'numeric',
|
|
@@ -154,6 +161,6 @@ function EventHeader(inProps) {
|
|
|
154
161
|
month: 'long'
|
|
155
162
|
}),
|
|
156
163
|
hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
|
|
157
|
-
} })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, { userId: (_b = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _b === void 0 ? void 0 : _b.id, elevation: 0, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isEventAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EventInviteButton_1.default, { size:
|
|
164
|
+
} })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, { userId: (_b = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _b === void 0 ? void 0 : _b.id, secondary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isEventAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EventInviteButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(EditEventButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data) }), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, { eventId: scEvent === null || scEvent === void 0 ? void 0 : scEvent.id })] })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EventSubscribeButton_1.default, Object.assign({ event: scEvent }, EventSubscribeButtonProps)), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, { eventId: scEvent === null || scEvent === void 0 ? void 0 : scEvent.id })] })) }) })] }))] })));
|
|
158
165
|
}
|
|
159
166
|
exports.default = EventHeader;
|
|
@@ -22,7 +22,7 @@ const Root = (0, material_1.styled)(Widget_1.default, {
|
|
|
22
22
|
name: constants_1.PREFIX,
|
|
23
23
|
slot: 'Root',
|
|
24
24
|
overridesResolver: (_props, styles) => styles.root
|
|
25
|
-
})();
|
|
25
|
+
})(() => ({}));
|
|
26
26
|
function isTextLongerThanLimit(text, limit = 125) {
|
|
27
27
|
return text.length > limit;
|
|
28
28
|
}
|
|
@@ -60,6 +60,7 @@ function EventInfoWidget(inProps) {
|
|
|
60
60
|
const handleToggleSummary = (0, react_1.useCallback)(() => {
|
|
61
61
|
setExpanded(!expanded);
|
|
62
62
|
}, [expanded]);
|
|
63
|
+
// RENDER
|
|
63
64
|
if (!scEvent && loading) {
|
|
64
65
|
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
65
66
|
}
|
|
@@ -13,7 +13,7 @@ const Root = (0, material_1.styled)(Widget_1.default, {
|
|
|
13
13
|
name: constants_1.PREFIX,
|
|
14
14
|
slot: 'SkeletonRoot',
|
|
15
15
|
overridesResolver: (_props, styles) => styles.root
|
|
16
|
-
})();
|
|
16
|
+
})(() => ({}));
|
|
17
17
|
function EventInfoWigetSkeleton() {
|
|
18
18
|
return ((0, jsx_runtime_1.jsx)(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.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "8px" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", width: "184px", height: "21px" })] })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", width: "100%" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", width: "100%" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", width: "50%" }), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ gap: "16px", marginTop: "24px" }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", width: "223px", height: "21px" })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", width: "223px", height: "21px" })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", width: "223px", height: "21px" })] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { animation: "wave", width: "223px", height: "21px" })] }))] }))] })) })));
|
|
19
19
|
}
|
|
@@ -72,23 +72,28 @@ function EventLocationWidget(inProps) {
|
|
|
72
72
|
googleMapsApiKey: scContext.settings.integrations.geocoding.apiKey,
|
|
73
73
|
libraries: ['maps']
|
|
74
74
|
});
|
|
75
|
+
const mapOptions = {
|
|
76
|
+
fullscreenControl: false,
|
|
77
|
+
mapTypeControl: false,
|
|
78
|
+
streetViewControl: false,
|
|
79
|
+
zoomControl: false // Disables the zoom control (+/- buttons)
|
|
80
|
+
};
|
|
75
81
|
if (!((_c = (_b = (_a = scContext === null || scContext === void 0 ? void 0 : scContext.settings) === null || _a === void 0 ? void 0 : _a.integrations) === null || _b === void 0 ? void 0 : _b.geocoding) === null || _c === void 0 ? void 0 : _c.apiKey) || (scEvent && (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === types_1.SCEventLocationType.ONLINE)) {
|
|
76
82
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
77
83
|
}
|
|
78
84
|
/**
|
|
79
85
|
* Loading event
|
|
80
86
|
*/
|
|
81
|
-
console.log(isLoaded, scEvent);
|
|
82
87
|
if (!isLoaded || !scEvent) {
|
|
83
88
|
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
84
89
|
}
|
|
85
90
|
/**
|
|
86
91
|
* Renders root object
|
|
87
92
|
*/
|
|
88
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventLocationWidget.title", defaultMessage: "ui.eventLocationWidget.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.map }, { children: (0, jsx_runtime_1.jsx)(api_1.GoogleMap, Object.assign({ mapContainerClassName: classes.map, center: {
|
|
93
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title, gutterBottom: true }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventLocationWidget.title", defaultMessage: "ui.eventLocationWidget.title" }) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.map }, { children: (0, jsx_runtime_1.jsx)(api_1.GoogleMap, Object.assign({ mapContainerClassName: classes.map, center: {
|
|
89
94
|
lat: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lat,
|
|
90
95
|
lng: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lng
|
|
91
|
-
}, zoom: 15 }, { children: (0, jsx_runtime_1.jsx)(api_1.MarkerF, { position: {
|
|
96
|
+
}, options: mapOptions, zoom: 15 }, { children: (0, jsx_runtime_1.jsx)(api_1.MarkerF, { position: {
|
|
92
97
|
lat: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lat,
|
|
93
98
|
lng: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lng
|
|
94
99
|
} }) })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.locationTitle }, { children: (0, string_1.formatEventLocationGeolocation)(scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation, true) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", className: classes.address }, { children: (0, string_1.formatEventLocationGeolocation)(scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation) }))] }) })));
|
|
@@ -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
|
/**
|