@selfcommunity/react-ui 0.7.50-events.58 → 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 +1 -5
- package/lib/cjs/components/Events/Events.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 +1 -5
- package/lib/esm/components/Events/Events.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;
|
|
@@ -182,11 +182,7 @@ function EventSubscribeButton(inProps) {
|
|
|
182
182
|
}
|
|
183
183
|
return _status;
|
|
184
184
|
}, [status, scEvent]);
|
|
185
|
-
if (!scEvent ||
|
|
186
|
-
status === undefined ||
|
|
187
|
-
(isEventAdmin && (user === null || user === void 0 ? void 0 : user.id) === scUserContext.user.id) ||
|
|
188
|
-
(isEventAdmin && !(user === null || user === void 0 ? void 0 : user.id)) ||
|
|
189
|
-
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))) {
|
|
190
186
|
return null;
|
|
191
187
|
}
|
|
192
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 ||
|
|
@@ -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
|
, {
|
|
@@ -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
|
}
|
|
@@ -180,11 +180,7 @@ export default function EventSubscribeButton(inProps) {
|
|
|
180
180
|
}
|
|
181
181
|
return _status;
|
|
182
182
|
}, [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)) {
|
|
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))) {
|
|
188
184
|
return null;
|
|
189
185
|
}
|
|
190
186
|
return (_jsx(_Fragment, { children: (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) !== SCEventPrivacyType.PRIVATE ||
|
|
@@ -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
|
, {
|
|
@@ -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 }))] }));
|