@selfcommunity/react-ui 0.7.50-events.57 → 0.7.50-events.59
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/EventHeader/EventHeader.d.ts +7 -1
- package/lib/cjs/components/EventHeader/EventHeader.js +2 -2
- package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +7 -9
- package/lib/cjs/components/Events/Events.js +2 -2
- package/lib/cjs/components/Events/PastEventsFilter.d.ts +2 -1
- package/lib/cjs/components/Events/PastEventsFilter.js +4 -3
- package/lib/cjs/components/SuggestedEventsWidget/SuggestedEventsWidget.js +1 -1
- package/lib/cjs/shared/EventActionsMenu/index.d.ts +6 -2
- package/lib/cjs/shared/EventActionsMenu/index.js +3 -2
- package/lib/esm/components/EventHeader/EventHeader.d.ts +7 -1
- package/lib/esm/components/EventHeader/EventHeader.js +2 -2
- package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +7 -9
- package/lib/esm/components/Events/Events.js +2 -2
- package/lib/esm/components/Events/PastEventsFilter.d.ts +2 -1
- package/lib/esm/components/Events/PastEventsFilter.js +4 -3
- package/lib/esm/components/SuggestedEventsWidget/SuggestedEventsWidget.js +1 -1
- package/lib/esm/shared/EventActionsMenu/index.d.ts +6 -2
- package/lib/esm/shared/EventActionsMenu/index.js +3 -2
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SCEventType } from '@selfcommunity/types';
|
|
2
2
|
import { EventSubscribeButtonProps } from '../EventSubscribeButton';
|
|
3
|
+
import { EventActionsMenuProps } from '../../shared/EventActionsMenu';
|
|
3
4
|
export interface EventHeaderProps {
|
|
4
5
|
/**
|
|
5
6
|
* Id of event object
|
|
@@ -22,10 +23,15 @@ export interface EventHeaderProps {
|
|
|
22
23
|
*/
|
|
23
24
|
eventId?: number;
|
|
24
25
|
/**
|
|
25
|
-
* Props to spread event button
|
|
26
|
+
* Props to spread event button
|
|
26
27
|
* @default {}
|
|
27
28
|
*/
|
|
28
29
|
EventSubscribeButtonProps?: EventSubscribeButtonProps;
|
|
30
|
+
/**
|
|
31
|
+
* Props to spread event actions menu
|
|
32
|
+
* @default {}
|
|
33
|
+
*/
|
|
34
|
+
EventActionsProps?: EventActionsMenuProps;
|
|
29
35
|
/**
|
|
30
36
|
* Any other properties
|
|
31
37
|
*/
|
|
@@ -77,7 +77,7 @@ function EventHeader(inProps) {
|
|
|
77
77
|
props: inProps,
|
|
78
78
|
name: constants_1.PREFIX
|
|
79
79
|
});
|
|
80
|
-
const { id = null, className = null, event, eventId = null, EventSubscribeButtonProps = {} } = props, rest = tslib_1.__rest(props, ["id", "className", "event", "eventId", "EventSubscribeButtonProps"]);
|
|
80
|
+
const { id = null, className = null, event, eventId = null, EventSubscribeButtonProps = {}, EventActionsProps = {} } = props, rest = tslib_1.__rest(props, ["id", "className", "event", "eventId", "EventSubscribeButtonProps", "EventActionsProps"]);
|
|
81
81
|
// PREFERENCES
|
|
82
82
|
const scPreferences = (0, react_core_1.useSCPreferences)();
|
|
83
83
|
// CONTEXT
|
|
@@ -167,6 +167,6 @@ function EventHeader(inProps) {
|
|
|
167
167
|
month: 'long'
|
|
168
168
|
}),
|
|
169
169
|
hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
|
|
170
|
-
} })) })), (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, { buttonProps: { disabled: true }, 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, {
|
|
170
|
+
} })) })), (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, { buttonProps: { disabled: true }, 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, Object.assign({ event: scEvent }, EventActionsProps))] })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EventSubscribeButton_1.default, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps)), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent }, EventActionsProps))] })) }) })] }))] })));
|
|
171
171
|
}
|
|
172
172
|
exports.default = EventHeader;
|
|
@@ -132,9 +132,11 @@ function EventSubscribeButton(inProps) {
|
|
|
132
132
|
}
|
|
133
133
|
else {
|
|
134
134
|
s =
|
|
135
|
-
scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.
|
|
136
|
-
?
|
|
137
|
-
: types_1.SCEventSubscriptionStatusType.NOT_GOING
|
|
135
|
+
scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.REQUESTED
|
|
136
|
+
? null
|
|
137
|
+
: scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.NOT_GOING
|
|
138
|
+
? types_1.SCEventSubscriptionStatusType.SUBSCRIBED
|
|
139
|
+
: types_1.SCEventSubscriptionStatusType.NOT_GOING;
|
|
138
140
|
}
|
|
139
141
|
onSubscribe && onSubscribe(scEvent, s);
|
|
140
142
|
})
|
|
@@ -180,15 +182,11 @@ function EventSubscribeButton(inProps) {
|
|
|
180
182
|
}
|
|
181
183
|
return _status;
|
|
182
184
|
}, [status, scEvent]);
|
|
183
|
-
if (!scEvent ||
|
|
184
|
-
status === undefined ||
|
|
185
|
-
(isEventAdmin && (user === null || user === void 0 ? void 0 : user.id) === scUserContext.user.id) ||
|
|
186
|
-
(isEventAdmin && !(user === null || user === void 0 ? void 0 : user.id)) ||
|
|
187
|
-
scEventsManager.isLoading(scEvent)) {
|
|
185
|
+
if (!scEvent || status === undefined || (isEventAdmin && (user === null || user === void 0 ? void 0 : user.id) === scUserContext.user.id) || (isEventAdmin && !(user === null || user === void 0 ? void 0 : user.id))) {
|
|
188
186
|
return null;
|
|
189
187
|
}
|
|
190
188
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) !== types_1.SCEventPrivacyType.PRIVATE ||
|
|
191
189
|
((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 &&
|
|
192
|
-
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,
|
|
190
|
+
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, onClick: handleToggleAction }, rest, { children: getStatus }))) }));
|
|
193
191
|
}
|
|
194
192
|
exports.default = EventSubscribeButton;
|
|
@@ -184,7 +184,7 @@ function Events(inProps) {
|
|
|
184
184
|
* Renders events list
|
|
185
185
|
*/
|
|
186
186
|
const filteredEvents = (0, utils_1.sortByAttr)(getFilteredEvents(), 'order');
|
|
187
|
-
const c = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showFilters && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general ? ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(PastEventsFilter_1.default, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick }) }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 4 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { size: 'small', fullWidth: true, value: search, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ disabled: showPastEvents, size: 'small', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }), value: dateSearch, onChange: handleOnChangeTimeFrame, renderValue: (selected) => options.find((option) => option.value === selected).label }, { children: options.map((option) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ value: option.value }, { children: [(0, jsx_runtime_1.jsx)(material_1.Radio, { checked: dateSearch === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.EventsChipRoot
|
|
187
|
+
const c = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showFilters && ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general && events.length ? ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(PastEventsFilter_1.default, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick }) }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 4 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { size: 'small', fullWidth: true, value: search, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ disabled: showPastEvents, size: 'small', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }), value: dateSearch, onChange: handleOnChangeTimeFrame, renderValue: (selected) => options.find((option) => option.value === selected).label }, { children: options.map((option) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ value: option.value }, { children: [(0, jsx_runtime_1.jsx)(material_1.Radio, { checked: dateSearch === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(exports.EventsChipRoot
|
|
188
188
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
189
189
|
// @ts-ignore
|
|
190
190
|
, {
|
|
@@ -196,7 +196,7 @@ function Events(inProps) {
|
|
|
196
196
|
variant: showFollowed ? 'filled' : 'outlined', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByFollowedInterest", defaultMessage: "ui.events.filterByFollowedInterest" }), onClick: handleChipClick,
|
|
197
197
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
198
198
|
// @ts-ignore
|
|
199
|
-
showFollowed: showFollowed, deleteIcon: showFollowed ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(PastEventsFilter_1.default, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick }) }))] })) }))), (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)) ||
|
|
199
|
+
showFollowed: showFollowed, deleteIcon: showFollowed ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(PastEventsFilter_1.default, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: dateSearch !== types_1.SCEventDateFilterType.ANY }) }))] })) }))), (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)) ||
|
|
200
200
|
(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" }) })))] })) })] }));
|
|
201
201
|
/**
|
|
202
202
|
* Renders root object (if content availability community option is false and user is anonymous, component is hidden)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
5
|
const material_1 = require("@mui/material");
|
|
5
6
|
const react_intl_1 = require("react-intl");
|
|
@@ -12,11 +13,11 @@ function PastEventsFilter(inProps) {
|
|
|
12
13
|
props: inProps,
|
|
13
14
|
name: constants_1.PREFIX
|
|
14
15
|
});
|
|
15
|
-
const { showPastEvents, handleClick, handleDeleteClick } = props;
|
|
16
|
+
const { showPastEvents, handleClick, handleDeleteClick } = props, rest = tslib_1.__rest(props, ["showPastEvents", "handleClick", "handleDeleteClick"]);
|
|
16
17
|
return ((0, jsx_runtime_1.jsx)(Events_1.EventsChipRoot
|
|
17
18
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
18
19
|
// @ts-ignore
|
|
19
|
-
, {
|
|
20
|
+
, Object.assign({
|
|
20
21
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
21
22
|
// @ts-ignore
|
|
22
23
|
color: showPastEvents ? 'secondary' : 'default',
|
|
@@ -25,6 +26,6 @@ function PastEventsFilter(inProps) {
|
|
|
25
26
|
variant: showPastEvents ? 'filled' : 'outlined', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByPastEvents", defaultMessage: "ui.events.filterByPastEvents" }), onClick: handleClick,
|
|
26
27
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
27
28
|
// @ts-ignore
|
|
28
|
-
showPastEvents: showPastEvents, deleteIcon: showPastEvents ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showPastEvents ? handleDeleteClick : undefined }));
|
|
29
|
+
showPastEvents: showPastEvents, deleteIcon: showPastEvents ? (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) : null, onDelete: showPastEvents ? handleDeleteClick : undefined }, rest)));
|
|
29
30
|
}
|
|
30
31
|
exports.default = PastEventsFilter;
|
|
@@ -85,6 +85,6 @@ function SuggestedEventsWidget(inProps) {
|
|
|
85
85
|
if (!eventsData) {
|
|
86
86
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
87
87
|
}
|
|
88
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.suggestedEventsWidget.title", defaultMessage: "ui.suggestedEventsWidget.title" }) })), (0, jsx_runtime_1.jsxs)(react_2.Swiper, Object.assign({ spaceBetween: 8, slidesPerView: "auto", grabCursor: true, modules: [modules_1.Navigation], onReachEnd: handleReachEnd, className: classes.swiper }, { children: [(showSkeleton ? [...eventsData.results, undefined] : eventsData.results).map((event, i) => ((0, jsx_runtime_1.jsx)(react_2.SwiperSlide, Object.assign({ className: classes.swiperSlide }, { children: (0, jsx_runtime_1.jsx)(Event_1.default, { event: event, template: event_1.SCEventTemplateType.PREVIEW, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), variant: "outlined", className: classes.event }) }), i))), (0, jsx_runtime_1.jsx)(Arrow_1.default, { className: classes.swiperPrevArrow, type: "prev", currentItem: currentItem, setCurrentItem: setCurrentItem }), (0, jsx_runtime_1.jsx)(Arrow_1.default, { className: classes.swiperNextArrow, type: "next", currentItem: currentItem, setCurrentItem: setCurrentItem })] }))] })), (0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENTS_SUGGESTED_ROUTE_NAME, {}), className: classes.actionButton }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.suggestedEventsWidget.showAll", defaultMessage: "ui.suggestedEventsWidget.showAll" }) })) })) }))] })));
|
|
88
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.suggestedEventsWidget.title", defaultMessage: "ui.suggestedEventsWidget.title" }) })), (0, jsx_runtime_1.jsxs)(react_2.Swiper, Object.assign({ spaceBetween: 8, slidesPerView: "auto", grabCursor: true, modules: [modules_1.Navigation], onReachEnd: handleReachEnd, onSlideChange: (swiper) => setCurrentItem(swiper.snapIndex), className: classes.swiper }, { children: [(showSkeleton ? [...eventsData.results, undefined] : eventsData.results).map((event, i) => ((0, jsx_runtime_1.jsx)(react_2.SwiperSlide, Object.assign({ className: classes.swiperSlide }, { children: (0, jsx_runtime_1.jsx)(Event_1.default, { event: event, template: event_1.SCEventTemplateType.PREVIEW, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), variant: "outlined", className: classes.event }) }), i))), (0, jsx_runtime_1.jsx)(Arrow_1.default, { className: classes.swiperPrevArrow, type: "prev", currentItem: currentItem, setCurrentItem: setCurrentItem }), (0, jsx_runtime_1.jsx)(Arrow_1.default, { className: classes.swiperNextArrow, type: "next", currentItem: currentItem, setCurrentItem: setCurrentItem })] }))] })), (0, jsx_runtime_1.jsx)(material_1.CardActions, Object.assign({ className: classes.actions }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EVENTS_SUGGESTED_ROUTE_NAME, {}), className: classes.actionButton }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "caption" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.suggestedEventsWidget.showAll", defaultMessage: "ui.suggestedEventsWidget.showAll" }) })) })) }))] })));
|
|
89
89
|
}
|
|
90
90
|
exports.default = SuggestedEventsWidget;
|
|
@@ -9,11 +9,15 @@ export interface EventActionsMenuProps extends IconButtonProps {
|
|
|
9
9
|
/**
|
|
10
10
|
* The event
|
|
11
11
|
*/
|
|
12
|
-
event
|
|
12
|
+
event: SCEventType;
|
|
13
13
|
/**
|
|
14
14
|
* The event id
|
|
15
15
|
*/
|
|
16
|
-
eventId
|
|
16
|
+
eventId?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Handles callback on delete confirm
|
|
19
|
+
*/
|
|
20
|
+
onDeleteConfirm?: () => void;
|
|
17
21
|
/**
|
|
18
22
|
* Any other properties
|
|
19
23
|
*/
|
|
@@ -71,7 +71,7 @@ function EventActionsMenu(inProps) {
|
|
|
71
71
|
props: inProps,
|
|
72
72
|
name: PREFIX
|
|
73
73
|
});
|
|
74
|
-
const { className, event, eventId } = props, rest = tslib_1.__rest(props, ["className", "event", "eventId"]);
|
|
74
|
+
const { className, event, eventId, onDeleteConfirm } = props, rest = tslib_1.__rest(props, ["className", "event", "eventId", "onDeleteConfirm"]);
|
|
75
75
|
// STATE
|
|
76
76
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
77
77
|
const [openConfirmDialog, setOpenConfirmDialog] = (0, react_1.useState)(false);
|
|
@@ -99,6 +99,7 @@ function EventActionsMenu(inProps) {
|
|
|
99
99
|
function handleDeleteThread() {
|
|
100
100
|
api_services_1.EventService.deleteEvent(scEvent.id)
|
|
101
101
|
.then(() => {
|
|
102
|
+
onDeleteConfirm();
|
|
102
103
|
handleCloseDialog();
|
|
103
104
|
})
|
|
104
105
|
.catch((error) => {
|
|
@@ -146,7 +147,7 @@ function EventActionsMenu(inProps) {
|
|
|
146
147
|
];
|
|
147
148
|
};
|
|
148
149
|
if (!scUserContext.user ||
|
|
149
|
-
((scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) === types_1.SCEventPrivacyType.PRIVATE && (scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) !== types_1.SCEventSubscriptionStatusType.SUBSCRIBED)) {
|
|
150
|
+
((scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) === types_1.SCEventPrivacyType.PRIVATE && !isEventAdmin && (scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) !== types_1.SCEventSubscriptionStatusType.SUBSCRIBED)) {
|
|
150
151
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
151
152
|
}
|
|
152
153
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "more_vert" }) })), isMobile ? ((0, jsx_runtime_1.jsx)(SwipeableDrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "bottom", open: Boolean(anchorEl), onClose: handleClose, onOpen: handleOpen, PaperProps: { className: classes.paper }, disableSwipeToOpen: true }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: renderList() }) }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ className: classes.menuRoot, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, PaperProps: { className: classes.paper } }, { children: renderList() }))), openConfirmDialog && ((0, jsx_runtime_1.jsx)(ConfirmDialog_1.default, { open: openConfirmDialog, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.shared.eventActionsMenu.dialog.msg", defaultMessage: "ui.shared.eventActionsMenu.dialog.msg" }), btnConfirm: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.shared.eventActionsMenu.dialog.confirm", defaultMessage: "ui.shared.eventActionsMenu.dialog.confirm" }), onConfirm: handleDeleteThread, onClose: handleCloseDialog }))] }));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SCEventType } from '@selfcommunity/types';
|
|
2
2
|
import { EventSubscribeButtonProps } from '../EventSubscribeButton';
|
|
3
|
+
import { EventActionsMenuProps } from '../../shared/EventActionsMenu';
|
|
3
4
|
export interface EventHeaderProps {
|
|
4
5
|
/**
|
|
5
6
|
* Id of event object
|
|
@@ -22,10 +23,15 @@ export interface EventHeaderProps {
|
|
|
22
23
|
*/
|
|
23
24
|
eventId?: number;
|
|
24
25
|
/**
|
|
25
|
-
* Props to spread event button
|
|
26
|
+
* Props to spread event button
|
|
26
27
|
* @default {}
|
|
27
28
|
*/
|
|
28
29
|
EventSubscribeButtonProps?: EventSubscribeButtonProps;
|
|
30
|
+
/**
|
|
31
|
+
* Props to spread event actions menu
|
|
32
|
+
* @default {}
|
|
33
|
+
*/
|
|
34
|
+
EventActionsProps?: EventActionsMenuProps;
|
|
29
35
|
/**
|
|
30
36
|
* Any other properties
|
|
31
37
|
*/
|
|
@@ -75,7 +75,7 @@ export default function EventHeader(inProps) {
|
|
|
75
75
|
props: inProps,
|
|
76
76
|
name: PREFIX
|
|
77
77
|
});
|
|
78
|
-
const { id = null, className = null, event, eventId = null, EventSubscribeButtonProps = {} } = props, rest = __rest(props, ["id", "className", "event", "eventId", "EventSubscribeButtonProps"]);
|
|
78
|
+
const { id = null, className = null, event, eventId = null, EventSubscribeButtonProps = {}, EventActionsProps = {} } = props, rest = __rest(props, ["id", "className", "event", "eventId", "EventSubscribeButtonProps", "EventActionsProps"]);
|
|
79
79
|
// PREFERENCES
|
|
80
80
|
const scPreferences = useSCPreferences();
|
|
81
81
|
// CONTEXT
|
|
@@ -165,5 +165,5 @@ export default function EventHeader(inProps) {
|
|
|
165
165
|
month: 'long'
|
|
166
166
|
}),
|
|
167
167
|
hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
|
|
168
|
-
} })) })), _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, { buttonProps: { disabled: true }, 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, {
|
|
168
|
+
} })) })), _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, { buttonProps: { disabled: true }, 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, Object.assign({ event: scEvent }, EventActionsProps))] })] }))) : (_jsxs(_Fragment, { children: [_jsx(EventSubscribeButton, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps)), _jsx(EventActionsMenu, Object.assign({ event: scEvent }, EventActionsProps))] })) }) })] }))] })));
|
|
169
169
|
}
|
|
@@ -130,9 +130,11 @@ export default function EventSubscribeButton(inProps) {
|
|
|
130
130
|
}
|
|
131
131
|
else {
|
|
132
132
|
s =
|
|
133
|
-
scEvent.subscription_status === SCEventSubscriptionStatusType.
|
|
134
|
-
?
|
|
135
|
-
: SCEventSubscriptionStatusType.NOT_GOING
|
|
133
|
+
scEvent.subscription_status === SCEventSubscriptionStatusType.REQUESTED
|
|
134
|
+
? null
|
|
135
|
+
: scEvent.subscription_status === SCEventSubscriptionStatusType.NOT_GOING
|
|
136
|
+
? SCEventSubscriptionStatusType.SUBSCRIBED
|
|
137
|
+
: SCEventSubscriptionStatusType.NOT_GOING;
|
|
136
138
|
}
|
|
137
139
|
onSubscribe && onSubscribe(scEvent, s);
|
|
138
140
|
})
|
|
@@ -178,14 +180,10 @@ export default function EventSubscribeButton(inProps) {
|
|
|
178
180
|
}
|
|
179
181
|
return _status;
|
|
180
182
|
}, [status, scEvent]);
|
|
181
|
-
if (!scEvent ||
|
|
182
|
-
status === undefined ||
|
|
183
|
-
(isEventAdmin && (user === null || user === void 0 ? void 0 : user.id) === scUserContext.user.id) ||
|
|
184
|
-
(isEventAdmin && !(user === null || user === void 0 ? void 0 : user.id)) ||
|
|
185
|
-
scEventsManager.isLoading(scEvent)) {
|
|
183
|
+
if (!scEvent || status === undefined || (isEventAdmin && (user === null || user === void 0 ? void 0 : user.id) === scUserContext.user.id) || (isEventAdmin && !(user === null || user === void 0 ? void 0 : user.id))) {
|
|
186
184
|
return null;
|
|
187
185
|
}
|
|
188
186
|
return (_jsx(_Fragment, { children: (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) !== SCEventPrivacyType.PRIVATE ||
|
|
189
187
|
((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 &&
|
|
190
|
-
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,
|
|
188
|
+
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, onClick: handleToggleAction }, rest, { children: getStatus }))) }));
|
|
191
189
|
}
|
|
@@ -181,7 +181,7 @@ export default function Events(inProps) {
|
|
|
181
181
|
* Renders events list
|
|
182
182
|
*/
|
|
183
183
|
const filteredEvents = sortByAttr(getFilteredEvents(), 'order');
|
|
184
|
-
const c = (_jsxs(_Fragment, { children: [showFilters && (_jsx(Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general ? (_jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick }) }))) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ item: true, xs: 12, md: 4 }, { children: _jsx(TextField, { size: 'small', fullWidth: true, value: search, label: _jsx(FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(InputLabel, { children: _jsx(FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), _jsx(Select, Object.assign({ disabled: showPastEvents, size: 'small', label: _jsx(FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }), value: dateSearch, onChange: handleOnChangeTimeFrame, renderValue: (selected) => options.find((option) => option.value === selected).label }, { children: options.map((option) => (_jsxs(MenuItem, Object.assign({ value: option.value }, { children: [_jsx(Radio, { checked: dateSearch === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })) })), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(EventsChipRoot
|
|
184
|
+
const c = (_jsxs(_Fragment, { children: [showFilters && (_jsx(Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general && events.length ? (_jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick }) }))) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ item: true, xs: 12, md: 4 }, { children: _jsx(TextField, { size: 'small', fullWidth: true, value: search, label: _jsx(FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(InputLabel, { children: _jsx(FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), _jsx(Select, Object.assign({ disabled: showPastEvents, size: 'small', label: _jsx(FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }), value: dateSearch, onChange: handleOnChangeTimeFrame, renderValue: (selected) => options.find((option) => option.value === selected).label }, { children: options.map((option) => (_jsxs(MenuItem, Object.assign({ value: option.value }, { children: [_jsx(Radio, { checked: dateSearch === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })) })), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(EventsChipRoot
|
|
185
185
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
186
186
|
// @ts-ignore
|
|
187
187
|
, {
|
|
@@ -193,7 +193,7 @@ export default function Events(inProps) {
|
|
|
193
193
|
variant: showFollowed ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByFollowedInterest", defaultMessage: "ui.events.filterByFollowedInterest" }), onClick: handleChipClick,
|
|
194
194
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
195
195
|
// @ts-ignore
|
|
196
|
-
showFollowed: showFollowed, deleteIcon: showFollowed ? _jsx(Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null }) })), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick }) }))] })) }))), _jsx(_Fragment, { children: !events.length ? (_jsx(Box, Object.assign({ className: classes.noResults }, { children: (onlyStaffEnabled && !UserUtils.isStaff(scUserContext.user)) ||
|
|
196
|
+
showFollowed: showFollowed, deleteIcon: showFollowed ? _jsx(Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null }) })), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: dateSearch !== SCEventDateFilterType.ANY }) }))] })) }))), _jsx(_Fragment, { children: !events.length ? (_jsx(Box, Object.assign({ className: classes.noResults }, { children: (onlyStaffEnabled && !UserUtils.isStaff(scUserContext.user)) ||
|
|
197
197
|
(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" }) })))] })) })] }));
|
|
198
198
|
/**
|
|
199
199
|
* Renders root object (if content availability community option is false and user is anonymous, component is hidden)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { Icon } from '@mui/material';
|
|
3
4
|
import { FormattedMessage } from 'react-intl';
|
|
@@ -10,11 +11,11 @@ export default function PastEventsFilter(inProps) {
|
|
|
10
11
|
props: inProps,
|
|
11
12
|
name: PREFIX
|
|
12
13
|
});
|
|
13
|
-
const { showPastEvents, handleClick, handleDeleteClick } = props;
|
|
14
|
+
const { showPastEvents, handleClick, handleDeleteClick } = props, rest = __rest(props, ["showPastEvents", "handleClick", "handleDeleteClick"]);
|
|
14
15
|
return (_jsx(EventsChipRoot
|
|
15
16
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
16
17
|
// @ts-ignore
|
|
17
|
-
, {
|
|
18
|
+
, Object.assign({
|
|
18
19
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
19
20
|
// @ts-ignore
|
|
20
21
|
color: showPastEvents ? 'secondary' : 'default',
|
|
@@ -23,5 +24,5 @@ export default function PastEventsFilter(inProps) {
|
|
|
23
24
|
variant: showPastEvents ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByPastEvents", defaultMessage: "ui.events.filterByPastEvents" }), onClick: handleClick,
|
|
24
25
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
25
26
|
// @ts-ignore
|
|
26
|
-
showPastEvents: showPastEvents, deleteIcon: showPastEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showPastEvents ? handleDeleteClick : undefined }));
|
|
27
|
+
showPastEvents: showPastEvents, deleteIcon: showPastEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showPastEvents ? handleDeleteClick : undefined }, rest)));
|
|
27
28
|
}
|
|
@@ -83,5 +83,5 @@ export default function SuggestedEventsWidget(inProps) {
|
|
|
83
83
|
if (!eventsData) {
|
|
84
84
|
return _jsx(HiddenPlaceholder, {});
|
|
85
85
|
}
|
|
86
|
-
return (_jsxs(Root, Object.assign({ className: classes.root }, rest, { children: [_jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.suggestedEventsWidget.title", defaultMessage: "ui.suggestedEventsWidget.title" }) })), _jsxs(Swiper, Object.assign({ spaceBetween: 8, slidesPerView: "auto", grabCursor: true, modules: [Navigation], onReachEnd: handleReachEnd, className: classes.swiper }, { children: [(showSkeleton ? [...eventsData.results, undefined] : eventsData.results).map((event, i) => (_jsx(SwiperSlide, Object.assign({ className: classes.swiperSlide }, { children: _jsx(Event, { event: event, template: SCEventTemplateType.PREVIEW, actions: _jsx(_Fragment, {}), variant: "outlined", className: classes.event }) }), i))), _jsx(Arrow, { className: classes.swiperPrevArrow, type: "prev", currentItem: currentItem, setCurrentItem: setCurrentItem }), _jsx(Arrow, { className: classes.swiperNextArrow, type: "next", currentItem: currentItem, setCurrentItem: setCurrentItem })] }))] })), _jsx(CardActions, Object.assign({ className: classes.actions }, { children: _jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.EVENTS_SUGGESTED_ROUTE_NAME, {}), className: classes.actionButton }, { children: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.suggestedEventsWidget.showAll", defaultMessage: "ui.suggestedEventsWidget.showAll" }) })) })) }))] })));
|
|
86
|
+
return (_jsxs(Root, Object.assign({ className: classes.root }, rest, { children: [_jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.suggestedEventsWidget.title", defaultMessage: "ui.suggestedEventsWidget.title" }) })), _jsxs(Swiper, Object.assign({ spaceBetween: 8, slidesPerView: "auto", grabCursor: true, modules: [Navigation], onReachEnd: handleReachEnd, onSlideChange: (swiper) => setCurrentItem(swiper.snapIndex), className: classes.swiper }, { children: [(showSkeleton ? [...eventsData.results, undefined] : eventsData.results).map((event, i) => (_jsx(SwiperSlide, Object.assign({ className: classes.swiperSlide }, { children: _jsx(Event, { event: event, template: SCEventTemplateType.PREVIEW, actions: _jsx(_Fragment, {}), variant: "outlined", className: classes.event }) }), i))), _jsx(Arrow, { className: classes.swiperPrevArrow, type: "prev", currentItem: currentItem, setCurrentItem: setCurrentItem }), _jsx(Arrow, { className: classes.swiperNextArrow, type: "next", currentItem: currentItem, setCurrentItem: setCurrentItem })] }))] })), _jsx(CardActions, Object.assign({ className: classes.actions }, { children: _jsx(Button, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.EVENTS_SUGGESTED_ROUTE_NAME, {}), className: classes.actionButton }, { children: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.suggestedEventsWidget.showAll", defaultMessage: "ui.suggestedEventsWidget.showAll" }) })) })) }))] })));
|
|
87
87
|
}
|
|
@@ -9,11 +9,15 @@ export interface EventActionsMenuProps extends IconButtonProps {
|
|
|
9
9
|
/**
|
|
10
10
|
* The event
|
|
11
11
|
*/
|
|
12
|
-
event
|
|
12
|
+
event: SCEventType;
|
|
13
13
|
/**
|
|
14
14
|
* The event id
|
|
15
15
|
*/
|
|
16
|
-
eventId
|
|
16
|
+
eventId?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Handles callback on delete confirm
|
|
19
|
+
*/
|
|
20
|
+
onDeleteConfirm?: () => void;
|
|
17
21
|
/**
|
|
18
22
|
* Any other properties
|
|
19
23
|
*/
|
|
@@ -69,7 +69,7 @@ export default function EventActionsMenu(inProps) {
|
|
|
69
69
|
props: inProps,
|
|
70
70
|
name: PREFIX
|
|
71
71
|
});
|
|
72
|
-
const { className, event, eventId } = props, rest = __rest(props, ["className", "event", "eventId"]);
|
|
72
|
+
const { className, event, eventId, onDeleteConfirm } = props, rest = __rest(props, ["className", "event", "eventId", "onDeleteConfirm"]);
|
|
73
73
|
// STATE
|
|
74
74
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
75
75
|
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
|
@@ -97,6 +97,7 @@ export default function EventActionsMenu(inProps) {
|
|
|
97
97
|
function handleDeleteThread() {
|
|
98
98
|
EventService.deleteEvent(scEvent.id)
|
|
99
99
|
.then(() => {
|
|
100
|
+
onDeleteConfirm();
|
|
100
101
|
handleCloseDialog();
|
|
101
102
|
})
|
|
102
103
|
.catch((error) => {
|
|
@@ -144,7 +145,7 @@ export default function EventActionsMenu(inProps) {
|
|
|
144
145
|
];
|
|
145
146
|
};
|
|
146
147
|
if (!scUserContext.user ||
|
|
147
|
-
((scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) === SCEventPrivacyType.PRIVATE && (scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) !== SCEventSubscriptionStatusType.SUBSCRIBED)) {
|
|
148
|
+
((scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) === SCEventPrivacyType.PRIVATE && !isEventAdmin && (scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) !== SCEventSubscriptionStatusType.SUBSCRIBED)) {
|
|
148
149
|
return _jsx(HiddenPlaceholder, {});
|
|
149
150
|
}
|
|
150
151
|
return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { onClick: handleOpen }, { children: _jsx(Icon, { children: "more_vert" }) })), isMobile ? (_jsx(SwipeableDrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "bottom", open: Boolean(anchorEl), onClose: handleClose, onOpen: handleOpen, PaperProps: { className: classes.paper }, disableSwipeToOpen: true }, { children: _jsx(List, { children: renderList() }) }))) : (_jsx(MenuRoot, Object.assign({ className: classes.menuRoot, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, PaperProps: { className: classes.paper } }, { children: renderList() }))), openConfirmDialog && (_jsx(ConfirmDialog, { open: openConfirmDialog, title: _jsx(FormattedMessage, { id: "ui.shared.eventActionsMenu.dialog.msg", defaultMessage: "ui.shared.eventActionsMenu.dialog.msg" }), btnConfirm: _jsx(FormattedMessage, { id: "ui.shared.eventActionsMenu.dialog.confirm", defaultMessage: "ui.shared.eventActionsMenu.dialog.confirm" }), onConfirm: handleDeleteThread, onClose: handleCloseDialog }))] }));
|