@selfcommunity/react-ui 0.9.0-alpha.18 → 0.9.0-alpha.19
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.js +3 -3
- package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
- package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +10 -12
- package/lib/esm/components/EventHeader/EventHeader.js +3 -3
- package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
- package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +12 -14
- package/lib/umd/react-ui.js +1 -1
- package/package.json +3 -3
|
@@ -96,8 +96,8 @@ function EventHeader(inProps) {
|
|
|
96
96
|
/**
|
|
97
97
|
* Handles callback subscribe/unsubscribe event
|
|
98
98
|
*/
|
|
99
|
-
const handleSubscribe = (
|
|
100
|
-
setSCEvent(
|
|
99
|
+
const handleSubscribe = (event) => {
|
|
100
|
+
setSCEvent(event);
|
|
101
101
|
};
|
|
102
102
|
// RENDER
|
|
103
103
|
if (!scEvent) {
|
|
@@ -141,6 +141,6 @@ function EventHeader(inProps) {
|
|
|
141
141
|
month: 'long'
|
|
142
142
|
}),
|
|
143
143
|
hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
|
|
144
|
-
} })) })), (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.online", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, { className: classes.planner, userId: scEvent.managed_by.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, disabled: isEventFinished }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [!isMobile && ((0, jsx_runtime_1.jsx)(EditEventButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, onEditSuccess:
|
|
144
|
+
} })) })), (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.online", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, { className: classes.planner, userId: scEvent.managed_by.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, disabled: isEventFinished }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [!isMobile && ((0, jsx_runtime_1.jsx)(EditEventButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, onEditSuccess: setSCEvent, disabled: isEventFinished })), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent, onEditSuccess: (data) => setSCEvent(data) }, 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, { disabled: isEventFinished })), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent, onEditSuccess: setSCEvent }, EventActionsProps))] })) }) })] }))] })));
|
|
145
145
|
}
|
|
146
146
|
exports.default = EventHeader;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SCEventType, SCUserType } from '@selfcommunity/types';
|
|
2
2
|
export interface EventSubscribeButtonProps {
|
|
3
3
|
/**
|
|
4
4
|
* Overrides or extends the styles applied to the component.
|
|
@@ -25,7 +25,7 @@ export interface EventSubscribeButtonProps {
|
|
|
25
25
|
* @param user
|
|
26
26
|
* @param joined
|
|
27
27
|
*/
|
|
28
|
-
onSubscribe?: (event: SCEventType
|
|
28
|
+
onSubscribe?: (event: SCEventType) => any;
|
|
29
29
|
/**
|
|
30
30
|
* Others properties
|
|
31
31
|
*/
|
|
@@ -102,12 +102,12 @@ function EventSubscribeButton(inProps) {
|
|
|
102
102
|
});
|
|
103
103
|
const isEventAdmin = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
|
|
104
104
|
// HANDLERS
|
|
105
|
-
const handleOpen = (event) => {
|
|
105
|
+
const handleOpen = (0, react_1.useCallback)((event) => {
|
|
106
106
|
setAnchorEl(event.currentTarget);
|
|
107
|
-
};
|
|
108
|
-
const handleClose = () => {
|
|
107
|
+
}, [setAnchorEl]);
|
|
108
|
+
const handleClose = (0, react_1.useCallback)(() => {
|
|
109
109
|
setAnchorEl(null);
|
|
110
|
-
};
|
|
110
|
+
}, [setAnchorEl]);
|
|
111
111
|
(0, react_1.useEffect)(() => {
|
|
112
112
|
/**
|
|
113
113
|
* Call scEventsManager.subscriptionStatus inside an effect
|
|
@@ -117,25 +117,23 @@ function EventSubscribeButton(inProps) {
|
|
|
117
117
|
setStatus(scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus(scEvent));
|
|
118
118
|
}
|
|
119
119
|
}, [authUserId, scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus, scEvent]);
|
|
120
|
-
const toggleEventAttendance = (eventStatus) => {
|
|
120
|
+
const toggleEventAttendance = (0, react_1.useCallback)((eventStatus) => {
|
|
121
121
|
setLoading(true);
|
|
122
122
|
const isGoing = eventStatus === types_1.SCEventSubscriptionStatusType.GOING ||
|
|
123
123
|
!(scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) ||
|
|
124
124
|
(scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) === types_1.SCEventSubscriptionStatusType.INVITED;
|
|
125
125
|
const toggleAction = isGoing ? scEventsManager.toggleEventAttendance(scEvent) : scEventsManager.toggleEventNonattendance(scEvent);
|
|
126
126
|
toggleAction
|
|
127
|
-
.then(() => {
|
|
128
|
-
onSubscribe
|
|
129
|
-
? onSubscribe(scEvent, (0, react_core_1.getEventStatus)(scEvent, isGoing))
|
|
130
|
-
: setSCEvent(Object.assign({}, scEvent, { subscription_status: (0, react_core_1.getEventStatus)(scEvent, isGoing) }));
|
|
127
|
+
.then((data) => {
|
|
128
|
+
onSubscribe ? onSubscribe(data) : setSCEvent(data);
|
|
131
129
|
setLoading(false);
|
|
132
130
|
pubsub_js_1.default.publish(`${PubSub_1.SCTopicType.EVENT}.${PubSub_1.SCGroupEventType.MEMBERS}`);
|
|
133
131
|
})
|
|
134
132
|
.catch((e) => {
|
|
135
133
|
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
|
|
136
134
|
});
|
|
137
|
-
};
|
|
138
|
-
const handleToggleAction = (event) => {
|
|
135
|
+
}, [scEvent, scEventsManager, onSubscribe, setLoading]);
|
|
136
|
+
const handleToggleAction = (0, react_1.useCallback)((event) => {
|
|
139
137
|
setAnchorEl(null);
|
|
140
138
|
if (!scUserContext.user) {
|
|
141
139
|
scContext.settings.handleAnonymousAction();
|
|
@@ -143,7 +141,7 @@ function EventSubscribeButton(inProps) {
|
|
|
143
141
|
else if (status !== undefined) {
|
|
144
142
|
toggleEventAttendance(event.target.value);
|
|
145
143
|
}
|
|
146
|
-
};
|
|
144
|
+
}, [scUserContext.user, status, scContext.settings]);
|
|
147
145
|
function renderMenuItems() {
|
|
148
146
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { children: options.map((option) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ className: classes.item, disabled: loading }, { children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { label: option.label, control: loading ? ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { color: "primary", size: 20 })) : ((0, jsx_runtime_1.jsx)(material_1.Checkbox, { size: "small", checked: status === option.value, value: option.value, onChange: handleToggleAction, name: `${option.value}-option`, inputProps: { 'aria-label': `${option.label}` } })), labelPlacement: "start" }) }), option.value))) }));
|
|
149
147
|
}
|
|
@@ -94,8 +94,8 @@ export default function EventHeader(inProps) {
|
|
|
94
94
|
/**
|
|
95
95
|
* Handles callback subscribe/unsubscribe event
|
|
96
96
|
*/
|
|
97
|
-
const handleSubscribe = (
|
|
98
|
-
setSCEvent(
|
|
97
|
+
const handleSubscribe = (event) => {
|
|
98
|
+
setSCEvent(event);
|
|
99
99
|
};
|
|
100
100
|
// RENDER
|
|
101
101
|
if (!scEvent) {
|
|
@@ -139,5 +139,5 @@ export default function EventHeader(inProps) {
|
|
|
139
139
|
month: 'long'
|
|
140
140
|
}),
|
|
141
141
|
hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
|
|
142
|
-
} })) })), _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.online", defaultMessage: "ui.eventHeader.location.online" })) }))] })), _jsx(User, { className: classes.planner, userId: scEvent.managed_by.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, disabled: isEventFinished }), _jsxs(Box, { children: [!isMobile && (_jsx(EditEventButton, { size: isMobile ? 'small' : 'medium', event: scEvent, onEditSuccess:
|
|
142
|
+
} })) })), _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.online", defaultMessage: "ui.eventHeader.location.online" })) }))] })), _jsx(User, { className: classes.planner, userId: scEvent.managed_by.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, disabled: isEventFinished }), _jsxs(Box, { children: [!isMobile && (_jsx(EditEventButton, { size: isMobile ? 'small' : 'medium', event: scEvent, onEditSuccess: setSCEvent, disabled: isEventFinished })), _jsx(EventActionsMenu, Object.assign({ event: scEvent, onEditSuccess: (data) => setSCEvent(data) }, EventActionsProps))] })] }))) : (_jsxs(_Fragment, { children: [_jsx(EventSubscribeButton, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps, { disabled: isEventFinished })), _jsx(EventActionsMenu, Object.assign({ event: scEvent, onEditSuccess: setSCEvent }, EventActionsProps))] })) }) })] }))] })));
|
|
143
143
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SCEventType, SCUserType } from '@selfcommunity/types';
|
|
2
2
|
export interface EventSubscribeButtonProps {
|
|
3
3
|
/**
|
|
4
4
|
* Overrides or extends the styles applied to the component.
|
|
@@ -25,7 +25,7 @@ export interface EventSubscribeButtonProps {
|
|
|
25
25
|
* @param user
|
|
26
26
|
* @param joined
|
|
27
27
|
*/
|
|
28
|
-
onSubscribe?: (event: SCEventType
|
|
28
|
+
onSubscribe?: (event: SCEventType) => any;
|
|
29
29
|
/**
|
|
30
30
|
* Others properties
|
|
31
31
|
*/
|
|
@@ -4,12 +4,12 @@ import { LoadingButton } from '@mui/lab';
|
|
|
4
4
|
import { Box, Button, Checkbox, CircularProgress, FormControlLabel, Icon, Menu, MenuItem, SwipeableDrawer, useMediaQuery, useTheme } from '@mui/material';
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
6
6
|
import { useThemeProps } from '@mui/system';
|
|
7
|
-
import {
|
|
7
|
+
import { useSCContext, useSCFetchEvent, useSCUser } from '@selfcommunity/react-core';
|
|
8
8
|
import { SCEventPrivacyType, SCEventSubscriptionStatusType } from '@selfcommunity/types';
|
|
9
9
|
import { CacheStrategies, Logger } from '@selfcommunity/utils';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import PubSub from 'pubsub-js';
|
|
12
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
12
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
13
13
|
import { FormattedMessage } from 'react-intl';
|
|
14
14
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
15
15
|
import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
|
|
@@ -100,12 +100,12 @@ export default function EventSubscribeButton(inProps) {
|
|
|
100
100
|
});
|
|
101
101
|
const isEventAdmin = useMemo(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
|
|
102
102
|
// HANDLERS
|
|
103
|
-
const handleOpen = (event) => {
|
|
103
|
+
const handleOpen = useCallback((event) => {
|
|
104
104
|
setAnchorEl(event.currentTarget);
|
|
105
|
-
};
|
|
106
|
-
const handleClose = () => {
|
|
105
|
+
}, [setAnchorEl]);
|
|
106
|
+
const handleClose = useCallback(() => {
|
|
107
107
|
setAnchorEl(null);
|
|
108
|
-
};
|
|
108
|
+
}, [setAnchorEl]);
|
|
109
109
|
useEffect(() => {
|
|
110
110
|
/**
|
|
111
111
|
* Call scEventsManager.subscriptionStatus inside an effect
|
|
@@ -115,25 +115,23 @@ export default function EventSubscribeButton(inProps) {
|
|
|
115
115
|
setStatus(scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus(scEvent));
|
|
116
116
|
}
|
|
117
117
|
}, [authUserId, scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus, scEvent]);
|
|
118
|
-
const toggleEventAttendance = (eventStatus) => {
|
|
118
|
+
const toggleEventAttendance = useCallback((eventStatus) => {
|
|
119
119
|
setLoading(true);
|
|
120
120
|
const isGoing = eventStatus === SCEventSubscriptionStatusType.GOING ||
|
|
121
121
|
!(scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) ||
|
|
122
122
|
(scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) === SCEventSubscriptionStatusType.INVITED;
|
|
123
123
|
const toggleAction = isGoing ? scEventsManager.toggleEventAttendance(scEvent) : scEventsManager.toggleEventNonattendance(scEvent);
|
|
124
124
|
toggleAction
|
|
125
|
-
.then(() => {
|
|
126
|
-
onSubscribe
|
|
127
|
-
? onSubscribe(scEvent, getEventStatus(scEvent, isGoing))
|
|
128
|
-
: setSCEvent(Object.assign({}, scEvent, { subscription_status: getEventStatus(scEvent, isGoing) }));
|
|
125
|
+
.then((data) => {
|
|
126
|
+
onSubscribe ? onSubscribe(data) : setSCEvent(data);
|
|
129
127
|
setLoading(false);
|
|
130
128
|
PubSub.publish(`${SCTopicType.EVENT}.${SCGroupEventType.MEMBERS}`);
|
|
131
129
|
})
|
|
132
130
|
.catch((e) => {
|
|
133
131
|
Logger.error(SCOPE_SC_UI, e);
|
|
134
132
|
});
|
|
135
|
-
};
|
|
136
|
-
const handleToggleAction = (event) => {
|
|
133
|
+
}, [scEvent, scEventsManager, onSubscribe, setLoading]);
|
|
134
|
+
const handleToggleAction = useCallback((event) => {
|
|
137
135
|
setAnchorEl(null);
|
|
138
136
|
if (!scUserContext.user) {
|
|
139
137
|
scContext.settings.handleAnonymousAction();
|
|
@@ -141,7 +139,7 @@ export default function EventSubscribeButton(inProps) {
|
|
|
141
139
|
else if (status !== undefined) {
|
|
142
140
|
toggleEventAttendance(event.target.value);
|
|
143
141
|
}
|
|
144
|
-
};
|
|
142
|
+
}, [scUserContext.user, status, scContext.settings]);
|
|
145
143
|
function renderMenuItems() {
|
|
146
144
|
return (_jsx(Box, { children: options.map((option) => (_jsx(MenuItem, Object.assign({ className: classes.item, disabled: loading }, { children: _jsx(FormControlLabel, { label: option.label, control: loading ? (_jsx(CircularProgress, { color: "primary", size: 20 })) : (_jsx(Checkbox, { size: "small", checked: status === option.value, value: option.value, onChange: handleToggleAction, name: `${option.value}-option`, inputProps: { 'aria-label': `${option.label}` } })), labelPlacement: "start" }) }), option.value))) }));
|
|
147
145
|
}
|