@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,27 +1,66 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
|
-
import { Avatar, Button, Typography } from '@mui/material';
|
|
4
|
+
import { Avatar, Box, Button, CardActions, CardContent, CardMedia, Divider, Typography } from '@mui/material';
|
|
5
5
|
import { SCEventLocationType } from '@selfcommunity/types';
|
|
6
6
|
import { Link, SCRoutes, useSCFetchEvent, useSCRouting } from '@selfcommunity/react-core';
|
|
7
7
|
import { FormattedMessage, useIntl } from 'react-intl';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { useThemeProps } from '@mui/system';
|
|
10
10
|
import BaseItem from '../../shared/BaseItem';
|
|
11
|
+
import Widget from '../Widget';
|
|
11
12
|
import { PREFIX } from './constants';
|
|
12
13
|
import EventSkeleton from './Skeleton';
|
|
14
|
+
import Calendar from '../../shared/Calendar';
|
|
15
|
+
import EventInfoDetails from '../../shared/EventInfoDetails';
|
|
16
|
+
import User from '../User';
|
|
17
|
+
import EventPartecipantsButton from '../EventPartecipantsButton';
|
|
18
|
+
import { SCEventTemplateType } from '../../types/event';
|
|
13
19
|
const classes = {
|
|
14
20
|
root: `${PREFIX}-root`,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
detailRoot: `${PREFIX}-detail-root`,
|
|
22
|
+
previewRoot: `${PREFIX}-preview-root`,
|
|
23
|
+
snippetRoot: `${PREFIX}-snippet-root`,
|
|
24
|
+
detailImageWrapper: `${PREFIX}-detail-image-wrapper`,
|
|
25
|
+
detailImage: `${PREFIX}-detail-image`,
|
|
26
|
+
detailNameWrapper: `${PREFIX}-detail-name-wrapper`,
|
|
27
|
+
detailName: `${PREFIX}-detail-name`,
|
|
28
|
+
detailContent: `${PREFIX}-detail-content`,
|
|
29
|
+
detailUser: `${PREFIX}-detail-user`,
|
|
30
|
+
detailFirstDivider: `${PREFIX}-detail-first-divider`,
|
|
31
|
+
detailSecondDivider: `${PREFIX}-detail-second-divider`,
|
|
32
|
+
detailActions: `${PREFIX}-detail-actions`,
|
|
33
|
+
previewImageWrapper: `${PREFIX}-preview-image-wrapper`,
|
|
34
|
+
previewImage: `${PREFIX}-preview-image`,
|
|
35
|
+
previewNameWrapper: `${PREFIX}-preview-name-wrapper`,
|
|
36
|
+
previewName: `${PREFIX}-preview-name`,
|
|
37
|
+
previewContent: `${PREFIX}-preview-content`,
|
|
38
|
+
previewActions: `${PREFIX}-preview-actions`,
|
|
39
|
+
snippetAvatar: `${PREFIX}-snippet-avatar`,
|
|
40
|
+
snippetPrimary: `${PREFIX}-snippet-primary`,
|
|
41
|
+
snippetSecondary: `${PREFIX}-snippet-secondary`,
|
|
42
|
+
snippetActions: `${PREFIX}-snippet-actions`
|
|
19
43
|
};
|
|
20
|
-
const Root = styled(
|
|
44
|
+
const Root = styled(Widget, {
|
|
21
45
|
name: PREFIX,
|
|
22
46
|
slot: 'Root',
|
|
23
47
|
overridesResolver: (props, styles) => styles.root
|
|
24
48
|
})(() => ({}));
|
|
49
|
+
const DetailRoot = styled(Box, {
|
|
50
|
+
name: PREFIX,
|
|
51
|
+
slot: 'DetailRoot',
|
|
52
|
+
overridesResolver: (props, styles) => styles.detailRoot
|
|
53
|
+
})(() => ({}));
|
|
54
|
+
const PreviewRoot = styled(Box, {
|
|
55
|
+
name: PREFIX,
|
|
56
|
+
slot: 'PreviewRoot',
|
|
57
|
+
overridesResolver: (props, styles) => styles.previewRoot
|
|
58
|
+
})(() => ({}));
|
|
59
|
+
const SnippetRoot = styled(BaseItem, {
|
|
60
|
+
name: PREFIX,
|
|
61
|
+
slot: 'SnippetRoot',
|
|
62
|
+
overridesResolver: (props, styles) => styles.snippetRoot
|
|
63
|
+
})(() => ({}));
|
|
25
64
|
/**
|
|
26
65
|
* > API documentation for the Community-JS Event component. Learn about the available props and the CSS API.
|
|
27
66
|
*
|
|
@@ -60,7 +99,7 @@ export default function Event(inProps) {
|
|
|
60
99
|
props: inProps,
|
|
61
100
|
name: PREFIX
|
|
62
101
|
});
|
|
63
|
-
const { eventId = null, event = null, className = null,
|
|
102
|
+
const { id = `event_object_${props.eventId ? props.eventId : props.event ? props.event.id : ''}`, eventId = null, event = null, className = null, template = SCEventTemplateType.SNIPPET, hideEventParticipants = false, hideEventPlanner = false, actions, EventSkeletonComponentProps = {} } = props, rest = __rest(props, ["id", "eventId", "event", "className", "template", "hideEventParticipants", "hideEventPlanner", "actions", "EventSkeletonComponentProps"]);
|
|
64
103
|
// STATE
|
|
65
104
|
const { scEvent } = useSCFetchEvent({ id: eventId, event });
|
|
66
105
|
// CONTEXT
|
|
@@ -71,10 +110,27 @@ export default function Event(inProps) {
|
|
|
71
110
|
* Renders event object
|
|
72
111
|
*/
|
|
73
112
|
if (!scEvent) {
|
|
74
|
-
return _jsx(EventSkeleton, {
|
|
113
|
+
return _jsx(EventSkeleton, Object.assign({ template: template }, EventSkeletonComponentProps, rest, { actions: actions }));
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Renders event object
|
|
117
|
+
*/
|
|
118
|
+
let contentObj;
|
|
119
|
+
if (template === SCEventTemplateType.DETAIL) {
|
|
120
|
+
contentObj = (_jsxs(DetailRoot, Object.assign({ className: classes.detailRoot }, { children: [_jsxs(Box, Object.assign({ className: classes.detailImageWrapper }, { children: [_jsx(CardMedia, { component: "img", image: scEvent.image_medium, alt: scEvent.name, className: classes.detailImage }), _jsx(Calendar, { day: new Date(scEvent.start_date).getDate() })] })), _jsxs(CardContent, Object.assign({ className: classes.detailContent }, { children: [_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.detailNameWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h3", className: classes.detailName }, { children: scEvent.name })) })), _jsx(EventInfoDetails, { event: scEvent }), !hideEventPlanner && (_jsx(User, { user: scEvent.managed_by, elevation: 0, secondary: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.myEventsWidget.planner", defaultMessage: "ui.myEventsWidget.planner" }) })), actions: _jsx(_Fragment, {}), className: classes.detailUser })), !hideEventParticipants && (_jsxs(_Fragment, { children: [_jsx(Divider, { className: classes.detailFirstDivider }), _jsx(EventPartecipantsButton, { event: scEvent, eventId: scEvent.id })] })), _jsx(Divider, { className: classes.detailSecondDivider })] })), actions !== null && actions !== void 0 ? actions : (_jsx(CardActions, Object.assign({ className: classes.detailActions }, { children: _jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) })))] })));
|
|
121
|
+
}
|
|
122
|
+
else if (template === SCEventTemplateType.PREVIEW) {
|
|
123
|
+
contentObj = (_jsxs(PreviewRoot, Object.assign({ className: classes.previewRoot }, { children: [_jsx(Box, Object.assign({ position: "relative", className: classes.previewImageWrapper }, { children: _jsx(CardMedia, { component: "img", height: "100px", image: scEvent.image_medium, alt: scEvent.name, className: classes.previewImage }) })), _jsxs(CardContent, Object.assign({ className: classes.previewContent }, { children: [_jsx(EventInfoDetails, { event: scEvent, hidePrivacyIcon: true, hasLocationInfo: false, beforePrivacyInfo: _jsx(Typography, Object.assign({ variant: "h5" }, { children: scEvent.name })) }), !hideEventParticipants && _jsx(EventPartecipantsButton, { event: scEvent })] })), actions !== null && actions !== void 0 ? actions : (_jsx(CardActions, Object.assign({ className: classes.previewActions }, { children: _jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) })))] })));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
contentObj = (_jsx(SnippetRoot, { elevation: 0, square: true, disableTypography: true, className: classes.snippetRoot, image: _jsx(Avatar, { variant: "square", alt: scEvent.name, src: scEvent.image_medium, className: classes.snippetAvatar }), primary: _jsxs(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.snippetPrimary }, { children: [_jsx(Typography, Object.assign({ component: "span" }, { children: `${intl.formatDate(scEvent.start_date, {
|
|
127
|
+
weekday: 'long',
|
|
128
|
+
month: 'long',
|
|
129
|
+
day: 'numeric'
|
|
130
|
+
})}` })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: scEvent.name }))] })), secondary: _jsxs(Typography, Object.assign({ component: "p", variant: "body2", className: classes.snippetSecondary }, { children: [_jsx(FormattedMessage, { id: `ui.eventForm.privacy.${scEvent.privacy}`, defaultMessage: `ui.eventForm.privacy.${scEvent.privacy}` }), " -", ' ', (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: `ui.eventForm.address.live.label`, defaultMessage: `ui.eventForm.address.live.label` })) : (_jsx(FormattedMessage, { id: `ui.eventForm.address.online.label`, defaultMessage: `ui.eventForm.address.online.label` }))] })), actions: actions !== null && actions !== void 0 ? actions : (_jsx(Box, Object.assign({ className: classes.snippetActions }, { children: _jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) }))) }));
|
|
75
131
|
}
|
|
76
132
|
/**
|
|
77
133
|
* Renders root object
|
|
78
134
|
*/
|
|
79
|
-
return (_jsx(Root, Object.assign({
|
|
135
|
+
return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className, `${PREFIX}-${template}`) }, rest, { children: contentObj })));
|
|
80
136
|
}
|
|
@@ -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.
|
|
@@ -1,19 +1,44 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Button, Icon } from '@mui/material';
|
|
3
|
+
import { AvatarGroup, Box, Button, CardContent, Divider, Icon, Stack } from '@mui/material';
|
|
3
4
|
import { styled } from '@mui/material/styles';
|
|
4
5
|
import Skeleton from '@mui/material/Skeleton';
|
|
5
6
|
import { PREFIX } from './constants';
|
|
6
|
-
import classNames from 'classnames';
|
|
7
7
|
import BaseItem from '../../shared/BaseItem';
|
|
8
|
+
import { SCEventTemplateType } from '../../types/event';
|
|
9
|
+
import Widget from '../Widget';
|
|
10
|
+
import { useThemeProps } from '@mui/system';
|
|
11
|
+
import classNames from 'classnames';
|
|
8
12
|
const classes = {
|
|
9
13
|
root: `${PREFIX}-skeleton-root`,
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
skeletonDetailRoot: `${PREFIX}-skeleton-detail-root`,
|
|
15
|
+
skeletonPreviewRoot: `${PREFIX}-skeleton-preview-root`,
|
|
16
|
+
skeletonSnippetRoot: `${PREFIX}-skeleton-snippet-root`,
|
|
17
|
+
skeletonDetailCalendar: `${PREFIX}-skeleton-detail-calendar`,
|
|
18
|
+
skeletonDetailContent: `${PREFIX}-skeleton-detail-content`,
|
|
19
|
+
skeletonDetailUser: `${PREFIX}-skeleton-detail-user`,
|
|
20
|
+
skeletonDetailFirstDivider: `${PREFIX}-skeleton-detail-first-divider`,
|
|
21
|
+
skeletonDetailSecondDivider: `${PREFIX}-skeleton-detail-second-divider`,
|
|
22
|
+
skeletonPreviewContent: `${PREFIX}-skeleton-preview-content`,
|
|
23
|
+
skeletonSnippetImage: `${PREFIX}-skeleton-snippet-image`,
|
|
24
|
+
skeletonSnippetAction: `${PREFIX}-skeleton-snippet-action`
|
|
12
25
|
};
|
|
13
|
-
const Root = styled(
|
|
26
|
+
const Root = styled(Widget, {
|
|
14
27
|
name: PREFIX,
|
|
15
28
|
slot: 'SkeletonRoot'
|
|
16
29
|
})(() => ({}));
|
|
30
|
+
const SkeletonDetailRoot = styled(Box, {
|
|
31
|
+
name: PREFIX,
|
|
32
|
+
slot: 'SkeletonDetailRoot'
|
|
33
|
+
})(() => ({}));
|
|
34
|
+
const SkeletonPreviewRoot = styled(Box, {
|
|
35
|
+
name: PREFIX,
|
|
36
|
+
slot: 'SkeletonPreviewRoot'
|
|
37
|
+
})(() => ({}));
|
|
38
|
+
const SkeletonSnippetRoot = styled(BaseItem, {
|
|
39
|
+
name: PREFIX,
|
|
40
|
+
slot: 'SkeletonSnippetRoot'
|
|
41
|
+
})(() => ({}));
|
|
17
42
|
/**
|
|
18
43
|
* > API documentation for the Community-JS Event Skeleton component. Learn about the available props and the CSS API.
|
|
19
44
|
|
|
@@ -37,6 +62,24 @@ const Root = styled(BaseItem, {
|
|
|
37
62
|
*
|
|
38
63
|
*/
|
|
39
64
|
export default function EventSkeleton(inProps) {
|
|
40
|
-
|
|
41
|
-
|
|
65
|
+
// PROPS
|
|
66
|
+
const props = useThemeProps({
|
|
67
|
+
props: inProps,
|
|
68
|
+
name: PREFIX
|
|
69
|
+
});
|
|
70
|
+
const { className, template = SCEventTemplateType.SNIPPET, actions } = props, rest = __rest(props, ["className", "template", "actions"]);
|
|
71
|
+
/**
|
|
72
|
+
* Renders event object
|
|
73
|
+
*/
|
|
74
|
+
let contentObj;
|
|
75
|
+
if (template === SCEventTemplateType.DETAIL) {
|
|
76
|
+
contentObj = (_jsxs(SkeletonDetailRoot, Object.assign({ className: classes.skeletonDetailRoot }, { children: [_jsxs(Box, Object.assign({ position: "relative" }, { children: [_jsx(Skeleton, { variant: "rectangular", animation: "wave", width: "100%", height: "170px" }), _jsx(Skeleton, { className: classes.skeletonDetailCalendar, variant: "rounded", animation: "wave", width: "60px", height: "60px" })] })), _jsxs(CardContent, Object.assign({ className: classes.skeletonDetailContent }, { children: [_jsx(Skeleton, { animation: "wave", width: "36%", height: "40px" }), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "9px" }, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", width: "50%", height: "20px" })] })), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "9px" }, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", width: "35%", height: "20px" })] })), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "14px" }, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", width: "27%", height: "20px" })] })), _jsxs(Stack, Object.assign({ direction: "row", gap: "8px", className: classes.skeletonDetailUser }, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "36px", height: "36px" }), _jsxs(Stack, Object.assign({ gap: "1px" }, { children: [_jsx(Skeleton, { animation: "wave", width: "75px", height: "15px" }), _jsx(Skeleton, { animation: "wave", width: "86px", height: "16px" })] }))] })), _jsx(Divider, { className: classes.skeletonDetailFirstDivider }), _jsxs(Stack, Object.assign({ direction: "row", gap: "8px", alignItems: "center", height: "28px" }, { children: [_jsx(Skeleton, { animation: "wave", width: "68px", height: "20px" }), _jsxs(AvatarGroup, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" })] })] })), _jsx(Divider, { className: classes.skeletonDetailSecondDivider })] }))] })));
|
|
77
|
+
}
|
|
78
|
+
else if (template === SCEventTemplateType.PREVIEW) {
|
|
79
|
+
contentObj = (_jsxs(SkeletonPreviewRoot, Object.assign({ className: classes.skeletonPreviewRoot }, { children: [_jsx(Box, Object.assign({ position: "relative" }, { children: _jsx(Skeleton, { variant: "rectangular", animation: "wave", width: "100%", height: "80px" }) })), _jsxs(CardContent, Object.assign({ className: classes.skeletonPreviewContent }, { children: [_jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", width: "30%", height: "16px" })] })), _jsx(Skeleton, { animation: "wave", width: "46%", height: "20px" }), _jsx(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "14px" }, { children: _jsx(Skeleton, { animation: "wave", width: "27%", height: "16px" }) })), _jsxs(Stack, Object.assign({ direction: "row", gap: "8px", alignItems: "center", height: "28px" }, { children: [_jsxs(AvatarGroup, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" })] }), _jsx(Skeleton, { animation: "wave", width: "10%", height: "20px" })] }))] }))] })));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
contentObj = (_jsx(SkeletonSnippetRoot, { elevation: 0, square: true, disableTypography: true, className: classes.skeletonSnippetRoot, image: _jsxs(Box, Object.assign({ className: classes.skeletonSnippetImage }, { children: [_jsx(Skeleton, { animation: "wave", variant: "rectangular", width: 100, height: 60 }), " ", _jsx(Icon, Object.assign({ fontSize: "large" }, { children: "CalendarIcon" }))] })), primary: _jsx(Skeleton, { animation: "wave", variant: "rectangular", height: 10, width: "40%", style: { marginBottom: 12 } }), secondary: _jsxs(_Fragment, { children: [_jsx(Skeleton, { animation: "wave", variant: "rectangular", height: 10, width: "60%", style: { marginBottom: 10, marginRight: 5 } }), _jsx(Skeleton, { animation: "wave", variant: "rectangular", height: 10, width: "35%" })] }), actions: _jsx(_Fragment, { children: actions !== null && actions !== void 0 ? actions : (_jsx(Button, Object.assign({ size: "small", variant: "outlined", disabled: true }, { children: _jsx(Skeleton, { animation: "wave", height: 10, width: 30, style: { marginTop: 5, marginBottom: 5 } }) }))) }) }));
|
|
83
|
+
}
|
|
84
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className, `${PREFIX}-skeleton-${template}`) }, rest, { children: contentObj })));
|
|
42
85
|
}
|
|
@@ -2,7 +2,7 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
|
-
import { Box, Icon, Paper, Typography } from '@mui/material';
|
|
5
|
+
import { Box, Icon, Paper, Typography, useMediaQuery, useTheme } from '@mui/material';
|
|
6
6
|
import { SCEventLocationType, SCEventPrivacyType } from '@selfcommunity/types';
|
|
7
7
|
import { SCPreferences, useSCFetchEvent, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
8
8
|
import EventHeaderSkeleton from './Skeleton';
|
|
@@ -18,6 +18,7 @@ import PubSub from 'pubsub-js';
|
|
|
18
18
|
import EditEventButton from '../EditEventButton';
|
|
19
19
|
import User from '../User';
|
|
20
20
|
import Calendar from '../../shared/Calendar';
|
|
21
|
+
import EventActionsMenu from '../../shared/EventActionsMenu';
|
|
21
22
|
const classes = {
|
|
22
23
|
root: `${PREFIX}-root`,
|
|
23
24
|
cover: `${PREFIX}-cover`,
|
|
@@ -31,7 +32,8 @@ const classes = {
|
|
|
31
32
|
};
|
|
32
33
|
const Root = styled(Box, {
|
|
33
34
|
name: PREFIX,
|
|
34
|
-
slot: 'Root'
|
|
35
|
+
slot: 'Root',
|
|
36
|
+
shouldForwardProp: (prop) => prop !== 'isEventAdmin'
|
|
35
37
|
})(() => ({}));
|
|
36
38
|
/**
|
|
37
39
|
* > API documentation for the Community-JS Event Header component. Learn about the available props and the CSS API.
|
|
@@ -86,6 +88,8 @@ export default function EventHeader(inProps) {
|
|
|
86
88
|
const updatesSubscription = useRef(null);
|
|
87
89
|
// CONST
|
|
88
90
|
const isEventAdmin = 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]);
|
|
91
|
+
const theme = useTheme();
|
|
92
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
89
93
|
/**
|
|
90
94
|
* Subscriber for pubsub callback
|
|
91
95
|
*/
|
|
@@ -120,7 +124,10 @@ export default function EventHeader(inProps) {
|
|
|
120
124
|
const _backgroundCover = Object.assign({}, (scEvent.image_bigger
|
|
121
125
|
? { background: `url('${scEvent.image_bigger}') center / cover` }
|
|
122
126
|
: { background: `url('${scPreferences.preferences[SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
|
|
123
|
-
return (
|
|
127
|
+
return (
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
_jsxs(Root, Object.assign({ id: id, className: classNames(classes.root, className), isEventAdmin: isEventAdmin }, rest, { children: [_jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(Box, Object.assign({ className: classes.calendar }, { children: _jsx(Calendar, { day: new Date(scEvent.start_date).getDate() }) })) })), _jsxs(Box, Object.assign({ className: classes.info }, { children: [_jsx(Typography, Object.assign({ className: classes.time }, { children: scEvent.end_date && scEvent.end_date !== scEvent.start_date ? (new Date(scEvent.start_date).getDate() !== new Date(scEvent.end_date).getDate() ? (_jsx(FormattedMessage, { id: "ui.eventHeader.startEndTimeDiff", defaultMessage: "ui.eventHeader.startEndTimeDiff", values: {
|
|
124
131
|
startDate: intl.formatDate(scEvent.start_date, {
|
|
125
132
|
weekday: 'long',
|
|
126
133
|
day: 'numeric',
|
|
@@ -152,5 +159,5 @@ export default function EventHeader(inProps) {
|
|
|
152
159
|
month: 'long'
|
|
153
160
|
}),
|
|
154
161
|
hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
|
|
155
|
-
} })) })), _jsx(Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), _jsxs(Box, Object.assign({ className: classes.visibility }, { children: [_jsx(_Fragment, { children: scEvent.privacy === SCEventPrivacyType.PUBLIC ? (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), _jsx(Bullet, {}), _jsx(Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), _jsx(User, { userId: (_b = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _b === void 0 ? void 0 : _b.id, elevation: 0, actions: _jsx(_Fragment, { children: isEventAdmin ? (_jsxs(Box, Object.assign({ className: classes.multiActions }, { children: [_jsx(EventInviteButton, { size:
|
|
162
|
+
} })) })), _jsx(Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), _jsxs(Box, Object.assign({ className: classes.visibility }, { children: [_jsx(_Fragment, { children: scEvent.privacy === SCEventPrivacyType.PUBLIC ? (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), _jsx(Bullet, {}), _jsx(Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), _jsx(User, { userId: (_b = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _b === void 0 ? void 0 : _b.id, secondary: _jsx(FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: _jsx(_Fragment, { children: isEventAdmin ? (_jsxs(Box, Object.assign({ className: classes.multiActions }, { children: [_jsx(EventInviteButton, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id }), _jsxs(Box, { children: [_jsx(EditEventButton, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data) }), _jsx(EventActionsMenu, { eventId: scEvent === null || scEvent === void 0 ? void 0 : scEvent.id })] })] }))) : (_jsxs(_Fragment, { children: [_jsx(EventSubscribeButton, Object.assign({ event: scEvent }, EventSubscribeButtonProps)), _jsx(EventActionsMenu, { eventId: scEvent === null || scEvent === void 0 ? void 0 : scEvent.id })] })) }) })] }))] })));
|
|
156
163
|
}
|
|
@@ -20,7 +20,7 @@ const Root = styled(Widget, {
|
|
|
20
20
|
name: PREFIX,
|
|
21
21
|
slot: 'Root',
|
|
22
22
|
overridesResolver: (_props, styles) => styles.root
|
|
23
|
-
})();
|
|
23
|
+
})(() => ({}));
|
|
24
24
|
function isTextLongerThanLimit(text, limit = 125) {
|
|
25
25
|
return text.length > limit;
|
|
26
26
|
}
|
|
@@ -58,6 +58,7 @@ export default function EventInfoWidget(inProps) {
|
|
|
58
58
|
const handleToggleSummary = useCallback(() => {
|
|
59
59
|
setExpanded(!expanded);
|
|
60
60
|
}, [expanded]);
|
|
61
|
+
// RENDER
|
|
61
62
|
if (!scEvent && loading) {
|
|
62
63
|
return _jsx(Skeleton, {});
|
|
63
64
|
}
|
|
@@ -10,7 +10,7 @@ const Root = styled(Widget, {
|
|
|
10
10
|
name: PREFIX,
|
|
11
11
|
slot: 'SkeletonRoot',
|
|
12
12
|
overridesResolver: (_props, styles) => styles.root
|
|
13
|
-
})();
|
|
13
|
+
})(() => ({}));
|
|
14
14
|
export default function EventInfoWigetSkeleton() {
|
|
15
15
|
return (_jsx(Root, Object.assign({ className: classes.root }, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "8px" }, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", width: "184px", height: "21px" })] })), _jsx(Skeleton, { animation: "wave", width: "100%" }), _jsx(Skeleton, { animation: "wave", width: "100%" }), _jsx(Skeleton, { animation: "wave", width: "50%" }), _jsxs(Stack, Object.assign({ gap: "16px", marginTop: "24px" }, { children: [_jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", width: "223px", height: "21px" })] })), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", width: "223px", height: "21px" })] })), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", width: "223px", height: "21px" })] })), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [_jsx(Skeleton, { animation: "wave", variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: "wave", width: "223px", height: "21px" })] }))] }))] })) })));
|
|
16
16
|
}
|
|
@@ -70,23 +70,28 @@ export default function EventLocationWidget(inProps) {
|
|
|
70
70
|
googleMapsApiKey: scContext.settings.integrations.geocoding.apiKey,
|
|
71
71
|
libraries: ['maps']
|
|
72
72
|
});
|
|
73
|
+
const mapOptions = {
|
|
74
|
+
fullscreenControl: false,
|
|
75
|
+
mapTypeControl: false,
|
|
76
|
+
streetViewControl: false,
|
|
77
|
+
zoomControl: false // Disables the zoom control (+/- buttons)
|
|
78
|
+
};
|
|
73
79
|
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) === SCEventLocationType.ONLINE)) {
|
|
74
80
|
return _jsx(HiddenPlaceholder, {});
|
|
75
81
|
}
|
|
76
82
|
/**
|
|
77
83
|
* Loading event
|
|
78
84
|
*/
|
|
79
|
-
console.log(isLoaded, scEvent);
|
|
80
85
|
if (!isLoaded || !scEvent) {
|
|
81
86
|
return _jsx(EventLocationWidgetSkeleton, {});
|
|
82
87
|
}
|
|
83
88
|
/**
|
|
84
89
|
* Renders root object
|
|
85
90
|
*/
|
|
86
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(CardContent, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.eventLocationWidget.title", defaultMessage: "ui.eventLocationWidget.title" }) })), _jsx(Box, Object.assign({ className: classes.map }, { children: _jsx(GoogleMap, Object.assign({ mapContainerClassName: classes.map, center: {
|
|
91
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(CardContent, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, gutterBottom: true }, { children: _jsx(FormattedMessage, { id: "ui.eventLocationWidget.title", defaultMessage: "ui.eventLocationWidget.title" }) })), _jsx(Box, Object.assign({ className: classes.map }, { children: _jsx(GoogleMap, Object.assign({ mapContainerClassName: classes.map, center: {
|
|
87
92
|
lat: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lat,
|
|
88
93
|
lng: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lng
|
|
89
|
-
}, zoom: 15 }, { children: _jsx(MarkerF, { position: {
|
|
94
|
+
}, options: mapOptions, zoom: 15 }, { children: _jsx(MarkerF, { position: {
|
|
90
95
|
lat: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lat,
|
|
91
96
|
lng: scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation_lng
|
|
92
97
|
} }) })) })), _jsx(Typography, Object.assign({ variant: "h4", className: classes.locationTitle }, { children: formatEventLocationGeolocation(scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation, true) })), _jsx(Typography, Object.assign({ variant: "body1", className: classes.address }, { children: formatEventLocationGeolocation(scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation) }))] }) })));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Avatar, AvatarGroup, Button, List, ListItem, Typography
|
|
3
|
+
import { Avatar, AvatarGroup, Button, List, ListItem, Typography } from '@mui/material';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
|
-
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
6
5
|
import { useThemeProps } from '@mui/system';
|
|
7
6
|
import { Endpoints, EventService, http } from '@selfcommunity/api-services';
|
|
8
7
|
import { useSCFetchEvent } from '@selfcommunity/react-core';
|
|
@@ -19,19 +18,22 @@ import User, { UserSkeleton } from '../User';
|
|
|
19
18
|
const PREFIX = 'SCEventPartecipantsButton';
|
|
20
19
|
const classes = {
|
|
21
20
|
root: `${PREFIX}-root`,
|
|
21
|
+
avatar: `${PREFIX}-avatar`,
|
|
22
|
+
partecipants: `${PREFIX}-partecipants`,
|
|
22
23
|
dialogRoot: `${PREFIX}-dialog-root`,
|
|
24
|
+
infiniteScroll: `${PREFIX}-infinite-scroll`,
|
|
23
25
|
endMessage: `${PREFIX}-end-message`
|
|
24
26
|
};
|
|
25
27
|
const Root = styled(Button, {
|
|
26
28
|
name: PREFIX,
|
|
27
29
|
slot: 'Root',
|
|
28
30
|
overridesResolver: (_props, styles) => styles.root
|
|
29
|
-
})();
|
|
31
|
+
})(() => ({}));
|
|
30
32
|
const DialogRoot = styled(BaseDialog, {
|
|
31
33
|
name: PREFIX,
|
|
32
|
-
slot: '
|
|
34
|
+
slot: 'DialogRoot',
|
|
33
35
|
overridesResolver: (_props, styles) => styles.dialogRoot
|
|
34
|
-
})();
|
|
36
|
+
})(() => ({}));
|
|
35
37
|
/**
|
|
36
38
|
*> API documentation for the Community-JS Event Partecipants Button component. Learn about the available props and the CSS API.
|
|
37
39
|
*
|
|
@@ -120,8 +122,5 @@ export default function EventPartecipantsButton(inProps) {
|
|
|
120
122
|
const handleToggleDialogOpen = useCallback(() => {
|
|
121
123
|
setOpen((prev) => !prev);
|
|
122
124
|
}, [setOpen]);
|
|
123
|
-
|
|
124
|
-
const theme = useTheme();
|
|
125
|
-
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
126
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleToggleDialogOpen, disabled: loading || !scEvent || scEvent.goings_counter === 0 }, rest, { children: [_jsx(Typography, Object.assign({ color: "primary", variant: "caption" }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.eventPartecipantsButton.partecipants", id: "ui.eventPartecipantsButton.partecipants" }) })), loading || !scEvent ? (_jsx(AvatarGroupSkeleton, Object.assign({}, rest))) : (_jsx(AvatarGroup, Object.assign({ total: scEvent.goings_counter }, { children: followers.map((c) => (_jsx(Avatar, { alt: c.username, src: c.avatar }, c.id))) })))] })), open && (_jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: _jsx(FormattedMessage, { defaultMessage: "ui.eventPartecipantsButton.dialogTitle", id: "ui.eventPartecipantsButton.dialogTitle", values: { total: scEvent.goings_counter } }), onClose: handleToggleDialogOpen, open: open }, DialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: followers.length, next: fetchFollowers, hasMoreNext: next !== null || loading, loaderNext: _jsx(UserSkeleton, { elevation: 0 }), height: isMobile ? '100%' : 400, endMessage: _jsx(Typography, Object.assign({ className: classes.endMessage }, { children: _jsx(FormattedMessage, { id: "ui.eventPartecipantsButton.noOtherPartecipants", defaultMessage: "ui.eventPartecipantsButton.noOtherPartecipants" }) })) }, { children: _jsx(List, { children: followers.map((follower) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: follower }) }, follower.id))) }) })) })))] }));
|
|
125
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleToggleDialogOpen, disabled: loading || !scEvent || scEvent.goings_counter === 0 }, rest, { children: [_jsx(Typography, Object.assign({ className: classes.partecipants, variant: "caption" }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.eventPartecipantsButton.partecipants", id: "ui.eventPartecipantsButton.partecipants" }) })), loading || !scEvent ? (_jsx(AvatarGroupSkeleton, Object.assign({}, rest))) : (_jsx(AvatarGroup, Object.assign({ total: scEvent.goings_counter }, { children: followers.map((c) => (_jsx(Avatar, { alt: c.username, src: c.avatar, className: classes.avatar }, c.id))) })))] })), open && (_jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: _jsx(FormattedMessage, { defaultMessage: "ui.eventPartecipantsButton.dialogTitle", id: "ui.eventPartecipantsButton.dialogTitle", values: { total: scEvent.goings_counter } }), onClose: handleToggleDialogOpen, open: open }, DialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: followers.length, next: fetchFollowers, hasMoreNext: next !== null || loading, loaderNext: _jsx(UserSkeleton, { elevation: 0 }), className: classes.infiniteScroll, endMessage: _jsx(Typography, Object.assign({ className: classes.endMessage }, { children: _jsx(FormattedMessage, { id: "ui.eventPartecipantsButton.noOtherPartecipants", defaultMessage: "ui.eventPartecipantsButton.noOtherPartecipants" }) })) }, { children: _jsx(List, { children: followers.map((follower) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: follower }) }, follower.id))) }) })) })))] }));
|
|
127
126
|
}
|
|
@@ -179,9 +179,10 @@ export default function EventSubscribeButton(inProps) {
|
|
|
179
179
|
}
|
|
180
180
|
return _status;
|
|
181
181
|
}, [status, scEvent]);
|
|
182
|
-
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))) {
|
|
182
|
+
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)) {
|
|
183
183
|
return null;
|
|
184
184
|
}
|
|
185
|
-
return (_jsx(_Fragment, { children: (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) !== SCEventPrivacyType.PRIVATE
|
|
185
|
+
return (_jsx(_Fragment, { children: (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) !== SCEventPrivacyType.PRIVATE ||
|
|
186
|
+
((scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) !== SCEventPrivacyType.PRIVATE && status && status !== SCEventSubscriptionStatusType.REQUESTED) ? (_jsxs(_Fragment, { children: [_jsx(SelectRoot, Object.assign({ className: classNames(classes.selectRoot, className, { [classes.going]: status && status === SCEventSubscriptionStatusType.GOING }, { [classes.notGoing]: status && status === SCEventSubscriptionStatusType.NOT_GOING }), onClick: handleOpen, endIcon: _jsx(Icon, { children: open ? 'expand_less' : 'expand_more' }), startIcon: status &&
|
|
186
187
|
status !== SCEventSubscriptionStatusType.SUBSCRIBED && (_jsx(Icon, { children: status === SCEventSubscriptionStatusType.GOING ? 'circle_checked' : 'circle_closed' })) }, rest, { children: getStatus })), isMobile ? (_jsx(SwipeableDrawerRoot, Object.assign({ className: classes.drawerRoot, PaperProps: { className: classes.paper }, open: open, onClose: handleClose, onOpen: handleOpen, anchor: "bottom", disableSwipeToOpen: true }, { children: renderMenuItems() }))) : (_jsx(MenuRoot, Object.assign({ className: classes.menuRoot, anchorEl: anchorEl, open: open, onClose: handleClose }, { children: renderMenuItems() })))] })) : (_jsx(RequestRoot, Object.assign({ className: classNames(classes.requestRoot, className), variant: "outlined", size: "small", loading: scUserContext.user ? scEventsManager.isLoading(scEvent) : null, disabled: status === SCEventSubscriptionStatusType.REQUESTED }, rest, { children: getStatus }))) }));
|
|
187
188
|
}
|
|
@@ -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
|
|
@@ -74,7 +74,7 @@ export default function Events(inProps) {
|
|
|
74
74
|
props: inProps,
|
|
75
75
|
name: PREFIX
|
|
76
76
|
});
|
|
77
|
-
const { endpointQueryParams = { limit: 8, offset: DEFAULT_PAGINATION_OFFSET }, className, EventComponentProps = {}, showFilters = false, filters, general =
|
|
77
|
+
const { endpointQueryParams = { limit: 8, offset: DEFAULT_PAGINATION_OFFSET }, className, EventComponentProps = { elevation: 0, square: true }, EventSkeletonComponentProps = { elevation: 0, square: true }, showFilters = false, filters, general = true } = props, rest = __rest(props, ["endpointQueryParams", "className", "EventComponentProps", "EventSkeletonComponentProps", "showFilters", "filters", "general"]);
|
|
78
78
|
// STATE
|
|
79
79
|
const [events, setEvents] = useState([]);
|
|
80
80
|
const [loading, setLoading] = useState(true);
|
|
@@ -186,7 +186,7 @@ export default function Events(inProps) {
|
|
|
186
186
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
187
187
|
// @ts-ignore
|
|
188
188
|
selected: selected, deleteIcon: selected ? _jsx(Icon, { children: "close" }) : null, onDelete: selected ? handleDeleteClick : null }) }))] })) }))), _jsx(_Fragment, { children: !events.length ? (_jsx(Box, Object.assign({ className: classes.noResults }, { children: (onlyStaffEnabled && !UserUtils.isStaff(scUserContext.user)) ||
|
|
189
|
-
(onlyStaffEnabled && UserUtils.isStaff(scUserContext.user) && general) ? (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, {}), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, {
|
|
189
|
+
(onlyStaffEnabled && UserUtils.isStaff(scUserContext.user) && general) ? (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps)), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { actions: _jsx(CreateEventButton, {}) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title.onlyStaff", defaultMessage: "ui.events.noEvents.title.onlyStaff" }) }))] })) }))) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.events }, { children: _jsxs(_Fragment, { children: [filteredEvents.map((event) => (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 8, md: 6, className: classes.item }, { children: _jsx(Event, Object.assign({ event: event, eventId: event.id }, EventComponentProps)) }), event.id))), filteredEvents.length % 2 !== 0 && (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 8, md: 6, className: classes.itemSkeleton }, { children: _jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { actions: _jsx(CreateEventButton, Object.assign({ variant: "outlined", color: "primary", size: "small" }, { children: _jsx(FormattedMessage, { id: "ui.events.skeleton.action.add", defaultMessage: "ui.events.skeleton.action.add" }) })) })) }), 'skeleton-item'))] }) })), Boolean(next) && (_jsx(Button, Object.assign({ color: "secondary", variant: "text", onClick: handleNext, className: classes.showMore }, { children: _jsx(FormattedMessage, { id: "ui.events.button.seeMore", defaultMessage: "ui.events.button.seeMore" }) })))] })) })] }));
|
|
190
190
|
/**
|
|
191
191
|
* Renders root object (if content availability community option is false and user is anonymous, component is hidden)
|
|
192
192
|
*/
|
|
@@ -194,7 +194,7 @@ export default function Events(inProps) {
|
|
|
194
194
|
return null;
|
|
195
195
|
}
|
|
196
196
|
if (loading) {
|
|
197
|
-
return _jsx(Skeleton, {});
|
|
197
|
+
return _jsx(Skeleton, { EventSkeletonProps: EventSkeletonComponentProps });
|
|
198
198
|
}
|
|
199
199
|
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: c })));
|
|
200
200
|
}
|
|
@@ -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
|
}
|
|
@@ -4,7 +4,7 @@ import { styled } from '@mui/material/styles';
|
|
|
4
4
|
import Box from '@mui/material/Box';
|
|
5
5
|
import { useSCMediaClick } from '@selfcommunity/react-core';
|
|
6
6
|
import { useThemeProps } from '@mui/system';
|
|
7
|
-
import { File, Link, Share } from '../../shared/Media';
|
|
7
|
+
import { File, Link, Share, Event } from '../../shared/Media';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
const PREFIX = 'SCFeedObjectMediaPreview';
|
|
10
10
|
const classes = {
|
|
@@ -42,7 +42,7 @@ export default (inProps) => {
|
|
|
42
42
|
props: inProps,
|
|
43
43
|
name: PREFIX
|
|
44
44
|
});
|
|
45
|
-
const { className, medias, mediaObjectTypes = [File, Link, Share] } = props, rest = __rest(props, ["className", "medias", "mediaObjectTypes"]);
|
|
45
|
+
const { className, medias, mediaObjectTypes = [File, Link, Share, Event] } = props, rest = __rest(props, ["className", "medias", "mediaObjectTypes"]);
|
|
46
46
|
const { handleMediaClick } = useSCMediaClick();
|
|
47
47
|
if (!medias.length) {
|
|
48
48
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button, CardActions,
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button, CardActions, Icon, IconButton, Typography } from '@mui/material';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
import { Box, useThemeProps } from '@mui/system';
|
|
6
6
|
import { Endpoints, EventService, http } from '@selfcommunity/api-services';
|
|
@@ -11,19 +11,22 @@ import { useCallback, useEffect, useMemo, useReducer, useState } from 'react';
|
|
|
11
11
|
import { FormattedMessage } from 'react-intl';
|
|
12
12
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
13
13
|
import { DEFAULT_PAGINATION_LIMIT, DEFAULT_PAGINATION_OFFSET } from '../../constants/Pagination';
|
|
14
|
-
import Calendar from '../../shared/Calendar';
|
|
15
|
-
import EventInfoDetails from '../../shared/EventInfoDetails';
|
|
16
14
|
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
17
15
|
import { actionWidgetTypes, dataWidgetReducer, stateWidgetInitializer } from '../../utils/widget';
|
|
18
|
-
import EventPartecipantsButton from '../EventPartecipantsButton';
|
|
19
|
-
import User from '../User';
|
|
20
16
|
import Widget from '../Widget';
|
|
21
17
|
import { PREFIX } from './constants';
|
|
22
18
|
import Skeleton from './Skeleton';
|
|
19
|
+
import { SCEventTemplateType } from '../../types/event';
|
|
20
|
+
import Event from '../Event';
|
|
23
21
|
const classes = {
|
|
24
22
|
root: `${PREFIX}-root`,
|
|
25
23
|
titleWrapper: `${PREFIX}-title-wrapper`,
|
|
24
|
+
imageWrapper: `${PREFIX}-image-wrapper`,
|
|
25
|
+
image: `${PREFIX}-image`,
|
|
26
26
|
content: `${PREFIX}-content`,
|
|
27
|
+
nameWrapper: `${PREFIX}-name-wrapper`,
|
|
28
|
+
name: `${PREFIX}-name`,
|
|
29
|
+
user: `${PREFIX}-user`,
|
|
27
30
|
firstDivider: `${PREFIX}-first-divider`,
|
|
28
31
|
secondDivider: `${PREFIX}-second-divider`,
|
|
29
32
|
actions: `${PREFIX}-actions`,
|
|
@@ -34,9 +37,8 @@ const Root = styled(Widget, {
|
|
|
34
37
|
name: PREFIX,
|
|
35
38
|
slot: 'Root',
|
|
36
39
|
overridesResolver: (_props, styles) => styles.root
|
|
37
|
-
})();
|
|
40
|
+
})(() => ({}));
|
|
38
41
|
export default function MyEventsWidget(inProps) {
|
|
39
|
-
var _a, _b, _c, _d, _e, _f;
|
|
40
42
|
// PROPS
|
|
41
43
|
const props = useThemeProps({
|
|
42
44
|
props: inProps,
|
|
@@ -94,13 +96,13 @@ export default function MyEventsWidget(inProps) {
|
|
|
94
96
|
// EFFECTS
|
|
95
97
|
useEffect(() => {
|
|
96
98
|
let _t;
|
|
97
|
-
if (scUserContext.user) {
|
|
99
|
+
if (eventsEnabled && scUserContext.user) {
|
|
98
100
|
_t = setTimeout(_initComponent);
|
|
99
101
|
return () => {
|
|
100
102
|
clearTimeout(_t);
|
|
101
103
|
};
|
|
102
104
|
}
|
|
103
|
-
}, [scUserContext.user]);
|
|
105
|
+
}, [scUserContext.user, eventsEnabled]);
|
|
104
106
|
const handlePrev = useCallback(() => {
|
|
105
107
|
setEventIndex(eventIndex - 1);
|
|
106
108
|
}, [eventIndex]);
|
|
@@ -122,5 +124,5 @@ export default function MyEventsWidget(inProps) {
|
|
|
122
124
|
if (state.count === 0) {
|
|
123
125
|
return _jsx(HiddenPlaceholder, {});
|
|
124
126
|
}
|
|
125
|
-
return (_jsxs(Root, Object.assign({ className: classes.root }, rest, { children: [_jsx(Box, Object.assign({ className: classes.titleWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.myEventsWidget.title", defaultMessage: "ui.myEventsWidget.title" }) })) })),
|
|
127
|
+
return (_jsxs(Root, Object.assign({ className: classes.root }, rest, { children: [_jsx(Box, Object.assign({ className: classes.titleWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.myEventsWidget.title", defaultMessage: "ui.myEventsWidget.title" }) })) })), _jsx(Event, { event: state.results[eventIndex], template: SCEventTemplateType.DETAIL, actions: _jsx(_Fragment, {}), elevation: 0, square: true }), _jsxs(CardActions, Object.assign({ className: classes.actions }, { children: [_jsx(IconButton, Object.assign({ size: "small", disabled: eventIndex === 0, className: classes.arrows, onClick: handlePrev }, { children: _jsx(Icon, { children: "chevron_left" }) })), _jsx(Button, Object.assign({ href: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}), className: classes.actionButton }, { children: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.myEventsWidget.showAll", defaultMessage: "ui.myEventsWidget.showAll" }) })) })), _jsx(IconButton, Object.assign({ size: "small", disabled: eventIndex === state.count - 1, className: classes.arrows, onClick: handleNext }, { children: _jsx(Icon, { children: "chevron_right" }) }))] }))] })));
|
|
126
128
|
}
|