@selfcommunity/react-ui 0.7.50-events.52 → 0.7.50-events.54
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/EventSubscribeButton/EventSubscribeButton.js +7 -3
- package/lib/cjs/components/Events/Events.js +5 -0
- package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +7 -3
- package/lib/esm/components/Events/Events.js +5 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
|
@@ -81,7 +81,7 @@ function EventSubscribeButton(inProps) {
|
|
|
81
81
|
});
|
|
82
82
|
const { className, eventId, event, user, onSubscribe } = props, rest = tslib_1.__rest(props, ["className", "eventId", "event", "user", "onSubscribe"]);
|
|
83
83
|
// STATE
|
|
84
|
-
const [status, setStatus] = (0, react_1.useState)(
|
|
84
|
+
const [status, setStatus] = (0, react_1.useState)(undefined);
|
|
85
85
|
const [anchorEl, setAnchorEl] = react_1.default.useState(null);
|
|
86
86
|
const open = Boolean(anchorEl);
|
|
87
87
|
// CONTEXT
|
|
@@ -180,11 +180,15 @@ function EventSubscribeButton(inProps) {
|
|
|
180
180
|
}
|
|
181
181
|
return _status;
|
|
182
182
|
}, [status, scEvent]);
|
|
183
|
-
if (!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)) {
|
|
184
188
|
return null;
|
|
185
189
|
}
|
|
186
190
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) !== types_1.SCEventPrivacyType.PRIVATE ||
|
|
187
|
-
((scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy)
|
|
191
|
+
((scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) === types_1.SCEventPrivacyType.PRIVATE && status && status !== types_1.SCEventSubscriptionStatusType.REQUESTED) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SelectRoot, Object.assign({ className: (0, classnames_1.default)(classes.selectRoot, className, { [classes.going]: status && status === types_1.SCEventSubscriptionStatusType.GOING }, { [classes.notGoing]: status && status === types_1.SCEventSubscriptionStatusType.NOT_GOING }), onClick: handleOpen, endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: open ? 'expand_less' : 'expand_more' }), startIcon: status &&
|
|
188
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, disabled: status === types_1.SCEventSubscriptionStatusType.REQUESTED, onClick: handleToggleAction }, rest, { children: getStatus }))) }));
|
|
189
193
|
}
|
|
190
194
|
exports.default = EventSubscribeButton;
|
|
@@ -76,6 +76,11 @@ function Events(inProps) {
|
|
|
76
76
|
props: inProps,
|
|
77
77
|
name: constants_1.PREFIX
|
|
78
78
|
});
|
|
79
|
+
// TODO:
|
|
80
|
+
/**
|
|
81
|
+
* Add as prop API Endpoint
|
|
82
|
+
* endpoint: EndpointType;
|
|
83
|
+
*/
|
|
79
84
|
const { endpointQueryParams = { limit: 8, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, className, EventComponentProps = { elevation: 0, square: true }, EventSkeletonComponentProps = { elevation: 0, square: true }, showFilters = false, filters, general = true } = props, rest = tslib_1.__rest(props, ["endpointQueryParams", "className", "EventComponentProps", "EventSkeletonComponentProps", "showFilters", "filters", "general"]);
|
|
80
85
|
// STATE
|
|
81
86
|
const [events, setEvents] = (0, react_1.useState)([]);
|
|
@@ -79,7 +79,7 @@ export default function EventSubscribeButton(inProps) {
|
|
|
79
79
|
});
|
|
80
80
|
const { className, eventId, event, user, onSubscribe } = props, rest = __rest(props, ["className", "eventId", "event", "user", "onSubscribe"]);
|
|
81
81
|
// STATE
|
|
82
|
-
const [status, setStatus] = useState(
|
|
82
|
+
const [status, setStatus] = useState(undefined);
|
|
83
83
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
84
84
|
const open = Boolean(anchorEl);
|
|
85
85
|
// CONTEXT
|
|
@@ -178,10 +178,14 @@ export default function EventSubscribeButton(inProps) {
|
|
|
178
178
|
}
|
|
179
179
|
return _status;
|
|
180
180
|
}, [status, scEvent]);
|
|
181
|
-
if (!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)) {
|
|
182
186
|
return null;
|
|
183
187
|
}
|
|
184
188
|
return (_jsx(_Fragment, { children: (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) !== SCEventPrivacyType.PRIVATE ||
|
|
185
|
-
((scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy)
|
|
189
|
+
((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
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, disabled: status === SCEventSubscriptionStatusType.REQUESTED, onClick: handleToggleAction }, rest, { children: getStatus }))) }));
|
|
187
191
|
}
|
|
@@ -74,6 +74,11 @@ export default function Events(inProps) {
|
|
|
74
74
|
props: inProps,
|
|
75
75
|
name: PREFIX
|
|
76
76
|
});
|
|
77
|
+
// TODO:
|
|
78
|
+
/**
|
|
79
|
+
* Add as prop API Endpoint
|
|
80
|
+
* endpoint: EndpointType;
|
|
81
|
+
*/
|
|
77
82
|
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
83
|
// STATE
|
|
79
84
|
const [events, setEvents] = useState([]);
|