@selfcommunity/react-templates 0.5.0-alpha.20 → 0.5.0-alpha.22
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/CategoryFeed/CategoryFeed.js +3 -3
- package/lib/cjs/components/EventFeed/EventFeed.js +7 -10
- package/lib/cjs/components/ExploreFeed/ExploreFeed.js +3 -3
- package/lib/cjs/components/GroupFeed/GroupFeed.js +9 -12
- package/lib/cjs/components/MainFeed/MainFeed.js +3 -3
- package/lib/cjs/components/UserFeed/UserFeed.js +1 -1
- package/lib/esm/components/CategoryFeed/CategoryFeed.js +3 -3
- package/lib/esm/components/EventFeed/EventFeed.js +7 -10
- package/lib/esm/components/ExploreFeed/ExploreFeed.js +3 -3
- package/lib/esm/components/GroupFeed/GroupFeed.js +9 -12
- package/lib/esm/components/MainFeed/MainFeed.js +3 -3
- package/lib/esm/components/UserFeed/UserFeed.js +1 -1
- package/lib/umd/react-templates.js +1 -1
- package/package.json +6 -6
|
@@ -91,7 +91,7 @@ function CategoryFeed(inProps) {
|
|
|
91
91
|
if (feedObject.categories.findIndex((c) => c.id === scCategory.id) === -1) {
|
|
92
92
|
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
|
|
93
93
|
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
94
|
-
action: (
|
|
94
|
+
action: () => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], react_ui_1.ContributionUtils.getRouteData(feedObject)) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }) }))),
|
|
95
95
|
variant: 'success',
|
|
96
96
|
autoHideDuration: 7000
|
|
97
97
|
});
|
|
@@ -101,7 +101,7 @@ function CategoryFeed(inProps) {
|
|
|
101
101
|
const feedUnit = {
|
|
102
102
|
type: feedObject.type,
|
|
103
103
|
[feedObject.type]: feedObject,
|
|
104
|
-
|
|
104
|
+
seen: false,
|
|
105
105
|
has_boost: false
|
|
106
106
|
};
|
|
107
107
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -123,7 +123,7 @@ function CategoryFeed(inProps) {
|
|
|
123
123
|
feedObject: item[item.type],
|
|
124
124
|
feedObjectType: item.type,
|
|
125
125
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
126
|
-
markRead: scUser ? !item.
|
|
126
|
+
markRead: scUser ? !item.seen : null
|
|
127
127
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
128
128
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
129
129
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: ((scCategory.content_only_staff && react_core_1.UserUtils.isStaff(scUserContext.user)) || !scCategory.content_only_staff) && ((0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { categories: [scCategory] }, feedType: types_1.SCFeedTypologyType.CATEGORY })) }), CustomAdvProps: { categoriesId: [scCategory.id] }, enabledCustomAdvPositions: [
|
|
@@ -119,7 +119,7 @@ function EventFeed(inProps) {
|
|
|
119
119
|
const feedUnit = {
|
|
120
120
|
type: feedObject.type,
|
|
121
121
|
[feedObject.type]: feedObject,
|
|
122
|
-
|
|
122
|
+
seen: false,
|
|
123
123
|
has_boost: false
|
|
124
124
|
};
|
|
125
125
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -146,15 +146,12 @@ function EventFeed(inProps) {
|
|
|
146
146
|
status !== types_1.SCEventSubscriptionStatusType.NOT_GOING))) {
|
|
147
147
|
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 }) })));
|
|
148
148
|
}
|
|
149
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.GetEventFeed), { url: () => api_services_1.Endpoints.GetEventFeed.url({ id: scEvent.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
markRead: scUser ? !((_a = item === null || item === void 0 ? void 0 : item.seen_by_id) === null || _a === void 0 ? void 0 : _a.includes(scUser.id)) : null
|
|
156
|
-
});
|
|
157
|
-
}, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
149
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.GetEventFeed), { url: () => api_services_1.Endpoints.GetEventFeed.url({ id: scEvent.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
150
|
+
feedObject: item[item.type],
|
|
151
|
+
feedObjectType: item.type,
|
|
152
|
+
feedObjectActivities: item.activities ? item.activities : null,
|
|
153
|
+
markRead: scUser ? !(item === null || item === void 0 ? void 0 : item.seen) : null
|
|
154
|
+
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
158
155
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
159
156
|
}, 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 &&
|
|
160
157
|
((!scUserContext.user && scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC) ||
|
|
@@ -99,7 +99,7 @@ function ExploreFeed(inProps) {
|
|
|
99
99
|
const feedUnit = {
|
|
100
100
|
type: feedObject.type,
|
|
101
101
|
[feedObject.type]: feedObject,
|
|
102
|
-
|
|
102
|
+
seen: false,
|
|
103
103
|
has_boost: false
|
|
104
104
|
};
|
|
105
105
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -112,7 +112,7 @@ function ExploreFeed(inProps) {
|
|
|
112
112
|
const feedUnit = {
|
|
113
113
|
type: feedObject.type,
|
|
114
114
|
[feedObject.type]: feedObject,
|
|
115
|
-
|
|
115
|
+
seen: false,
|
|
116
116
|
has_boost: false
|
|
117
117
|
};
|
|
118
118
|
feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -128,7 +128,7 @@ function ExploreFeed(inProps) {
|
|
|
128
128
|
feedObject: item[item.type],
|
|
129
129
|
feedObjectType: item.type,
|
|
130
130
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
131
|
-
markRead: scUser ? !item.
|
|
131
|
+
markRead: scUser ? !item.seen : null
|
|
132
132
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
133
133
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
134
134
|
}, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }), react_core_1.UserUtils.isAdmin(scUserContext.user) && (0, jsx_runtime_1.jsx)(react_ui_1.OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), FeedSidebarProps: FeedSidebarProps, enabledCustomAdvPositions: [
|
|
@@ -76,7 +76,7 @@ function GroupFeed(inProps) {
|
|
|
76
76
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
77
77
|
const scGroupsManager = scUserContext.managers.groups;
|
|
78
78
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
79
|
-
const { scGroup
|
|
79
|
+
const { scGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
|
|
80
80
|
// REF
|
|
81
81
|
const feedRef = (0, react_1.useRef)();
|
|
82
82
|
// CONST
|
|
@@ -95,7 +95,7 @@ function GroupFeed(inProps) {
|
|
|
95
95
|
var _a;
|
|
96
96
|
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
|
|
97
97
|
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
98
|
-
action: (
|
|
98
|
+
action: () => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], react_ui_1.ContributionUtils.getRouteData(feedObject)) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }) }))),
|
|
99
99
|
variant: 'success',
|
|
100
100
|
autoHideDuration: 7000
|
|
101
101
|
});
|
|
@@ -104,7 +104,7 @@ function GroupFeed(inProps) {
|
|
|
104
104
|
const feedUnit = {
|
|
105
105
|
type: feedObject.type,
|
|
106
106
|
[feedObject.type]: feedObject,
|
|
107
|
-
|
|
107
|
+
seen: false,
|
|
108
108
|
has_boost: false
|
|
109
109
|
};
|
|
110
110
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -123,15 +123,12 @@ function GroupFeed(inProps) {
|
|
|
123
123
|
else if (scGroup && status !== types_1.SCGroupSubscriptionStatusType.SUBSCRIBED) {
|
|
124
124
|
return (0, jsx_runtime_1.jsx)(react_ui_1.GroupInfoWidget, { className: classes.root, groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id });
|
|
125
125
|
}
|
|
126
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.GetGroupFeed), { url: () => api_services_1.Endpoints.GetGroupFeed.url({ id: scGroup.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
markRead: scUser ? !((_a = item === null || item === void 0 ? void 0 : item.seen_by_id) === null || _a === void 0 ? void 0 : _a.includes(scUser.id)) : null
|
|
133
|
-
});
|
|
134
|
-
}, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
126
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.GetGroupFeed), { url: () => api_services_1.Endpoints.GetGroupFeed.url({ id: scGroup.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
127
|
+
feedObject: item[item.type],
|
|
128
|
+
feedObjectType: item.type,
|
|
129
|
+
feedObjectActivities: item.activities ? item.activities : null,
|
|
130
|
+
markRead: scUser ? !(item === null || item === void 0 ? void 0 : item.seen) : null
|
|
131
|
+
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
135
132
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
136
133
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: scGroup &&
|
|
137
134
|
scGroup.subscription_status === types_1.SCGroupSubscriptionStatusType.SUBSCRIBED && ((0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { group: scGroup }, label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "templates.groupFeed.composer.label", defaultMessage: "templates.groupFeed.composer.label" }), feedType: types_1.SCFeedTypologyType.GROUP })), CustomAdvProps: { position: types_1.SCCustomAdvPosition.POSITION_FEED, groupsId: [scGroup.id] }, enabledCustomAdvPositions: [
|
|
@@ -103,7 +103,7 @@ function MainFeed(inProps) {
|
|
|
103
103
|
const feedUnit = {
|
|
104
104
|
type: feedObject.type,
|
|
105
105
|
[feedObject.type]: feedObject,
|
|
106
|
-
|
|
106
|
+
seen: false,
|
|
107
107
|
has_boost: false
|
|
108
108
|
};
|
|
109
109
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -116,7 +116,7 @@ function MainFeed(inProps) {
|
|
|
116
116
|
const feedUnit = {
|
|
117
117
|
type: feedObject.type,
|
|
118
118
|
[feedObject.type]: feedObject,
|
|
119
|
-
|
|
119
|
+
seen: false,
|
|
120
120
|
has_boost: false
|
|
121
121
|
};
|
|
122
122
|
feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -128,7 +128,7 @@ function MainFeed(inProps) {
|
|
|
128
128
|
feedObject: item[item.type],
|
|
129
129
|
feedObjectType: item.type,
|
|
130
130
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
131
|
-
markRead: scUser ? !item.
|
|
131
|
+
markRead: scUser ? !item.seen : null
|
|
132
132
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
133
133
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
134
134
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }), react_core_1.UserUtils.isAdmin(scUserContext.user) && (0, jsx_runtime_1.jsx)(react_ui_1.OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), requireAuthentication: true, disablePaginationLinks: true, enabledCustomAdvPositions: [
|
|
@@ -101,7 +101,7 @@ function UserFeed(inProps) {
|
|
|
101
101
|
const feedUnit = {
|
|
102
102
|
type: feedObject.type,
|
|
103
103
|
[feedObject.type]: feedObject,
|
|
104
|
-
|
|
104
|
+
seen: false,
|
|
105
105
|
has_boost: false
|
|
106
106
|
};
|
|
107
107
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -88,7 +88,7 @@ export default function CategoryFeed(inProps) {
|
|
|
88
88
|
if (feedObject.categories.findIndex((c) => c.id === scCategory.id) === -1) {
|
|
89
89
|
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
|
|
90
90
|
enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
91
|
-
action: (
|
|
91
|
+
action: () => (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], ContributionUtils.getRouteData(feedObject)) }, { children: _jsx(FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }) }))),
|
|
92
92
|
variant: 'success',
|
|
93
93
|
autoHideDuration: 7000
|
|
94
94
|
});
|
|
@@ -98,7 +98,7 @@ export default function CategoryFeed(inProps) {
|
|
|
98
98
|
const feedUnit = {
|
|
99
99
|
type: feedObject.type,
|
|
100
100
|
[feedObject.type]: feedObject,
|
|
101
|
-
|
|
101
|
+
seen: false,
|
|
102
102
|
has_boost: false
|
|
103
103
|
};
|
|
104
104
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -120,7 +120,7 @@ export default function CategoryFeed(inProps) {
|
|
|
120
120
|
feedObject: item[item.type],
|
|
121
121
|
feedObjectType: item.type,
|
|
122
122
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
123
|
-
markRead: scUser ? !item.
|
|
123
|
+
markRead: scUser ? !item.seen : null
|
|
124
124
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
125
125
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
126
126
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsx(_Fragment, { children: ((scCategory.content_only_staff && UserUtils.isStaff(scUserContext.user)) || !scCategory.content_only_staff) && (_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { categories: [scCategory] }, feedType: SCFeedTypologyType.CATEGORY })) }), CustomAdvProps: { categoriesId: [scCategory.id] }, enabledCustomAdvPositions: [
|
|
@@ -116,7 +116,7 @@ export default function EventFeed(inProps) {
|
|
|
116
116
|
const feedUnit = {
|
|
117
117
|
type: feedObject.type,
|
|
118
118
|
[feedObject.type]: feedObject,
|
|
119
|
-
|
|
119
|
+
seen: false,
|
|
120
120
|
has_boost: false
|
|
121
121
|
};
|
|
122
122
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -143,15 +143,12 @@ export default function EventFeed(inProps) {
|
|
|
143
143
|
status !== SCEventSubscriptionStatusType.NOT_GOING))) {
|
|
144
144
|
return (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(EventInfoWidget, { className: classes.root, event: scEvent }) })));
|
|
145
145
|
}
|
|
146
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, Endpoints.GetEventFeed), { url: () => Endpoints.GetEventFeed.url({ id: scEvent.id }) }), widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
markRead: scUser ? !((_a = item === null || item === void 0 ? void 0 : item.seen_by_id) === null || _a === void 0 ? void 0 : _a.includes(scUser.id)) : null
|
|
153
|
-
});
|
|
154
|
-
}, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
146
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, Endpoints.GetEventFeed), { url: () => Endpoints.GetEventFeed.url({ id: scEvent.id }) }), widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
147
|
+
feedObject: item[item.type],
|
|
148
|
+
feedObjectType: item.type,
|
|
149
|
+
feedObjectActivities: item.activities ? item.activities : null,
|
|
150
|
+
markRead: scUser ? !(item === null || item === void 0 ? void 0 : item.seen) : null
|
|
151
|
+
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
155
152
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
156
153
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(EventInfoWidget, { className: classes.root, event: scEvent }), Boolean(scEvent &&
|
|
157
154
|
((!scUserContext.user && scEvent.privacy === SCEventPrivacyType.PUBLIC) ||
|
|
@@ -96,7 +96,7 @@ export default function ExploreFeed(inProps) {
|
|
|
96
96
|
const feedUnit = {
|
|
97
97
|
type: feedObject.type,
|
|
98
98
|
[feedObject.type]: feedObject,
|
|
99
|
-
|
|
99
|
+
seen: false,
|
|
100
100
|
has_boost: false
|
|
101
101
|
};
|
|
102
102
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -109,7 +109,7 @@ export default function ExploreFeed(inProps) {
|
|
|
109
109
|
const feedUnit = {
|
|
110
110
|
type: feedObject.type,
|
|
111
111
|
[feedObject.type]: feedObject,
|
|
112
|
-
|
|
112
|
+
seen: false,
|
|
113
113
|
has_boost: false
|
|
114
114
|
};
|
|
115
115
|
feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -125,7 +125,7 @@ export default function ExploreFeed(inProps) {
|
|
|
125
125
|
feedObject: item[item.type],
|
|
126
126
|
feedObjectType: item.type,
|
|
127
127
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
128
|
-
markRead: scUser ? !item.
|
|
128
|
+
markRead: scUser ? !item.seen : null
|
|
129
129
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
130
130
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
131
131
|
}, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess }), UserUtils.isAdmin(scUserContext.user) && _jsx(OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), FeedSidebarProps: FeedSidebarProps, enabledCustomAdvPositions: [
|
|
@@ -73,7 +73,7 @@ export default function GroupFeed(inProps) {
|
|
|
73
73
|
const scUserContext = useSCUser();
|
|
74
74
|
const scGroupsManager = scUserContext.managers.groups;
|
|
75
75
|
const { enqueueSnackbar } = useSnackbar();
|
|
76
|
-
const { scGroup
|
|
76
|
+
const { scGroup } = useSCFetchGroup({ id: groupId, group });
|
|
77
77
|
// REF
|
|
78
78
|
const feedRef = useRef();
|
|
79
79
|
// CONST
|
|
@@ -92,7 +92,7 @@ export default function GroupFeed(inProps) {
|
|
|
92
92
|
var _a;
|
|
93
93
|
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
|
|
94
94
|
enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
95
|
-
action: (
|
|
95
|
+
action: () => (_jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], ContributionUtils.getRouteData(feedObject)) }, { children: _jsx(FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }) }))),
|
|
96
96
|
variant: 'success',
|
|
97
97
|
autoHideDuration: 7000
|
|
98
98
|
});
|
|
@@ -101,7 +101,7 @@ export default function GroupFeed(inProps) {
|
|
|
101
101
|
const feedUnit = {
|
|
102
102
|
type: feedObject.type,
|
|
103
103
|
[feedObject.type]: feedObject,
|
|
104
|
-
|
|
104
|
+
seen: false,
|
|
105
105
|
has_boost: false
|
|
106
106
|
};
|
|
107
107
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -120,15 +120,12 @@ export default function GroupFeed(inProps) {
|
|
|
120
120
|
else if (scGroup && status !== SCGroupSubscriptionStatusType.SUBSCRIBED) {
|
|
121
121
|
return _jsx(GroupInfoWidget, { className: classes.root, groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id });
|
|
122
122
|
}
|
|
123
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, Endpoints.GetGroupFeed), { url: () => Endpoints.GetGroupFeed.url({ id: scGroup.id }) }), widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
markRead: scUser ? !((_a = item === null || item === void 0 ? void 0 : item.seen_by_id) === null || _a === void 0 ? void 0 : _a.includes(scUser.id)) : null
|
|
130
|
-
});
|
|
131
|
-
}, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
123
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, Endpoints.GetGroupFeed), { url: () => Endpoints.GetGroupFeed.url({ id: scGroup.id }) }), widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
124
|
+
feedObject: item[item.type],
|
|
125
|
+
feedObjectType: item.type,
|
|
126
|
+
feedObjectActivities: item.activities ? item.activities : null,
|
|
127
|
+
markRead: scUser ? !(item === null || item === void 0 ? void 0 : item.seen) : null
|
|
128
|
+
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
132
129
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
133
130
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: scGroup &&
|
|
134
131
|
scGroup.subscription_status === SCGroupSubscriptionStatusType.SUBSCRIBED && (_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { group: scGroup }, label: _jsx(FormattedMessage, { id: "templates.groupFeed.composer.label", defaultMessage: "templates.groupFeed.composer.label" }), feedType: SCFeedTypologyType.GROUP })), CustomAdvProps: { position: SCCustomAdvPosition.POSITION_FEED, groupsId: [scGroup.id] }, enabledCustomAdvPositions: [
|
|
@@ -100,7 +100,7 @@ export default function MainFeed(inProps) {
|
|
|
100
100
|
const feedUnit = {
|
|
101
101
|
type: feedObject.type,
|
|
102
102
|
[feedObject.type]: feedObject,
|
|
103
|
-
|
|
103
|
+
seen: false,
|
|
104
104
|
has_boost: false
|
|
105
105
|
};
|
|
106
106
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -113,7 +113,7 @@ export default function MainFeed(inProps) {
|
|
|
113
113
|
const feedUnit = {
|
|
114
114
|
type: feedObject.type,
|
|
115
115
|
[feedObject.type]: feedObject,
|
|
116
|
-
|
|
116
|
+
seen: false,
|
|
117
117
|
has_boost: false
|
|
118
118
|
};
|
|
119
119
|
feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -125,7 +125,7 @@ export default function MainFeed(inProps) {
|
|
|
125
125
|
feedObject: item[item.type],
|
|
126
126
|
feedObjectType: item.type,
|
|
127
127
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
128
|
-
markRead: scUser ? !item.
|
|
128
|
+
markRead: scUser ? !item.seen : null
|
|
129
129
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
130
130
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
131
131
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess }), UserUtils.isAdmin(scUserContext.user) && _jsx(OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), requireAuthentication: true, disablePaginationLinks: true, enabledCustomAdvPositions: [
|
|
@@ -98,7 +98,7 @@ export default function UserFeed(inProps) {
|
|
|
98
98
|
const feedUnit = {
|
|
99
99
|
type: feedObject.type,
|
|
100
100
|
[feedObject.type]: feedObject,
|
|
101
|
-
|
|
101
|
+
seen: false,
|
|
102
102
|
has_boost: false
|
|
103
103
|
};
|
|
104
104
|
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|