@selfcommunity/react-templates 0.5.0-alpha.2 → 0.5.0-alpha.21
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/Category/Category.js +1 -2
- package/lib/cjs/components/Category/Skeleton.js +1 -2
- package/lib/cjs/components/CategoryFeed/CategoryFeed.js +18 -7
- package/lib/cjs/components/CategoryFeed/Skeleton.js +2 -2
- package/lib/cjs/components/Event/Event.js +1 -2
- package/lib/cjs/components/Event/Skeleton.js +1 -2
- package/lib/cjs/components/EventFeed/EventFeed.js +37 -26
- package/lib/cjs/components/EventFeed/Skeleton.js +2 -2
- package/lib/cjs/components/ExploreFeed/ExploreFeed.js +8 -7
- package/lib/cjs/components/ExploreFeed/Skeleton.js +2 -2
- package/lib/cjs/components/FeedObjectDetail/FeedObjectDetail.js +5 -4
- package/lib/cjs/components/FeedObjectDetail/Skeleton.js +1 -2
- package/lib/cjs/components/Group/Group.js +1 -2
- package/lib/cjs/components/Group/Skeleton.js +1 -2
- package/lib/cjs/components/GroupFeed/GroupFeed.js +30 -18
- package/lib/cjs/components/GroupFeed/Skeleton.js +2 -2
- package/lib/cjs/components/Lesson/Lesson.js +2 -3
- package/lib/cjs/components/LoyaltyProgramDetail/LoyaltyProgramDetail.js +2 -4
- package/lib/cjs/components/LoyaltyProgramDetail/PointsList.js +1 -2
- package/lib/cjs/components/LoyaltyProgramDetail/PrizeItemSkeleton.js +1 -2
- package/lib/cjs/components/LoyaltyProgramDetail/Skeleton.js +1 -2
- package/lib/cjs/components/MainFeed/MainFeed.js +8 -7
- package/lib/cjs/components/MainFeed/Skeleton.js +2 -2
- package/lib/cjs/components/NotificationFeed/NotificationFeed.js +2 -2
- package/lib/cjs/components/NotificationFeed/Skeleton.js +2 -2
- package/lib/cjs/components/UserFeed/Skeleton.js +2 -2
- package/lib/cjs/components/UserFeed/UserFeed.js +6 -5
- package/lib/cjs/components/UserProfile/Skeleton.js +1 -2
- package/lib/cjs/components/UserProfile/UserProfile.js +6 -4
- package/lib/esm/components/Category/Category.js +1 -2
- package/lib/esm/components/Category/Skeleton.js +1 -2
- package/lib/esm/components/CategoryFeed/CategoryFeed.js +20 -9
- package/lib/esm/components/CategoryFeed/Skeleton.js +1 -1
- package/lib/esm/components/Event/Event.js +1 -2
- package/lib/esm/components/Event/Skeleton.js +1 -2
- package/lib/esm/components/EventFeed/EventFeed.js +37 -26
- package/lib/esm/components/EventFeed/Skeleton.js +1 -1
- package/lib/esm/components/ExploreFeed/ExploreFeed.js +7 -6
- package/lib/esm/components/ExploreFeed/Skeleton.js +1 -1
- package/lib/esm/components/FeedObjectDetail/FeedObjectDetail.js +5 -4
- package/lib/esm/components/FeedObjectDetail/Skeleton.js +1 -2
- package/lib/esm/components/Group/Group.js +1 -2
- package/lib/esm/components/Group/Skeleton.js +1 -2
- package/lib/esm/components/GroupFeed/GroupFeed.js +31 -19
- package/lib/esm/components/GroupFeed/Skeleton.js +1 -1
- package/lib/esm/components/Lesson/Lesson.js +1 -2
- package/lib/esm/components/LoyaltyProgramDetail/LoyaltyProgramDetail.js +1 -3
- package/lib/esm/components/LoyaltyProgramDetail/PointsList.js +1 -2
- package/lib/esm/components/LoyaltyProgramDetail/PrizeItemSkeleton.js +1 -2
- package/lib/esm/components/LoyaltyProgramDetail/Skeleton.js +1 -2
- package/lib/esm/components/MainFeed/MainFeed.js +7 -6
- package/lib/esm/components/MainFeed/Skeleton.js +1 -1
- package/lib/esm/components/NotificationFeed/NotificationFeed.js +1 -1
- package/lib/esm/components/NotificationFeed/Skeleton.js +1 -1
- package/lib/esm/components/UserFeed/Skeleton.js +1 -1
- package/lib/esm/components/UserFeed/UserFeed.js +5 -4
- package/lib/esm/components/UserProfile/Skeleton.js +1 -2
- package/lib/esm/components/UserProfile/UserProfile.js +6 -4
- package/lib/umd/{c473ce30406a3dad83e1.eot → 30b299174b4fa1fb9ce8.eot} +0 -0
- package/lib/umd/{b6dbec3d5816ff8baef1.woff → 3b49304a98beb1239bc7.ttf} +0 -0
- package/lib/umd/589.js +2 -0
- package/lib/umd/738.js +1 -1
- package/lib/umd/73cbb3dbfaa3ddd4df47.js +2 -0
- package/lib/umd/73cbb3dbfaa3ddd4df47.js.LICENSE.txt +21 -0
- package/lib/umd/ab247f43e550f5f6d0f8.woff2 +0 -0
- package/lib/umd/{ba74e493633796d551d1.ttf → ce10db0c87e7112cb315.woff} +0 -0
- package/lib/umd/{6158171e38cbff3c3340.svg → fff8590360ed9eed64ae.svg} +75 -69
- package/lib/umd/react-templates.js +1 -1
- package/package.json +9 -6
- package/lib/umd/60a7fdeaadfe844bc015.woff2 +0 -0
- package/lib/umd/916.js +0 -2
- /package/lib/umd/{916.js.LICENSE.txt → 589.js.LICENSE.txt} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useMemo, useRef } from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
3
|
+
import { styled } from '@mui/material';
|
|
4
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';
|
|
@@ -87,7 +87,8 @@ export default function ExploreFeed(inProps) {
|
|
|
87
87
|
const feedRef = useRef();
|
|
88
88
|
// HANDLERS
|
|
89
89
|
const handleComposerSuccess = (feedObject) => {
|
|
90
|
-
|
|
90
|
+
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.inlineComposerWidget.success';
|
|
91
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
91
92
|
variant: 'success',
|
|
92
93
|
autoHideDuration: 3000
|
|
93
94
|
});
|
|
@@ -95,10 +96,10 @@ export default function ExploreFeed(inProps) {
|
|
|
95
96
|
const feedUnit = {
|
|
96
97
|
type: feedObject.type,
|
|
97
98
|
[feedObject.type]: feedObject,
|
|
98
|
-
|
|
99
|
+
seen: false,
|
|
99
100
|
has_boost: false
|
|
100
101
|
};
|
|
101
|
-
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
102
|
+
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
102
103
|
};
|
|
103
104
|
const handleAddGenerationContent = (feedObjects) => {
|
|
104
105
|
if (feedRef && feedRef.current) {
|
|
@@ -108,7 +109,7 @@ export default function ExploreFeed(inProps) {
|
|
|
108
109
|
const feedUnit = {
|
|
109
110
|
type: feedObject.type,
|
|
110
111
|
[feedObject.type]: feedObject,
|
|
111
|
-
|
|
112
|
+
seen: false,
|
|
112
113
|
has_boost: false
|
|
113
114
|
};
|
|
114
115
|
feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -124,7 +125,7 @@ export default function ExploreFeed(inProps) {
|
|
|
124
125
|
feedObject: item[item.type],
|
|
125
126
|
feedObjectType: item.type,
|
|
126
127
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
127
|
-
markRead: scUser ? !item.
|
|
128
|
+
markRead: scUser ? !item.seen : null
|
|
128
129
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
129
130
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
130
131
|
}, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess }), UserUtils.isAdmin(scUserContext.user) && _jsx(OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), FeedSidebarProps: FeedSidebarProps, enabledCustomAdvPositions: [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
3
|
+
import { styled } from '@mui/material';
|
|
4
4
|
import { FeedObjectSkeleton, SCFeedObjectTemplateType, FeedSkeleton, GenericSkeleton, InlineComposerWidgetSkeleton } from '@selfcommunity/react-ui';
|
|
5
5
|
import { PREFIX } from './constants';
|
|
6
6
|
const classes = {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
4
|
-
import { Box, Grid, Hidden } from '@mui/material';
|
|
3
|
+
import { Box, Grid, Hidden, styled } from '@mui/material';
|
|
5
4
|
import { CommentsFeedObject, CustomAdv, FeedObject, RelatedFeedObjectsWidget, SCFeedObjectTemplateType, StickyBox } from '@selfcommunity/react-ui';
|
|
6
5
|
import FeedObjectDetailSkeleton from './Skeleton';
|
|
7
6
|
import { useThemeProps } from '@mui/system';
|
|
@@ -54,8 +53,10 @@ export default function FeedObjectDetail(inProps) {
|
|
|
54
53
|
const scUserContext = useSCUser();
|
|
55
54
|
const scPreferences = useSCPreferences();
|
|
56
55
|
// RETRIVE OBJECTS
|
|
57
|
-
const { obj,
|
|
56
|
+
const { obj, error } = useSCFetchFeedObject({ id: feedObjectId, feedObject, feedObjectType });
|
|
58
57
|
const [comments, setComments] = useState([]);
|
|
58
|
+
const commentsEnabled = SCPreferences.CONFIGURATIONS_COMMENTS_ENABLED in scPreferences.preferences &&
|
|
59
|
+
scPreferences.preferences[SCPreferences.CONFIGURATIONS_COMMENTS_ENABLED].value;
|
|
59
60
|
/**
|
|
60
61
|
* Compute preferences
|
|
61
62
|
*/
|
|
@@ -94,5 +95,5 @@ export default function FeedObjectDetail(inProps) {
|
|
|
94
95
|
if (!obj) {
|
|
95
96
|
return _jsx(FeedObjectDetailSkeleton, {});
|
|
96
97
|
}
|
|
97
|
-
return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, { children: _jsxs(Grid, Object.assign({ container: true, spacing: 2 }, { children: [_jsxs(Grid, Object.assign({ item: true, xs: 12, md: 7 }, { children: [_jsx(FeedObject, Object.assign({}, FeedObjectProps, { feedObject: obj, template: SCFeedObjectTemplateType.DETAIL, onReply: handleReply })), renderAdvertising(), _jsx(CommentsFeedObject, Object.assign({ showTitle: true, feedObject: obj, comments: comments }, CommentsFeedObjectProps), `comments_${obj.id}`)] })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 5 }, { children: _jsx(Hidden, Object.assign({ mdDown: true }, { children: _jsx(StickyBox, Object.assign({}, FeedSidebarProps, { children: _jsx(RelatedFeedObjectsWidget, Object.assign({ feedObject: obj, feedObjectId: obj.id }, RelatedFeedObjectProps), `related_${obj.id}`) })) })) }))] })) })));
|
|
98
|
+
return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, { children: _jsxs(Grid, Object.assign({ container: true, spacing: 2 }, { children: [_jsxs(Grid, Object.assign({ item: true, xs: 12, md: 7 }, { children: [_jsx(FeedObject, Object.assign({}, FeedObjectProps, { feedObject: obj, template: SCFeedObjectTemplateType.DETAIL, onReply: handleReply })), renderAdvertising(), commentsEnabled && (_jsx(CommentsFeedObject, Object.assign({ showTitle: true, feedObject: obj, comments: comments }, CommentsFeedObjectProps), `comments_${obj.id}`))] })), _jsx(Grid, Object.assign({ item: true, xs: 12, md: 5 }, { children: _jsx(Hidden, Object.assign({ mdDown: true }, { children: _jsx(StickyBox, Object.assign({}, FeedSidebarProps, { children: _jsx(RelatedFeedObjectsWidget, Object.assign({ feedObject: obj, feedObjectId: obj.id }, RelatedFeedObjectProps), `related_${obj.id}`) })) })) }))] })) })));
|
|
98
99
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CommentsFeedObjectSkeleton, FeedObjectSkeleton, SCFeedObjectTemplateType, RelatedFeedObjectsWidgetSkeleton } from '@selfcommunity/react-ui';
|
|
3
|
-
import { Box, Grid } from '@mui/material';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
3
|
+
import { Box, Grid, styled } from '@mui/material';
|
|
5
4
|
import { PREFIX } from './constants';
|
|
6
5
|
const classes = {
|
|
7
6
|
root: `${PREFIX}-skeleton-root`
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { styled } from '@mui/material
|
|
3
|
-
import { Box } from '@mui/material';
|
|
2
|
+
import { Box, styled } from '@mui/material';
|
|
4
3
|
import { GroupHeader } from '@selfcommunity/react-ui';
|
|
5
4
|
import { useSCFetchGroup } from '@selfcommunity/react-core';
|
|
6
5
|
import GroupSkeletonTemplate from './Skeleton';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box } from '@mui/material';
|
|
3
|
-
import { styled } from '@mui/material/styles';
|
|
2
|
+
import { Box, styled } from '@mui/material';
|
|
4
3
|
import GroupFeedSkeleton from '../GroupFeed/Skeleton';
|
|
5
4
|
import { GroupHeaderSkeleton } from '@selfcommunity/react-ui';
|
|
6
5
|
import { PREFIX } from './constants';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useRef } from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { styled } from '@mui/material';
|
|
4
4
|
import { ContributionUtils, Feed, FeedObject, FeedObjectSkeleton, GroupInfoWidget, GroupMembersWidget, InlineComposerWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
|
|
5
5
|
import { Endpoints } from '@selfcommunity/api-services';
|
|
6
|
-
import { Link, SCRoutes, useSCFetchGroup, useSCRouting } from '@selfcommunity/react-core';
|
|
6
|
+
import { Link, SCRoutes, useSCFetchGroup, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
7
7
|
import { SCCustomAdvPosition, SCFeedTypologyType, SCGroupSubscriptionStatusType } from '@selfcommunity/types';
|
|
8
8
|
import { useThemeProps } from '@mui/system';
|
|
9
9
|
import classNames from 'classnames';
|
|
@@ -66,18 +66,33 @@ export default function GroupFeed(inProps) {
|
|
|
66
66
|
name: PREFIX
|
|
67
67
|
});
|
|
68
68
|
const { id = 'group_feed', className, group, groupId, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
|
|
69
|
+
// STATUS
|
|
70
|
+
const [status, setStatus] = useState(undefined);
|
|
69
71
|
// CONTEXT
|
|
70
72
|
const scRoutingContext = useSCRouting();
|
|
73
|
+
const scUserContext = useSCUser();
|
|
74
|
+
const scGroupsManager = scUserContext.managers.groups;
|
|
71
75
|
const { enqueueSnackbar } = useSnackbar();
|
|
76
|
+
const { scGroup } = useSCFetchGroup({ id: groupId, group });
|
|
72
77
|
// REF
|
|
73
78
|
const feedRef = useRef();
|
|
74
|
-
//
|
|
75
|
-
const
|
|
79
|
+
// CONST
|
|
80
|
+
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
/**
|
|
83
|
+
* Call scGroupsManager.subscriptionStatus inside an effect
|
|
84
|
+
* to avoid warning rendering child during update parent state
|
|
85
|
+
*/
|
|
86
|
+
if (authUserId) {
|
|
87
|
+
setStatus(scGroupsManager.subscriptionStatus(scGroup));
|
|
88
|
+
}
|
|
89
|
+
}, [authUserId, scGroupsManager.subscriptionStatus, scGroup]);
|
|
76
90
|
// HANDLERS
|
|
77
91
|
const handleComposerSuccess = (feedObject) => {
|
|
78
92
|
var _a;
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
|
|
94
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
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" }) }))),
|
|
81
96
|
variant: 'success',
|
|
82
97
|
autoHideDuration: 7000
|
|
83
98
|
});
|
|
@@ -86,10 +101,10 @@ export default function GroupFeed(inProps) {
|
|
|
86
101
|
const feedUnit = {
|
|
87
102
|
type: feedObject.type,
|
|
88
103
|
[feedObject.type]: feedObject,
|
|
89
|
-
|
|
104
|
+
seen: false,
|
|
90
105
|
has_boost: false
|
|
91
106
|
};
|
|
92
|
-
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
107
|
+
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
93
108
|
}
|
|
94
109
|
};
|
|
95
110
|
// WIDGETS
|
|
@@ -102,18 +117,15 @@ export default function GroupFeed(inProps) {
|
|
|
102
117
|
if (!scGroup) {
|
|
103
118
|
return _jsx(GroupFeedSkeleton, {});
|
|
104
119
|
}
|
|
105
|
-
else if (scGroup &&
|
|
120
|
+
else if (scGroup && status !== SCGroupSubscriptionStatusType.SUBSCRIBED) {
|
|
106
121
|
return _jsx(GroupInfoWidget, { className: classes.root, groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id });
|
|
107
122
|
}
|
|
108
|
-
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) => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
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
|
|
115
|
-
});
|
|
116
|
-
}, 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: {
|
|
117
129
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
118
130
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: scGroup &&
|
|
119
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: [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
3
|
+
import { styled } from '@mui/material';
|
|
4
4
|
import { FeedObjectSkeleton, SCFeedObjectTemplateType, FeedSkeleton, GenericSkeleton, InlineComposerWidgetSkeleton } from '@selfcommunity/react-ui';
|
|
5
5
|
import { PREFIX } from './constants';
|
|
6
6
|
const classes = {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
5
4
|
import { useThemeProps } from '@mui/system';
|
|
6
|
-
import { Box, Icon, IconButton, Typography, useMediaQuery, useTheme, Alert } from '@mui/material';
|
|
5
|
+
import { Box, Icon, IconButton, Typography, useMediaQuery, useTheme, Alert, styled } from '@mui/material';
|
|
7
6
|
import { PREFIX } from './constants';
|
|
8
7
|
import { SCCourseJoinStatusType, SCCourseLessonCompletionStatusType } from '@selfcommunity/types';
|
|
9
8
|
import { SCRoutes, useSCFetchCourse, useSCFetchLesson, useSCRouting, Link } from '@selfcommunity/react-core';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useContext, useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
5
4
|
import { http, Endpoints, UserService, LoyaltyService } from '@selfcommunity/api-services';
|
|
6
5
|
import { SCUserContext } from '@selfcommunity/react-core';
|
|
7
|
-
import { Box, Button, Card, CardActions, CardContent, CardMedia, Grid, Typography, useMediaQuery, useTheme } from '@mui/material';
|
|
6
|
+
import { Box, Button, Card, CardActions, CardContent, CardMedia, Grid, Typography, useMediaQuery, useTheme, styled, Chip } from '@mui/material';
|
|
8
7
|
import { FormattedMessage } from 'react-intl';
|
|
9
|
-
import Chip from '@mui/material/Chip';
|
|
10
8
|
import classNames from 'classnames';
|
|
11
9
|
import { useThemeProps } from '@mui/system';
|
|
12
10
|
import Skeleton from './Skeleton';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
5
4
|
import { SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
|
|
6
|
-
import { Divider, Grid, Typography } from '@mui/material';
|
|
5
|
+
import { Divider, Grid, Typography, styled } from '@mui/material';
|
|
7
6
|
import { FormattedMessage } from 'react-intl';
|
|
8
7
|
import classNames from 'classnames';
|
|
9
8
|
const PREFERENCES = [
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { styled } from '@mui/material
|
|
3
|
-
import { Typography, CardContent, Skeleton, CardActions, CardMedia, Button } from '@mui/material';
|
|
2
|
+
import { Typography, CardContent, Skeleton, CardActions, CardMedia, Button, styled } from '@mui/material';
|
|
4
3
|
import { Widget } from '@selfcommunity/react-ui';
|
|
5
4
|
import { PREFIX } from './constants';
|
|
6
5
|
const classes = {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { styled } from '@mui/material
|
|
3
|
-
import { Typography, Grid, Skeleton, Box, useTheme, useMediaQuery } from '@mui/material';
|
|
2
|
+
import { Typography, Grid, Skeleton, Box, useTheme, useMediaQuery, styled } from '@mui/material';
|
|
4
3
|
import PrizeItemSkeleton from './PrizeItemSkeleton';
|
|
5
4
|
import { PREFIX } from './constants';
|
|
6
5
|
const classes = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useRef } from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
3
|
+
import { styled } from '@mui/material';
|
|
4
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, UserUtils } from '@selfcommunity/react-core';
|
|
@@ -91,7 +91,8 @@ export default function MainFeed(inProps) {
|
|
|
91
91
|
}
|
|
92
92
|
// HANDLERS
|
|
93
93
|
const handleComposerSuccess = (feedObject) => {
|
|
94
|
-
|
|
94
|
+
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.inlineComposerWidget.success';
|
|
95
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
95
96
|
variant: 'success',
|
|
96
97
|
autoHideDuration: 3000
|
|
97
98
|
});
|
|
@@ -99,10 +100,10 @@ export default function MainFeed(inProps) {
|
|
|
99
100
|
const feedUnit = {
|
|
100
101
|
type: feedObject.type,
|
|
101
102
|
[feedObject.type]: feedObject,
|
|
102
|
-
|
|
103
|
+
seen: false,
|
|
103
104
|
has_boost: false
|
|
104
105
|
};
|
|
105
|
-
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
106
|
+
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
106
107
|
};
|
|
107
108
|
const handleAddGenerationContent = (feedObjects) => {
|
|
108
109
|
if (feedRef && feedRef.current) {
|
|
@@ -112,7 +113,7 @@ export default function MainFeed(inProps) {
|
|
|
112
113
|
const feedUnit = {
|
|
113
114
|
type: feedObject.type,
|
|
114
115
|
[feedObject.type]: feedObject,
|
|
115
|
-
|
|
116
|
+
seen: false,
|
|
116
117
|
has_boost: false
|
|
117
118
|
};
|
|
118
119
|
feedRef.current.addFeedData(feedUnit, true);
|
|
@@ -124,7 +125,7 @@ export default function MainFeed(inProps) {
|
|
|
124
125
|
feedObject: item[item.type],
|
|
125
126
|
feedObjectType: item.type,
|
|
126
127
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
127
|
-
markRead: scUser ? !item.
|
|
128
|
+
markRead: scUser ? !item.seen : null
|
|
128
129
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
129
130
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
130
131
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess }), UserUtils.isAdmin(scUserContext.user) && _jsx(OnBoardingWidget, { onGeneratedContent: handleAddGenerationContent })] }), requireAuthentication: true, disablePaginationLinks: true, enabledCustomAdvPositions: [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
3
|
+
import { styled } from '@mui/material';
|
|
4
4
|
import { FeedObjectSkeleton, SCFeedObjectTemplateType, FeedSkeleton, GenericSkeleton, InlineComposerWidgetSkeleton } from '@selfcommunity/react-ui';
|
|
5
5
|
import { PREFIX } from './constants';
|
|
6
6
|
const classes = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useContext } from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
3
|
+
import { styled } from '@mui/material';
|
|
4
4
|
import { BroadcastMessages, CategoriesSuggestionWidget, Feed, SCFeedObjectTemplateType, FeedUpdatesWidget, LoyaltyProgramWidget, Notification, NotificationSkeleton, UserSuggestionWidget, PlatformWidget, getUnseenNotificationCounter } from '@selfcommunity/react-ui';
|
|
5
5
|
import { Endpoints } from '@selfcommunity/api-services';
|
|
6
6
|
import { SCUserContext } from '@selfcommunity/react-core';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
3
|
+
import { styled } from '@mui/material';
|
|
4
4
|
import { FeedSkeleton, GenericSkeleton, NotificationSkeleton } from '@selfcommunity/react-ui';
|
|
5
5
|
import { PREFIX } from './constants';
|
|
6
6
|
const classes = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
3
|
+
import { styled } from '@mui/material';
|
|
4
4
|
import { FeedObjectSkeleton, SCFeedObjectTemplateType, FeedSkeleton, GenericSkeleton, InlineComposerWidgetSkeleton } from '@selfcommunity/react-ui';
|
|
5
5
|
import { PREFIX } from './constants';
|
|
6
6
|
const classes = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useRef } from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
3
|
+
import { styled } from '@mui/material';
|
|
4
4
|
import { Endpoints } from '@selfcommunity/api-services';
|
|
5
5
|
import { useSCFetchUser, useSCUser } from '@selfcommunity/react-core';
|
|
6
6
|
import { Feed, FeedObject, FeedObjectSkeleton, InlineComposerWidget, SCFeedObjectTemplateType, UserFollowedCategoriesWidget, UserFollowedUsersWidget, UserFollowersWidget, UserLiveStreamWidget } from '@selfcommunity/react-ui';
|
|
@@ -89,7 +89,8 @@ export default function UserFeed(inProps) {
|
|
|
89
89
|
const feedRef = useRef();
|
|
90
90
|
// HANDLERS
|
|
91
91
|
const handleComposerSuccess = (feedObject) => {
|
|
92
|
-
|
|
92
|
+
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.inlineComposerWidget.success';
|
|
93
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
93
94
|
variant: 'success',
|
|
94
95
|
autoHideDuration: 3000
|
|
95
96
|
});
|
|
@@ -97,10 +98,10 @@ export default function UserFeed(inProps) {
|
|
|
97
98
|
const feedUnit = {
|
|
98
99
|
type: feedObject.type,
|
|
99
100
|
[feedObject.type]: feedObject,
|
|
100
|
-
|
|
101
|
+
seen: false,
|
|
101
102
|
has_boost: false
|
|
102
103
|
};
|
|
103
|
-
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
104
|
+
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
104
105
|
};
|
|
105
106
|
// WIDGETS
|
|
106
107
|
const _widgets = useMemo(() => widgets.map((w) => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box } from '@mui/material';
|
|
3
|
-
import { styled } from '@mui/material/styles';
|
|
2
|
+
import { Box, styled } from '@mui/material';
|
|
4
3
|
import { UserProfileHeaderSkeleton } from '@selfcommunity/react-ui';
|
|
5
4
|
import UserFeedSkeleton from '../UserFeed/Skeleton';
|
|
6
5
|
import { PREFIX } from './constants';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
4
|
-
import { Box, Button, Icon, Stack, Typography } from '@mui/material';
|
|
3
|
+
import { Box, Button, Icon, Stack, Typography, styled } from '@mui/material';
|
|
5
4
|
import { ConnectionUserButton, LoyaltyProgramWidget, TagChip, UserActionIconButton, UserConnectionsRequestsSentWidget, UserConnectionsRequestsWidget, UserConnectionsWidget, UserCounters, UserCreatedCoursesWidget, UserFollowedCategoriesWidget, UserFollowedUsersWidget, UserFollowersWidget, UserLiveStreamWidget, UserProfileBlocked, UserProfileHeader, UserSubscribedGroupsWidget } from '@selfcommunity/react-ui';
|
|
6
5
|
import UserFeed from '../UserFeed';
|
|
7
6
|
import { SCPreferences, SCRoutes, useSCFetchUser, useSCPreferences, useSCRouting, useSCUser, useSCFetchUserBlockedBy } from '@selfcommunity/react-core';
|
|
@@ -183,13 +182,16 @@ export default function UserProfile(inProps) {
|
|
|
183
182
|
const isMe = useMemo(() => scUserContext.user && (scUser === null || scUser === void 0 ? void 0 : scUser.id) === scUserContext.user.id, [scUserContext.user, scUser]);
|
|
184
183
|
const followEnabled = useMemo(() => SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED in scPreferencesContext.preferences &&
|
|
185
184
|
scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED].value, [scPreferencesContext.preferences]);
|
|
186
|
-
const
|
|
185
|
+
const connectionEnabled = SCPreferences.CONFIGURATIONS_CONNECTION_ENABLED in scPreferencesContext.preferences &&
|
|
186
|
+
scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_CONNECTION_ENABLED].value;
|
|
187
|
+
const privateMessagingEnabled = useMemo(() => SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED in scPreferencesContext.preferences &&
|
|
188
|
+
scPreferencesContext.preferences[SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED].value, [scPreferencesContext.preferences]);
|
|
187
189
|
const _widgets = useMemo(() => {
|
|
188
190
|
var _a, _b;
|
|
189
191
|
if (widgets !== null) {
|
|
190
192
|
return widgets;
|
|
191
193
|
}
|
|
192
|
-
if (!scUser) {
|
|
194
|
+
if (!scUser || (!followEnabled && !connectionEnabled)) {
|
|
193
195
|
return [];
|
|
194
196
|
}
|
|
195
197
|
let _widgets = [];
|
|
Binary file
|
|
Binary file
|