@selfcommunity/react-templates 0.3.50-events.97 → 0.3.50-events.99
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.
|
@@ -79,6 +79,7 @@ function EventFeed(inProps) {
|
|
|
79
79
|
const { id = 'event_feed', className, event, eventId, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
|
|
80
80
|
// CONTEXT
|
|
81
81
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
82
|
+
const scUserContext = (0, react_core_1.useSCUser)();
|
|
82
83
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
83
84
|
// REF
|
|
84
85
|
const feedRef = (0, react_1.useRef)();
|
|
@@ -113,8 +114,9 @@ function EventFeed(inProps) {
|
|
|
113
114
|
if (!scEvent) {
|
|
114
115
|
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
115
116
|
}
|
|
116
|
-
else if (scEvent &&
|
|
117
|
+
else if (scEvent.privacy === types_1.SCEventPrivacyType.PRIVATE &&
|
|
117
118
|
scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.SUBSCRIBED &&
|
|
119
|
+
scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.INVITED &&
|
|
118
120
|
scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.GOING &&
|
|
119
121
|
scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.NOT_GOING) {
|
|
120
122
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(react_ui_1.EventInfoWidget, { className: classes.root, event: scEvent }) })));
|
|
@@ -130,9 +132,12 @@ function EventFeed(inProps) {
|
|
|
130
132
|
}, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
131
133
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
132
134
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.EventInfoWidget, { className: classes.root, event: scEvent }), Boolean(scEvent &&
|
|
133
|
-
(scEvent.
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
((!scUserContext.user && scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC) ||
|
|
136
|
+
(scUserContext.user &&
|
|
137
|
+
(scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.SUBSCRIBED ||
|
|
138
|
+
scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.INVITED ||
|
|
139
|
+
scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.GOING ||
|
|
140
|
+
scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.NOT_GOING)))) && ((0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { event: scEvent }, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.eventFeed.composer.label", defaultMessage: "templates.eventFeed.composer.label" }), feedType: types_1.SCFeedTypologyType.EVENT }))] }), CustomAdvProps: { position: types_1.SCCustomAdvPosition.POSITION_FEED, groupsId: [scEvent.id] }, enabledCustomAdvPositions: [
|
|
136
141
|
types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
137
142
|
types_1.SCCustomAdvPosition.POSITION_FEED,
|
|
138
143
|
types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
@@ -3,8 +3,8 @@ import { useMemo, useRef } from 'react';
|
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { ContributionUtils, EventInfoWidget, EventLocationWidget, EventMembersWidget, Feed, FeedObject, FeedObjectSkeleton, InlineComposerWidget, RelatedEventsWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
|
|
5
5
|
import { Endpoints } from '@selfcommunity/api-services';
|
|
6
|
-
import { Link, SCRoutes, useSCFetchEvent, useSCRouting } from '@selfcommunity/react-core';
|
|
7
|
-
import { SCCustomAdvPosition, SCEventSubscriptionStatusType, SCFeedTypologyType } from '@selfcommunity/types';
|
|
6
|
+
import { Link, SCRoutes, useSCFetchEvent, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
7
|
+
import { SCCustomAdvPosition, SCEventPrivacyType, SCEventSubscriptionStatusType, SCFeedTypologyType } from '@selfcommunity/types';
|
|
8
8
|
import { useThemeProps } from '@mui/system';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import { FormattedMessage } from 'react-intl';
|
|
@@ -76,6 +76,7 @@ export default function EventFeed(inProps) {
|
|
|
76
76
|
const { id = 'event_feed', className, event, eventId, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
|
|
77
77
|
// CONTEXT
|
|
78
78
|
const scRoutingContext = useSCRouting();
|
|
79
|
+
const scUserContext = useSCUser();
|
|
79
80
|
const { enqueueSnackbar } = useSnackbar();
|
|
80
81
|
// REF
|
|
81
82
|
const feedRef = useRef();
|
|
@@ -110,8 +111,9 @@ export default function EventFeed(inProps) {
|
|
|
110
111
|
if (!scEvent) {
|
|
111
112
|
return _jsx(EventFeedSkeleton, {});
|
|
112
113
|
}
|
|
113
|
-
else if (scEvent &&
|
|
114
|
+
else if (scEvent.privacy === SCEventPrivacyType.PRIVATE &&
|
|
114
115
|
scEvent.subscription_status !== SCEventSubscriptionStatusType.SUBSCRIBED &&
|
|
116
|
+
scEvent.subscription_status !== SCEventSubscriptionStatusType.INVITED &&
|
|
115
117
|
scEvent.subscription_status !== SCEventSubscriptionStatusType.GOING &&
|
|
116
118
|
scEvent.subscription_status !== SCEventSubscriptionStatusType.NOT_GOING) {
|
|
117
119
|
return (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(EventInfoWidget, { className: classes.root, event: scEvent }) })));
|
|
@@ -127,9 +129,12 @@ export default function EventFeed(inProps) {
|
|
|
127
129
|
}, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
128
130
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
129
131
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(EventInfoWidget, { className: classes.root, event: scEvent }), Boolean(scEvent &&
|
|
130
|
-
(scEvent.
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
((!scUserContext.user && scEvent.privacy === SCEventPrivacyType.PUBLIC) ||
|
|
133
|
+
(scUserContext.user &&
|
|
134
|
+
(scEvent.subscription_status === SCEventSubscriptionStatusType.SUBSCRIBED ||
|
|
135
|
+
scEvent.subscription_status === SCEventSubscriptionStatusType.INVITED ||
|
|
136
|
+
scEvent.subscription_status === SCEventSubscriptionStatusType.GOING ||
|
|
137
|
+
scEvent.subscription_status === SCEventSubscriptionStatusType.NOT_GOING)))) && (_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { event: scEvent }, label: _jsx(FormattedMessage, { id: "templates.eventFeed.composer.label", defaultMessage: "templates.eventFeed.composer.label" }), feedType: SCFeedTypologyType.EVENT }))] }), CustomAdvProps: { position: SCCustomAdvPosition.POSITION_FEED, groupsId: [scEvent.id] }, enabledCustomAdvPositions: [
|
|
133
138
|
SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
134
139
|
SCCustomAdvPosition.POSITION_FEED,
|
|
135
140
|
SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|