@selfcommunity/react-ui 0.7.50-events.91 → 0.7.50-events.93
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/AcceptRequestUserEventButton/AcceptRequestUserEventButton.d.ts +57 -0
- package/lib/cjs/components/AcceptRequestUserEventButton/AcceptRequestUserEventButton.js +75 -0
- package/lib/cjs/components/AcceptRequestUserEventButton/index.d.ts +3 -0
- package/lib/cjs/components/AcceptRequestUserEventButton/index.js +5 -0
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +1 -1
- package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
- package/lib/cjs/components/Composer/Layer/CloseLayer/CloseLayer.d.ts +1 -1
- package/lib/cjs/components/Composer/Layer/LocationLayer/LocationLayer.d.ts +1 -1
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.d.ts +1 -1
- package/lib/cjs/components/Event/Skeleton.js +8 -3
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +36 -5
- package/lib/cjs/components/EventMembersWidget/Skeleton.js +1 -1
- package/lib/cjs/components/EventMembersWidget/TabContentComponent.d.ts +6 -2
- package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +53 -8
- package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +1 -1
- package/lib/cjs/components/Events/Events.d.ts +18 -1
- package/lib/cjs/components/Events/Events.js +3 -3
- package/lib/cjs/components/Events/Skeleton.d.ts +11 -0
- package/lib/cjs/components/Events/Skeleton.js +2 -2
- package/lib/cjs/components/InviteUserEventButton/InviteUserEventButton.d.ts +2 -5
- package/lib/cjs/components/InviteUserEventButton/InviteUserEventButton.js +5 -4
- package/lib/cjs/components/MyEventsWidget/Skeleton.js +1 -1
- package/lib/cjs/index.d.ts +5 -4
- package/lib/cjs/index.js +14 -11
- package/lib/cjs/shared/ConfirmDialog/ConfirmDialog.js +7 -7
- package/lib/cjs/shared/EventActionsMenu/index.js +4 -3
- package/lib/cjs/shared/Media/File/PreviewComponent.d.ts +1 -1
- package/lib/cjs/shared/Media/Link/LayerComponent.d.ts +1 -1
- package/lib/cjs/shared/Media/Link/PreviewComponent.d.ts +1 -1
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/cjs/types/index.js +3 -1
- package/lib/esm/components/AcceptRequestUserEventButton/AcceptRequestUserEventButton.d.ts +57 -0
- package/lib/esm/components/AcceptRequestUserEventButton/AcceptRequestUserEventButton.js +72 -0
- package/lib/esm/components/AcceptRequestUserEventButton/index.d.ts +3 -0
- package/lib/esm/components/AcceptRequestUserEventButton/index.js +2 -0
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +1 -1
- package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
- package/lib/esm/components/Composer/Layer/CloseLayer/CloseLayer.d.ts +1 -1
- package/lib/esm/components/Composer/Layer/LocationLayer/LocationLayer.d.ts +1 -1
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.d.ts +1 -1
- package/lib/esm/components/Event/Skeleton.js +9 -4
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +36 -5
- package/lib/esm/components/EventMembersWidget/Skeleton.js +1 -1
- package/lib/esm/components/EventMembersWidget/TabContentComponent.d.ts +6 -2
- package/lib/esm/components/EventMembersWidget/TabContentComponent.js +54 -9
- package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +1 -1
- package/lib/esm/components/Events/Events.d.ts +18 -1
- package/lib/esm/components/Events/Events.js +3 -3
- package/lib/esm/components/Events/Skeleton.d.ts +11 -0
- package/lib/esm/components/Events/Skeleton.js +2 -2
- package/lib/esm/components/InviteUserEventButton/InviteUserEventButton.d.ts +2 -5
- package/lib/esm/components/InviteUserEventButton/InviteUserEventButton.js +5 -4
- package/lib/esm/components/MyEventsWidget/Skeleton.js +2 -2
- package/lib/esm/index.d.ts +5 -4
- package/lib/esm/index.js +8 -7
- package/lib/esm/shared/ConfirmDialog/ConfirmDialog.js +7 -7
- package/lib/esm/shared/EventActionsMenu/index.js +4 -3
- package/lib/esm/shared/Media/File/PreviewComponent.d.ts +1 -1
- package/lib/esm/shared/Media/Link/LayerComponent.d.ts +1 -1
- package/lib/esm/shared/Media/Link/PreviewComponent.d.ts +1 -1
- package/lib/esm/types/index.d.ts +2 -1
- package/lib/esm/types/index.js +2 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
|
@@ -30,5 +30,5 @@ export interface ComposerIconButtonProps extends IconButtonProps {
|
|
|
30
30
|
|
|
31
31
|
* @param inProps
|
|
32
32
|
*/
|
|
33
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<ComposerIconButtonProps, "id" | "role" | "
|
|
33
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<ComposerIconButtonProps, "id" | "role" | "className" | "style" | "classes" | "form" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "component" | "name" | "type" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "action" | "size" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "ComposerProps"> & React.RefAttributes<HTMLButtonElement>>;
|
|
34
34
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { AvatarGroup, Box, Button, CardContent, Divider, Icon, Stack } from '@mui/material';
|
|
3
|
+
import { AvatarGroup, Box, Button, CardActions, CardContent, Divider, Icon, Stack, useTheme } from '@mui/material';
|
|
4
4
|
import Skeleton from '@mui/material/Skeleton';
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
6
6
|
import { useThemeProps } from '@mui/system';
|
|
@@ -16,10 +16,13 @@ const classes = {
|
|
|
16
16
|
skeletonSnippetRoot: `${PREFIX}-skeleton-snippet-root`,
|
|
17
17
|
skeletonDetailCalendar: `${PREFIX}-skeleton-detail-calendar`,
|
|
18
18
|
skeletonDetailContent: `${PREFIX}-skeleton-detail-content`,
|
|
19
|
+
skeletonDetailActions: `${PREFIX}-skeleton-detail-actions`,
|
|
19
20
|
skeletonDetailUser: `${PREFIX}-skeleton-detail-user`,
|
|
20
21
|
skeletonDetailFirstDivider: `${PREFIX}-skeleton-detail-first-divider`,
|
|
21
22
|
skeletonDetailSecondDivider: `${PREFIX}-skeleton-detail-second-divider`,
|
|
22
23
|
skeletonPreviewContent: `${PREFIX}-skeleton-preview-content`,
|
|
24
|
+
skeletonPreviewName: `${PREFIX}-skeleton-preview-name`,
|
|
25
|
+
skeletonPreviewActions: `${PREFIX}-skeleton-preview-actions`,
|
|
23
26
|
skeletonSnippetImage: `${PREFIX}-skeleton-snippet-image`,
|
|
24
27
|
skeletonSnippetAction: `${PREFIX}-skeleton-snippet-action`
|
|
25
28
|
};
|
|
@@ -68,18 +71,20 @@ export default function EventSkeleton(inProps) {
|
|
|
68
71
|
name: PREFIX
|
|
69
72
|
});
|
|
70
73
|
const { className, template = SCEventTemplateType.SNIPPET, skeletonsAnimation = 'wave', actions } = props, rest = __rest(props, ["className", "template", "skeletonsAnimation", "actions"]);
|
|
74
|
+
const theme = useTheme();
|
|
71
75
|
/**
|
|
72
76
|
* Renders event object
|
|
73
77
|
*/
|
|
74
78
|
let contentObj;
|
|
75
79
|
if (template === SCEventTemplateType.DETAIL) {
|
|
76
|
-
|
|
80
|
+
console.log(actions);
|
|
81
|
+
contentObj = (_jsxs(SkeletonDetailRoot, Object.assign({ className: classes.skeletonDetailRoot }, { children: [_jsxs(Box, Object.assign({ position: "relative" }, { children: [_jsx(Skeleton, { variant: "rectangular", animation: skeletonsAnimation, width: "100%", height: "170px" }), _jsx(Skeleton, { className: classes.skeletonDetailCalendar, variant: "rounded", animation: skeletonsAnimation, width: "60px", height: "60px" })] })), _jsxs(CardContent, Object.assign({ className: classes.skeletonDetailContent }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, width: "36%", height: "40px" }), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "9px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, width: "50%", height: "20px" })] })), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "9px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, width: "35%", height: "20px" })] })), _jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "14px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, width: "27%", height: "20px" })] })), _jsxs(Stack, Object.assign({ direction: "row", gap: "8px", className: classes.skeletonDetailUser }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "36px", height: "36px" }), _jsxs(Stack, Object.assign({ gap: "1px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, width: "75px", height: "15px" }), _jsx(Skeleton, { animation: skeletonsAnimation, width: "86px", height: "16px" })] }))] })), _jsx(Divider, { className: classes.skeletonDetailFirstDivider }), _jsxs(Stack, Object.assign({ direction: "row", gap: "8px", alignItems: "center", height: "28px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, width: "68px", height: "20px" }), _jsxs(AvatarGroup, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" })] })] })), _jsx(Divider, { className: classes.skeletonDetailSecondDivider })] })), _jsx(CardActions, Object.assign({ className: classes.skeletonDetailActions }, { children: actions !== undefined ? actions : _jsx(Skeleton, { variant: "rounded", width: 100, height: 30 }) }))] })));
|
|
77
82
|
}
|
|
78
83
|
else if (template === SCEventTemplateType.PREVIEW) {
|
|
79
|
-
contentObj = (_jsxs(SkeletonPreviewRoot, Object.assign({ className: classes.skeletonPreviewRoot }, { children: [_jsx(Box, Object.assign({ position: "relative" }, { children: _jsx(Skeleton, { variant: "rectangular", animation: skeletonsAnimation, width: "100%", height: "80px" }) })), _jsxs(CardContent, Object.assign({ className: classes.skeletonPreviewContent }, { children: [_jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, width: "
|
|
84
|
+
contentObj = (_jsxs(SkeletonPreviewRoot, Object.assign({ className: classes.skeletonPreviewRoot }, { children: [_jsx(Box, Object.assign({ position: "relative" }, { children: _jsx(Skeleton, { variant: "rectangular", animation: skeletonsAnimation, width: "100%", height: "80px" }) })), _jsxs(CardContent, Object.assign({ className: classes.skeletonPreviewContent }, { children: [_jsxs(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px" }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: "21px", height: "21px" }), _jsx(Skeleton, { animation: skeletonsAnimation, width: "50%", height: "20px" })] })), _jsx(Skeleton, { animation: skeletonsAnimation, width: "67%", height: "25px", className: classes.skeletonPreviewName }), _jsx(Stack, Object.assign({ direction: "row", alignItems: "center", gap: "8px", marginBottom: "2px" }, { children: _jsx(Skeleton, { animation: skeletonsAnimation, width: "27%", height: "18px" }) })), _jsx(Stack, Object.assign({ direction: "row", gap: "8px", alignItems: "center" }, { children: _jsxs(AvatarGroup, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: `${theme.selfcommunity.user.avatar.sizeSmall}px`, height: `${theme.selfcommunity.user.avatar.sizeSmall}px` }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: `${theme.selfcommunity.user.avatar.sizeSmall}px`, height: `${theme.selfcommunity.user.avatar.sizeSmall}px` }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "circular", width: `${theme.selfcommunity.user.avatar.sizeSmall}px`, height: `${theme.selfcommunity.user.avatar.sizeSmall}px` })] }) }))] })), _jsx(CardActions, Object.assign({ className: classes.skeletonPreviewActions }, { children: actions !== undefined ? actions : _jsx(Skeleton, { variant: "rounded", width: 100, height: 30 }) }))] })));
|
|
80
85
|
}
|
|
81
86
|
else {
|
|
82
|
-
contentObj = (_jsx(SkeletonSnippetRoot, { elevation: 0, square: true, disableTypography: true, className: classes.skeletonSnippetRoot, image: _jsxs(Box, Object.assign({ className: classes.skeletonSnippetImage }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", width: 100, height: 60 }), " ", _jsx(Icon, Object.assign({ fontSize: "large" }, { children: "CalendarIcon" }))] })), primary: _jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "40%", style: { marginBottom: 12 } }), secondary: _jsxs(_Fragment, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "60%", style: { marginBottom: 10, marginRight: 5 } }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "35%" })] }), actions: _jsx(_Fragment, { children: actions !==
|
|
87
|
+
contentObj = (_jsx(SkeletonSnippetRoot, { elevation: 0, square: true, disableTypography: true, className: classes.skeletonSnippetRoot, image: _jsxs(Box, Object.assign({ className: classes.skeletonSnippetImage }, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", width: 100, height: 60 }), " ", _jsx(Icon, Object.assign({ fontSize: "large" }, { children: "CalendarIcon" }))] })), primary: _jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "40%", style: { marginBottom: 12 } }), secondary: _jsxs(_Fragment, { children: [_jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "60%", style: { marginBottom: 10, marginRight: 5 } }), _jsx(Skeleton, { animation: skeletonsAnimation, variant: "rectangular", height: 10, width: "35%" })] }), actions: _jsx(_Fragment, { children: actions !== undefined ? (actions) : (_jsx(Button, Object.assign({ size: "small", variant: "outlined", disabled: true }, { children: _jsx(Skeleton, { animation: skeletonsAnimation, height: 10, width: 30, style: { marginTop: 5, marginBottom: 5 } }) }))) }) }));
|
|
83
88
|
}
|
|
84
89
|
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className, `${PREFIX}-skeleton-${template}`) }, rest, { children: contentObj })));
|
|
85
90
|
}
|
|
@@ -52,7 +52,16 @@ export default function EventMembersWidget(inProps) {
|
|
|
52
52
|
cacheStrategy,
|
|
53
53
|
visibleItems: limit
|
|
54
54
|
}, stateWidgetInitializer);
|
|
55
|
-
const [
|
|
55
|
+
const [requests, dispatchRequests] = useReducer(dataWidgetReducer, {
|
|
56
|
+
isLoadingNext: false,
|
|
57
|
+
next: null,
|
|
58
|
+
cacheKey: SCCache.getWidgetStateCacheKey(SCCache.USER_REQUESTS_EVENTS_STATE_CACHE_PREFIX_KEY, eventId || event.id),
|
|
59
|
+
cacheStrategy,
|
|
60
|
+
visibleItems: limit
|
|
61
|
+
}, stateWidgetInitializer);
|
|
62
|
+
const [invitedCount, setInvitedCount] = useState(0);
|
|
63
|
+
const [requestsCount, setRequestsCount] = useState(0);
|
|
64
|
+
const [requestsUsers, setRequestsUsers] = useState([]);
|
|
56
65
|
const [tabValue, setTabValue] = useState('1');
|
|
57
66
|
const [refresh, setRefresh] = useState(false);
|
|
58
67
|
// CONTEXT
|
|
@@ -82,7 +91,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
82
91
|
EventService.getEventInvitedUsers(scEvent.id, Object.assign({}, endpointQueryParams))
|
|
83
92
|
.then((payload) => {
|
|
84
93
|
dispatchInvited({ type: actionWidgetTypes.LOAD_NEXT_SUCCESS, payload: Object.assign(Object.assign({}, payload), { initialized: true }) });
|
|
85
|
-
|
|
94
|
+
setInvitedCount(payload.count);
|
|
86
95
|
})
|
|
87
96
|
.catch((error) => {
|
|
88
97
|
dispatchInvited({ type: actionWidgetTypes.LOAD_NEXT_FAILURE, payload: { errorLoadNext: error } });
|
|
@@ -90,6 +99,21 @@ export default function EventMembersWidget(inProps) {
|
|
|
90
99
|
});
|
|
91
100
|
}
|
|
92
101
|
}, [invited.isLoadingNext, invited.initialized, dispatchInvited, scUserContext.user, scEvent]);
|
|
102
|
+
const _initRequests = useCallback(() => {
|
|
103
|
+
if (!requests.initialized && !requests.isLoadingNext && hasAllow) {
|
|
104
|
+
dispatchRequests({ type: actionWidgetTypes.LOADING_NEXT });
|
|
105
|
+
EventService.getEventWaitingApprovalSubscribers(scEvent.id, Object.assign({}, endpointQueryParams))
|
|
106
|
+
.then((payload) => {
|
|
107
|
+
dispatchRequests({ type: actionWidgetTypes.LOAD_NEXT_SUCCESS, payload: Object.assign(Object.assign({}, payload), { initialized: true }) });
|
|
108
|
+
setRequestsCount(payload.count);
|
|
109
|
+
setRequestsUsers(payload.results);
|
|
110
|
+
})
|
|
111
|
+
.catch((error) => {
|
|
112
|
+
dispatchRequests({ type: actionWidgetTypes.LOAD_NEXT_FAILURE, payload: { errorLoadNext: error } });
|
|
113
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}, [requests.isLoadingNext, requests.initialized, dispatchRequests, scUserContext.user, scEvent]);
|
|
93
117
|
// EFFECTS
|
|
94
118
|
useEffect(() => {
|
|
95
119
|
let _t;
|
|
@@ -102,6 +126,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
102
126
|
else {
|
|
103
127
|
_initParticipants();
|
|
104
128
|
_initInvited();
|
|
129
|
+
_initRequests();
|
|
105
130
|
}
|
|
106
131
|
});
|
|
107
132
|
return () => {
|
|
@@ -120,8 +145,14 @@ export default function EventMembersWidget(inProps) {
|
|
|
120
145
|
if (!scEvent) {
|
|
121
146
|
return _jsx(HiddenPlaceholder, {});
|
|
122
147
|
}
|
|
123
|
-
return (_jsx(Root, Object.assign({ className: classes.root }, rest, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.title }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })), _jsxs(TabContext, Object.assign({ value: tabValue }, { children: [_jsxs(TabList, Object.assign({ className: classes.tabsWrapper, onChange: handleTabChange, textColor: "primary", indicatorColor: "primary", variant: "fullWidth" }, { children: [_jsx(Tab, { label: _jsxs(Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h3" }, { children: participants.count })), _jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.participants", defaultMessage: "ui.eventMembersWidget.participants" }) }))] })), value: "1" }), hasAllow && (_jsx(Tab, { label: _jsxs(Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h3" }, { children:
|
|
148
|
+
return (_jsx(Root, Object.assign({ className: classes.root }, rest, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.title }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })), _jsxs(TabContext, Object.assign({ value: tabValue }, { children: [_jsxs(TabList, Object.assign({ className: classes.tabsWrapper, onChange: handleTabChange, textColor: "primary", indicatorColor: "primary", variant: "fullWidth" }, { children: [_jsx(Tab, { label: _jsxs(Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h3" }, { children: participants.count })), _jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.participants", defaultMessage: "ui.eventMembersWidget.participants" }) }))] })), value: "1" }), hasAllow && (_jsx(Tab, { label: _jsxs(Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h3" }, { children: invitedCount })), _jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.invited", defaultMessage: "ui.eventMembersWidget.invited" }) }))] })), value: "2" })), hasAllow && (_jsx(Tab, { label: _jsxs(Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h3" }, { children: requestsCount })), _jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.requests", defaultMessage: "ui.eventMembersWidget.requests" }) }))] })), value: "3" }))] })), _jsx(TabPanel, Object.assign({ value: "1", className: classes.tabPanel }, { children: _jsx(TabContentComponent, { tabValue: "1", state: participants, dispatch: dispatchParticipants, userProps: userProps, dialogProps: dialogProps }) })), hasAllow && (_jsx(TabPanel, Object.assign({ value: "2", className: classes.tabPanel }, { children: _jsx(TabContentComponent, { tabValue: "2", state: invited, dispatch: dispatchInvited, userProps: userProps, dialogProps: dialogProps, actionProps: {
|
|
149
|
+
scEvent,
|
|
150
|
+
setCount: setInvitedCount
|
|
151
|
+
}, setRefresh: setRefresh }) }))), hasAllow && (_jsx(TabPanel, Object.assign({ value: "3", className: classes.tabPanel }, { children: _jsx(TabContentComponent, { tabValue: "3", state: requests, dispatch: dispatchRequests, userProps: userProps, dialogProps: dialogProps, actionProps: {
|
|
124
152
|
scEvent,
|
|
125
|
-
|
|
126
|
-
|
|
153
|
+
count: requestsCount,
|
|
154
|
+
setCount: setRequestsCount,
|
|
155
|
+
users: requestsUsers,
|
|
156
|
+
setUsers: setRequestsUsers
|
|
157
|
+
} }) })))] }))] })) })));
|
|
127
158
|
}
|
|
@@ -21,5 +21,5 @@ const Root = styled(Widget, {
|
|
|
21
21
|
overridesResolver: (_props, styles) => styles.skeletonRoot
|
|
22
22
|
})(() => ({}));
|
|
23
23
|
export default function EventMembersWidgetSkeleton() {
|
|
24
|
-
return (_jsx(Root, Object.assign({ className: classes.root }, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Skeleton, { animation: "wave", width: "53px", height: "25px", className: classes.title }), _jsxs(TabContext, Object.assign({ value: "1" }, { children: [_jsx(Box, Object.assign({ className: classes.tabsWrapper }, { children:
|
|
24
|
+
return (_jsx(Root, Object.assign({ className: classes.root }, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Skeleton, { animation: "wave", width: "53px", height: "25px", className: classes.title }), _jsxs(TabContext, Object.assign({ value: "1" }, { children: [_jsx(Box, Object.assign({ className: classes.tabsWrapper }, { children: _jsx(TabList, Object.assign({ variant: "fullWidth" }, { children: [1, 2, 3].map((_element, i) => (_jsx(Tab, { label: _jsxs(Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [_jsx(Skeleton, { animation: "wave", width: "26px", height: "24px" }), _jsx(Skeleton, { animation: "wave", width: "106px", height: "19px" })] })), value: `${i + 1}` }, i))) })) })), _jsx(TabPanel, Object.assign({ value: "1", className: classes.tabPanel }, { children: _jsxs(List, { children: [[1, 2, 3, 4].map((_element, i) => (_jsx(ListItem, { children: _jsx(UserSkeleton, {}) }, i))), _jsx(Skeleton, { className: classes.actionButton, animation: "wave", width: "52px", height: "20px" })] }) })), _jsx(TabPanel, { value: "2", className: classes.tabPanel }), _jsx(TabPanel, { value: "3", className: classes.tabPanel })] }))] })) })));
|
|
25
25
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { SCEventType } from '@selfcommunity/types';
|
|
1
|
+
import { SCEventType, SCUserType } from '@selfcommunity/types';
|
|
2
2
|
import { Dispatch, SetStateAction } from 'react';
|
|
3
3
|
import { BaseDialogProps } from '../../shared/BaseDialog';
|
|
4
4
|
import { UserProps } from '../User';
|
|
5
5
|
interface TabComponentProps {
|
|
6
|
+
tabValue: '1' | '2' | '3';
|
|
6
7
|
state: any;
|
|
7
8
|
dispatch: Dispatch<any>;
|
|
8
9
|
/**
|
|
@@ -17,7 +18,10 @@ interface TabComponentProps {
|
|
|
17
18
|
dialogProps?: BaseDialogProps;
|
|
18
19
|
actionProps?: {
|
|
19
20
|
scEvent?: SCEventType;
|
|
20
|
-
|
|
21
|
+
count?: number;
|
|
22
|
+
setCount?: Dispatch<SetStateAction<number>>;
|
|
23
|
+
users?: SCUserType[];
|
|
24
|
+
setUsers?: Dispatch<SetStateAction<SCUserType[]>>;
|
|
21
25
|
};
|
|
22
26
|
setRefresh?: Dispatch<SetStateAction<boolean>>;
|
|
23
27
|
}
|
|
@@ -2,12 +2,14 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { Button, List, ListItem, styled, Typography } from '@mui/material';
|
|
3
3
|
import { Endpoints, http } from '@selfcommunity/api-services';
|
|
4
4
|
import { Logger } from '@selfcommunity/utils';
|
|
5
|
-
import {
|
|
5
|
+
import { useSnackbar } from 'notistack';
|
|
6
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
6
7
|
import { FormattedMessage } from 'react-intl';
|
|
7
8
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
8
9
|
import BaseDialog from '../../shared/BaseDialog';
|
|
9
10
|
import InfiniteScroll from '../../shared/InfiniteScroll';
|
|
10
11
|
import { actionWidgetTypes } from '../../utils/widget';
|
|
12
|
+
import AcceptRequestUserEventButton from '../AcceptRequestUserEventButton';
|
|
11
13
|
import EventInviteButton from '../EventInviteButton';
|
|
12
14
|
import InviteUserEventButton from '../InviteUserEventButton';
|
|
13
15
|
import User, { UserSkeleton } from '../User';
|
|
@@ -26,9 +28,13 @@ const DialogRoot = styled(BaseDialog, {
|
|
|
26
28
|
})(() => ({}));
|
|
27
29
|
export default function TabContentComponent(props) {
|
|
28
30
|
// PROPS
|
|
29
|
-
const { state, dispatch, userProps, dialogProps, actionProps, setRefresh } = props;
|
|
31
|
+
const { state, dispatch, userProps, dialogProps, actionProps, setRefresh, tabValue } = props;
|
|
30
32
|
// STATE
|
|
31
33
|
const [openDialog, setOpenDialog] = useState(false);
|
|
34
|
+
// HOOKS
|
|
35
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
36
|
+
// CONSTS
|
|
37
|
+
const users = useMemo(() => (tabValue === '3' ? actionProps === null || actionProps === void 0 ? void 0 : actionProps.users : state.results), [tabValue, actionProps, state]);
|
|
32
38
|
// HANDLERS
|
|
33
39
|
/**
|
|
34
40
|
* Handles pagination
|
|
@@ -50,12 +56,51 @@ export default function TabContentComponent(props) {
|
|
|
50
56
|
const handleToggleDialogOpen = useCallback(() => {
|
|
51
57
|
setOpenDialog((prev) => !prev);
|
|
52
58
|
}, []);
|
|
53
|
-
const getActionsComponent = useCallback((userId) =>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
const getActionsComponent = useCallback((userId) => {
|
|
60
|
+
if (tabValue === '2' && actionProps) {
|
|
61
|
+
const handleInvitations = (invited) => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
if (invited) {
|
|
64
|
+
(_a = actionProps.setCount) === null || _a === void 0 ? void 0 : _a.call(actionProps, (prev) => prev - 1);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
(_b = actionProps.setCount) === null || _b === void 0 ? void 0 : _b.call(actionProps, (prev) => prev + 1);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
return _jsx(InviteUserEventButton, { event: actionProps.scEvent, userId: userId, handleInvitations: handleInvitations });
|
|
58
71
|
}
|
|
59
|
-
|
|
60
|
-
|
|
72
|
+
else if (tabValue === '3' && actionProps) {
|
|
73
|
+
const handleConfirm = (id) => {
|
|
74
|
+
if (id) {
|
|
75
|
+
actionProps.setCount((prev) => prev - 1);
|
|
76
|
+
actionProps.setUsers((prev) => prev.filter((user) => user.id !== id));
|
|
77
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.acceptRequestUserEventButton.snackbar.success", defaultMessage: "ui.acceptRequestUserEventButton.snackbar.success" }), {
|
|
78
|
+
variant: 'success',
|
|
79
|
+
autoHideDuration: 3000
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
84
|
+
variant: 'error',
|
|
85
|
+
autoHideDuration: 3000
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return _jsx(AcceptRequestUserEventButton, { event: actionProps.scEvent, userId: userId, handleConfirm: handleConfirm });
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
92
|
+
}, [tabValue, actionProps, dispatch, setRefresh]);
|
|
93
|
+
if (tabValue === '2' && state.count === 0 && actionProps) {
|
|
94
|
+
const handleInvitations = (invited) => {
|
|
95
|
+
if (invited) {
|
|
96
|
+
dispatch({ type: actionWidgetTypes.RESET });
|
|
97
|
+
setRefresh(true);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return _jsx(EventInviteButton, { event: actionProps.scEvent, className: classes.eventButton, handleInvitations: handleInvitations });
|
|
101
|
+
}
|
|
102
|
+
if (tabValue === '3' && (actionProps === null || actionProps === void 0 ? void 0 : actionProps.count) === 0) {
|
|
103
|
+
return (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.noOtherRequests", defaultMessage: "ui.eventMembersWidget.noOtherRequests" }) })));
|
|
104
|
+
}
|
|
105
|
+
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))) }) })) })))] }));
|
|
61
106
|
}
|
|
@@ -125,5 +125,5 @@ export default function EventParticipantsButton(inProps) {
|
|
|
125
125
|
const handleToggleDialogOpen = useCallback(() => {
|
|
126
126
|
setOpen((prev) => !prev);
|
|
127
127
|
}, [setOpen]);
|
|
128
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleToggleDialogOpen, disabled: loading || !scEvent || scEvent.goings_counter === 0 }, rest, { children: [!hideCaption && (_jsx(Typography, Object.assign({ className: classes.participants, variant: "caption" }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.eventParticipantsButton.participants", id: "ui.eventParticipantsButton.participants" }) }))), !followers.length && (loading || !scEvent) ? (_jsx(AvatarGroupSkeleton, Object.assign({}, rest, (!participantsAvailable && { skeletonsAnimation: false })))) : (_jsx(AvatarGroup, Object.assign({ total:
|
|
128
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleToggleDialogOpen, disabled: loading || !scEvent || scEvent.goings_counter === 0 }, rest, { children: [!hideCaption && (_jsx(Typography, Object.assign({ className: classes.participants, variant: "caption" }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.eventParticipantsButton.participants", id: "ui.eventParticipantsButton.participants" }) }))), !followers.length && (loading || !scEvent) ? (_jsx(AvatarGroupSkeleton, Object.assign({}, rest, (!participantsAvailable && { skeletonsAnimation: false })))) : (_jsx(AvatarGroup, Object.assign({ total: followers.length }, { children: followers.map((c) => (_jsx(Avatar, { alt: c.username, src: c.avatar, className: classes.avatar }, c.id))) })))] })), open && (_jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: _jsx(FormattedMessage, { defaultMessage: "ui.eventParticipantsButton.dialogTitle", id: "ui.eventParticipantsButton.dialogTitle", values: { total: scEvent.goings_counter } }), onClose: handleToggleDialogOpen, open: open }, DialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: followers.length, next: fetchFollowers, hasMoreNext: next !== null || loading, loaderNext: _jsx(UserSkeleton, { elevation: 0 }), className: classes.infiniteScroll, endMessage: _jsx(Typography, Object.assign({ className: classes.endMessage }, { children: _jsx(FormattedMessage, { id: "ui.eventParticipantsButton.noOtherParticipants", defaultMessage: "ui.eventParticipantsButton.noOtherParticipants" }) })) }, { children: _jsx(List, { children: followers.map((follower) => (_jsx(ListItem, { children: _jsx(User, { elevation: 0, user: follower }) }, follower.id))) }) })) })))] }));
|
|
129
129
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { GridProps } from '@mui/material';
|
|
1
2
|
import { EndpointType } from '@selfcommunity/api-services';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { EventProps, EventSkeletonProps } from '../Event';
|
|
5
|
+
import { EventsSkeletonProps } from '../Events/Skeleton';
|
|
4
6
|
export declare const EventsChipRoot: import("@emotion/styled").StyledComponent<import("@mui/material").ChipOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
5
7
|
ref?: React.Ref<HTMLDivElement>;
|
|
6
|
-
}, "avatar" | "
|
|
8
|
+
}, "avatar" | "className" | "style" | "classes" | "label" | "tabIndex" | "color" | "children" | "sx" | "variant" | "disabled" | "size" | "icon" | "clickable" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
7
9
|
export interface EventsProps {
|
|
8
10
|
/**
|
|
9
11
|
* Overrides or extends the styles applied to the component.
|
|
@@ -25,11 +27,26 @@ export interface EventsProps {
|
|
|
25
27
|
* @default {}
|
|
26
28
|
*/
|
|
27
29
|
EventComponentProps?: EventProps;
|
|
30
|
+
/**
|
|
31
|
+
* Props to spread to events skeleton object
|
|
32
|
+
* @default {}
|
|
33
|
+
*/
|
|
34
|
+
EventsSkeletonComponentProps?: EventsSkeletonProps;
|
|
28
35
|
/**
|
|
29
36
|
* Props to spread to single event skeleton object
|
|
30
37
|
* @default {}
|
|
31
38
|
*/
|
|
32
39
|
EventSkeletonComponentProps?: EventSkeletonProps;
|
|
40
|
+
/**
|
|
41
|
+
* Props spread to grid container
|
|
42
|
+
* @default {}
|
|
43
|
+
*/
|
|
44
|
+
GridContainerComponentProps?: Exclude<keyof GridProps, 'container' | 'component' | 'children' | 'item' | 'classes'>;
|
|
45
|
+
/**
|
|
46
|
+
* Props spread to single grid item
|
|
47
|
+
* @default {}
|
|
48
|
+
*/
|
|
49
|
+
GridItemComponentProps?: Exclude<keyof GridProps, 'container' | 'component' | 'children' | 'item' | 'classes'>;
|
|
33
50
|
/**
|
|
34
51
|
* Show/Hide filters
|
|
35
52
|
* @default true
|
|
@@ -76,7 +76,7 @@ export default function Events(inProps) {
|
|
|
76
76
|
props: inProps,
|
|
77
77
|
name: PREFIX
|
|
78
78
|
});
|
|
79
|
-
const { endpoint = Endpoints.SearchEvents, 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, ["endpoint", "endpointQueryParams", "className", "EventComponentProps", "EventSkeletonComponentProps", "showFilters", "filters", "general"]);
|
|
79
|
+
const { endpoint = Endpoints.SearchEvents, endpointQueryParams = { limit: 8, offset: DEFAULT_PAGINATION_OFFSET }, className, EventComponentProps = { elevation: 0, square: true }, EventsSkeletonComponentProps = {}, EventSkeletonComponentProps = { elevation: 0, square: true }, GridContainerComponentProps = {}, GridItemComponentProps = {}, showFilters = false, filters, general = true } = props, rest = __rest(props, ["endpoint", "endpointQueryParams", "className", "EventComponentProps", "EventsSkeletonComponentProps", "EventSkeletonComponentProps", "GridContainerComponentProps", "GridItemComponentProps", "showFilters", "filters", "general"]);
|
|
80
80
|
// STATE
|
|
81
81
|
const [events, setEvents] = useState([]);
|
|
82
82
|
const [loading, setLoading] = useState(true);
|
|
@@ -194,7 +194,7 @@ export default function Events(inProps) {
|
|
|
194
194
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
195
195
|
// @ts-ignore
|
|
196
196
|
showFollowed: showFollowed, deleteIcon: showFollowed ? _jsx(Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null }) })), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: dateSearch !== SCEventDateFilterType.ANY }) }))] })) }))), _jsx(_Fragment, { children: !events.length ? (_jsx(Box, Object.assign({ className: classes.noResults }, { children: (onlyStaffEnabled && !UserUtils.isStaff(scUserContext.user)) ||
|
|
197
|
-
(onlyStaffEnabled && UserUtils.isStaff(scUserContext.user) && general) ? (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps)), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: _jsx(CreateEventButton, {}) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title.onlyStaff", defaultMessage: "ui.events.noEvents.title.onlyStaff" }) }))] })) }))) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.events }, { children: _jsxs(_Fragment, { children: [filteredEvents.map((event) => (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.item }, { children: _jsx(Event, Object.assign({ event: event, eventId: event.id }, EventComponentProps)) }), event.id))), filteredEvents.length % 2 !== 0 && (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.itemSkeleton }, { 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" }) })))] })) })] }));
|
|
197
|
+
(onlyStaffEnabled && UserUtils.isStaff(scUserContext.user) && general) ? (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps)), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: _jsx(CreateEventButton, {}) })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title.onlyStaff", defaultMessage: "ui.events.noEvents.title.onlyStaff" }) }))] })) }))) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.events }, GridContainerComponentProps, { children: _jsxs(_Fragment, { children: [filteredEvents.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))), filteredEvents.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" }) })))] })) })] }));
|
|
198
198
|
/**
|
|
199
199
|
* Renders root object (if content availability community option is false and user is anonymous, component is hidden)
|
|
200
200
|
*/
|
|
@@ -202,7 +202,7 @@ export default function Events(inProps) {
|
|
|
202
202
|
return null;
|
|
203
203
|
}
|
|
204
204
|
if (loading) {
|
|
205
|
-
return _jsx(Skeleton, { EventSkeletonProps: EventSkeletonComponentProps });
|
|
205
|
+
return _jsx(Skeleton, Object.assign({}, EventsSkeletonComponentProps, { EventSkeletonProps: EventSkeletonComponentProps }));
|
|
206
206
|
}
|
|
207
207
|
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: c })));
|
|
208
208
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GridProps } from '@mui/material';
|
|
1
2
|
export interface EventsSkeletonProps {
|
|
2
3
|
/**
|
|
3
4
|
* Overrides or extends the styles applied to the component.
|
|
@@ -9,6 +10,16 @@ export interface EventsSkeletonProps {
|
|
|
9
10
|
* @default null
|
|
10
11
|
*/
|
|
11
12
|
EventSkeletonProps?: any;
|
|
13
|
+
/**
|
|
14
|
+
* Props spread to grid container
|
|
15
|
+
* @default {}
|
|
16
|
+
*/
|
|
17
|
+
GridContainerComponentProps?: Exclude<keyof GridProps, 'container' | 'component' | 'children' | 'item' | 'classes'>;
|
|
18
|
+
/**
|
|
19
|
+
* Props spread to single grid item
|
|
20
|
+
* @default {}
|
|
21
|
+
*/
|
|
22
|
+
GridItemComponentProps?: Exclude<keyof GridProps, 'container' | 'component' | 'children' | 'item' | 'classes'>;
|
|
12
23
|
/**
|
|
13
24
|
* @default 20
|
|
14
25
|
*/
|
|
@@ -35,6 +35,6 @@ const Root = styled(Box, {
|
|
|
35
35
|
*
|
|
36
36
|
*/
|
|
37
37
|
export default function EventsSkeleton(inProps) {
|
|
38
|
-
const { className, EventSkeletonProps = {}, eventsNumber = 8 } = inProps, rest = __rest(inProps, ["className", "EventSkeletonProps", "eventsNumber"]);
|
|
39
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(Grid, Object.assign({ container: true, spacing: { xs: 3 }, className: classes.events }, { children: [...Array(eventsNumber)].map((event, index) => (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6 }, { children: _jsx(EventSkeleton, Object.assign({}, EventSkeletonProps)) }), index))) })) })));
|
|
38
|
+
const { className, EventSkeletonProps = {}, eventsNumber = 8, GridContainerComponentProps = {}, GridItemComponentProps = {} } = inProps, rest = __rest(inProps, ["className", "EventSkeletonProps", "eventsNumber", "GridContainerComponentProps", "GridItemComponentProps"]);
|
|
39
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsx(Grid, Object.assign({ container: true, spacing: { xs: 3 }, className: classes.events }, GridContainerComponentProps, { children: [...Array(eventsNumber)].map((event, index) => (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6 }, GridItemComponentProps, { children: _jsx(EventSkeleton, Object.assign({}, EventSkeletonProps)) }), index))) })) })));
|
|
40
40
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SCEventType, SCUserType } from '@selfcommunity/types';
|
|
2
|
-
import {
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
3
|
export interface InviteUserEventButtonProps {
|
|
4
4
|
/**
|
|
5
5
|
* Overrides or extends the styles applied to the component.
|
|
@@ -26,10 +26,7 @@ export interface InviteUserEventButtonProps {
|
|
|
26
26
|
* @default null
|
|
27
27
|
*/
|
|
28
28
|
user?: SCUserType;
|
|
29
|
-
|
|
30
|
-
* setInvitedNumber set state action
|
|
31
|
-
*/
|
|
32
|
-
setInvitedNumber?: Dispatch<SetStateAction<number>>;
|
|
29
|
+
handleInvitations?: ((invited: boolean) => void) | null;
|
|
33
30
|
/**
|
|
34
31
|
* Others properties
|
|
35
32
|
*/
|
|
@@ -47,18 +47,19 @@ export default function InviteUserEventButton(inProps) {
|
|
|
47
47
|
props: inProps,
|
|
48
48
|
name: PREFIX
|
|
49
49
|
});
|
|
50
|
-
const { className, eventId, event, userId, user,
|
|
50
|
+
const { className, eventId, event, userId, user, handleInvitations } = props, rest = __rest(props, ["className", "eventId", "event", "userId", "user", "handleInvitations"]);
|
|
51
51
|
// STATE
|
|
52
|
+
const [invited, setInvited] = useState(true);
|
|
53
|
+
//HOOKS
|
|
52
54
|
const { scEvent } = useSCFetchEvent({ id: eventId, event });
|
|
53
55
|
const { scUser } = useSCFetchUser({ id: userId, user });
|
|
54
|
-
const [invited, setInvited] = useState(true);
|
|
55
56
|
const handleInviteAction = useCallback(() => {
|
|
56
57
|
setInvited(null);
|
|
57
58
|
if (invited) {
|
|
58
59
|
EventService.removeInviteEvent(scEvent.id, { users: [scUser.id] })
|
|
59
60
|
.then(() => {
|
|
60
61
|
setInvited(false);
|
|
61
|
-
|
|
62
|
+
handleInvitations === null || handleInvitations === void 0 ? void 0 : handleInvitations(true);
|
|
62
63
|
})
|
|
63
64
|
.catch((_error) => {
|
|
64
65
|
Logger.error(SCOPE_SC_UI, _error);
|
|
@@ -68,7 +69,7 @@ export default function InviteUserEventButton(inProps) {
|
|
|
68
69
|
EventService.inviteOrAcceptEventRequest(scEvent.id, { users: [scUser.id] })
|
|
69
70
|
.then(() => {
|
|
70
71
|
setInvited(true);
|
|
71
|
-
|
|
72
|
+
handleInvitations === null || handleInvitations === void 0 ? void 0 : handleInvitations(false);
|
|
72
73
|
})
|
|
73
74
|
.catch((_error) => {
|
|
74
75
|
Logger.error(SCOPE_SC_UI, _error);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, CardActions } from '@mui/material';
|
|
3
3
|
import Skeleton from '@mui/material/Skeleton';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
@@ -20,5 +20,5 @@ const Root = styled(Widget, {
|
|
|
20
20
|
overridesResolver: (_props, styles) => styles.skeletonRoot
|
|
21
21
|
})(() => ({}));
|
|
22
22
|
export default function MyEventsWidgetSkeleton() {
|
|
23
|
-
return (_jsxs(Root, Object.assign({ className: classes.root }, { children: [_jsx(Box, Object.assign({ padding: "12px 16px" }, { children: _jsx(Skeleton, { animation: "wave", width: "141px", height: "33px" }) })), _jsx(EventSkeleton, { template: SCEventTemplateType.DETAIL, elevation: 0, square: true }), _jsxs(CardActions, Object.assign({ className: classes.actions }, { children: [_jsx(Skeleton, { animation: "wave", variant: "rounded", width: "14px", height: "14px" }), _jsx(Skeleton, { animation: "wave", width: "52px", height: "20px" }), _jsx(Skeleton, { animation: "wave", variant: "rounded", width: "14px", height: "14px" })] }))] })));
|
|
23
|
+
return (_jsxs(Root, Object.assign({ className: classes.root }, { children: [_jsx(Box, Object.assign({ padding: "12px 16px" }, { children: _jsx(Skeleton, { animation: "wave", width: "141px", height: "33px" }) })), _jsx(EventSkeleton, { template: SCEventTemplateType.DETAIL, elevation: 0, square: true, actions: _jsx(_Fragment, {}) }), _jsxs(CardActions, Object.assign({ className: classes.actions }, { children: [_jsx(Skeleton, { animation: "wave", variant: "rounded", width: "14px", height: "14px" }), _jsx(Skeleton, { animation: "wave", width: "52px", height: "20px" }), _jsx(Skeleton, { animation: "wave", variant: "rounded", width: "14px", height: "14px" })] }))] })));
|
|
24
24
|
}
|