@selfcommunity/react-ui 0.7.50-events.78 → 0.7.50-events.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/EventHeader/EventHeader.js +2 -1
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +6 -3
- package/lib/esm/components/EventHeader/EventHeader.js +2 -1
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +7 -4
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
|
@@ -30,6 +30,7 @@ const classes = {
|
|
|
30
30
|
name: `${constants_1.PREFIX}-name`,
|
|
31
31
|
visibility: `${constants_1.PREFIX}-visibility`,
|
|
32
32
|
visibilityItem: `${constants_1.PREFIX}-visibility-item`,
|
|
33
|
+
planner: `${constants_1.PREFIX}-planner`,
|
|
33
34
|
multiActions: `${constants_1.PREFIX}-multi-actions`
|
|
34
35
|
};
|
|
35
36
|
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
@@ -167,6 +168,6 @@ function EventHeader(inProps) {
|
|
|
167
168
|
month: 'long'
|
|
168
169
|
}),
|
|
169
170
|
hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
|
|
170
|
-
} })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, {
|
|
171
|
+
} })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, { className: classes.planner, userId: (_b = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _b === void 0 ? void 0 : _b.id, secondary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isEventAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EventInviteButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(EditEventButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data) }), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent }, EventActionsProps))] })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EventSubscribeButton_1.default, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps)), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent }, EventActionsProps))] })) }) })] }))] })));
|
|
171
172
|
}
|
|
172
173
|
exports.default = EventHeader;
|
|
@@ -61,6 +61,10 @@ function EventMembersWidget(inProps) {
|
|
|
61
61
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
62
62
|
// HOOKS
|
|
63
63
|
const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
|
|
64
|
+
// CONSTS
|
|
65
|
+
const hasAllow = (0, react_1.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]);
|
|
66
|
+
const title = (0, react_1.useMemo)(() => (tabValue === '1' ? 'ui.eventMembersWidget.participants' : 'ui.eventMembersWidget.invited'), [tabValue]);
|
|
67
|
+
// CALLBACKS
|
|
64
68
|
const _initParticipants = (0, react_1.useCallback)(() => {
|
|
65
69
|
if (!participants.initialized && !participants.isLoadingNext) {
|
|
66
70
|
dispatchParticipants({ type: widget_1.actionWidgetTypes.LOADING_NEXT });
|
|
@@ -75,8 +79,7 @@ function EventMembersWidget(inProps) {
|
|
|
75
79
|
}
|
|
76
80
|
}, [participants.isLoadingNext, participants.initialized, dispatchParticipants, scEvent]);
|
|
77
81
|
const _initInvited = (0, react_1.useCallback)(() => {
|
|
78
|
-
|
|
79
|
-
if (!invited.initialized && !invited.isLoadingNext && ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id) === scEvent.managed_by.id) {
|
|
82
|
+
if (!invited.initialized && !invited.isLoadingNext && hasAllow) {
|
|
80
83
|
dispatchInvited({ type: widget_1.actionWidgetTypes.LOADING_NEXT });
|
|
81
84
|
api_services_1.EventService.getEventInvitedUsers(scEvent.id, Object.assign({}, endpointQueryParams))
|
|
82
85
|
.then((payload) => {
|
|
@@ -119,7 +122,7 @@ function EventMembersWidget(inProps) {
|
|
|
119
122
|
if (!scEvent) {
|
|
120
123
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
121
124
|
}
|
|
122
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id:
|
|
125
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: classes.root }, rest, { children: (0, jsx_runtime_1.jsxs)(material_1.CardContent, Object.assign({ className: classes.content }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.title }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: title, defaultMessage: title }) })), (0, jsx_runtime_1.jsxs)(lab_1.TabContext, Object.assign({ value: tabValue }, { children: [(0, jsx_runtime_1.jsxs)(lab_1.TabList, Object.assign({ className: classes.tabsWrapper, onChange: handleTabChange, textColor: "primary", indicatorColor: "primary", variant: "fullWidth" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3" }, { children: participants.count })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventMembersWidget.participants", defaultMessage: "ui.eventMembersWidget.participants" }) }))] })), value: "1" }), hasAllow && ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3" }, { children: invitedNumber })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "subtitle2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventMembersWidget.invited", defaultMessage: "ui.eventMembersWidget.invited" }) }))] })), value: "2" }))] })), (0, jsx_runtime_1.jsx)(lab_1.TabPanel, Object.assign({ value: "1", className: classes.tabPanel }, { children: (0, jsx_runtime_1.jsx)(TabContentComponent_1.default, { state: participants, dispatch: dispatchParticipants, userProps: userProps, dialogProps: dialogProps }) })), hasAllow && ((0, jsx_runtime_1.jsx)(lab_1.TabPanel, Object.assign({ value: "2", className: classes.tabPanel }, { children: (0, jsx_runtime_1.jsx)(TabContentComponent_1.default, { state: invited, dispatch: dispatchInvited, userProps: userProps, dialogProps: dialogProps, actionProps: {
|
|
123
126
|
scEvent,
|
|
124
127
|
setInvitedNumber
|
|
125
128
|
}, setRefresh: setRefresh }) })))] }))] })) })));
|
|
@@ -28,6 +28,7 @@ const classes = {
|
|
|
28
28
|
name: `${PREFIX}-name`,
|
|
29
29
|
visibility: `${PREFIX}-visibility`,
|
|
30
30
|
visibilityItem: `${PREFIX}-visibility-item`,
|
|
31
|
+
planner: `${PREFIX}-planner`,
|
|
31
32
|
multiActions: `${PREFIX}-multi-actions`
|
|
32
33
|
};
|
|
33
34
|
const Root = styled(Box, {
|
|
@@ -165,5 +166,5 @@ export default function EventHeader(inProps) {
|
|
|
165
166
|
month: 'long'
|
|
166
167
|
}),
|
|
167
168
|
hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
|
|
168
|
-
} })) })), _jsx(Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), _jsxs(Box, Object.assign({ className: classes.visibility }, { children: [_jsx(_Fragment, { children: scEvent.privacy === SCEventPrivacyType.PUBLIC ? (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), _jsx(Bullet, {}), _jsx(Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), _jsx(User, {
|
|
169
|
+
} })) })), _jsx(Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), _jsxs(Box, Object.assign({ className: classes.visibility }, { children: [_jsx(_Fragment, { children: scEvent.privacy === SCEventPrivacyType.PUBLIC ? (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : (_jsxs(Typography, Object.assign({ className: classes.visibilityItem }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), _jsx(Bullet, {}), _jsx(Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === SCEventLocationType.PERSON ? (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : (_jsx(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })) }))] })), _jsx(User, { className: classes.planner, userId: (_b = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _b === void 0 ? void 0 : _b.id, secondary: _jsx(FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: _jsx(_Fragment, { children: isEventAdmin ? (_jsxs(Box, Object.assign({ className: classes.multiActions }, { children: [_jsx(EventInviteButton, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id }), _jsxs(Box, { children: [_jsx(EditEventButton, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data) }), _jsx(EventActionsMenu, Object.assign({ event: scEvent }, EventActionsProps))] })] }))) : (_jsxs(_Fragment, { children: [_jsx(EventSubscribeButton, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps)), _jsx(EventActionsMenu, Object.assign({ event: scEvent }, EventActionsProps))] })) }) })] }))] })));
|
|
169
170
|
}
|
|
@@ -6,7 +6,7 @@ import { styled } from '@mui/system';
|
|
|
6
6
|
import { EventService } from '@selfcommunity/api-services';
|
|
7
7
|
import { SCCache, useSCFetchEvent, useSCUser } from '@selfcommunity/react-core';
|
|
8
8
|
import { Logger } from '@selfcommunity/utils';
|
|
9
|
-
import { useCallback, useEffect, useReducer, useState } from 'react';
|
|
9
|
+
import { useCallback, useEffect, useMemo, useReducer, useState } from 'react';
|
|
10
10
|
import { FormattedMessage } from 'react-intl';
|
|
11
11
|
import 'swiper/css';
|
|
12
12
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
@@ -59,6 +59,10 @@ export default function EventMembersWidget(inProps) {
|
|
|
59
59
|
const scUserContext = useSCUser();
|
|
60
60
|
// HOOKS
|
|
61
61
|
const { scEvent } = useSCFetchEvent({ id: eventId, event });
|
|
62
|
+
// CONSTS
|
|
63
|
+
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]);
|
|
64
|
+
const title = useMemo(() => (tabValue === '1' ? 'ui.eventMembersWidget.participants' : 'ui.eventMembersWidget.invited'), [tabValue]);
|
|
65
|
+
// CALLBACKS
|
|
62
66
|
const _initParticipants = useCallback(() => {
|
|
63
67
|
if (!participants.initialized && !participants.isLoadingNext) {
|
|
64
68
|
dispatchParticipants({ type: actionWidgetTypes.LOADING_NEXT });
|
|
@@ -73,8 +77,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
73
77
|
}
|
|
74
78
|
}, [participants.isLoadingNext, participants.initialized, dispatchParticipants, scEvent]);
|
|
75
79
|
const _initInvited = useCallback(() => {
|
|
76
|
-
|
|
77
|
-
if (!invited.initialized && !invited.isLoadingNext && ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id) === scEvent.managed_by.id) {
|
|
80
|
+
if (!invited.initialized && !invited.isLoadingNext && hasAllow) {
|
|
78
81
|
dispatchInvited({ type: actionWidgetTypes.LOADING_NEXT });
|
|
79
82
|
EventService.getEventInvitedUsers(scEvent.id, Object.assign({}, endpointQueryParams))
|
|
80
83
|
.then((payload) => {
|
|
@@ -117,7 +120,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
117
120
|
if (!scEvent) {
|
|
118
121
|
return _jsx(HiddenPlaceholder, {});
|
|
119
122
|
}
|
|
120
|
-
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:
|
|
123
|
+
return (_jsx(Root, Object.assign({ className: classes.root }, rest, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.title }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })), _jsxs(TabContext, Object.assign({ value: tabValue }, { children: [_jsxs(TabList, Object.assign({ className: classes.tabsWrapper, onChange: handleTabChange, textColor: "primary", indicatorColor: "primary", variant: "fullWidth" }, { children: [_jsx(Tab, { label: _jsxs(Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h3" }, { children: participants.count })), _jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.participants", defaultMessage: "ui.eventMembersWidget.participants" }) }))] })), value: "1" }), hasAllow && (_jsx(Tab, { label: _jsxs(Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h3" }, { children: invitedNumber })), _jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.invited", defaultMessage: "ui.eventMembersWidget.invited" }) }))] })), value: "2" }))] })), _jsx(TabPanel, Object.assign({ value: "1", className: classes.tabPanel }, { children: _jsx(TabContentComponent, { state: participants, dispatch: dispatchParticipants, userProps: userProps, dialogProps: dialogProps }) })), hasAllow && (_jsx(TabPanel, Object.assign({ value: "2", className: classes.tabPanel }, { children: _jsx(TabContentComponent, { state: invited, dispatch: dispatchInvited, userProps: userProps, dialogProps: dialogProps, actionProps: {
|
|
121
124
|
scEvent,
|
|
122
125
|
setInvitedNumber
|
|
123
126
|
}, setRefresh: setRefresh }) })))] }))] })) })));
|