@selfcommunity/react-templates 0.3.50-events.77 → 0.3.50-events.78
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.
|
@@ -101,6 +101,22 @@ function ExploreFeed(inProps) {
|
|
|
101
101
|
};
|
|
102
102
|
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
103
103
|
};
|
|
104
|
+
const handleAddGenerationContent = (feedObjects) => {
|
|
105
|
+
if (feedRef && feedRef.current) {
|
|
106
|
+
const currentFeedObjectIds = feedRef.current.getCurrentFeedObjectIds();
|
|
107
|
+
feedObjects.forEach((feedObject) => {
|
|
108
|
+
if (!currentFeedObjectIds.includes(feedObject.id)) {
|
|
109
|
+
const feedUnit = {
|
|
110
|
+
type: feedObject.type,
|
|
111
|
+
[feedObject.type]: feedObject,
|
|
112
|
+
seen_by_id: [],
|
|
113
|
+
has_boost: false
|
|
114
|
+
};
|
|
115
|
+
feedRef.current.addFeedData(feedUnit, true);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
104
120
|
// WIDGETS
|
|
105
121
|
const _widgets = (0, react_1.useMemo)(() => widgets.map((w) => {
|
|
106
122
|
return Object.assign(Object.assign({}, w), { componentProps: Object.assign({}, w.componentProps) });
|
|
@@ -112,7 +128,7 @@ function ExploreFeed(inProps) {
|
|
|
112
128
|
markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
|
|
113
129
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
114
130
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
115
|
-
}, HeaderComponent: (0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }), FeedSidebarProps: FeedSidebarProps, enabledCustomAdvPositions: [
|
|
131
|
+
}, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }), " ", (0, jsx_runtime_1.jsx)(react_ui_1.OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), FeedSidebarProps: FeedSidebarProps, enabledCustomAdvPositions: [
|
|
116
132
|
types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
117
133
|
types_1.SCCustomAdvPosition.POSITION_FEED,
|
|
118
134
|
types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
@@ -107,6 +107,19 @@ function MainFeed(inProps) {
|
|
|
107
107
|
};
|
|
108
108
|
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
109
109
|
};
|
|
110
|
+
const handleAddGenerationContent = (feedObjects) => {
|
|
111
|
+
feedObjects.forEach((feedObject) => {
|
|
112
|
+
if (!feedRef && feedRef.current && feedRef.current.getCurrentFeedObjectIds().includes(feedObject.id)) {
|
|
113
|
+
const feedUnit = {
|
|
114
|
+
type: feedObject.type,
|
|
115
|
+
[feedObject.type]: feedObject,
|
|
116
|
+
seen_by_id: [],
|
|
117
|
+
has_boost: false
|
|
118
|
+
};
|
|
119
|
+
feedRef.current.addFeedData(feedUnit, true);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
};
|
|
110
123
|
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className), ref: feedRef, endpoint: api_services_1.Endpoints.MainFeed, widgets: widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
111
124
|
feedObject: item[item.type],
|
|
112
125
|
feedObjectType: item.type,
|
|
@@ -114,7 +127,7 @@ function MainFeed(inProps) {
|
|
|
114
127
|
markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
|
|
115
128
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
116
129
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
117
|
-
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }), requireAuthentication: true, disablePaginationLinks: true, enabledCustomAdvPositions: [
|
|
130
|
+
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess }), " ", (0, jsx_runtime_1.jsx)(react_ui_1.OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), requireAuthentication: true, disablePaginationLinks: true, enabledCustomAdvPositions: [
|
|
118
131
|
types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
119
132
|
types_1.SCCustomAdvPosition.POSITION_FEED,
|
|
120
133
|
types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useRef } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
|
-
import { CategoriesPopularWidget, Feed, FeedObject, FeedObjectSkeleton, SCFeedObjectTemplateType, InlineComposerWidget, LoyaltyProgramWidget, UserSuggestionWidget, PlatformWidget } from '@selfcommunity/react-ui';
|
|
4
|
+
import { CategoriesPopularWidget, Feed, FeedObject, FeedObjectSkeleton, SCFeedObjectTemplateType, InlineComposerWidget, LoyaltyProgramWidget, UserSuggestionWidget, PlatformWidget, OnBoardingWidget } from '@selfcommunity/react-ui';
|
|
5
5
|
import { Endpoints } from '@selfcommunity/api-services';
|
|
6
6
|
import { useThemeProps } from '@mui/system';
|
|
7
7
|
import classNames from 'classnames';
|
|
@@ -98,6 +98,22 @@ export default function ExploreFeed(inProps) {
|
|
|
98
98
|
};
|
|
99
99
|
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
100
100
|
};
|
|
101
|
+
const handleAddGenerationContent = (feedObjects) => {
|
|
102
|
+
if (feedRef && feedRef.current) {
|
|
103
|
+
const currentFeedObjectIds = feedRef.current.getCurrentFeedObjectIds();
|
|
104
|
+
feedObjects.forEach((feedObject) => {
|
|
105
|
+
if (!currentFeedObjectIds.includes(feedObject.id)) {
|
|
106
|
+
const feedUnit = {
|
|
107
|
+
type: feedObject.type,
|
|
108
|
+
[feedObject.type]: feedObject,
|
|
109
|
+
seen_by_id: [],
|
|
110
|
+
has_boost: false
|
|
111
|
+
};
|
|
112
|
+
feedRef.current.addFeedData(feedUnit, true);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
101
117
|
// WIDGETS
|
|
102
118
|
const _widgets = useMemo(() => widgets.map((w) => {
|
|
103
119
|
return Object.assign(Object.assign({}, w), { componentProps: Object.assign({}, w.componentProps) });
|
|
@@ -109,7 +125,7 @@ export default function ExploreFeed(inProps) {
|
|
|
109
125
|
markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
|
|
110
126
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
111
127
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
112
|
-
}, HeaderComponent: _jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess }), FeedSidebarProps: FeedSidebarProps, enabledCustomAdvPositions: [
|
|
128
|
+
}, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess }), " ", _jsx(OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), FeedSidebarProps: FeedSidebarProps, enabledCustomAdvPositions: [
|
|
113
129
|
SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
114
130
|
SCCustomAdvPosition.POSITION_FEED,
|
|
115
131
|
SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useRef } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
|
-
import { CategoriesSuggestionWidget, Feed, FeedObject, FeedObjectSkeleton, SCFeedObjectTemplateType, InlineComposerWidget, LoyaltyProgramWidget, UserSuggestionWidget, PlatformWidget } from '@selfcommunity/react-ui';
|
|
4
|
+
import { CategoriesSuggestionWidget, Feed, FeedObject, FeedObjectSkeleton, SCFeedObjectTemplateType, InlineComposerWidget, LoyaltyProgramWidget, UserSuggestionWidget, PlatformWidget, OnBoardingWidget } from '@selfcommunity/react-ui';
|
|
5
5
|
import { Endpoints } from '@selfcommunity/api-services';
|
|
6
6
|
import { SCUserContext } from '@selfcommunity/react-core';
|
|
7
7
|
import { useThemeProps } from '@mui/system';
|
|
@@ -104,6 +104,19 @@ export default function MainFeed(inProps) {
|
|
|
104
104
|
};
|
|
105
105
|
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
106
106
|
};
|
|
107
|
+
const handleAddGenerationContent = (feedObjects) => {
|
|
108
|
+
feedObjects.forEach((feedObject) => {
|
|
109
|
+
if (!feedRef && feedRef.current && feedRef.current.getCurrentFeedObjectIds().includes(feedObject.id)) {
|
|
110
|
+
const feedUnit = {
|
|
111
|
+
type: feedObject.type,
|
|
112
|
+
[feedObject.type]: feedObject,
|
|
113
|
+
seen_by_id: [],
|
|
114
|
+
has_boost: false
|
|
115
|
+
};
|
|
116
|
+
feedRef.current.addFeedData(feedUnit, true);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
};
|
|
107
120
|
return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className), ref: feedRef, endpoint: Endpoints.MainFeed, widgets: widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
108
121
|
feedObject: item[item.type],
|
|
109
122
|
feedObjectType: item.type,
|
|
@@ -111,7 +124,7 @@ export default function MainFeed(inProps) {
|
|
|
111
124
|
markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
|
|
112
125
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
113
126
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
114
|
-
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess }), requireAuthentication: true, disablePaginationLinks: true, enabledCustomAdvPositions: [
|
|
127
|
+
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess }), " ", _jsx(OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), requireAuthentication: true, disablePaginationLinks: true, enabledCustomAdvPositions: [
|
|
115
128
|
SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
116
129
|
SCCustomAdvPosition.POSITION_FEED,
|
|
117
130
|
SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|