@selfcommunity/react-ui 0.10.4-alpha.8 → 0.10.4
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/Category/Skeleton.js +1 -1
- package/lib/cjs/components/Composer/Composer.js +19 -13
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.d.ts +6 -1
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.js +3 -2
- package/lib/cjs/components/EventForm/EventForm.js +25 -7
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +7 -7
- package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +11 -6
- package/lib/cjs/components/Events/Events.js +10 -10
- package/lib/cjs/components/FeedObject/Actions/Share/Share.js +2 -2
- package/lib/cjs/components/FeedObject/Activities/ActivitiesMenu/ActivitiesMenu.js +19 -19
- package/lib/cjs/components/MyEventsWidget/Skeleton.js +2 -4
- package/lib/cjs/components/NavigationMenuIconButton/DefaultDrawerContent.js +3 -2
- package/lib/cjs/components/NavigationMenuIconButton/DefaultDrawerSkeleton.d.ts +24 -0
- package/lib/cjs/components/NavigationMenuIconButton/DefaultDrawerSkeleton.js +40 -0
- package/lib/cjs/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +1 -1
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +1 -1
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +6 -0
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -2
- package/lib/cjs/components/VoteButton/VoteButton.js +1 -1
- package/lib/cjs/index.d.ts +2 -1
- package/lib/cjs/index.js +7 -5
- package/lib/cjs/shared/BackdropScrollDisabled/BackdropScrollDisabled.js +1 -1
- package/lib/cjs/shared/ContributionActionsMenu/index.js +1 -1
- package/lib/esm/components/Category/Skeleton.js +1 -1
- package/lib/esm/components/Composer/Composer.js +20 -14
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.d.ts +6 -1
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +3 -2
- package/lib/esm/components/EventForm/EventForm.js +26 -8
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +7 -7
- package/lib/esm/components/EventMembersWidget/TabContentComponent.js +11 -6
- package/lib/esm/components/Events/Events.js +10 -10
- package/lib/esm/components/FeedObject/Actions/Share/Share.js +2 -2
- package/lib/esm/components/FeedObject/Activities/ActivitiesMenu/ActivitiesMenu.js +20 -20
- package/lib/esm/components/MyEventsWidget/Skeleton.js +1 -3
- package/lib/esm/components/NavigationMenuIconButton/DefaultDrawerContent.js +3 -2
- package/lib/esm/components/NavigationMenuIconButton/DefaultDrawerSkeleton.d.ts +24 -0
- package/lib/esm/components/NavigationMenuIconButton/DefaultDrawerSkeleton.js +35 -0
- package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +1 -1
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +1 -1
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +6 -0
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -2
- package/lib/esm/components/VoteButton/VoteButton.js +1 -1
- package/lib/esm/index.d.ts +2 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/shared/BackdropScrollDisabled/BackdropScrollDisabled.js +1 -1
- package/lib/esm/shared/ContributionActionsMenu/index.js +1 -1
- package/lib/umd/react-ui.js +2 -2
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { LoadingButton } from '@mui/lab';
|
|
4
|
-
import { Box, FormControl, FormGroup, Icon, IconButton, InputAdornment, InputLabel, MenuItem, Paper, Select, Stack, Switch, TextField, Typography } from '@mui/material';
|
|
4
|
+
import { Alert, Box, FormControl, FormGroup, Icon, IconButton, InputAdornment, InputLabel, MenuItem, Paper, Select, Stack, Switch, TextField, Typography } from '@mui/material';
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
6
6
|
import { useThemeProps } from '@mui/system';
|
|
7
7
|
import { LocalizationProvider, MobileDatePicker, MobileTimePicker } from '@mui/x-date-pickers';
|
|
@@ -74,7 +74,8 @@ const classes = {
|
|
|
74
74
|
actions: `${PREFIX}-actions`,
|
|
75
75
|
privacySection: `${PREFIX}-privacy-section`,
|
|
76
76
|
privacySectionInfo: `${PREFIX}-privacy-section-info`,
|
|
77
|
-
error: `${PREFIX}-error
|
|
77
|
+
error: `${PREFIX}-error`,
|
|
78
|
+
genericError: `${PREFIX}-generic-error`
|
|
78
79
|
};
|
|
79
80
|
const Root = styled(Box, {
|
|
80
81
|
name: PREFIX,
|
|
@@ -146,6 +147,7 @@ export default function EventForm(inProps) {
|
|
|
146
147
|
// STATE
|
|
147
148
|
const [field, setField] = useState(initialFieldState);
|
|
148
149
|
const [error, setError] = useState({});
|
|
150
|
+
const [genericError, setGenericError] = useState(null);
|
|
149
151
|
// PREFERENCES
|
|
150
152
|
const scPreferences = useSCPreferences();
|
|
151
153
|
const privateEnabled = useMemo(() => scPreferences.preferences[SCPreferences.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED].value, [scPreferences.preferences]);
|
|
@@ -166,6 +168,7 @@ export default function EventForm(inProps) {
|
|
|
166
168
|
delete error.imageOriginalError;
|
|
167
169
|
setError(error);
|
|
168
170
|
}
|
|
171
|
+
setGenericError(null);
|
|
169
172
|
}, [error]);
|
|
170
173
|
/**
|
|
171
174
|
* Notify when a group info changed
|
|
@@ -183,9 +186,11 @@ export default function EventForm(inProps) {
|
|
|
183
186
|
}, [event]);
|
|
184
187
|
const handleGeoData = useCallback((data) => {
|
|
185
188
|
setField((prev) => (Object.assign(Object.assign({}, prev), data)));
|
|
189
|
+
setGenericError(null);
|
|
186
190
|
}, []);
|
|
187
191
|
const handleSubmit = useCallback(() => {
|
|
188
192
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: true })));
|
|
193
|
+
setGenericError(null);
|
|
189
194
|
const formData = new FormData();
|
|
190
195
|
if (field.imageOriginalFile) {
|
|
191
196
|
formData.append('image_original', field.imageOriginalFile);
|
|
@@ -225,12 +230,23 @@ export default function EventForm(inProps) {
|
|
|
225
230
|
})
|
|
226
231
|
.catch((e) => {
|
|
227
232
|
const _error = formatHttpErrorCode(e);
|
|
228
|
-
if (Object.
|
|
229
|
-
|
|
233
|
+
if ('errorsError' in _error || !Object.keys(_error).length) {
|
|
234
|
+
setGenericError(intl.formatMessage({
|
|
235
|
+
id: 'ui.eventForm.genericError',
|
|
236
|
+
defaultMessage: 'ui.eventForm.genericError'
|
|
237
|
+
}));
|
|
230
238
|
}
|
|
231
239
|
else {
|
|
232
|
-
|
|
240
|
+
setGenericError(null);
|
|
233
241
|
}
|
|
242
|
+
let __errors = {};
|
|
243
|
+
if ('coverError' in _error) {
|
|
244
|
+
__errors = Object.assign(Object.assign({}, __errors), { ['coverError']: _jsx(FormattedMessage, { id: "ui.ui.eventForm.cover.error", defaultMessage: "ui.ui.eventForm.cover.error" }) });
|
|
245
|
+
}
|
|
246
|
+
if ('nameError' in _error || ('nonFieldErrorsError' in _error && _error['nonFieldErrorsError'].error === 'unique')) {
|
|
247
|
+
__errors = Object.assign(Object.assign({}, __errors), { ['nameError']: _jsx(FormattedMessage, { id: "ui.eventForm.name.error.unique", defaultMessage: "ui.eventForm.name.error.unique" }) });
|
|
248
|
+
}
|
|
249
|
+
setError(__errors);
|
|
234
250
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
|
|
235
251
|
Logger.error(SCOPE_SC_UI, e);
|
|
236
252
|
onError === null || onError === void 0 ? void 0 : onError(e);
|
|
@@ -243,6 +259,7 @@ export default function EventForm(inProps) {
|
|
|
243
259
|
delete error[`${name}Error`];
|
|
244
260
|
setError(error);
|
|
245
261
|
}
|
|
262
|
+
setGenericError(null);
|
|
246
263
|
}, [setField, error]);
|
|
247
264
|
const handleChangeDateTime = useCallback((value, name) => {
|
|
248
265
|
setField((prev) => (Object.assign(Object.assign({}, prev), { [name]: value })));
|
|
@@ -254,6 +271,7 @@ export default function EventForm(inProps) {
|
|
|
254
271
|
delete error['endDateError'];
|
|
255
272
|
setError(error);
|
|
256
273
|
}
|
|
274
|
+
setGenericError(null);
|
|
257
275
|
}, [setField, error]);
|
|
258
276
|
const shouldDisableDate = useCallback((date) => {
|
|
259
277
|
let disabled = false;
|
|
@@ -277,7 +295,7 @@ export default function EventForm(inProps) {
|
|
|
277
295
|
/**
|
|
278
296
|
* Renders root object
|
|
279
297
|
*/
|
|
280
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(UploadEventCover, { isCreationMode: true, onChange: handleChangeCover }) })), _jsxs(FormGroup, Object.assign({ className: classes.form }, { children: [_jsx(TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
|
|
298
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(UploadEventCover, { isCreationMode: true, onChange: handleChangeCover }) })), Boolean(error['coverError']) && _jsx(Typography, Object.assign({ color: "error" }, { children: error['coverError'] })), _jsxs(FormGroup, Object.assign({ className: classes.form }, { children: [_jsx(TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
|
|
281
299
|
endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: EVENT_TITLE_MAX_LENGTH - field.name.length }))
|
|
282
300
|
}, error: Boolean(field.name.length > EVENT_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: field.name.length > EVENT_TITLE_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.eventForm.name.error.maxLength", defaultMessage: "ui.eventForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), _jsx(Box, Object.assign({ className: classes.dateTime }, { children: _jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? itLocale : enLocale }, { children: [_jsx(MobileDatePicker, { className: classes.picker, disablePast: true, label: field.startDate && _jsx(FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, slots: {
|
|
283
301
|
textField: (params) => (_jsx(TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.startDate)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "CalendarIcon" }) }) }))) }) })))
|
|
@@ -329,7 +347,7 @@ export default function EventForm(inProps) {
|
|
|
329
347
|
b: (chunks) => _jsx("strong", { children: chunks })
|
|
330
348
|
} })) }))] }))), _jsx(TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
331
349
|
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_a = field.description) === null || _a === void 0 ? void 0 : _a.length) ? EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : EVENT_DESCRIPTION_MAX_LENGTH })))
|
|
332
|
-
}, error: Boolean(((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) > EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > EVENT_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null }), _jsx(Box, Object.assign({ className: classes.actions }, { children: _jsx(LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.name ||
|
|
350
|
+
}, error: Boolean(((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) > EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > EVENT_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null }), genericError && (_jsx(Box, Object.assign({ className: classes.genericError }, { children: _jsx(Alert, Object.assign({ variant: "filled", severity: "error" }, { children: genericError })) }))), _jsx(Box, Object.assign({ className: classes.actions }, { children: _jsx(LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.name ||
|
|
333
351
|
!field.startDate ||
|
|
334
352
|
!field.startTime ||
|
|
335
353
|
!field.endDate ||
|
|
@@ -337,7 +355,7 @@ export default function EventForm(inProps) {
|
|
|
337
355
|
(field.location === SCEventLocationType.ONLINE && !field.link) ||
|
|
338
356
|
(field.location === SCEventLocationType.PERSON && !field.geolocation) ||
|
|
339
357
|
(field.recurring !== SCEventRecurrenceType.NEVER && !field.endDate && !field.endTime) ||
|
|
340
|
-
|
|
358
|
+
field.isSubmitting ||
|
|
341
359
|
field.name.length > EVENT_TITLE_MAX_LENGTH ||
|
|
342
360
|
field.description.length > EVENT_DESCRIPTION_MAX_LENGTH, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: event ? (_jsx(FormattedMessage, { id: "ui.eventForm.button.edit", defaultMessage: "ui.eventForm.button.edit" })) : (_jsx(FormattedMessage, { id: "ui.eventForm.button.create", defaultMessage: "ui.eventForm.button.create" })) })) }))] }))] })));
|
|
343
361
|
}
|
|
@@ -97,7 +97,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
97
97
|
Logger.error(SCOPE_SC_UI, error);
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
}, [participants.isLoadingNext, participants.initialized, scEvent, dispatchParticipants, setParticipantsCount]);
|
|
100
|
+
}, [participants.isLoadingNext, participants.initialized, scEvent, endpointQueryParams, dispatchParticipants, setParticipantsCount]);
|
|
101
101
|
const _initInvited = useCallback(() => {
|
|
102
102
|
if (!invited.initialized && !invited.isLoadingNext && hasAllow) {
|
|
103
103
|
dispatchInvited({ type: actionWidgetTypes.LOADING_NEXT });
|
|
@@ -111,7 +111,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
111
111
|
Logger.error(SCOPE_SC_UI, error);
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
}, [invited.isLoadingNext, invited.initialized, scEvent, dispatchInvited, setInvitedCount]);
|
|
114
|
+
}, [invited.isLoadingNext, invited.initialized, scEvent, hasAllow, endpointQueryParams, dispatchInvited, setInvitedCount]);
|
|
115
115
|
const _initRequests = useCallback(() => {
|
|
116
116
|
if (!requests.initialized && !requests.isLoadingNext && hasAllow) {
|
|
117
117
|
dispatchRequests({ type: actionWidgetTypes.LOADING_NEXT });
|
|
@@ -126,7 +126,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
126
126
|
Logger.error(SCOPE_SC_UI, error);
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
}, [requests.isLoadingNext, requests.initialized, scEvent, dispatchRequests, setRequestsCount, setRequestsUsers]);
|
|
129
|
+
}, [requests.isLoadingNext, requests.initialized, scEvent, hasAllow, endpointQueryParams, dispatchRequests, setRequestsCount, setRequestsUsers]);
|
|
130
130
|
// EFFECTS
|
|
131
131
|
useEffect(() => {
|
|
132
132
|
let _t;
|
|
@@ -150,18 +150,18 @@ export default function EventMembersWidget(inProps) {
|
|
|
150
150
|
clearTimeout(_t);
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
}, [scUserContext.user, scEvent, refresh]);
|
|
153
|
+
}, [scUserContext.user, scEvent, refresh, _initParticipants, _initInvited, _initRequests]);
|
|
154
154
|
useEffect(() => {
|
|
155
155
|
if (participants.initialized && scEvent && Boolean((eventId !== undefined && scEvent.id !== eventId) || (event && scEvent.id !== event.id))) {
|
|
156
156
|
dispatchParticipants({ type: actionWidgetTypes.RESET, payload: {} });
|
|
157
157
|
dispatchRequests({ type: actionWidgetTypes.RESET, payload: {} });
|
|
158
158
|
dispatchInvited({ type: actionWidgetTypes.RESET, payload: {} });
|
|
159
159
|
}
|
|
160
|
-
}, [participants.initialized, scEvent, eventId, event]);
|
|
160
|
+
}, [participants.initialized, scEvent, eventId, event, dispatchParticipants, dispatchInvited, dispatchRequests]);
|
|
161
161
|
// HANDLERS
|
|
162
162
|
const handleTabChange = useCallback((_evt, newTabValue) => {
|
|
163
163
|
setTabValue(newTabValue);
|
|
164
|
-
}, []);
|
|
164
|
+
}, [setTabValue]);
|
|
165
165
|
const handleRefresh = useCallback((_tabValue) => {
|
|
166
166
|
if (_tabValue === TabContentEnum.PARTICIPANTS) {
|
|
167
167
|
dispatchParticipants({ type: actionWidgetTypes.RESET });
|
|
@@ -170,7 +170,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
170
170
|
dispatchInvited({ type: actionWidgetTypes.RESET });
|
|
171
171
|
}
|
|
172
172
|
setRefresh(_tabValue);
|
|
173
|
-
}, []);
|
|
173
|
+
}, [dispatchParticipants, dispatchInvited, setRefresh]);
|
|
174
174
|
if (!scUserContext.user) {
|
|
175
175
|
return _jsx(HiddenPlaceholder, {});
|
|
176
176
|
}
|
|
@@ -40,7 +40,7 @@ export default function TabContentComponent(props) {
|
|
|
40
40
|
// HOOKS
|
|
41
41
|
const { enqueueSnackbar } = useSnackbar();
|
|
42
42
|
// CONSTS
|
|
43
|
-
const users = useMemo(() => (tabValue === TabContentEnum.REQUESTS ? actionProps === null || actionProps === void 0 ? void 0 : actionProps.users : state.results), [tabValue, actionProps, state]);
|
|
43
|
+
const users = useMemo(() => (tabValue === TabContentEnum.REQUESTS ? actionProps === null || actionProps === void 0 ? void 0 : actionProps.users : state.results), [tabValue, actionProps === null || actionProps === void 0 ? void 0 : actionProps.users, state.results]);
|
|
44
44
|
// EFFECTS
|
|
45
45
|
useEffect(() => {
|
|
46
46
|
updatesInvited.current = PubSub.subscribe(`${SCTopicType.EVENT}.${SCGroupEventType.INVITE_MEMBER}`, handleInviteMember);
|
|
@@ -50,6 +50,11 @@ export default function TabContentComponent(props) {
|
|
|
50
50
|
updatesParticipants.current && PubSub.unsubscribe(updatesParticipants.current);
|
|
51
51
|
};
|
|
52
52
|
}, []);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (openDialog && state.next && state.initialized) {
|
|
55
|
+
handleNext();
|
|
56
|
+
}
|
|
57
|
+
}, [openDialog, state.next, state.initialized]);
|
|
53
58
|
// HANDLERS
|
|
54
59
|
/**
|
|
55
60
|
* Handles pagination
|
|
@@ -67,16 +72,16 @@ export default function TabContentComponent(props) {
|
|
|
67
72
|
.catch((error) => {
|
|
68
73
|
Logger.error(SCOPE_SC_UI, error);
|
|
69
74
|
});
|
|
70
|
-
}, [state.next, state.isLoadingNext, state.initialized]);
|
|
75
|
+
}, [state.next, state.isLoadingNext, state.initialized, dispatch]);
|
|
71
76
|
const handleToggleDialogOpen = useCallback(() => {
|
|
72
77
|
setOpenDialog((prev) => !prev);
|
|
73
|
-
}, []);
|
|
78
|
+
}, [setOpenDialog]);
|
|
74
79
|
const handleToggleMember = useCallback(() => {
|
|
75
80
|
handleRefresh === null || handleRefresh === void 0 ? void 0 : handleRefresh(TabContentEnum.PARTICIPANTS);
|
|
76
|
-
}, []);
|
|
81
|
+
}, [handleRefresh]);
|
|
77
82
|
const handleInviteMember = useCallback(() => {
|
|
78
83
|
handleRefresh === null || handleRefresh === void 0 ? void 0 : handleRefresh(TabContentEnum.INVITED);
|
|
79
|
-
}, []);
|
|
84
|
+
}, [handleRefresh]);
|
|
80
85
|
const getActionsComponent = useCallback((userId) => {
|
|
81
86
|
if (tabValue === TabContentEnum.INVITED && actionProps) {
|
|
82
87
|
const _handleInvitations = (invited) => {
|
|
@@ -127,5 +132,5 @@ export default function TabContentComponent(props) {
|
|
|
127
132
|
else if (tabValue === TabContentEnum.REQUESTS && (actionProps === null || actionProps === void 0 ? void 0 : actionProps.count) === 0) {
|
|
128
133
|
return (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.noOtherRequests", defaultMessage: "ui.eventMembersWidget.noOtherRequests" }) })));
|
|
129
134
|
}
|
|
130
|
-
return (_jsxs(_Fragment, { children: [_jsx(List, { children: users === null || users === void 0 ? void 0 : users.map((user) => (_jsx(ListItem, { children: _jsx(User, Object.assign({ elevation: 0, user: user }, userProps, { actions: getActionsComponent(user.id) })) }, user.id))) }), state.count > state.visibleItems && (_jsx(Button, Object.assign({ onClick: handleToggleDialogOpen, className: classes.actionButton }, { children: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.showAll", defaultMessage: "ui.eventMembersWidget.showAll" }) })) }))), openDialog && (_jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: _jsx(FormattedMessage, { defaultMessage: "ui.eventMembersWidget.title", id: "ui.eventMembersWidget.title" }), onClose: handleToggleDialogOpen, open: openDialog }, dialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: state.results.length, next: handleNext, hasMoreNext: Boolean(state.next), loaderNext: _jsx(UserSkeleton, Object.assign({ elevation: 0 }, userProps)), className: classes.infiniteScroll, endMessage: _jsx(Typography, Object.assign({ className: classes.endMessage }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.noMoreResults", defaultMessage: "ui.eventMembersWidget.noMoreResults" }) })) }, { children: _jsx(List, { children: state.results.map((user) => (_jsx(ListItem, { children: _jsx(User, Object.assign({ elevation: 0, user: user }, userProps)) }, user.id))) }) })) })))] }));
|
|
135
|
+
return (_jsxs(_Fragment, { children: [_jsx(List, { children: users === null || users === void 0 ? void 0 : users.slice(0, state.visibleItems).map((user) => (_jsx(ListItem, { children: _jsx(User, Object.assign({ elevation: 0, user: user }, userProps, { actions: getActionsComponent(user.id) })) }, user.id))) }), state.count > state.visibleItems && (_jsx(Button, Object.assign({ onClick: handleToggleDialogOpen, className: classes.actionButton }, { children: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.showAll", defaultMessage: "ui.eventMembersWidget.showAll" }) })) }))), openDialog && (_jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: _jsx(FormattedMessage, { defaultMessage: "ui.eventMembersWidget.title", id: "ui.eventMembersWidget.title" }), onClose: handleToggleDialogOpen, open: openDialog }, dialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: state.results.length, next: handleNext, hasMoreNext: Boolean(state.next), loaderNext: _jsx(UserSkeleton, Object.assign({ elevation: 0 }, userProps)), className: classes.infiniteScroll, endMessage: _jsx(Typography, Object.assign({ className: classes.endMessage }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.noMoreResults", defaultMessage: "ui.eventMembersWidget.noMoreResults" }) })) }, { children: _jsx(List, { children: state.results.map((user) => (_jsx(ListItem, { children: _jsx(User, Object.assign({ elevation: 0, user: user }, userProps)) }, user.id))) }) })) })))] }));
|
|
131
136
|
}
|
|
@@ -118,14 +118,14 @@ export default function Events(inProps) {
|
|
|
118
118
|
/**
|
|
119
119
|
* Fetches events list
|
|
120
120
|
*/
|
|
121
|
-
const fetchEvents = (
|
|
121
|
+
const fetchEvents = () => {
|
|
122
122
|
setLoading(true);
|
|
123
123
|
return http
|
|
124
124
|
.request({
|
|
125
125
|
url: endpoint.url({}),
|
|
126
126
|
method: endpoint.method,
|
|
127
127
|
params: Object.assign(Object.assign({}, endpointQueryParams), (general
|
|
128
|
-
? Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (
|
|
128
|
+
? Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (query && { search: query })), (dateSearch !== SCEventDateFilterType.ANY && { date_filter: dateSearch })), (location !== SCEventLocationFilterType.ANY && { location })), (showFollowed && { follows: showFollowed })), (showPastEvents && { date_filter: SCEventDateFilterType.PAST })) : Object.assign(Object.assign(Object.assign({ subscription_status: SCEventSubscriptionStatusType.GOING }, (location !== SCEventLocationFilterType.ANY && { location })), (showPastEvents && { past: showPastEvents })), (showMyEvents && { created_by: authUserId }))))
|
|
129
129
|
})
|
|
130
130
|
.then((res) => {
|
|
131
131
|
setEvents(res.data.results);
|
|
@@ -144,9 +144,9 @@ export default function Events(inProps) {
|
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
146
|
else {
|
|
147
|
-
|
|
147
|
+
fetchEvents();
|
|
148
148
|
}
|
|
149
|
-
}, [contentAvailability, authUserId, dateSearch, location, showFollowed, showPastEvents, showMyEvents
|
|
149
|
+
}, [contentAvailability, authUserId, dateSearch, location, showFollowed, showPastEvents, showMyEvents]);
|
|
150
150
|
/**
|
|
151
151
|
* Subscriber for pubsub callback
|
|
152
152
|
*/
|
|
@@ -209,18 +209,18 @@ export default function Events(inProps) {
|
|
|
209
209
|
/**
|
|
210
210
|
* Renders events list
|
|
211
211
|
*/
|
|
212
|
-
const c = (_jsxs(_Fragment, { children: [showFilters && (_jsx(Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general ? (_jsxs(_Fragment, { children: [
|
|
212
|
+
const c = (_jsxs(_Fragment, { children: [showFilters && (_jsx(Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general ? (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ item: true }, { children: _jsx(EventsChipRoot, { color: showMyEvents ? 'secondary' : 'default', variant: showMyEvents ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByCreatedByMe", defaultMessage: "ui.events.filterByCreatedByMe" }), onClick: () => setShowMyEvents(!showMyEvents),
|
|
213
213
|
// @ts-expect-error this is needed to use showFollowed into SCEvents
|
|
214
|
-
showFollowed: showMyEvents, deleteIcon: showMyEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showMyEvents ?
|
|
214
|
+
showFollowed: showMyEvents, deleteIcon: showMyEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showMyEvents ? () => setShowMyEvents(false) : null, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsx(LocationEventsFilter, { value: location, disabled: loading, handleOnChange: handleOnChangeLocation }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ item: true, xs: 12, md: 3 }, { children: _jsx(TextField, { className: classes.search, size: 'small', fullWidth: true, value: query, label: _jsx(FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading, onKeyUp: (e) => {
|
|
215
215
|
e.preventDefault();
|
|
216
216
|
if (e.key === 'Enter') {
|
|
217
|
-
fetchEvents(
|
|
217
|
+
fetchEvents();
|
|
218
218
|
}
|
|
219
219
|
}, InputProps: {
|
|
220
|
-
endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: isMobile ? (_jsx(IconButton, Object.assign({ onClick: () => fetchEvents(
|
|
221
|
-
} }) })), _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 || loading
|
|
220
|
+
endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: isMobile ? (_jsx(IconButton, Object.assign({ onClick: () => fetchEvents(), disabled: loading }, { children: _jsx(Icon, { children: "search" }) }))) : (_jsx(Button, { size: "small", variant: "contained", color: "secondary", onClick: () => fetchEvents(), endIcon: _jsx(Icon, { children: "search" }), disabled: loading })) })))
|
|
221
|
+
} }) })), _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 || loading, 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, xs: 12, md: 2 }, { children: _jsx(LocationEventsFilter, { value: location, disabled: loading, handleOnChange: handleOnChangeLocation }) })), authUserId && (_jsx(Grid, Object.assign({ item: true }, { children: _jsx(EventsChipRoot, { color: showFollowed ? 'secondary' : 'default', variant: showFollowed ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByFollowedInterest", defaultMessage: "ui.events.filterByFollowedInterest" }), onClick: handleChipClick,
|
|
222
222
|
// @ts-expect-error this is needed to use showFollowed into SCEvents
|
|
223
|
-
showFollowed: showFollowed, deleteIcon: showFollowed ? _jsx(Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null, disabled: loading
|
|
223
|
+
showFollowed: showFollowed, deleteIcon: showFollowed ? _jsx(Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null, disabled: loading }) }))), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: dateSearch !== SCEventDateFilterType.ANY || loading }) }))] })) }))), _jsx(_Fragment, { children: loading ? (_jsx(Skeleton, Object.assign({}, EventsSkeletonComponentProps, { EventSkeletonProps: EventSkeletonComponentProps }))) : (_jsx(_Fragment, { children: !events.length ? (_jsx(Box, Object.assign({ className: classes.noResults }, { children: general ? (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (onlyStaffEnabled && UserUtils.isStaff(scUserContext.user)) || !onlyStaffEnabled ? _jsx(CreateEventButton, {}) : null })), _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, { skeletonsAnimation: false, actions: (onlyStaffEnabled && UserUtils.isStaff(scUserContext.user)) || !onlyStaffEnabled ? _jsx(CreateEventButton, {}) : null })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title.personal", defaultMessage: "ui.events.noEvents.title.personal" }) }))] })) }))) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.events }, GridContainerComponentProps, { children: _jsxs(_Fragment, { children: [events.map((event) => (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.item }, GridItemComponentProps, { children: _jsx(Event, Object.assign({ event: event, eventId: event.id }, EventComponentProps)) }), event.id))), authUserId && events.length % 2 !== 0 && (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.itemSkeleton }, GridItemComponentProps, { children: _jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, 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" }) })))] })) })) })] }));
|
|
224
224
|
/**
|
|
225
225
|
* Renders root object (if content availability community option is false and user is anonymous, component is hidden)
|
|
226
226
|
*/
|
|
@@ -195,7 +195,7 @@ export default function Share(props) {
|
|
|
195
195
|
* @return {JSX.Element}
|
|
196
196
|
*/
|
|
197
197
|
function renderShareBtn() {
|
|
198
|
-
return (_jsx(React.Fragment, { children: withAction && (_jsxs(React.Fragment, { children: [!inlineAction && withAudience && _jsx(Divider, { className: classes.divider }), _jsx(Tooltip, Object.assign({ title: `${intl.formatMessage(messages.share)}` }, { children: _jsx(LoadingButton, Object.assign({ loading: isSharing, onClick: handleOpenShareMenu, className: classes.button }, { children: _jsx(Icon, { children: "share" }) })) })), _jsx(_Fragment, { children: !isMobile ? (_jsx(Menu, Object.assign({ anchorEl: anchorEl, open:
|
|
198
|
+
return (_jsx(React.Fragment, { children: withAction && (_jsxs(React.Fragment, { children: [!inlineAction && withAudience && _jsx(Divider, { className: classes.divider }), _jsx(Tooltip, Object.assign({ title: `${intl.formatMessage(messages.share)}` }, { children: _jsx(LoadingButton, Object.assign({ loading: isSharing, onClick: handleOpenShareMenu, className: classes.button }, { children: _jsx(Icon, { children: "share" }) })) })), Boolean(anchorEl) && (_jsx(_Fragment, { children: !isMobile ? (_jsx(Menu, Object.assign({ anchorEl: anchorEl, open: true, onClose: handleClose, onClick: handleClose, slotProps: {
|
|
199
199
|
paper: {
|
|
200
200
|
elevation: 0,
|
|
201
201
|
sx: {
|
|
@@ -216,7 +216,7 @@ export default function Share(props) {
|
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
}, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, { children: renderShareMenuItems() }))) : (_jsx(SwipeableDrawer, Object.assign({ open:
|
|
219
|
+
}, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, { children: renderShareMenuItems() }))) : (_jsx(SwipeableDrawer, Object.assign({ open: true, onClick: handleClose, onClose: handleClose, onOpen: handleOpenShareMenu, anchor: "bottom", disableSwipeToOpen: true }, { children: renderShareMenuItems() }))) })), isComposerOpen && (_jsx(Composer, { open: true, defaultValue: composerShareProps, onClose: handleComposerOnClose, onSuccess: handleComposerOnSuccess, maxWidth: "sm", fullWidth: true }))] })) }));
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* Renders share action
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useContext } from 'react';
|
|
5
5
|
import Box from '@mui/material/Box';
|
|
@@ -78,24 +78,24 @@ export default function ActivitiesMenu(props) {
|
|
|
78
78
|
*/
|
|
79
79
|
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsx(Box, Object.assign({ className: classes.selector }, { children: _jsx(Tooltip, Object.assign({ title: _jsx(FormattedMessage, { id: "ui.feedObject.activitiesMenu.tooltipTitle", defaultMessage: "ui.feedObject.activitiesMenu.tooltipTitle" }) }, { children: _jsxs(Button, Object.assign({ variant: "text", size: "small", onClick: handleOpen }, { children: [selectedActivities === SCFeedObjectActivitiesType.CONNECTIONS_COMMENTS && followEnabled
|
|
80
80
|
? intl.formatMessage(messages.followedComments)
|
|
81
|
-
: intl.formatMessage(messages[`${camelCase(selectedActivities)}`]), "\u00A0 ", _jsx(Icon, { children: "expand_more" })] })) })) })), isMobile ? (_jsx(SwipeableDrawer, Object.assign({ open:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
81
|
+
: intl.formatMessage(messages[`${camelCase(selectedActivities)}`]), "\u00A0 ", _jsx(Icon, { children: "expand_more" })] })) })) })), open && (_jsx(_Fragment, { children: isMobile ? (_jsx(SwipeableDrawer, Object.assign({ open: true, onClose: handleClose, onOpen: handleOpen, anchor: "bottom", disableSwipeToOpen: true }, { children: renderMenuContent() }))) : (_jsx(Menu, Object.assign({ anchorEl: anchorEl, open: true, onClose: handleClose, onClick: handleClose, PaperProps: {
|
|
82
|
+
elevation: 0,
|
|
83
|
+
sx: {
|
|
84
|
+
overflow: 'visible',
|
|
85
|
+
filter: 'drop-shadow(0px 2px 8px rgba(0,0,0,0.32))',
|
|
86
|
+
mt: 1.5,
|
|
87
|
+
'&:before': {
|
|
88
|
+
content: '""',
|
|
89
|
+
display: 'block',
|
|
90
|
+
position: 'absolute',
|
|
91
|
+
top: 0,
|
|
92
|
+
right: 14,
|
|
93
|
+
width: 10,
|
|
94
|
+
height: 10,
|
|
95
|
+
bgcolor: 'background.paper',
|
|
96
|
+
transform: 'translateY(-50%) rotate(45deg)',
|
|
97
|
+
zIndex: 0
|
|
98
|
+
}
|
|
98
99
|
}
|
|
99
|
-
}
|
|
100
|
-
}, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, { children: renderMenuContent() })))] })));
|
|
100
|
+
}, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, { children: renderMenuContent() }))) }))] })));
|
|
101
101
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, CardActions } from '@mui/material';
|
|
3
|
-
import Skeleton from '@mui/material/Skeleton';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
2
|
+
import { Box, CardActions, Skeleton, styled } from '@mui/material';
|
|
5
3
|
import Widget from '../Widget';
|
|
6
4
|
import { PREFIX } from './constants';
|
|
7
5
|
import { SCEventTemplateType } from '../../types/event';
|
|
@@ -10,6 +10,7 @@ import { SCFeatureName } from '@selfcommunity/types';
|
|
|
10
10
|
import { styled } from '@mui/material/styles';
|
|
11
11
|
import classNames from 'classnames';
|
|
12
12
|
import { useThemeProps } from '@mui/system';
|
|
13
|
+
import DefaultDrawerSkeleton from './DefaultDrawerSkeleton';
|
|
13
14
|
const PREFIX = 'SCDefaultDrawerContent';
|
|
14
15
|
const classes = {
|
|
15
16
|
root: `${PREFIX}-root`,
|
|
@@ -29,7 +30,7 @@ export default function DefaultDrawerContent(inProps) {
|
|
|
29
30
|
});
|
|
30
31
|
const { className, CategoryItemProps = { showTooltip: true } } = props, rest = __rest(props, ["className", "CategoryItemProps"]);
|
|
31
32
|
// HOOKS
|
|
32
|
-
const { categories } = useSCFetchCategories();
|
|
33
|
+
const { categories, isLoading } = useSCFetchCategories();
|
|
33
34
|
const [categoriesOrdered, setCategoriesOrdered] = useState([]);
|
|
34
35
|
// ROUTING
|
|
35
36
|
const scRoutingContext = useSCRouting();
|
|
@@ -77,5 +78,5 @@ export default function DefaultDrawerContent(inProps) {
|
|
|
77
78
|
onTouchMove: mouseLeave
|
|
78
79
|
});
|
|
79
80
|
//order
|
|
80
|
-
return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [isMobile && (_jsxs(_Fragment, { children: [_jsxs(List, Object.assign({ className: classes.navigation }, { children: [_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "home" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.home", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.home" }) })] })) })), groupsEnabled && scUserContext.user && (_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.GROUPS_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "groups" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.groups", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.groups" }) })] })) }))), eventsEnabled && (scUserContext.user || contentAvailable) && (_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "CalendarIcon" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.events", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.events" }) })] })) }))), exploreStreamEnabled && (contentAvailable || scUserContext.user) && (_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.EXPLORE_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "explore" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.explore", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.explore" }) })] })) })))] })), _jsx(Divider, {})] })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.category.title", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.category.title" }) })), !categoriesOrdered.length && (_jsx(Typography, Object.assign({ variant: "body1", className: classes.noResults }, { children: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.category.noResults", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.category.noResults" }) }))), categoriesOrdered.map((c, index) => (_jsx(Zoom, Object.assign({ in: true, style: { transform: isHovered[c.id] && 'scale(1.05)' } }, { children: _jsx(ListItem, { children: _jsx(Category, Object.assign({ ButtonBaseProps: { component: Link, to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c) }, elevation: 0, category: c, actions: null }, CategoryItemProps, getMouseEvents(() => handleMouseEnter(c.id), () => handleMouseLeave(c.id)))) }, c.id) }), index)))] })));
|
|
81
|
+
return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [isMobile && (_jsxs(_Fragment, { children: [_jsxs(List, Object.assign({ className: classes.navigation }, { children: [_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "home" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.home", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.home" }) })] })) })), groupsEnabled && scUserContext.user && (_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.GROUPS_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "groups" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.groups", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.groups" }) })] })) }))), eventsEnabled && (scUserContext.user || contentAvailable) && (_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "CalendarIcon" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.events", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.events" }) })] })) }))), exploreStreamEnabled && (contentAvailable || scUserContext.user) && (_jsx(ListItem, Object.assign({ disablePadding: true }, { children: _jsxs(ListItemButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.EXPLORE_ROUTE_NAME, {}) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "explore" }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.explore", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.navigation.explore" }) })] })) })))] })), _jsx(Divider, {})] })), _jsx(Typography, Object.assign({ variant: "subtitle1", className: classes.title }, { children: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.category.title", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.category.title" }) })), isLoading ? (_jsx(DefaultDrawerSkeleton, {})) : (_jsxs(_Fragment, { children: [!categoriesOrdered.length && (_jsx(Typography, Object.assign({ variant: "body1", className: classes.noResults }, { children: _jsx(FormattedMessage, { id: "ui.navigationMenuIconButton.defaultDrawerContent.category.noResults", defaultMessage: "ui.navigationMenuIconButton.defaultDrawerContent.category.noResults" }) }))), categoriesOrdered.map((c, index) => (_jsx(Zoom, Object.assign({ in: true, style: { transform: isHovered[c.id] && 'scale(1.05)' } }, { children: _jsx(ListItem, { children: _jsx(Category, Object.assign({ ButtonBaseProps: { component: Link, to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c) }, elevation: 0, category: c, actions: null }, CategoryItemProps, getMouseEvents(() => handleMouseEnter(c.id), () => handleMouseLeave(c.id)))) }, c.id) }), index)))] }))] })));
|
|
81
82
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BoxProps } from '@mui/material';
|
|
2
|
+
export declare const PREFIX = "SCDefaultDrawerSkeleton";
|
|
3
|
+
export declare type DefaultDrawerSkeletonProps = BoxProps;
|
|
4
|
+
/**
|
|
5
|
+
* > API documentation for the Community-JS Default Drawer Skeleton component. Learn about the available props and the CSS API.
|
|
6
|
+
|
|
7
|
+
#### Import
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import {SCDefaultDrawerSkeleton} from '@selfcommunity/react-ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
#### Component Name
|
|
14
|
+
|
|
15
|
+
The name `SCDefaultDrawerSkeleton-root` can be used when providing style overrides in the theme.
|
|
16
|
+
|
|
17
|
+
#### CSS
|
|
18
|
+
|
|
19
|
+
|Rule Name|Global class|Description|
|
|
20
|
+
|---|---|---|
|
|
21
|
+
|root|.SCDefaultDrawerSkeleton-root|Styles applied to the root element.|
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
export default function DefaultDrawerSkeleton(props: DefaultDrawerSkeletonProps): JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import CategorySkeleton from '../Category/Skeleton';
|
|
4
|
+
import { Box, ListItem } from '@mui/material';
|
|
5
|
+
export const PREFIX = 'SCDefaultDrawerSkeleton';
|
|
6
|
+
const classes = {
|
|
7
|
+
root: `${PREFIX}-skeleton-root`
|
|
8
|
+
};
|
|
9
|
+
const Root = styled(Box, {
|
|
10
|
+
name: PREFIX,
|
|
11
|
+
slot: 'root'
|
|
12
|
+
})(() => ({}));
|
|
13
|
+
/**
|
|
14
|
+
* > API documentation for the Community-JS Default Drawer Skeleton component. Learn about the available props and the CSS API.
|
|
15
|
+
|
|
16
|
+
#### Import
|
|
17
|
+
|
|
18
|
+
```jsx
|
|
19
|
+
import {SCDefaultDrawerSkeleton} from '@selfcommunity/react-ui';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
#### Component Name
|
|
23
|
+
|
|
24
|
+
The name `SCDefaultDrawerSkeleton-root` can be used when providing style overrides in the theme.
|
|
25
|
+
|
|
26
|
+
#### CSS
|
|
27
|
+
|
|
28
|
+
|Rule Name|Global class|Description|
|
|
29
|
+
|---|---|---|
|
|
30
|
+
|root|.SCDefaultDrawerSkeleton-root|Styles applied to the root element.|
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
export default function DefaultDrawerSkeleton(props) {
|
|
34
|
+
return (_jsx(Root, Object.assign({ className: classes.root }, props, { children: [...Array(5)].map((category, index) => (_jsx(ListItem, { children: _jsx(CategorySkeleton, { elevation: 0, actions: null }) }, index))) })));
|
|
35
|
+
}
|
|
@@ -199,5 +199,5 @@ export default function NavigationSettingsIconButton(inProps) {
|
|
|
199
199
|
if (!scUserContext.user) {
|
|
200
200
|
return null;
|
|
201
201
|
}
|
|
202
|
-
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({ onClick: () => setAnchorEl(null), className: classes.drawerRoot, anchor: "bottom", open:
|
|
202
|
+
return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { onClick: handleOpen }, { children: _jsx(Icon, { children: "more_vert" }) })), Boolean(anchorEl) && (_jsx(_Fragment, { children: isMobile ? (_jsx(SwipeableDrawerRoot, Object.assign({ onClick: () => setAnchorEl(null), className: classes.drawerRoot, anchor: "bottom", open: true, onClose: handleClose, onOpen: handleOpen, PaperProps: { className: classes.paper }, disableSwipeToOpen: true }, { children: _jsx(List, { children: renderList() }) }))) : (_jsx(MenuRoot, Object.assign({ onClick: () => setAnchorEl(null), className: classes.menuRoot, anchorEl: anchorEl, open: true, onClose: handleClose, PaperProps: { className: classes.paper } }, { children: renderList() }))) }))] }));
|
|
203
203
|
}
|
|
@@ -147,7 +147,7 @@ export default function NavigationToolbar(inProps) {
|
|
|
147
147
|
}), "aria-label": "Events", to: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}), component: Link }, { children: _jsx(Icon, { children: "CalendarIcon" }) })))] })));
|
|
148
148
|
return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsx(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: _jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[SCPreferences.ADDONS_CLOSED_COMMUNITY] && (_jsx(Button, Object.assign({ color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && (_jsx(_Fragment, { children: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? (_jsx(Tooltip, Object.assign({ title: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: _jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? (_jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteProps))) : (_jsx(Box, { className: classes.search })), startActions, scUserContext.user ? (_jsxs(_Fragment, { children: [showComposer && _jsx(ComposerIconButton, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), _jsx(Tooltip, Object.assign({ title: scUserContext.user.username }, { children: _jsx(IconButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: _jsx(Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), _jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classNames(classes.notification, {
|
|
149
149
|
[classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}))
|
|
150
|
-
}), "aria-label": "Notification", onClick: handleOpenNotificationMenu }, { children: _jsx(Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: _jsx(Icon, { children: "notifications_active" }) })) })), _jsx(NotificationMenu, Object.assign({ className: classes.notificationsMenu, id: "notification-menu", anchorEl: anchorNotification, open:
|
|
150
|
+
}), "aria-label": "Notification", onClick: handleOpenNotificationMenu }, { children: _jsx(Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: _jsx(Icon, { children: "notifications_active" }) })) })), Boolean(anchorNotification) && (_jsx(NotificationMenu, Object.assign({ className: classes.notificationsMenu, id: "notification-menu", anchorEl: anchorNotification, open: true, onClose: handleCloseNotificationMenu, onClick: handleCloseNotificationMenu, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, NotificationMenuProps)))] }), privateMessagingEnabled && (_jsx(IconButton, Object.assign({ className: classNames(classes.messages, {
|
|
151
151
|
[classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}))
|
|
152
152
|
}), "aria-label": "Messages", to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}), component: Link }, { children: _jsx(Badge, Object.assign({ badgeContent: 0, color: "secondary" }, { children: _jsx(Icon, { children: "email" }) })) }))), endActions, _jsx(NavigationSettingsIconButtonComponent, { className: classes.settings })] })) : (_jsxs(_Fragment, { children: [endActions, _jsx(Button, Object.assign({ color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNIN_ROUTE_NAME, {}) }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.login", defaultMessage: "ui.appBar.navigation.login" }) }))] }))] })));
|
|
153
153
|
}
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { SearchAutocompleteProps } from '../SearchAutocomplete';
|
|
4
4
|
import { NavigationSettingsIconButtonProps } from '../NavigationSettingsIconButton';
|
|
5
5
|
import { NavigationMenuIconButtonProps } from '../NavigationMenuIconButton';
|
|
6
|
+
import { ComposerIconButtonProps } from '../ComposerIconButton';
|
|
6
7
|
export interface NavigationToolbarMobileProps extends ToolbarProps {
|
|
7
8
|
/**
|
|
8
9
|
* Disable search action if possible
|
|
@@ -32,6 +33,11 @@ export interface NavigationToolbarMobileProps extends ToolbarProps {
|
|
|
32
33
|
* Component for Navigation Settings
|
|
33
34
|
*/
|
|
34
35
|
NavigationSettingsIconButtonComponent?: (inProps: NavigationSettingsIconButtonProps) => JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* Props to spread to the ComposerIconButton
|
|
38
|
+
* @default {}
|
|
39
|
+
*/
|
|
40
|
+
ComposerIconButtonProps?: ComposerIconButtonProps;
|
|
35
41
|
}
|
|
36
42
|
/**
|
|
37
43
|
* > API documentation for the Community-JS Navigation Toolbar Mobile component. Learn about the available props and the CSS API.
|
|
@@ -69,7 +69,7 @@ export default function NavigationToolbarMobile(inProps) {
|
|
|
69
69
|
props: inProps,
|
|
70
70
|
name: PREFIX
|
|
71
71
|
});
|
|
72
|
-
const { className = '', disableSearch = false, preserveDesktopLogo = false, SearchAutocompleteProps = {}, children = null, startActions = null, endActions = null, NavigationMenuIconButtonComponent = NavigationMenuIconButton, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton } = props, rest = __rest(props, ["className", "disableSearch", "preserveDesktopLogo", "SearchAutocompleteProps", "children", "startActions", "endActions", "NavigationMenuIconButtonComponent", "NavigationSettingsIconButtonComponent"]);
|
|
72
|
+
const { className = '', disableSearch = false, preserveDesktopLogo = false, SearchAutocompleteProps = {}, children = null, startActions = null, endActions = null, NavigationMenuIconButtonComponent = NavigationMenuIconButton, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, ComposerIconButtonProps = {} } = props, rest = __rest(props, ["className", "disableSearch", "preserveDesktopLogo", "SearchAutocompleteProps", "children", "startActions", "endActions", "NavigationMenuIconButtonComponent", "NavigationSettingsIconButtonComponent", "ComposerIconButtonProps"]);
|
|
73
73
|
// CONTEXT
|
|
74
74
|
const scUserContext = useSCUser();
|
|
75
75
|
const scRoutingContext = useSCRouting();
|
|
@@ -110,5 +110,5 @@ export default function NavigationToolbarMobile(inProps) {
|
|
|
110
110
|
groupsEnabled &&
|
|
111
111
|
eventsEnabled &&
|
|
112
112
|
(scUserContext.user || contentAvailable) &&
|
|
113
|
-
exploreStreamEnabled && _jsx(ComposerIconButton, {}), scUserContext.user && (groupsEnabled || eventsEnabled) && (_jsx(IconButton, Object.assign({ className: classes.notifications, component: Link, to: scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}) }, { children: _jsx(Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: _jsx(Icon, { children: "notifications_active" }) })) }))), scUserContext.user ? (_jsx(NavigationSettingsIconButtonComponent, { className: classes.settings })) : (_jsx(Button, Object.assign({ className: classes.login, color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNIN_ROUTE_NAME, {}) }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.login", defaultMessage: "ui.appBar.navigation.login" }) })))] })));
|
|
113
|
+
exploreStreamEnabled && _jsx(ComposerIconButton, Object.assign({}, ComposerIconButtonProps)), scUserContext.user && (groupsEnabled || eventsEnabled) && (_jsx(IconButton, Object.assign({ className: classes.notifications, component: Link, to: scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}) }, { children: _jsx(Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: _jsx(Icon, { children: "notifications_active" }) })) }))), scUserContext.user ? (_jsx(NavigationSettingsIconButtonComponent, { className: classes.settings })) : (_jsx(Button, Object.assign({ className: classes.login, color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNIN_ROUTE_NAME, {}) }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.login", defaultMessage: "ui.appBar.navigation.login" }) })))] })));
|
|
114
114
|
}
|
|
@@ -142,7 +142,7 @@ export default function VoteButton(inProps) {
|
|
|
142
142
|
: () => handleVoteAction(contributionReaction ? contributionReaction : reactions.default ? reactions.default : null), disabled: isLoading || Boolean(error), loading: isVoting, className: classNames(classes.root, className, {
|
|
143
143
|
[classes.voted]: scUserContext.user && contributionVoted
|
|
144
144
|
}) }, rest, rootProps, { children: scUserContext.user && contributionVoted ? (contributionReaction ? (_jsx(Icon, { children: _jsx("img", { alt: contributionReaction.label, src: contributionReaction.image, width: "100%", height: "100%" }) })) : (_jsx(Icon, { children: "thumb_up" }))) : (_jsx(Icon, { children: "thumb_up_off_alt" })) })));
|
|
145
|
-
return (_jsxs(_Fragment, { children: [reactions.default ? (button) : (_jsx(Tooltip, Object.assign({ title: contributionVoted ? (_jsx(FormattedMessage, { id: "ui.voteButton.voteDown", defaultMessage: "ui.voteButton.voteDown" })) : (_jsx(FormattedMessage, { id: "ui.voteButton.voteUp", defaultMessage: "ui.voteButton.voteUp" })) }, { children: _jsx("span", { children: button }) }))), reactions.default && (_jsx(PopperRoot, Object.assign({ id: `vote_${contributionId}_${contributionType}_popper`, className: classes.popperRoot, open:
|
|
145
|
+
return (_jsxs(_Fragment, { children: [reactions.default ? (button) : (_jsx(Tooltip, Object.assign({ title: contributionVoted ? (_jsx(FormattedMessage, { id: "ui.voteButton.voteDown", defaultMessage: "ui.voteButton.voteDown" })) : (_jsx(FormattedMessage, { id: "ui.voteButton.voteUp", defaultMessage: "ui.voteButton.voteUp" })) }, { children: _jsx("span", { children: button }) }))), reactions.default && Boolean(anchorEl) && !isVoting && !isLoading && (_jsx(PopperRoot, Object.assign({ id: `vote_${contributionId}_${contributionType}_popper`, className: classes.popperRoot, open: true, anchorEl: anchorEl, placement: "top", keepMounted: true }, { children: _jsx(Paper, Object.assign({ className: classes.reactionList, onMouseEnter: handleClearTimeout, onMouseLeave: handleMouseLeave }, { children: reactions.reactions
|
|
146
146
|
.filter((reaction) => !contributionVoted || (contributionVoted && contributionReaction.id !== reaction.id) ? reaction.active : reaction)
|
|
147
147
|
.map((reaction) => (_jsx(IconButton, Object.assign({ className: classes.reaction, onClick: () => handleVoteAction(reaction) }, { children: _jsx(Icon, { children: _jsx("img", { alt: reaction.label, src: reaction.image, width: "100%", height: "100%" }) }) }), reaction.id))) })) })))] }));
|
|
148
148
|
}
|