@selfcommunity/react-ui 0.11.0-alpha.5 → 0.11.0-alpha.51
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 +9 -1
- package/lib/cjs/components/CreateEventButton/CreateEventButton.d.ts +1 -1
- package/lib/cjs/components/CreateEventButton/CreateEventButton.js +1 -1
- package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -6
- package/lib/cjs/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -9
- package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +10 -4
- package/lib/cjs/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +17 -11
- package/lib/cjs/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +10 -2
- 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/Event/Event.js +6 -3
- package/lib/cjs/components/EventForm/EventAddress.js +1 -1
- package/lib/cjs/components/EventForm/EventForm.js +17 -8
- package/lib/cjs/components/EventFormDialog/EventFormDialog.d.ts +1 -1
- package/lib/cjs/components/EventFormDialog/EventFormDialog.js +3 -3
- package/lib/cjs/components/EventHeader/EventHeader.js +1 -1
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +11 -11
- package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +8 -8
- 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 +1 -1
- 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/GroupForm/GroupForm.js +2 -2
- 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 +62 -5
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +3 -1
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +13 -6
- 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/Notification/Event/Event.js +20 -2
- 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 +10 -2
- package/lib/esm/components/CreateEventButton/CreateEventButton.d.ts +1 -1
- package/lib/esm/components/CreateEventButton/CreateEventButton.js +1 -1
- package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.d.ts +0 -6
- package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -9
- package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.d.ts +10 -4
- package/lib/esm/components/CreateLiveStreamDialog/CreateLiveStreamDialog.js +17 -11
- package/lib/esm/components/CreateLiveStreamDialog/LiveStreamSelector/LiveStreamSelector.js +12 -4
- 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/Event/Event.js +6 -3
- package/lib/esm/components/EventForm/EventAddress.js +1 -1
- package/lib/esm/components/EventForm/EventForm.js +18 -9
- package/lib/esm/components/EventFormDialog/EventFormDialog.d.ts +1 -1
- package/lib/esm/components/EventFormDialog/EventFormDialog.js +3 -3
- package/lib/esm/components/EventHeader/EventHeader.js +1 -1
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +12 -12
- package/lib/esm/components/EventMembersWidget/TabContentComponent.js +9 -9
- 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 +1 -1
- 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/GroupForm/GroupForm.js +2 -2
- 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 +66 -9
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +3 -1
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +13 -6
- 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/Notification/Event/Event.js +22 -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/239.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +14 -13
- package/lib/umd/653.js +0 -2
- /package/lib/umd/{653.js.LICENSE.txt → 239.js.LICENSE.txt} +0 -0
|
@@ -40,14 +40,14 @@ export default function EventFormDialog(inProps) {
|
|
|
40
40
|
props: inProps,
|
|
41
41
|
name: PREFIX
|
|
42
42
|
});
|
|
43
|
-
const { className, open = true, onClose, EventFormComponentProps } = props, rest = __rest(props, ["className", "open", "onClose", "EventFormComponentProps"]);
|
|
43
|
+
const { className, open = true, onClose, EventFormComponentProps = {} } = props, rest = __rest(props, ["className", "open", "onClose", "EventFormComponentProps"]);
|
|
44
44
|
const handleSuccess = useCallback((event) => {
|
|
45
45
|
var _a;
|
|
46
|
-
(_a = EventFormComponentProps
|
|
46
|
+
(_a = EventFormComponentProps.onSuccess) === null || _a === void 0 ? void 0 : _a.call(EventFormComponentProps, event);
|
|
47
47
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
48
48
|
}, [onClose, EventFormComponentProps]);
|
|
49
49
|
/**
|
|
50
50
|
* Renders root object
|
|
51
51
|
*/
|
|
52
|
-
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, title: (EventFormComponentProps === null || EventFormComponentProps === void 0 ? void 0 : EventFormComponentProps.event) ? (_jsx(FormattedMessage, { id: "ui.eventForm.title.edit", defaultMessage: "ui.eventForm.title.edit" })) : (_jsx(FormattedMessage, { id: "ui.eventForm.title", defaultMessage: "ui.eventForm.title" })), open: open, onClose: onClose, className: classNames(classes.root, className) }, rest, { children: _jsx(EventForm, Object.assign({},
|
|
52
|
+
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, title: (EventFormComponentProps === null || EventFormComponentProps === void 0 ? void 0 : EventFormComponentProps.event) ? (_jsx(FormattedMessage, { id: "ui.eventForm.title.edit", defaultMessage: "ui.eventForm.title.edit" })) : (_jsx(FormattedMessage, { id: "ui.eventForm.title", defaultMessage: "ui.eventForm.title" })), open: open, onClose: onClose, className: classNames(classes.root, className) }, rest, { children: _jsx(EventForm, Object.assign({}, EventFormComponentProps, { onSuccess: handleSuccess })) })));
|
|
53
53
|
}
|
|
@@ -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
|
|
@@ -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,7 +129,7 @@ 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
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))) }) })) })))] }));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
REQUESTS = "3"
|
|
1
|
+
export declare enum TabContentType {
|
|
2
|
+
PARTICIPANTS = "participants",
|
|
3
|
+
INVITED = "invited",
|
|
4
|
+
REQUESTS = "requests"
|
|
6
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export var
|
|
2
|
-
(function (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
})(
|
|
1
|
+
export var TabContentType;
|
|
2
|
+
(function (TabContentType) {
|
|
3
|
+
TabContentType["PARTICIPANTS"] = "participants";
|
|
4
|
+
TabContentType["INVITED"] = "invited";
|
|
5
|
+
TabContentType["REQUESTS"] = "requests";
|
|
6
|
+
})(TabContentType || (TabContentType = {}));
|
|
@@ -80,7 +80,7 @@ export default function EventParticipantsButton(inProps) {
|
|
|
80
80
|
}, [scEvent]);
|
|
81
81
|
// FETCH FIRST FOLLOWERS
|
|
82
82
|
useDeepCompareEffectNoCheck(() => {
|
|
83
|
-
if (!scEvent) {
|
|
83
|
+
if (!scEvent || !participantsAvailable) {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
if (!followers.length && participantsAvailable) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GridProps } from '@mui/material';
|
|
2
2
|
import { EndpointType } from '@selfcommunity/api-services';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { CreateEventButtonProps } from '../CreateEventButton';
|
|
4
5
|
import { EventProps, EventSkeletonProps } from '../Event';
|
|
5
6
|
import { EventsSkeletonProps } from '../Events/Skeleton';
|
|
6
7
|
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>> & {
|
|
@@ -47,11 +48,21 @@ export interface EventsProps {
|
|
|
47
48
|
* @default {}
|
|
48
49
|
*/
|
|
49
50
|
GridItemComponentProps?: Pick<GridProps, Exclude<keyof GridProps, 'container' | 'component' | 'children' | 'item' | 'classes'>>;
|
|
51
|
+
/**
|
|
52
|
+
* Props to spread to CreateEvent component
|
|
53
|
+
* @default empty object
|
|
54
|
+
*/
|
|
55
|
+
CreateEventButtonProps?: CreateEventButtonProps;
|
|
50
56
|
/**
|
|
51
57
|
* Show/Hide filters
|
|
52
58
|
* @default true
|
|
53
59
|
*/
|
|
54
60
|
showFilters?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Hides my events title
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
hideTitle?: boolean;
|
|
55
66
|
/**
|
|
56
67
|
* Filters component
|
|
57
68
|
* @param props
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Box, Button, Chip, FormControl, Grid, Icon, IconButton, InputAdornment, InputLabel, MenuItem, Radio, Select, styled, TextField, Typography, useMediaQuery, useTheme, useThemeProps } from '@mui/material';
|
|
3
|
+
import { Box, Button, Chip, Divider, FormControl, Grid, Icon, IconButton, InputAdornment, InputLabel, MenuItem, Radio, Select, styled, TextField, Typography, useMediaQuery, useTheme, useThemeProps } from '@mui/material';
|
|
4
4
|
import { Endpoints, http } from '@selfcommunity/api-services';
|
|
5
5
|
import { SCPreferences, SCPreferencesContext, SCUserContext, UserUtils } from '@selfcommunity/react-core';
|
|
6
6
|
import { SCEventDateFilterType, SCEventLocationFilterType, SCEventSubscriptionStatusType } from '@selfcommunity/types';
|
|
@@ -18,10 +18,13 @@ import Skeleton from '../Events/Skeleton';
|
|
|
18
18
|
import { PREFIX } from './constants';
|
|
19
19
|
import LocationEventsFilter from './LocationEventsFilter';
|
|
20
20
|
import PastEventsFilter from './PastEventsFilter';
|
|
21
|
+
import OngoingEventsFilter from './OngoingEventsFilter';
|
|
21
22
|
const classes = {
|
|
22
23
|
root: `${PREFIX}-root`,
|
|
23
24
|
filters: `${PREFIX}-filters`,
|
|
24
25
|
events: `${PREFIX}-events`,
|
|
26
|
+
sectionTitle: `${PREFIX}-section-title`,
|
|
27
|
+
divider: `${PREFIX}-divider`,
|
|
25
28
|
item: `${PREFIX}-item`,
|
|
26
29
|
itemSkeleton: `${PREFIX}-item-skeleton`,
|
|
27
30
|
noResults: `${PREFIX}-no-results`,
|
|
@@ -29,7 +32,7 @@ const classes = {
|
|
|
29
32
|
search: `${PREFIX}-search`
|
|
30
33
|
};
|
|
31
34
|
const options = [
|
|
32
|
-
{ value: SCEventDateFilterType.
|
|
35
|
+
{ value: SCEventDateFilterType.ALL, label: _jsx(FormattedMessage, { id: "ui.events.select.any", defaultMessage: "ui.events.select.any" }) },
|
|
33
36
|
{ value: SCEventDateFilterType.TODAY, label: _jsx(FormattedMessage, { id: "ui.events.select.today", defaultMessage: "ui.events.select.today" }) },
|
|
34
37
|
{ value: SCEventDateFilterType.TOMORROW, label: _jsx(FormattedMessage, { id: "ui.events.select.tomorrow", defaultMessage: "ui.events.select.tomorrow" }) },
|
|
35
38
|
{ value: SCEventDateFilterType.THIS_WEEK, label: _jsx(FormattedMessage, { id: "ui.events.select.thisWeek", defaultMessage: "ui.events.select.thisWeek" }) },
|
|
@@ -43,7 +46,7 @@ const Root = styled(Box, {
|
|
|
43
46
|
export const EventsChipRoot = styled(Chip, {
|
|
44
47
|
name: PREFIX,
|
|
45
48
|
slot: 'EventsChipRoot',
|
|
46
|
-
shouldForwardProp: (prop) => prop !== 'showFollowed' && prop !== 'showPastEvents'
|
|
49
|
+
shouldForwardProp: (prop) => prop !== 'showFollowed' && prop !== 'showPastEvents' && prop !== 'showOngoingEvents'
|
|
47
50
|
})(() => ({}));
|
|
48
51
|
/**
|
|
49
52
|
* > API documentation for the Community-JS Events component. Learn about the available props and the CSS API.
|
|
@@ -78,7 +81,7 @@ export default function Events(inProps) {
|
|
|
78
81
|
props: inProps,
|
|
79
82
|
name: PREFIX
|
|
80
83
|
});
|
|
81
|
-
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"]);
|
|
84
|
+
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 = {}, CreateEventButtonProps = {}, showFilters = false, filters, general = true, hideTitle = false } = props, rest = __rest(props, ["endpoint", "endpointQueryParams", "className", "EventComponentProps", "EventsSkeletonComponentProps", "EventSkeletonComponentProps", "GridContainerComponentProps", "GridItemComponentProps", "CreateEventButtonProps", "showFilters", "filters", "general", "hideTitle"]);
|
|
82
85
|
// STATE
|
|
83
86
|
const [events, setEvents] = useState([]);
|
|
84
87
|
const [loading, setLoading] = useState(true);
|
|
@@ -88,7 +91,9 @@ export default function Events(inProps) {
|
|
|
88
91
|
const [location, setLocation] = useState(SCEventLocationFilterType.ANY);
|
|
89
92
|
const [showFollowed, setShowFollowed] = useState(false);
|
|
90
93
|
const [showPastEvents, setShowPastEvents] = useState(false);
|
|
94
|
+
const [showOngoingEvents, setShowOngoingEvents] = useState(false);
|
|
91
95
|
const [showMyEvents, setShowMyEvents] = useState(false);
|
|
96
|
+
const showUserEvents = !general && (events.length || (!events.length && (showPastEvents || showMyEvents || location !== SCEventLocationFilterType.ANY)));
|
|
92
97
|
// CONTEXT
|
|
93
98
|
const scUserContext = useContext(SCUserContext);
|
|
94
99
|
const scPreferencesContext = useContext(SCPreferencesContext);
|
|
@@ -115,6 +120,12 @@ export default function Events(inProps) {
|
|
|
115
120
|
const handleDeletePastClick = () => {
|
|
116
121
|
setShowPastEvents(false);
|
|
117
122
|
};
|
|
123
|
+
const handleChipOngoingClick = () => {
|
|
124
|
+
setShowOngoingEvents(!showOngoingEvents);
|
|
125
|
+
};
|
|
126
|
+
const handleDeleteOngoingClick = () => {
|
|
127
|
+
setShowOngoingEvents(false);
|
|
128
|
+
};
|
|
118
129
|
/**
|
|
119
130
|
* Fetches events list
|
|
120
131
|
*/
|
|
@@ -125,7 +136,7 @@ export default function Events(inProps) {
|
|
|
125
136
|
url: endpoint.url({}),
|
|
126
137
|
method: endpoint.method,
|
|
127
138
|
params: Object.assign(Object.assign({}, endpointQueryParams), (general
|
|
128
|
-
? Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (query && { search: query })), (dateSearch !== SCEventDateFilterType.
|
|
139
|
+
? Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (query && { search: query })), (dateSearch !== SCEventDateFilterType.ALL && { date_filter: dateSearch })), (location !== SCEventLocationFilterType.ANY && { location })), (showFollowed && { follows: showFollowed })), (showOngoingEvents && { date_filter: SCEventDateFilterType.NOT_PAST })) : Object.assign(Object.assign(Object.assign({ subscription_status: SCEventSubscriptionStatusType.GOING }, (location !== SCEventLocationFilterType.ANY && { location })), (showPastEvents && { past: showPastEvents })), (showMyEvents && { created_by: authUserId }))))
|
|
129
140
|
})
|
|
130
141
|
.then((res) => {
|
|
131
142
|
setEvents(res.data.results);
|
|
@@ -146,7 +157,7 @@ export default function Events(inProps) {
|
|
|
146
157
|
else {
|
|
147
158
|
fetchEvents();
|
|
148
159
|
}
|
|
149
|
-
}, [contentAvailability, authUserId, dateSearch, location, showFollowed, showPastEvents, showMyEvents]);
|
|
160
|
+
}, [contentAvailability, authUserId, dateSearch, location, showFollowed, showPastEvents, showMyEvents, showOngoingEvents]);
|
|
150
161
|
/**
|
|
151
162
|
* Subscriber for pubsub callback
|
|
152
163
|
*/
|
|
@@ -209,23 +220,23 @@ export default function Events(inProps) {
|
|
|
209
220
|
/**
|
|
210
221
|
* Renders events list
|
|
211
222
|
*/
|
|
212
|
-
const
|
|
223
|
+
const content = (_jsxs(_Fragment, { children: [showFilters && (_jsx(Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : showUserEvents ? (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ item: true }, { children: _jsx(EventsChipRoot, { color: showMyEvents ? 'secondary' : 'default', variant: showMyEvents ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByCreatedByMe", defaultMessage: "ui.events.filterByCreatedByMe" }), onClick: () => setShowMyEvents(!showMyEvents),
|
|
213
224
|
// @ts-expect-error this is needed to use showFollowed into SCEvents
|
|
214
|
-
showFollowed: showMyEvents, deleteIcon: showMyEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showMyEvents ? () => setShowMyEvents(false) : null, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsx(LocationEventsFilter, { value: location, disabled: loading, handleOnChange: handleOnChangeLocation }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ item: true, xs: 12, md: 3 }, { children: _jsx(TextField, { className: classes.search, size: 'small', fullWidth: true, value: query, label: _jsx(FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading, onKeyUp: (e) => {
|
|
225
|
+
showFollowed: showMyEvents, deleteIcon: showMyEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showMyEvents ? () => setShowMyEvents(false) : null, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(PastEventsFilter, { showPastEvents: showPastEvents, handleClick: handleChipPastClick, handleDeleteClick: handleDeletePastClick, disabled: loading }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsx(LocationEventsFilter, { value: location, disabled: loading, handleOnChange: handleOnChangeLocation }) }))] })) : general ? (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ item: true, xs: 12, md: 3 }, { children: _jsx(TextField, { className: classes.search, size: 'small', fullWidth: true, value: query, label: _jsx(FormattedMessage, { id: "ui.events.filterByName", defaultMessage: "ui.events.filterByName" }), variant: "outlined", onChange: handleOnChangeFilterName, disabled: loading, onKeyUp: (e) => {
|
|
215
226
|
e.preventDefault();
|
|
216
227
|
if (e.key === 'Enter') {
|
|
217
228
|
fetchEvents();
|
|
218
229
|
}
|
|
219
230
|
}, InputProps: {
|
|
220
231
|
endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: isMobile ? (_jsx(IconButton, Object.assign({ onClick: () => fetchEvents(), disabled: loading }, { children: _jsx(Icon, { children: "search" }) }))) : (_jsx(Button, { size: "small", variant: "contained", color: "secondary", onClick: () => fetchEvents(), endIcon: _jsx(Icon, { children: "search" }), disabled: loading })) })))
|
|
221
|
-
} }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(InputLabel, { children: _jsx(FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), _jsx(Select, Object.assign({ disabled:
|
|
232
|
+
} }) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(InputLabel, { children: _jsx(FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }) }), _jsx(Select, Object.assign({ disabled: showOngoingEvents || loading, size: 'small', label: _jsx(FormattedMessage, { id: "ui.events.filterByDate", defaultMessage: "ui.events.filterByDate" }), value: dateSearch, onChange: handleOnChangeTimeFrame, renderValue: (selected) => options.find((option) => option.value === selected).label }, { children: options.map((option) => (_jsxs(MenuItem, Object.assign({ value: option.value }, { children: [_jsx(Radio, { checked: dateSearch === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })) })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 2 }, { children: _jsx(LocationEventsFilter, { value: location, disabled: loading, handleOnChange: handleOnChangeLocation }) })), authUserId && (_jsx(Grid, Object.assign({ item: true }, { children: _jsx(EventsChipRoot, { color: showFollowed ? 'secondary' : 'default', variant: showFollowed ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByFollowedInterest", defaultMessage: "ui.events.filterByFollowedInterest" }), onClick: handleChipClick,
|
|
222
233
|
// @ts-expect-error this is needed to use showFollowed into SCEvents
|
|
223
|
-
showFollowed: showFollowed, deleteIcon: showFollowed ? _jsx(Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null, disabled: loading }) }))), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(
|
|
234
|
+
showFollowed: showFollowed, deleteIcon: showFollowed ? _jsx(Icon, { children: "close" }) : null, onDelete: showFollowed ? handleDeleteClick : null, disabled: loading }) }))), _jsx(Grid, Object.assign({ item: true }, { children: _jsx(OngoingEventsFilter, { showOngoingEvents: showOngoingEvents, handleClick: handleChipOngoingClick, handleDeleteClick: handleDeleteOngoingClick, disabled: dateSearch !== SCEventDateFilterType.ALL || loading }) }))] })) : null }))), _jsx(_Fragment, { children: loading ? (_jsx(Skeleton, Object.assign({}, EventsSkeletonComponentProps, { EventSkeletonProps: EventSkeletonComponentProps }))) : (_jsx(_Fragment, { children: !events.length ? (_jsx(Box, Object.assign({ className: classes.noResults }, { children: general ? (_jsxs(_Fragment, { children: [_jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: (onlyStaffEnabled && UserUtils.isStaff(scUserContext.user)) || !onlyStaffEnabled ? (_jsx(CreateEventButton, Object.assign({}, CreateEventButtonProps))) : null })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title", defaultMessage: "ui.events.noEvents.title" }) }))] })) : showUserEvents ? (_jsx(_Fragment, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.events.noEvents.title.personal", defaultMessage: "ui.events.noEvents.title.personal" }) })) })) : null }))) : (_jsxs(_Fragment, { children: [_jsx(Grid, Object.assign({ container: true, spacing: { xs: 2 }, className: classes.events }, GridContainerComponentProps, { children: _jsxs(_Fragment, { children: [events.map((event) => (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.item }, GridItemComponentProps, { children: _jsx(Event, Object.assign({ event: event, eventId: event.id }, EventComponentProps)) }), event.id))), authUserId && events.length % 2 !== 0 && (_jsx(Grid, Object.assign({ item: true, xs: 12, sm: 12, md: 6, className: classes.itemSkeleton }, GridItemComponentProps, { children: _jsx(EventSkeleton, Object.assign({}, EventSkeletonComponentProps, { skeletonsAnimation: false, actions: _jsx(CreateEventButton, Object.assign({ variant: "outlined", color: "primary", size: "small" }, CreateEventButtonProps, { children: _jsx(FormattedMessage, { id: "ui.events.skeleton.action.add", defaultMessage: "ui.events.skeleton.action.add" }) })) })) }), 'skeleton-item'))] }) })), Boolean(next) && (_jsx(Button, Object.assign({ color: "secondary", variant: "text", onClick: handleNext, className: classes.showMore }, { children: _jsx(FormattedMessage, { id: "ui.events.button.seeMore", defaultMessage: "ui.events.button.seeMore" }) })))] })) })) })] }));
|
|
224
235
|
/**
|
|
225
236
|
* Renders root object (if content availability community option is false and user is anonymous, component is hidden)
|
|
226
237
|
*/
|
|
227
238
|
if (!contentAvailability && !scUserContext.user) {
|
|
228
239
|
return null;
|
|
229
240
|
}
|
|
230
|
-
return (
|
|
241
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsx(_Fragment, { children: showUserEvents && !hideTitle ? (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.sectionTitle }, { children: _jsx(FormattedMessage, { id: "ui.events.myEvents.title", defaultMessage: "ui.events.myEvents.title" }) })), _jsx(Divider, { className: classes.divider })] })) : general ? (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.sectionTitle }, { children: _jsx(FormattedMessage, { id: "ui.events.allEvents.title", defaultMessage: "ui.events.allEvents.title" }) })), _jsx(Divider, { className: classes.divider })] })) : null }), content] })));
|
|
231
242
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChipProps } from '@mui/material';
|
|
2
|
+
export interface OngoingEventsFilterProps extends ChipProps {
|
|
3
|
+
autoHide?: boolean;
|
|
4
|
+
showOngoingEvents: boolean;
|
|
5
|
+
handleClick: () => void;
|
|
6
|
+
handleDeleteClick?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export default function OngoingEventsFilter(inProps: OngoingEventsFilterProps): JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Icon, useThemeProps } from '@mui/material';
|
|
4
|
+
import { FormattedMessage } from 'react-intl';
|
|
5
|
+
import { PREFIX } from './constants';
|
|
6
|
+
import { EventsChipRoot } from './Events';
|
|
7
|
+
export default function OngoingEventsFilter(inProps) {
|
|
8
|
+
// PROPS
|
|
9
|
+
const props = useThemeProps({
|
|
10
|
+
props: inProps,
|
|
11
|
+
name: PREFIX
|
|
12
|
+
});
|
|
13
|
+
const { autoHide = false, showOngoingEvents, handleClick, handleDeleteClick } = props, rest = __rest(props, ["autoHide", "showOngoingEvents", "handleClick", "handleDeleteClick"]);
|
|
14
|
+
if (autoHide) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return (_jsx(EventsChipRoot, Object.assign({ color: showOngoingEvents ? 'secondary' : 'default', variant: showOngoingEvents ? 'filled' : 'outlined', label: _jsx(FormattedMessage, { id: "ui.events.filterByOngoingEvents", defaultMessage: "ui.events.filterByOngoingEvents" }), onClick: handleClick,
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
showOngoingEvents: showOngoingEvents, deleteIcon: showOngoingEvents ? _jsx(Icon, { children: "close" }) : null, onDelete: showOngoingEvents ? handleDeleteClick : undefined }, rest)));
|
|
21
|
+
}
|
|
@@ -41,7 +41,7 @@ export default function Activities(props) {
|
|
|
41
41
|
: SCCommentsOrderBy.ADDED_AT_DESC
|
|
42
42
|
});
|
|
43
43
|
const objId = commentsObject.feedObject ? commentsObject.feedObject.id : null;
|
|
44
|
-
const skeletonsCount = Math.min(
|
|
44
|
+
const skeletonsCount = Math.min(2, commentsObject.feedObject ? commentsObject.feedObject.comment_count : 2);
|
|
45
45
|
const existFeedObjectActivities = feedObjectActivities && feedObjectActivities.length > 0;
|
|
46
46
|
/**
|
|
47
47
|
* Sync activities type if prop change
|
|
@@ -193,10 +193,10 @@ export default function GroupForm(inProps) {
|
|
|
193
193
|
}
|
|
194
194
|
groupService
|
|
195
195
|
.then((data) => {
|
|
196
|
-
onSuccess
|
|
196
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data);
|
|
197
197
|
notifyChanges(data);
|
|
198
|
-
onClose && onClose();
|
|
199
198
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
|
|
199
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
200
200
|
})
|
|
201
201
|
.catch((e) => {
|
|
202
202
|
setError(Object.assign(Object.assign({}, error), formatHttpErrorCode(e)));
|
|
@@ -193,7 +193,7 @@ export default function GroupInvitedWidget(inProps) {
|
|
|
193
193
|
setOpenDialog((prev) => !prev);
|
|
194
194
|
};
|
|
195
195
|
// RENDER
|
|
196
|
-
if ((!state.count && state.initialized) || !contentAvailability
|
|
196
|
+
if ((!state.count && state.initialized) || (!contentAvailability && !scUserContext.user) || !scGroup || !isGroupAdmin) {
|
|
197
197
|
return _jsx(HiddenPlaceholder, {});
|
|
198
198
|
}
|
|
199
199
|
if (!state.initialized) {
|
|
@@ -179,7 +179,7 @@ export default function GroupRequestsWidget(inProps) {
|
|
|
179
179
|
onSubscribeActon && onSubscribeActon(user);
|
|
180
180
|
}, [dispatch, state.count, state.results, onSubscribeActon]);
|
|
181
181
|
// RENDER
|
|
182
|
-
if ((!state.count && state.initialized) || !contentAvailability
|
|
182
|
+
if ((!state.count && state.initialized) || (!contentAvailability && !scUserContext.user) || !scGroup || !isGroupAdmin) {
|
|
183
183
|
return _jsx(HiddenPlaceholder, {});
|
|
184
184
|
}
|
|
185
185
|
if (!state.initialized) {
|
|
@@ -4,19 +4,24 @@ import { LoadingButton } from '@mui/lab';
|
|
|
4
4
|
import { Alert, Box, FormGroup, Paper, TextField, Typography } from '@mui/material';
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
6
6
|
import { useThemeProps } from '@mui/system';
|
|
7
|
+
import { SCCommunityEnvironment, SCCommunitySubscriptionTier } from '@selfcommunity/types';
|
|
7
8
|
import classNames from 'classnames';
|
|
8
|
-
import { useCallback, useState } from 'react';
|
|
9
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
9
10
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
10
11
|
import { LIVE_STREAM_DESCRIPTION_MAX_LENGTH, LIVE_STREAM_TITLE_MAX_LENGTH, LIVE_STREAM_SLUG_MAX_LENGTH } from '../../constants/LiveStream';
|
|
11
12
|
import { LIVESTREAM_DEFAULT_SETTINGS, PREFIX } from './constants';
|
|
12
13
|
import UploadEventCover from '../EventForm/UploadEventCover';
|
|
13
14
|
import LiveStreamSettingsForm from './LiveStreamFormSettings';
|
|
14
|
-
import { formatHttpErrorCode, LiveStreamService } from '@selfcommunity/api-services';
|
|
15
|
+
import { formatHttpErrorCode, LiveStreamApiClient, LiveStreamService } from '@selfcommunity/api-services';
|
|
15
16
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
16
17
|
import { Logger } from '@selfcommunity/utils';
|
|
17
18
|
import CoverPlaceholder from '../../assets/deafultCover';
|
|
19
|
+
import { Link, SCPreferences, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
20
|
+
import { HUB_PROD, HUB_STAGE } from '../PlatformWidget/constants';
|
|
21
|
+
import { WARNING_THRESHOLD_EXPIRING_SOON } from '../LiveStreamRoom/constants';
|
|
18
22
|
const classes = {
|
|
19
23
|
root: `${PREFIX}-root`,
|
|
24
|
+
warning: `${PREFIX}-warning`,
|
|
20
25
|
form: `${PREFIX}-form`,
|
|
21
26
|
title: `${PREFIX}-title`,
|
|
22
27
|
cover: `${PREFIX}-cover`,
|
|
@@ -72,14 +77,30 @@ const messages = defineMessages({
|
|
|
72
77
|
* @param inProps
|
|
73
78
|
*/
|
|
74
79
|
export default function LiveStreamForm(inProps) {
|
|
75
|
-
var _a, _b, _c;
|
|
80
|
+
var _a, _b, _c, _d;
|
|
76
81
|
//PROPS
|
|
77
82
|
const props = useThemeProps({
|
|
78
83
|
props: inProps,
|
|
79
84
|
name: PREFIX
|
|
80
85
|
});
|
|
81
86
|
const { className, onSuccess, onError, liveStream = null } = props, rest = __rest(props, ["className", "onSuccess", "onError", "liveStream"]);
|
|
82
|
-
//
|
|
87
|
+
// HOOKS
|
|
88
|
+
const scUserContext = useSCUser();
|
|
89
|
+
const { preferences } = useSCPreferences();
|
|
90
|
+
const isCommunityOwner = useMemo(() => { var _a; return ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.id) === 1; }, [scUserContext.user]);
|
|
91
|
+
const isFreeTrialTier = useMemo(() => preferences &&
|
|
92
|
+
SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
93
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
94
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
|
|
95
|
+
const isEnterpriseTier = useMemo(() => preferences &&
|
|
96
|
+
SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
97
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
98
|
+
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.ENTERPRISE, [preferences]);
|
|
99
|
+
const isStage = useMemo(() => preferences &&
|
|
100
|
+
SCPreferences.STATIC_ENVIRONMENT in preferences &&
|
|
101
|
+
preferences[SCPreferences.STATIC_ENVIRONMENT].value === SCCommunityEnvironment.STAGE, [preferences]);
|
|
102
|
+
const communityStackId = useMemo(() => preferences && SCPreferences.STATIC_ENVIRONMENT in preferences && preferences[SCPreferences.STATIC_STACKID].value, [preferences]);
|
|
103
|
+
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; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
|
|
83
104
|
const intl = useIntl();
|
|
84
105
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
85
106
|
// @ts-ignore
|
|
@@ -96,6 +117,7 @@ export default function LiveStreamForm(inProps) {
|
|
|
96
117
|
const [field, setField] = useState(initialFieldState);
|
|
97
118
|
const [error, setError] = useState({});
|
|
98
119
|
const [genericError, setGenericError] = useState(null);
|
|
120
|
+
const [timeRemaining, setTimeRemaining] = useState(null);
|
|
99
121
|
const _backgroundCover = Object.assign({}, (field.cover ? { background: `url('${field.cover}') center / cover` } : { background: `url('${CoverPlaceholder}') no-repeat 0 0 / 100% 100%` }));
|
|
100
122
|
const handleChangeCover = useCallback((cover) => {
|
|
101
123
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['coverFile']: cover })));
|
|
@@ -173,17 +195,54 @@ export default function LiveStreamForm(inProps) {
|
|
|
173
195
|
const handleChangeSettings = useCallback((data) => {
|
|
174
196
|
setField((prev) => (Object.assign(Object.assign({}, prev), { settings: data })));
|
|
175
197
|
}, [setField]);
|
|
198
|
+
const warning = useMemo(() => {
|
|
199
|
+
let _message;
|
|
200
|
+
if (isFreeTrialTier && isCommunityOwner && !isEnterpriseTier) {
|
|
201
|
+
_message = (_jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.warningSubscriptionRequired", defaultMessage: "ui.liveStreamForm.selector.warningSubscriptionRequired", values: {
|
|
202
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
203
|
+
// @ts-ignore
|
|
204
|
+
link: (...chunks) => (_jsx(Link, Object.assign({ target: "_blank", to: `${isStage ? HUB_STAGE : HUB_PROD}dashboard/community/${communityStackId}/subscription` }, { children: chunks })))
|
|
205
|
+
} }));
|
|
206
|
+
}
|
|
207
|
+
else if (timeRemaining !== null && timeRemaining <= WARNING_THRESHOLD_EXPIRING_SOON) {
|
|
208
|
+
if (timeRemaining <= 1) {
|
|
209
|
+
_message = (_jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.warningMinutesExausted", defaultMessage: "ui.liveStreamForm.selector.warningMinutesExausted" }));
|
|
210
|
+
}
|
|
211
|
+
else if (timeRemaining <= WARNING_THRESHOLD_EXPIRING_SOON) {
|
|
212
|
+
_message = (_jsx(FormattedMessage, { id: "ui.liveStreamForm.selector.warningRemainingMinutes", defaultMessage: "ui.liveStreamForm.selector.warningRemainingMinutes", values: { minutes: timeRemaining } }));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (_message) {
|
|
216
|
+
return (_jsx(Box, Object.assign({ className: classes.warning }, { children: _jsx(Alert, Object.assign({ variant: "filled", severity: "warning" }, { children: _message })) })));
|
|
217
|
+
}
|
|
218
|
+
return null;
|
|
219
|
+
}, [isFreeTrialTier, isCommunityOwner, timeRemaining]);
|
|
220
|
+
const fetchLivestreamStatus = () => {
|
|
221
|
+
LiveStreamApiClient.getMonthlyDuration()
|
|
222
|
+
.then((r) => {
|
|
223
|
+
setTimeRemaining(r.remaining_minutes);
|
|
224
|
+
})
|
|
225
|
+
.catch((error) => {
|
|
226
|
+
console.error('Error fetching live status:', error);
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
useEffect(() => {
|
|
230
|
+
fetchLivestreamStatus();
|
|
231
|
+
}, []);
|
|
176
232
|
/**
|
|
177
233
|
* Renders root object
|
|
178
234
|
*/
|
|
179
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(UploadEventCover, { isCreationMode: true, onChange: handleChangeCover }) })), Boolean(error['coverError']) && _jsx(Typography, Object.assign({ color: "error" }, { children: error['coverError'] })), _jsxs(FormGroup, Object.assign({ className: classes.form }, { children: [_jsx(TextField, { required: true, className: classes.title, placeholder: `${intl.formatMessage(messages.title)}`, margin: "normal", value: field.title, name: "title", onChange: handleChange, InputProps: {
|
|
235
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [warning, _jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(UploadEventCover, { isCreationMode: true, onChange: handleChangeCover }) })), Boolean(error['coverError']) && _jsx(Typography, Object.assign({ color: "error" }, { children: error['coverError'] })), _jsxs(FormGroup, Object.assign({ className: classes.form }, { children: [_jsx(TextField, { required: true, className: classes.title, placeholder: `${intl.formatMessage(messages.title)}`, margin: "normal", value: field.title, name: "title", onChange: handleChange, InputProps: {
|
|
180
236
|
endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: LIVE_STREAM_TITLE_MAX_LENGTH - field.title.length }))
|
|
181
237
|
}, error: Boolean(field.title.length > LIVE_STREAM_TITLE_MAX_LENGTH) || Boolean(error['titleError']), helperText: field.title.length > LIVE_STREAM_TITLE_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.title.error.maxLength", defaultMessage: "ui.liveStreamForm.title.error.maxLength" })) : error['titleError'] ? (error['titleError']) : null }), _jsx(TextField, { required: true, className: classes.slug, placeholder: `${intl.formatMessage(messages.slug)}`, margin: "normal", value: field.slug, name: "slug", onChange: handleChange, InputProps: {
|
|
182
238
|
endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: LIVE_STREAM_SLUG_MAX_LENGTH - field.slug.length }))
|
|
183
239
|
}, error: Boolean(field.slug.length > LIVE_STREAM_SLUG_MAX_LENGTH) || Boolean(error['slugError']), helperText: field.title.length > LIVE_STREAM_SLUG_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.slug.error.maxLength", defaultMessage: "ui.liveStreamForm.slug.error.maxLength" })) : error['slugError'] ? (error['slugError']) : null }), _jsx(TextField, { multiline: true, rows: 4, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
184
|
-
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((
|
|
185
|
-
}, error: Boolean(((
|
|
240
|
+
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) ? LIVE_STREAM_DESCRIPTION_MAX_LENGTH - field.description.length : LIVE_STREAM_DESCRIPTION_MAX_LENGTH })))
|
|
241
|
+
}, error: Boolean(((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > LIVE_STREAM_DESCRIPTION_MAX_LENGTH), helperText: ((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > LIVE_STREAM_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.description.error.maxLength", defaultMessage: "ui.liveStreamForm.description.error.maxLength" })) : null }), _jsx(LiveStreamSettingsForm, { settings: field.settings, onChange: handleChangeSettings }), 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.title ||
|
|
186
242
|
field.isSubmitting ||
|
|
187
243
|
field.title.length > LIVE_STREAM_TITLE_MAX_LENGTH ||
|
|
188
|
-
field.description.length > LIVE_STREAM_DESCRIPTION_MAX_LENGTH
|
|
244
|
+
field.description.length > LIVE_STREAM_DESCRIPTION_MAX_LENGTH ||
|
|
245
|
+
isFreeTrialTier ||
|
|
246
|
+
timeRemaining <= WARNING_THRESHOLD_EXPIRING_SOON ||
|
|
247
|
+
!canCreateLiveStream, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: liveStream ? (_jsx(FormattedMessage, { id: "ui.liveStreamForm.button.edit", defaultMessage: "ui.liveStreamForm.button.edit" })) : (_jsx(FormattedMessage, { id: "ui.liveStreamForm.button.create", defaultMessage: "ui.liveStreamForm.button.create" })) })) }))] }))] })));
|
|
189
248
|
}
|