@selfcommunity/react-ui 0.11.0-alpha.4 → 0.11.0-alpha.40
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/CategoryAutocomplete/CategoryAutocomplete.d.ts +5 -0
- package/lib/cjs/components/CategoryAutocomplete/CategoryAutocomplete.js +3 -3
- package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
- package/lib/cjs/components/Composer/Layer/CategoryLayer/CategoryLayer.js +4 -1
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.js +10 -2
- package/lib/cjs/components/CreateEventButton/CreateEventButton.d.ts +1 -1
- package/lib/cjs/components/CreateEventButton/CreateEventButton.js +1 -1
- package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +11 -9
- package/lib/cjs/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +21 -12
- package/lib/cjs/components/Editor/Editor.js +9 -9
- package/lib/cjs/components/Editor/nodes/HashtagNode.js +2 -0
- package/lib/cjs/components/Editor/nodes/MentionNode.js +2 -0
- package/lib/cjs/components/Editor/plugins/HorizontalRulePlugin.d.ts +8 -0
- package/lib/cjs/components/Editor/plugins/HorizontalRulePlugin.js +34 -0
- package/lib/cjs/components/Editor/plugins/LexicalRichTextPlugin.d.ts +2 -2
- package/lib/cjs/components/Editor/plugins/LexicalRichTextPlugin.js +2 -3
- package/lib/cjs/components/Editor/plugins/ToolbarPlugin.js +1 -1
- package/lib/cjs/components/Event/Event.js +6 -3
- package/lib/cjs/components/EventForm/EventForm.js +7 -5
- package/lib/cjs/components/EventHeader/EventHeader.js +1 -1
- package/lib/cjs/components/EventMediaWidget/EventMediaWidget.js +2 -2
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +11 -11
- package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +9 -9
- package/lib/cjs/components/EventMembersWidget/types.d.ts +4 -5
- package/lib/cjs/components/EventMembersWidget/types.js +7 -7
- package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +5 -5
- package/lib/cjs/components/Events/Events.d.ts +11 -0
- package/lib/cjs/components/Events/Events.js +21 -10
- package/lib/cjs/components/Events/OngoingEventsFilter.d.ts +8 -0
- package/lib/cjs/components/Events/OngoingEventsFilter.js +24 -0
- package/lib/cjs/components/FeedObject/Activities/Activities.js +1 -1
- package/lib/cjs/components/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
- package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +1 -1
- package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +65 -6
- package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
- package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +106 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +37 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +60 -5
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +1 -1
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +2 -2
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -1
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -4
- package/lib/cjs/components/SearchDialog/SearchDialog.d.ts +4 -1
- package/lib/cjs/components/SearchDialog/SearchDialog.js +2 -2
- package/lib/cjs/constants/LiveStream.d.ts +1 -0
- package/lib/cjs/constants/LiveStream.js +2 -1
- package/lib/cjs/shared/EventActionsMenu/index.js +5 -1
- package/lib/cjs/shared/UpScalingTierBadge/index.js +9 -0
- package/lib/cjs/utils/buttonCounters.d.ts +1 -0
- package/lib/cjs/utils/buttonCounters.js +4 -3
- package/lib/cjs/utils/contribution.js +1 -2
- package/lib/cjs/utils/events.d.ts +1 -0
- package/lib/cjs/utils/events.js +6 -1
- package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.d.ts +5 -0
- package/lib/esm/components/CategoryAutocomplete/CategoryAutocomplete.js +3 -3
- package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.d.ts +1 -1
- package/lib/esm/components/Composer/Layer/CategoryLayer/CategoryLayer.js +4 -1
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +11 -3
- package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +1 -1
- package/lib/esm/components/CreateEventButton/CreateEventButton.js +1 -1
- package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +11 -9
- package/lib/esm/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +23 -14
- package/lib/esm/components/Editor/Editor.js +8 -8
- package/lib/esm/components/Editor/nodes/HashtagNode.js +2 -0
- package/lib/esm/components/Editor/nodes/MentionNode.js +2 -0
- package/lib/esm/components/Editor/plugins/HorizontalRulePlugin.d.ts +8 -0
- package/lib/esm/components/Editor/plugins/HorizontalRulePlugin.js +30 -0
- package/lib/esm/components/Editor/plugins/LexicalRichTextPlugin.d.ts +2 -2
- package/lib/esm/components/Editor/plugins/LexicalRichTextPlugin.js +1 -1
- package/lib/esm/components/Editor/plugins/ToolbarPlugin.js +1 -1
- package/lib/esm/components/Event/Event.js +6 -3
- package/lib/esm/components/EventForm/EventForm.js +8 -6
- package/lib/esm/components/EventHeader/EventHeader.js +1 -1
- package/lib/esm/components/EventMediaWidget/EventMediaWidget.js +2 -2
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +12 -12
- package/lib/esm/components/EventMembersWidget/TabContentComponent.js +10 -10
- package/lib/esm/components/EventMembersWidget/types.d.ts +4 -5
- package/lib/esm/components/EventMembersWidget/types.js +6 -6
- package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +5 -5
- package/lib/esm/components/Events/Events.d.ts +11 -0
- package/lib/esm/components/Events/Events.js +22 -11
- package/lib/esm/components/Events/OngoingEventsFilter.d.ts +8 -0
- package/lib/esm/components/Events/OngoingEventsFilter.js +21 -0
- package/lib/esm/components/FeedObject/Activities/Activities.js +1 -1
- package/lib/esm/components/GroupInvitedWidget/GroupInvitedWidget.js +1 -1
- package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +1 -1
- package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +67 -8
- package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +8 -3
- package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +8 -6
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +3 -1
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.d.ts +2 -1
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/FocusLayout.js +2 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.d.ts +9 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamSettingsMenu.js +103 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.d.ts +4 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/NoParticipants.js +34 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.d.ts +3 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +45 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +64 -9
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +1 -1
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +2 -2
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -1
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +4 -4
- package/lib/esm/components/SearchDialog/SearchDialog.d.ts +4 -1
- package/lib/esm/components/SearchDialog/SearchDialog.js +2 -2
- package/lib/esm/constants/LiveStream.d.ts +1 -0
- package/lib/esm/constants/LiveStream.js +1 -0
- package/lib/esm/shared/EventActionsMenu/index.js +6 -2
- package/lib/esm/shared/UpScalingTierBadge/index.js +9 -0
- package/lib/esm/utils/buttonCounters.d.ts +1 -0
- package/lib/esm/utils/buttonCounters.js +3 -2
- package/lib/esm/utils/contribution.js +1 -2
- package/lib/esm/utils/events.d.ts +1 -0
- package/lib/esm/utils/events.js +4 -0
- package/lib/umd/336.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +11 -10
- package/lib/umd/653.js +0 -2
- /package/lib/umd/{653.js.LICENSE.txt → 336.js.LICENSE.txt} +0 -0
|
@@ -23,10 +23,11 @@ const classes = {
|
|
|
23
23
|
const Root = styled(BaseDialog, {
|
|
24
24
|
name: PREFIX,
|
|
25
25
|
slot: 'Root'
|
|
26
|
-
})((
|
|
26
|
+
})(() => ({
|
|
27
27
|
paddingBottom: '0px !important',
|
|
28
28
|
[`& .${classes.title}`]: {
|
|
29
|
-
display: 'flex'
|
|
29
|
+
display: 'flex',
|
|
30
|
+
alignItems: 'center'
|
|
30
31
|
},
|
|
31
32
|
[`& .${classes.content}`]: {
|
|
32
33
|
paddingBottom: 0
|
|
@@ -56,7 +57,7 @@ const Transition = React.forwardRef(function Transition(props, ref) {
|
|
|
56
57
|
* @param inProps
|
|
57
58
|
*/
|
|
58
59
|
export default function CreateLiveStreamDialog(inProps) {
|
|
59
|
-
var _a
|
|
60
|
+
var _a;
|
|
60
61
|
//PROPS
|
|
61
62
|
const props = useThemeProps({
|
|
62
63
|
props: inProps,
|
|
@@ -65,11 +66,12 @@ export default function CreateLiveStreamDialog(inProps) {
|
|
|
65
66
|
const { className, open = true, onClose, onSuccess } = props, rest = __rest(props, ["className", "open", "onClose", "onSuccess"]);
|
|
66
67
|
// CONTEXT
|
|
67
68
|
const scUserContext = useSCUser();
|
|
68
|
-
|
|
69
|
-
const canCreateEvent = useMemo(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_event; }, [(
|
|
69
|
+
// PERMISSION
|
|
70
|
+
const canCreateEvent = useMemo(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_event; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
|
|
70
71
|
// STATE
|
|
71
72
|
const [step, setStep] = useState(canCreateEvent ? CreateLiveStreamStep.SELECT_TYPE : CreateLiveStreamStep.CREATE_LIVE);
|
|
72
73
|
const [liveType, setLiveType] = useState(canCreateEvent ? null : LiveStreamType.DIRECT_LIVE);
|
|
74
|
+
const canShowBackButton = useMemo(() => step === CreateLiveStreamStep.CREATE_LIVE && canCreateEvent, [step, canCreateEvent]);
|
|
73
75
|
// HANDLER
|
|
74
76
|
const handleLiveTypeSelected = useCallback((l) => {
|
|
75
77
|
setLiveType(l);
|
|
@@ -78,23 +80,23 @@ export default function CreateLiveStreamDialog(inProps) {
|
|
|
78
80
|
setLiveType(l);
|
|
79
81
|
setStep(CreateLiveStreamStep.CREATE_LIVE);
|
|
80
82
|
}, []);
|
|
81
|
-
const handleBack = useCallback((
|
|
83
|
+
const handleBack = useCallback(() => {
|
|
82
84
|
setStep(CreateLiveStreamStep.SELECT_TYPE);
|
|
83
85
|
}, []);
|
|
84
86
|
const handleSubmit = useCallback((e) => {
|
|
85
87
|
onSuccess && onSuccess(e);
|
|
86
|
-
}, []);
|
|
88
|
+
}, [onSuccess]);
|
|
87
89
|
useEffect(() => {
|
|
88
90
|
if (!canCreateEvent) {
|
|
89
91
|
setLiveType(LiveStreamType.DIRECT_LIVE);
|
|
90
92
|
}
|
|
91
93
|
}, [canCreateEvent]);
|
|
92
94
|
// user must be logged
|
|
93
|
-
if (!scUserContext.user
|
|
95
|
+
if (!scUserContext.user) {
|
|
94
96
|
return null;
|
|
95
97
|
}
|
|
96
98
|
/**
|
|
97
99
|
* Renders root object
|
|
98
100
|
*/
|
|
99
|
-
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth:
|
|
101
|
+
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: "md", title: _jsxs(Box, Object.assign({ className: classes.title, component: "span" }, { children: [canShowBackButton && (_jsx(Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: _jsx(Icon, { children: "arrow_back" }) }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.button.back", defaultMessage: "ui.createLivestreamDialog.button.back" }) }))), _jsx(Box, Object.assign({ component: "span" }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: "body", onClose: !canShowBackButton ? onClose : undefined, className: classNames(classes.root, className), TransitionComponent: Transition, PaperProps: { elevation: 0 } }, rest, { children: _jsxs(Box, Object.assign({ className: classes.content }, { children: [step === CreateLiveStreamStep.SELECT_TYPE && (_jsx(LiveStreamSelector, { liveSelected: liveType, onLiveSelected: handleLiveTypeSelected, onNext: handleLiveTypeSelectedNext })), step === CreateLiveStreamStep.CREATE_LIVE && (_jsx(_Fragment, { children: liveType === LiveStreamType.EVENT_LIVE ? (_jsx(EventForm, { EventAddressComponentProps: { locations: [SCEventLocationType.LIVESTREAM] }, onSuccess: handleSubmit })) : (_jsx(LiveStreamForm, { onSuccess: handleSubmit })) }))] })) })));
|
|
100
102
|
}
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { Box, Typography, Button, Paper, Container, Radio, Alert } from '@mui/material';
|
|
5
|
-
import Icon from '@mui/material/Icon';
|
|
6
5
|
import { useThemeProps } from '@mui/system';
|
|
7
6
|
import classNames from 'classnames';
|
|
8
7
|
import { LiveStreamType } from '../types';
|
|
@@ -13,8 +12,8 @@ import LiveImage from '../../../assets/liveStream/live';
|
|
|
13
12
|
import { LiveStreamApiClient } from '@selfcommunity/api-services';
|
|
14
13
|
import { WARNING_THRESHOLD_EXPIRING_SOON } from '../../LiveStreamRoom/constants';
|
|
15
14
|
import { Link, SCPreferences, useSCContext, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
16
|
-
import { SCCommunitySubscriptionTier } from '@selfcommunity/types';
|
|
17
|
-
import {
|
|
15
|
+
import { SCCommunityEnvironment, SCCommunitySubscriptionTier } from '@selfcommunity/types';
|
|
16
|
+
import { HUB_PROD, HUB_STAGE } from '../../PlatformWidget/constants';
|
|
18
17
|
export const PREFIX = 'SCLiveStreamSelector';
|
|
19
18
|
const classes = {
|
|
20
19
|
root: `${PREFIX}-root`,
|
|
@@ -31,7 +30,12 @@ const OptionCard = styled(Paper, {
|
|
|
31
30
|
name: PREFIX,
|
|
32
31
|
slot: 'optionCardRoot',
|
|
33
32
|
shouldForwardProp: (prop) => prop !== 'selected'
|
|
34
|
-
})(({ theme, selected }) => ({
|
|
33
|
+
})(({ theme, selected }) => ({
|
|
34
|
+
'& h6': {
|
|
35
|
+
fontWeight: 'bold',
|
|
36
|
+
textTransform: 'uppercase'
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
35
39
|
const FeatureItem = styled(Box, {
|
|
36
40
|
name: PREFIX,
|
|
37
41
|
slot: 'featureItemRoot'
|
|
@@ -76,6 +80,14 @@ export default function LiveStreamSelector(inProps) {
|
|
|
76
80
|
SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
77
81
|
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
78
82
|
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
|
|
83
|
+
const isEnterpriseTier = useMemo(() => preferences &&
|
|
84
|
+
SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
85
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
86
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.ENTERPRISE, [preferences]);
|
|
87
|
+
const isStage = useMemo(() => preferences &&
|
|
88
|
+
SCPreferences.STATIC_ENVIRONMENT in preferences &&
|
|
89
|
+
preferences[SCPreferences.STATIC_ENVIRONMENT].value === SCCommunityEnvironment.STAGE, [preferences]);
|
|
90
|
+
const communityStackId = useMemo(() => preferences && SCPreferences.STATIC_ENVIRONMENT in preferences && preferences[SCPreferences.STATIC_STACKID].value, [preferences]);
|
|
79
91
|
const intl = useIntl();
|
|
80
92
|
const options = [
|
|
81
93
|
{
|
|
@@ -95,8 +107,7 @@ export default function LiveStreamSelector(inProps) {
|
|
|
95
107
|
id: 'ui.liveStreamForm.selector.scheduleLiveEventItem3',
|
|
96
108
|
defaultMessage: 'ui.liveStreamForm.selector.scheduleLiveEventItem3'
|
|
97
109
|
})
|
|
98
|
-
]
|
|
99
|
-
icons: [_jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" })]
|
|
110
|
+
]
|
|
100
111
|
},
|
|
101
112
|
{
|
|
102
113
|
title: intl.formatMessage({
|
|
@@ -118,8 +129,7 @@ export default function LiveStreamSelector(inProps) {
|
|
|
118
129
|
id: 'ui.liveStreamForm.selector.scheduleLiveStreamItem3',
|
|
119
130
|
defaultMessage: 'ui.liveStreamForm.selector.scheduleLiveStreamItem3'
|
|
120
131
|
})
|
|
121
|
-
]
|
|
122
|
-
icons: [_jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" }), _jsx(Icon, { children: "chevron_right" })]
|
|
132
|
+
]
|
|
123
133
|
}
|
|
124
134
|
];
|
|
125
135
|
const handleOptionSelect = (type) => {
|
|
@@ -151,11 +161,11 @@ export default function LiveStreamSelector(inProps) {
|
|
|
151
161
|
}, []);
|
|
152
162
|
const warning = useMemo(() => {
|
|
153
163
|
let _message;
|
|
154
|
-
if (isFreeTrialTier && isCommunityOwner) {
|
|
164
|
+
if (isFreeTrialTier && isCommunityOwner && !isEnterpriseTier) {
|
|
155
165
|
_message = (_jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.warningSubscriptionRequired", defaultMessage: "ui.liveStreamForm.selector.warningSubscriptionRequired", values: {
|
|
156
166
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
157
167
|
// @ts-ignore
|
|
158
|
-
link: (...chunks) => _jsx(Link, Object.assign({ to:
|
|
168
|
+
link: (...chunks) => (_jsx(Link, Object.assign({ target: "_blank", to: `${isStage ? HUB_STAGE : HUB_PROD}dashboard/community/${communityStackId}/subscription` }, { children: chunks })))
|
|
159
169
|
} }));
|
|
160
170
|
}
|
|
161
171
|
else if (timeRemaining !== null && timeRemaining <= WARNING_THRESHOLD_EXPIRING_SOON) {
|
|
@@ -171,13 +181,12 @@ export default function LiveStreamSelector(inProps) {
|
|
|
171
181
|
}
|
|
172
182
|
return null;
|
|
173
183
|
}, [timeRemaining, isFreeTrialTier]);
|
|
174
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className), maxWidth: "lg", sx: { py: 4 } }, { children: [_jsx(Typography, Object.assign({ variant: "h4", component: "h1", align: "center", gutterBottom: true, sx: { mb: 4, fontWeight: 500 } }, { children:
|
|
184
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className), maxWidth: "lg", sx: { py: 4 } }, { children: [_jsx(Typography, Object.assign({ variant: "h4", component: "h1", align: "center", gutterBottom: true, sx: { mb: 4, fontWeight: 500 } }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.title", defaultMessage: "ui.liveStreamForm.selector.title" }) })), warning, _jsx(Box, Object.assign({ className: classes.options }, { children: options.map((option, index) => (_jsxs(OptionCard, Object.assign({ selected: selectedOption === option.type, onClick: () => handleOptionSelect(option.type), elevation: 0, role: "button", tabIndex: 0, onKeyDown: (e) => {
|
|
175
185
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
176
186
|
handleOptionSelect(index);
|
|
177
187
|
e.preventDefault();
|
|
178
188
|
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return (_jsxs(FeatureItem, Object.assign({ component: "li" }, { children: [_Icon, _jsx(Typography, Object.assign({ variant: "body2", color: "text.secondary", sx: { flex: 1 } }, { children: feature }))] }), featureIndex));
|
|
189
|
+
} }, { children: [_jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: option.title })), _jsx(Radio, { checked: selectedOption === option.type })] }), _jsx("img", { src: option.image, alt: "option-image" }), _jsx(Box, Object.assign({ component: "ul" }, { children: option.features.map((feature, featureIndex) => {
|
|
190
|
+
return (_jsx(FeatureItem, Object.assign({ component: "li" }, { children: _jsx(Typography, Object.assign({ variant: "body2", color: "text.secondary", sx: { flex: 1 } }, { children: feature })) }), featureIndex));
|
|
182
191
|
}) }))] }), index))) })), _jsx(Box, Object.assign({ className: classes.actions }, { children: _jsx(Button, Object.assign({ disabled: !selectedOption || !timeRemaining || isFreeTrialTier, variant: "contained", onClick: handleNext, color: "secondary" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.next", defaultMessage: "ui.liveStreamForm.selector.next" }) })) }))] })));
|
|
183
192
|
}
|
|
@@ -8,19 +8,19 @@ import { useThemeProps } from '@mui/system';
|
|
|
8
8
|
import nodes from './nodes';
|
|
9
9
|
import { LexicalComposer } from '@lexical/react/LexicalComposer';
|
|
10
10
|
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
11
|
-
import
|
|
11
|
+
import ToolbarPlugin from './plugins/ToolbarPlugin';
|
|
12
|
+
import { PREFIX } from './constants';
|
|
13
|
+
import { HorizontalRulePlugin } from './plugins/HorizontalRulePlugin';
|
|
12
14
|
import { RichTextPlugin } from './plugins/LexicalRichTextPlugin';
|
|
13
|
-
import LexicalErrorBoundary from '@lexical/react/LexicalErrorBoundary';
|
|
14
|
-
import { HorizontalRulePlugin } from '@lexical/react/LexicalHorizontalRulePlugin';
|
|
15
|
+
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
|
|
15
16
|
import { AutoLinkPlugin, DefaultHtmlValuePlugin, EmojiPlugin, ImagePlugin, MentionsPlugin, OnChangePlugin } from './plugins';
|
|
17
|
+
import OnBlurPlugin from './plugins/OnBlurPlugin';
|
|
18
|
+
import OnFocusPlugin from './plugins/OnFocusPlugin';
|
|
16
19
|
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
|
|
20
|
+
import FloatingLinkPlugin from './plugins/FloatingLinkPlugin';
|
|
17
21
|
import ApiPlugin from './plugins/ApiPlugin';
|
|
18
|
-
import
|
|
22
|
+
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
|
|
19
23
|
import { ListPlugin } from '@lexical/react/LexicalListPlugin';
|
|
20
|
-
import FloatingLinkPlugin from './plugins/FloatingLinkPlugin';
|
|
21
|
-
import OnBlurPlugin from './plugins/OnBlurPlugin';
|
|
22
|
-
import OnFocusPlugin from './plugins/OnFocusPlugin';
|
|
23
|
-
import { PREFIX } from './constants';
|
|
24
24
|
const classes = {
|
|
25
25
|
root: `${PREFIX}-root`,
|
|
26
26
|
focused: `${PREFIX}-focused`,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
9
|
+
import { $createHorizontalRuleNode, INSERT_HORIZONTAL_RULE_COMMAND } from '@lexical/react/LexicalHorizontalRuleNode';
|
|
10
|
+
import { $insertNodeToNearestRoot } from '@lexical/utils';
|
|
11
|
+
import { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR } from 'lexical';
|
|
12
|
+
import { useEffect } from 'react';
|
|
13
|
+
export function HorizontalRulePlugin() {
|
|
14
|
+
const [editor] = useLexicalComposerContext();
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
return editor.registerCommand(INSERT_HORIZONTAL_RULE_COMMAND, (type) => {
|
|
17
|
+
const selection = $getSelection();
|
|
18
|
+
if (!$isRangeSelection(selection)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const focusNode = selection.focus.getNode();
|
|
22
|
+
if (focusNode !== null) {
|
|
23
|
+
const horizontalRuleNode = $createHorizontalRuleNode();
|
|
24
|
+
$insertNodeToNearestRoot(horizontalRuleNode);
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}, COMMAND_PRIORITY_EDITOR);
|
|
28
|
+
}, [editor]);
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ErrorBoundaryType } from '../shared/useDecorators';
|
|
2
2
|
export declare function RichTextPlugin({ contentEditable, placeholder, ErrorBoundary }: {
|
|
3
3
|
contentEditable: JSX.Element;
|
|
4
|
-
placeholder
|
|
5
|
-
ErrorBoundary
|
|
4
|
+
placeholder?: ((isEditable: boolean) => null | JSX.Element) | null | JSX.Element;
|
|
5
|
+
ErrorBoundary?: ErrorBoundaryType;
|
|
6
6
|
}): JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
3
|
-
import useLexicalEditable from '@lexical/react/useLexicalEditable';
|
|
3
|
+
import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
4
4
|
import { useDecorators } from '../shared/useDecorators';
|
|
5
5
|
import { useEditorFocus } from '../shared/useEditorFocus';
|
|
6
6
|
import { useCanShowPlaceholder } from '../shared/useCanShowPlaceholder';
|
|
@@ -155,7 +155,7 @@ export default function ToolbarPlugin(inProps) {
|
|
|
155
155
|
setFormats(FORMATS.filter((f) => selection.hasFormat(f)));
|
|
156
156
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
157
157
|
// @ts-ignore
|
|
158
|
-
setAlignment(ALIGNMENTS.find((a) => element.getFormatType() === a) || ALIGNMENTS[0]);
|
|
158
|
+
setAlignment(ALIGNMENTS.find((a) => { var _a; return ((_a = element.getFormatType) === null || _a === void 0 ? void 0 : _a.call(element)) === a; }) || ALIGNMENTS[0]);
|
|
159
159
|
// Update links
|
|
160
160
|
const node = getSelectedNode(selection);
|
|
161
161
|
const parent = node.getParent();
|
|
@@ -17,6 +17,7 @@ import User from '../User';
|
|
|
17
17
|
import Widget from '../Widget';
|
|
18
18
|
import { PREFIX } from './constants';
|
|
19
19
|
import EventSkeleton from './Skeleton';
|
|
20
|
+
import { checkEventFinished } from '../../utils/events';
|
|
20
21
|
const classes = {
|
|
21
22
|
root: `${PREFIX}-root`,
|
|
22
23
|
detailRoot: `${PREFIX}-detail-root`,
|
|
@@ -44,7 +45,8 @@ const classes = {
|
|
|
44
45
|
snippetInProgress: `${PREFIX}-snippet-in-progress`,
|
|
45
46
|
snippetPrimary: `${PREFIX}-snippet-primary`,
|
|
46
47
|
snippetSecondary: `${PREFIX}-snippet-secondary`,
|
|
47
|
-
snippetActions: `${PREFIX}-snippet-actions
|
|
48
|
+
snippetActions: `${PREFIX}-snippet-actions`,
|
|
49
|
+
finishedChip: `${PREFIX}-finished-chip`
|
|
48
50
|
};
|
|
49
51
|
const Root = styled(Widget, {
|
|
50
52
|
name: PREFIX,
|
|
@@ -108,6 +110,7 @@ export default function Event(inProps) {
|
|
|
108
110
|
// STATE
|
|
109
111
|
const { scEvent } = useSCFetchEvent({ id: eventId, event, autoSubscribe: false });
|
|
110
112
|
const inProgress = useMemo(() => scEvent && scEvent.active && scEvent.running, [scEvent]);
|
|
113
|
+
const isEventFinished = useMemo(() => checkEventFinished(scEvent), [scEvent]);
|
|
111
114
|
// CONTEXT
|
|
112
115
|
const scRoutingContext = useSCRouting();
|
|
113
116
|
// HOOKS
|
|
@@ -126,10 +129,10 @@ export default function Event(inProps) {
|
|
|
126
129
|
contentObj = (_jsxs(DetailRoot, Object.assign({ className: classes.detailRoot }, { children: [_jsxs(Box, Object.assign({ className: classes.detailImageWrapper }, { children: [_jsx(CardMedia, { component: "img", image: scEvent.image_medium, alt: scEvent.name, className: classes.detailImage }), !hideInProgress && inProgress && (_jsx(Chip, { size: "small", component: "div", label: _jsx(FormattedMessage, { id: "ui.event.inProgress", defaultMessage: "ui.event.inProgress" }), className: classes.detailInProgress })), _jsx(Calendar, { day: new Date(scEvent.start_date).getDate() })] })), _jsxs(CardContent, Object.assign({ className: classes.detailContent }, { children: [scEvent.active ? (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.detailNameWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h3", className: classes.detailName }, { children: scEvent.name })) }))) : (_jsx(Box, Object.assign({ className: classes.detailNameWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h3", className: classes.detailName }, { children: scEvent.name })) }))), _jsx(EventInfoDetails, { event: scEvent }), !hideEventPlanner && (_jsx(User, { user: scEvent.managed_by, elevation: 0, secondary: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.myEventsWidget.planner", defaultMessage: "ui.myEventsWidget.planner" }) })), actions: _jsx(_Fragment, {}), className: classes.detailUser })), !hideEventParticipants && (_jsxs(_Fragment, { children: [_jsx(Divider, { className: classes.detailFirstDivider }), _jsx(EventParticipantsButton, Object.assign({ event: scEvent }, EventParticipantsButtonComponentProps))] })), _jsx(Divider, { className: classes.detailSecondDivider })] })), actions !== null && actions !== void 0 ? actions : (_jsx(CardActions, Object.assign({ className: classes.detailActions }, { children: _jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) })))] })));
|
|
127
130
|
}
|
|
128
131
|
else if (template === SCEventTemplateType.PREVIEW) {
|
|
129
|
-
contentObj = (_jsxs(PreviewRoot, Object.assign({ className: classes.previewRoot }, { children: [_jsxs(Box, Object.assign({ position: "relative", className: classes.previewImageWrapper }, { children: [_jsx(CardMedia, { component: "img", image: scEvent.image_medium, alt: scEvent.name, className: classes.previewImage }), !hideInProgress && inProgress && (_jsx(Chip, { size: "small", component: "div", label: _jsx(FormattedMessage, { id: "ui.event.inProgress", defaultMessage: "ui.event.inProgress" }), className: classes.previewInProgress }))] })), _jsxs(CardContent, Object.assign({ className: classes.previewContent }, { children: [_jsx(EventInfoDetails, { event: scEvent, hidePrivacyIcon: true, hasLocationInfo: false, beforePrivacyInfo: _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.previewNameWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h5", className: classes.previewName }, { children: scEvent.name })) })) }), !hideEventParticipants && _jsx(EventParticipantsButton, Object.assign({ event: scEvent, hideCaption: true }, EventParticipantsButtonComponentProps))] })), actions !== null && actions !== void 0 ? actions : (_jsx(CardActions, Object.assign({ className: classes.previewActions }, { children: _jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) })))] })));
|
|
132
|
+
contentObj = (_jsxs(PreviewRoot, Object.assign({ className: classes.previewRoot }, { children: [_jsxs(Box, Object.assign({ position: "relative", className: classes.previewImageWrapper }, { children: [_jsx(CardMedia, { component: "img", image: scEvent.image_medium, alt: scEvent.name, className: classes.previewImage }), !hideInProgress && inProgress && (_jsx(Chip, { size: "small", component: "div", label: _jsx(FormattedMessage, { id: "ui.event.inProgress", defaultMessage: "ui.event.inProgress" }), className: classes.previewInProgress })), isEventFinished && (_jsx(Chip, { size: "small", component: "div", label: _jsx(FormattedMessage, { id: "ui.event.finished", defaultMessage: "ui.event.finished" }), className: classes.finishedChip }))] })), _jsxs(CardContent, Object.assign({ className: classes.previewContent }, { children: [_jsx(EventInfoDetails, { event: scEvent, hidePrivacyIcon: true, hasLocationInfo: false, beforePrivacyInfo: _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.previewNameWrapper }, { children: _jsx(Typography, Object.assign({ variant: "h5", className: classes.previewName }, { children: scEvent.name })) })) }), !hideEventParticipants && _jsx(EventParticipantsButton, Object.assign({ event: scEvent, hideCaption: true }, EventParticipantsButtonComponentProps))] })), actions !== null && actions !== void 0 ? actions : (_jsx(CardActions, Object.assign({ className: classes.previewActions }, { children: _jsx(Button, Object.assign({ size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent) }, { children: _jsx(FormattedMessage, { defaultMessage: "ui.event.see", id: "ui.event.see" }) })) })))] })));
|
|
130
133
|
}
|
|
131
134
|
else {
|
|
132
|
-
contentObj = (_jsx(SnippetRoot, { elevation: 0, square: true, disableTypography: true, className: classes.snippetRoot, image: _jsxs(Box, Object.assign({ className: classes.snippetImage }, { children: [_jsx(Avatar, { variant: "square", alt: scEvent.name, src: scEvent.image_medium, className: classes.snippetAvatar }), ' ', !hideInProgress && inProgress && (_jsx(Chip, { size: "small", component: "div", label: _jsx(FormattedMessage, { id: "ui.event.inProgress", defaultMessage: "ui.event.inProgress" }), className: classes.snippetInProgress }))] })), primary: _jsxs(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.snippetPrimary }, { children: [_jsx(Typography, Object.assign({ component: "span" }, { children: `${intl.formatDate(scEvent.start_date, {
|
|
135
|
+
contentObj = (_jsx(SnippetRoot, { elevation: 0, square: true, disableTypography: true, className: classes.snippetRoot, image: _jsxs(Box, Object.assign({ className: classes.snippetImage }, { children: [_jsx(Avatar, { variant: "square", alt: scEvent.name, src: scEvent.image_medium, className: classes.snippetAvatar }), ' ', !hideInProgress && inProgress && (_jsx(Chip, { size: "small", component: "div", label: _jsx(FormattedMessage, { id: "ui.event.inProgress", defaultMessage: "ui.event.inProgress" }), className: classes.snippetInProgress })), isEventFinished && (_jsx(Chip, { size: "small", component: "div", label: _jsx(FormattedMessage, { id: "ui.event.finished", defaultMessage: "ui.event.finished" }), className: classes.finishedChip }))] })), primary: _jsxs(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.EVENT_ROUTE_NAME, scEvent), className: classes.snippetPrimary }, { children: [_jsx(Typography, Object.assign({ component: "span" }, { children: `${intl.formatDate(scEvent.start_date, {
|
|
133
136
|
weekday: 'long',
|
|
134
137
|
month: 'long',
|
|
135
138
|
day: 'numeric'
|
|
@@ -7,7 +7,7 @@ import { useThemeProps } from '@mui/system';
|
|
|
7
7
|
import { LocalizationProvider, MobileDatePicker, MobileTimePicker } from '@mui/x-date-pickers';
|
|
8
8
|
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
9
9
|
import { EventService, formatHttpErrorCode } from '@selfcommunity/api-services';
|
|
10
|
-
import { SCPreferences, useSCContext, useSCPreferences } from '@selfcommunity/react-core';
|
|
10
|
+
import { SCPreferences, useSCContext, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
11
11
|
import { SCEventLocationType, SCEventPrivacyType, SCEventRecurrenceType, SCFeatureName } from '@selfcommunity/types';
|
|
12
12
|
import { Logger } from '@selfcommunity/utils';
|
|
13
13
|
import classNames from 'classnames';
|
|
@@ -119,7 +119,7 @@ const Root = styled(Box, {
|
|
|
119
119
|
* @param inProps
|
|
120
120
|
*/
|
|
121
121
|
export default function EventForm(inProps) {
|
|
122
|
-
var _a, _b, _c, _d, _e;
|
|
122
|
+
var _a, _b, _c, _d, _e, _f;
|
|
123
123
|
//PROPS
|
|
124
124
|
const props = useThemeProps({
|
|
125
125
|
props: inProps,
|
|
@@ -128,6 +128,7 @@ export default function EventForm(inProps) {
|
|
|
128
128
|
const { className, onSuccess, onError, event, presetLocation, EventAddressComponentProps = {} } = props, rest = __rest(props, ["className", "onSuccess", "onError", "event", "presetLocation", "EventAddressComponentProps"]);
|
|
129
129
|
// CONTEXT
|
|
130
130
|
const scContext = useSCContext();
|
|
131
|
+
const scUserContext = useSCUser();
|
|
131
132
|
// INTL
|
|
132
133
|
const intl = useIntl();
|
|
133
134
|
const startDateTime = useMemo(() => getNewDate(event === null || event === void 0 ? void 0 : event.start_date), [event]);
|
|
@@ -170,6 +171,7 @@ export default function EventForm(inProps) {
|
|
|
170
171
|
scPreferences.features.includes(SCFeatureName.LIVE_STREAM) &&
|
|
171
172
|
SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED in scPreferences.preferences &&
|
|
172
173
|
scPreferences.preferences[SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
|
|
174
|
+
const canCreateLiveStream = useMemo(() => { var _a, _b; return (_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_live_stream; }, [(_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.permission]);
|
|
173
175
|
const privateEnabled = useMemo(() => scPreferences.preferences[SCPreferences.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED].value, [scPreferences.preferences]);
|
|
174
176
|
const visibilityEnabled = useMemo(() => scPreferences.preferences[SCPreferences.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED].value, [scPreferences.preferences]);
|
|
175
177
|
const disablePastStartTime = useMemo(() => field.startDate.getDate() === getNewDate().getDate(), [field]);
|
|
@@ -382,7 +384,7 @@ export default function EventForm(inProps) {
|
|
|
382
384
|
start_date: field.startDate,
|
|
383
385
|
location: field.location,
|
|
384
386
|
geolocation: field.geolocation,
|
|
385
|
-
live_stream: Object.assign(Object.assign({ title: field.name || `${intl.formatMessage(messages.name)}` }, (event && ((
|
|
387
|
+
live_stream: Object.assign(Object.assign({ title: field.name || `${intl.formatMessage(messages.name)}` }, (event && ((_c = event.live_stream) === null || _c === void 0 ? void 0 : _c.created_at) && { created_at: field.startDate })), { settings: field.liveStreamSettings })
|
|
386
388
|
}) }, EventAddressComponentProps)), privateEnabled && (_jsxs(Box, Object.assign({ className: classes.privacySection }, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [_jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), _jsx(Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: event && !field.isPublic }), _jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), _jsx(Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? (_jsx(FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
|
|
387
389
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
388
390
|
// @ts-ignores
|
|
@@ -392,8 +394,8 @@ export default function EventForm(inProps) {
|
|
|
392
394
|
// @ts-ignore
|
|
393
395
|
b: (chunks) => _jsx("strong", { children: chunks })
|
|
394
396
|
} })) }))] }))), _jsx(TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
395
|
-
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((
|
|
396
|
-
}, error: Boolean(((
|
|
397
|
+
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) ? EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : EVENT_DESCRIPTION_MAX_LENGTH })))
|
|
398
|
+
}, error: Boolean(((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) > EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_f = field.description) === null || _f === void 0 ? void 0 : _f.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 ||
|
|
397
399
|
!field.startDate ||
|
|
398
400
|
!field.startTime ||
|
|
399
401
|
!field.endDate ||
|
|
@@ -405,5 +407,5 @@ export default function EventForm(inProps) {
|
|
|
405
407
|
field.isSubmitting ||
|
|
406
408
|
field.name.length > EVENT_TITLE_MAX_LENGTH ||
|
|
407
409
|
field.description.length > EVENT_DESCRIPTION_MAX_LENGTH ||
|
|
408
|
-
(field.location === SCEventLocationType.LIVESTREAM && !liveStreamEnabled), 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" })) })) }))] }))] })));
|
|
410
|
+
(field.location === SCEventLocationType.LIVESTREAM && (!liveStreamEnabled || !canCreateLiveStream)), 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" })) })) }))] }))] })));
|
|
409
411
|
}
|
|
@@ -89,7 +89,7 @@ export default function EventHeader(inProps) {
|
|
|
89
89
|
// INTL
|
|
90
90
|
const intl = useIntl();
|
|
91
91
|
// CONST
|
|
92
|
-
const isEventAdmin = useMemo(() => scUserContext.user && scEvent && (scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by.id) === scUserContext.user.id, [scUserContext.user, scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by]);
|
|
92
|
+
const isEventAdmin = useMemo(() => { var _a; return scUserContext.user && scEvent && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by]);
|
|
93
93
|
const isEventFinished = useMemo(() => checkEventFinished(scEvent), [scEvent]);
|
|
94
94
|
/**
|
|
95
95
|
* Handles callback subscribe/unsubscribe event
|
|
@@ -245,9 +245,9 @@ export default function EventMediaWidget(inProps) {
|
|
|
245
245
|
}
|
|
246
246
|
return (_jsxs(Root, Object.assign({ className: classes.root }, rest, { showPadding: hasAllow }, { children: [_jsx(CardHeader, { title: _jsxs(Stack, Object.assign({ direction: "row", justifyContent: "space-between", alignItems: "center" }, { children: [_jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.eventMediaWidget.title", defaultMessage: "ui.eventMediaWidget.title" }) })), hasAllow && mediasCount > 0 && _jsx(TriggerButton, { size: "small", onAdd: handleAddMedia })] })), className: classes.header }), _jsx(Divider, {}), _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsxs(Box, Object.assign({ className: classes.grid }, { children: [showSkeleton === 'widget' && _jsx(EventMediaSkeleton, {}), medias.slice(0, MEDIAS_TO_SHOW).map((media, i, array) => (_jsx(Box, Object.assign({ onClick: () => handleOpenLightbox(i), sx: {
|
|
247
247
|
background: `url(${media.image}) no-repeat center`
|
|
248
|
-
}, className: classes.media }, { children: medias.length > array.length && i === array.length - 1 && (_jsxs(Fragment, { children: [_jsx(Box, { className: classes.mediaLayer }), _jsx(Box, Object.assign({ className: classes.countHiddenMediaWrapper }, { children: _jsxs(Typography, Object.assign({ className: classes.countHiddenMedia }, { children: ["+", countHiddenMedia] })) }))] })) }), media.id))), hasAllow && mediasCount === 0 && (_jsx(Tooltip, Object.assign({ title: _jsx(FormattedMessage, { id: "ui.eventMediaWidget.add", defaultMessage: "ui.eventMediaWidget.add" }) }, { children: _jsx(TriggerButton, { size: "large", onAdd: handleAddMedia, isSquare: true }) })))] })), preview !== -1 && _jsx(Lightbox, { onClose: handleCloseLightbox, index: preview, medias: medias, onIndexChange: _fetchNext })] })), hasAllow && mediasCount > 0 && (_jsx(CardActions, Object.assign({ className: classes.actions }, { children: _jsx(Button, Object.assign({ onClick: handleToggleDialogOpen }, { children: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.eventMediaWidget.showAll", defaultMessage: "ui.eventMediaWidget.showAll" }) })) })) }))), _jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: intl.formatMessage(messages.title, { user: scEvent.managed_by.username }), onClose: handleToggleDialogOpen, open:
|
|
248
|
+
}, className: classes.media }, { children: medias.length > array.length && i === array.length - 1 && (_jsxs(Fragment, { children: [_jsx(Box, { className: classes.mediaLayer }), _jsx(Box, Object.assign({ className: classes.countHiddenMediaWrapper }, { children: _jsxs(Typography, Object.assign({ className: classes.countHiddenMedia }, { children: ["+", countHiddenMedia] })) }))] })) }), media.id))), hasAllow && mediasCount === 0 && (_jsx(Tooltip, Object.assign({ title: _jsx(FormattedMessage, { id: "ui.eventMediaWidget.add", defaultMessage: "ui.eventMediaWidget.add" }) }, { children: _jsx(TriggerButton, { size: "large", onAdd: handleAddMedia, isSquare: true }) })))] })), preview !== -1 && _jsx(Lightbox, { onClose: handleCloseLightbox, index: preview, medias: medias, onIndexChange: _fetchNext })] })), hasAllow && mediasCount > 0 && (_jsx(CardActions, Object.assign({ className: classes.actions }, { children: _jsx(Button, Object.assign({ onClick: handleToggleDialogOpen }, { children: _jsx(Typography, Object.assign({ variant: "caption" }, { children: _jsx(FormattedMessage, { id: "ui.eventMediaWidget.showAll", defaultMessage: "ui.eventMediaWidget.showAll" }) })) })) }))), openDialog && (_jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: intl.formatMessage(messages.title, { user: scEvent.managed_by.username }), onClose: handleToggleDialogOpen, open: true }, dialogProps, { children: _jsx(InfiniteScroll, Object.assign({ dataLength: medias.length, height: isMobile ? '100%' : '515px', next: handleNext, hasMoreNext: Boolean(state.next), className: classes.dialogInfiniteScroll, endMessage: _jsx(Typography, Object.assign({ className: classes.endMessage }, { children: _jsx(FormattedMessage, { id: "ui.eventMediaWidget.noMoreResults", defaultMessage: "ui.eventMediaWidget.noMoreResults" }) })) }, { children: _jsxs(Box, Object.assign({ className: classes.grid }, { children: [medias.map((media) => (_jsx(Box, Object.assign({ sx: {
|
|
249
249
|
background: `url(${media.image}) no-repeat center`
|
|
250
250
|
}, className: classes.dialogMediaWrapper }, { children: _jsx(Stack, Object.assign({ className: classes.dialogButtonWrapper }, { children: _jsx(LoadingButton, Object.assign({ className: classes.dialogLoadingButton, loading: mediaId === media.id, size: "large", onClick: () => handleRemoveMedia(media.id), sx: {
|
|
251
251
|
color: (theme) => (mediaId === media.id ? 'transparent' : theme.palette.common.white)
|
|
252
|
-
} }, { children: _jsx(Icon, Object.assign({ fontSize: "inherit" }, { children: "delete" })) })) })) }), media.id))), showSkeleton === 'dialog' && Array.from(Array(countHiddenMedia)).map((_, i) => _jsx(EventMediaSkeleton, {}, i))] })) })) })), _jsx(ConfirmDialog, { open:
|
|
252
|
+
} }, { children: _jsx(Icon, Object.assign({ fontSize: "inherit" }, { children: "delete" })) })) })) }), media.id))), showSkeleton === 'dialog' && Array.from(Array(countHiddenMedia)).map((_, i) => _jsx(EventMediaSkeleton, {}, i))] })) })) }))), openDialogConfirm && (_jsx(ConfirmDialog, { open: true, title: _jsx(FormattedMessage, { id: "ui.eventMediaWidget.dialog.title", defaultMessage: "ui.eventMediaWidget.dialog.title" }), content: _jsx(FormattedMessage, { id: "ui.eventMediaWidget.dialog.msg", defaultMessage: "ui.eventMediaWidget.dialog.msg" }), btnConfirm: _jsx(FormattedMessage, { id: "ui.eventMediaWidget.dialog.confirm", defaultMessage: "ui.eventMediaWidget.dialog.confirm" }), isUpdating: loading, onConfirm: handleConfirmAction, onClose: handleCloseAction }))] })));
|
|
253
253
|
}
|
|
@@ -16,7 +16,7 @@ import Widget from '../Widget';
|
|
|
16
16
|
import { PREFIX } from './constants';
|
|
17
17
|
import Skeleton from './Skeleton';
|
|
18
18
|
import TabContentComponent from './TabContentComponent';
|
|
19
|
-
import {
|
|
19
|
+
import { TabContentType } from './types';
|
|
20
20
|
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
21
21
|
const classes = {
|
|
22
22
|
root: `${PREFIX}-root`,
|
|
@@ -64,7 +64,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
64
64
|
const [invitedCount, setInvitedCount] = useState(invited.count);
|
|
65
65
|
const [requestsCount, setRequestsCount] = useState(requests.count);
|
|
66
66
|
const [requestsUsers, setRequestsUsers] = useState(requests.results);
|
|
67
|
-
const [tabValue, setTabValue] = useState(
|
|
67
|
+
const [tabValue, setTabValue] = useState(TabContentType.PARTICIPANTS);
|
|
68
68
|
const [refresh, setRefresh] = useState(null);
|
|
69
69
|
// CONTEXT
|
|
70
70
|
const scUserContext = useSCUser();
|
|
@@ -74,11 +74,11 @@ export default function EventMembersWidget(inProps) {
|
|
|
74
74
|
const hasAllow = useMemo(() => { var _a; return ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id) === (scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by.id); }, [scUserContext, scEvent]);
|
|
75
75
|
const title = useMemo(() => {
|
|
76
76
|
switch (tabValue) {
|
|
77
|
-
case
|
|
77
|
+
case TabContentType.REQUESTS:
|
|
78
78
|
return 'ui.eventMembersWidget.requests';
|
|
79
|
-
case
|
|
79
|
+
case TabContentType.INVITED:
|
|
80
80
|
return 'ui.eventMembersWidget.invited';
|
|
81
|
-
case
|
|
81
|
+
case TabContentType.PARTICIPANTS:
|
|
82
82
|
default:
|
|
83
83
|
return 'ui.eventMembersWidget.participants';
|
|
84
84
|
}
|
|
@@ -132,11 +132,11 @@ export default function EventMembersWidget(inProps) {
|
|
|
132
132
|
let _t;
|
|
133
133
|
if (scUserContext.user && scEvent) {
|
|
134
134
|
_t = setTimeout(() => {
|
|
135
|
-
if (refresh ===
|
|
135
|
+
if (refresh === TabContentType.PARTICIPANTS) {
|
|
136
136
|
_initParticipants();
|
|
137
137
|
setRefresh(null);
|
|
138
138
|
}
|
|
139
|
-
else if (refresh ===
|
|
139
|
+
else if (refresh === TabContentType.INVITED) {
|
|
140
140
|
_initInvited();
|
|
141
141
|
setRefresh(null);
|
|
142
142
|
}
|
|
@@ -163,10 +163,10 @@ export default function EventMembersWidget(inProps) {
|
|
|
163
163
|
setTabValue(newTabValue);
|
|
164
164
|
}, [setTabValue]);
|
|
165
165
|
const handleRefresh = useCallback((_tabValue) => {
|
|
166
|
-
if (_tabValue ===
|
|
166
|
+
if (_tabValue === TabContentType.PARTICIPANTS) {
|
|
167
167
|
dispatchParticipants({ type: actionWidgetTypes.RESET });
|
|
168
168
|
}
|
|
169
|
-
else if (_tabValue ===
|
|
169
|
+
else if (_tabValue === TabContentType.INVITED) {
|
|
170
170
|
dispatchInvited({ type: actionWidgetTypes.RESET });
|
|
171
171
|
}
|
|
172
172
|
setRefresh(_tabValue);
|
|
@@ -177,13 +177,13 @@ export default function EventMembersWidget(inProps) {
|
|
|
177
177
|
if (!scEvent ||
|
|
178
178
|
!participants.initialized ||
|
|
179
179
|
(scEvent && ((eventId !== undefined && scEvent.id !== eventId) || (event && scEvent.id !== event.id))) ||
|
|
180
|
-
(tabValue ===
|
|
180
|
+
(tabValue === TabContentType.PARTICIPANTS && participants.isLoadingNext && !participants.initialized)) {
|
|
181
181
|
return _jsx(Skeleton, {});
|
|
182
182
|
}
|
|
183
|
-
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: participantsCount })), _jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.participants", defaultMessage: "ui.eventMembersWidget.participants" }) }))] })), value:
|
|
183
|
+
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: participantsCount })), _jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.participants", defaultMessage: "ui.eventMembersWidget.participants" }) }))] })), value: TabContentType.PARTICIPANTS }), 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: TabContentType.INVITED })), 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: TabContentType.REQUESTS }))] })), _jsx(TabPanel, Object.assign({ value: TabContentType.PARTICIPANTS, className: classes.tabPanel }, { children: _jsx(TabContentComponent, { tabValue: TabContentType.PARTICIPANTS, state: participants, dispatch: dispatchParticipants, userProps: userProps, dialogProps: dialogProps, handleRefresh: handleRefresh }) })), hasAllow && (_jsx(TabPanel, Object.assign({ value: TabContentType.INVITED, className: classes.tabPanel }, { children: _jsx(TabContentComponent, { tabValue: TabContentType.INVITED, state: invited, dispatch: dispatchInvited, userProps: userProps, dialogProps: dialogProps, actionProps: {
|
|
184
184
|
scEvent,
|
|
185
185
|
setCount: setInvitedCount
|
|
186
|
-
}, handleRefresh: handleRefresh }) }))), hasAllow && (_jsx(TabPanel, Object.assign({ value:
|
|
186
|
+
}, handleRefresh: handleRefresh }) }))), hasAllow && (_jsx(TabPanel, Object.assign({ value: TabContentType.REQUESTS, className: classes.tabPanel }, { children: _jsx(TabContentComponent, { tabValue: TabContentType.REQUESTS, state: requests, dispatch: dispatchRequests, userProps: userProps, dialogProps: dialogProps, actionProps: {
|
|
187
187
|
scEvent,
|
|
188
188
|
count: requestsCount,
|
|
189
189
|
setCount: setRequestsCount,
|
|
@@ -16,7 +16,7 @@ import EventInviteButton from '../EventInviteButton';
|
|
|
16
16
|
import InviteUserEventButton from '../InviteUserEventButton';
|
|
17
17
|
import User, { UserSkeleton } from '../User';
|
|
18
18
|
import { PREFIX } from './constants';
|
|
19
|
-
import {
|
|
19
|
+
import { TabContentType } from './types';
|
|
20
20
|
const classes = {
|
|
21
21
|
actionButton: `${PREFIX}-action-button`,
|
|
22
22
|
eventButton: `${PREFIX}-event-button`,
|
|
@@ -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 ===
|
|
43
|
+
const users = useMemo(() => (tabValue === TabContentType.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);
|
|
@@ -77,13 +77,13 @@ export default function TabContentComponent(props) {
|
|
|
77
77
|
setOpenDialog((prev) => !prev);
|
|
78
78
|
}, [setOpenDialog]);
|
|
79
79
|
const handleToggleMember = useCallback(() => {
|
|
80
|
-
handleRefresh === null || handleRefresh === void 0 ? void 0 : handleRefresh(
|
|
80
|
+
handleRefresh === null || handleRefresh === void 0 ? void 0 : handleRefresh(TabContentType.PARTICIPANTS);
|
|
81
81
|
}, [handleRefresh]);
|
|
82
82
|
const handleInviteMember = useCallback(() => {
|
|
83
|
-
handleRefresh === null || handleRefresh === void 0 ? void 0 : handleRefresh(
|
|
83
|
+
handleRefresh === null || handleRefresh === void 0 ? void 0 : handleRefresh(TabContentType.INVITED);
|
|
84
84
|
}, [handleRefresh]);
|
|
85
85
|
const getActionsComponent = useCallback((userId) => {
|
|
86
|
-
if (tabValue ===
|
|
86
|
+
if (tabValue === TabContentType.INVITED && actionProps) {
|
|
87
87
|
const _handleInvitations = (invited) => {
|
|
88
88
|
var _a, _b;
|
|
89
89
|
if (invited) {
|
|
@@ -95,7 +95,7 @@ export default function TabContentComponent(props) {
|
|
|
95
95
|
};
|
|
96
96
|
return _jsx(InviteUserEventButton, { event: actionProps.scEvent, userId: userId, handleInvitations: _handleInvitations });
|
|
97
97
|
}
|
|
98
|
-
else if (tabValue ===
|
|
98
|
+
else if (tabValue === TabContentType.REQUESTS && actionProps) {
|
|
99
99
|
const handleConfirm = (id) => {
|
|
100
100
|
if (id) {
|
|
101
101
|
actionProps.setCount((prev) => prev - 1);
|
|
@@ -116,10 +116,10 @@ export default function TabContentComponent(props) {
|
|
|
116
116
|
}
|
|
117
117
|
return undefined;
|
|
118
118
|
}, [tabValue, actionProps]);
|
|
119
|
-
if (tabValue ===
|
|
119
|
+
if (tabValue === TabContentType.PARTICIPANTS && (actionProps === null || actionProps === void 0 ? void 0 : actionProps.count) === 0) {
|
|
120
120
|
return (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.noParticipants", defaultMessage: "ui.eventMembersWidget.noParticipants" }) })));
|
|
121
121
|
}
|
|
122
|
-
else if (tabValue ===
|
|
122
|
+
else if (tabValue === TabContentType.INVITED && state.count === 0 && actionProps) {
|
|
123
123
|
const date = actionProps.scEvent.end_date || actionProps.scEvent.start_date;
|
|
124
124
|
const disabled = new Date(date).getTime() < new Date().getTime();
|
|
125
125
|
const handleInvitations = (invited) => {
|
|
@@ -129,8 +129,8 @@ export default function TabContentComponent(props) {
|
|
|
129
129
|
};
|
|
130
130
|
return (_jsx(EventInviteButton, { event: actionProps.scEvent, className: classes.eventButton, handleInvitations: handleInvitations, disabled: disabled }));
|
|
131
131
|
}
|
|
132
|
-
else if (tabValue ===
|
|
132
|
+
else if (tabValue === TabContentType.REQUESTS && (actionProps === null || actionProps === void 0 ? void 0 : actionProps.count) === 0) {
|
|
133
133
|
return (_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.noOtherRequests", defaultMessage: "ui.eventMembersWidget.noOtherRequests" }) })));
|
|
134
134
|
}
|
|
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" }) })) }))), _jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: _jsx(FormattedMessage, { defaultMessage: "ui.eventMembersWidget.title", id: "ui.eventMembersWidget.title" }), onClose: handleToggleDialogOpen, open:
|
|
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: true }, 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))) }) })) })))] }));
|
|
136
136
|
}
|