@selfcommunity/react-templates 0.5.0-alpha.0 → 0.5.0-alpha.10
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 +15 -4
- 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 +30 -16
- package/lib/cjs/components/EventFeed/Skeleton.js +2 -2
- package/lib/cjs/components/ExploreFeed/ExploreFeed.js +5 -4
- 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 +22 -7
- 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 +5 -4
- 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 +5 -4
- 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 +17 -6
- 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 +30 -16
- package/lib/esm/components/EventFeed/Skeleton.js +1 -1
- package/lib/esm/components/ExploreFeed/ExploreFeed.js +4 -3
- 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 +23 -8
- 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 +4 -3
- 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 +4 -3
- 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
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const styles_1 = require("@mui/material/styles");
|
|
6
5
|
const material_1 = require("@mui/material");
|
|
7
6
|
const PrizeItemSkeleton_1 = tslib_1.__importDefault(require("./PrizeItemSkeleton"));
|
|
8
7
|
const constants_1 = require("./constants");
|
|
@@ -14,7 +13,7 @@ const classes = {
|
|
|
14
13
|
pointsList: `${constants_1.PREFIX}-points-list`,
|
|
15
14
|
chip: `${constants_1.PREFIX}-chip`
|
|
16
15
|
};
|
|
17
|
-
const Root = (0,
|
|
16
|
+
const Root = (0, material_1.styled)(material_1.Box, {
|
|
18
17
|
name: constants_1.PREFIX,
|
|
19
18
|
slot: 'SkeletonRoot'
|
|
20
19
|
})(() => ({}));
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
7
|
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
8
8
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
9
9
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
@@ -16,7 +16,7 @@ const constants_1 = require("./constants");
|
|
|
16
16
|
const classes = {
|
|
17
17
|
root: `${constants_1.PREFIX}-root`
|
|
18
18
|
};
|
|
19
|
-
const Root = (0,
|
|
19
|
+
const Root = (0, material_1.styled)(react_ui_1.Feed, {
|
|
20
20
|
name: constants_1.PREFIX,
|
|
21
21
|
slot: 'Root'
|
|
22
22
|
})(() => ({}));
|
|
@@ -94,7 +94,8 @@ function MainFeed(inProps) {
|
|
|
94
94
|
}
|
|
95
95
|
// HANDLERS
|
|
96
96
|
const handleComposerSuccess = (feedObject) => {
|
|
97
|
-
|
|
97
|
+
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.inlineComposerWidget.success';
|
|
98
|
+
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
98
99
|
variant: 'success',
|
|
99
100
|
autoHideDuration: 3000
|
|
100
101
|
});
|
|
@@ -105,7 +106,7 @@ function MainFeed(inProps) {
|
|
|
105
106
|
seen_by_id: [],
|
|
106
107
|
has_boost: false
|
|
107
108
|
};
|
|
108
|
-
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
109
|
+
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
109
110
|
};
|
|
110
111
|
const handleAddGenerationContent = (feedObjects) => {
|
|
111
112
|
if (feedRef && feedRef.current) {
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
7
|
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
9
|
const classes = {
|
|
10
10
|
root: `${constants_1.PREFIX}-skeleton-root`
|
|
11
11
|
};
|
|
12
|
-
const Root = (0,
|
|
12
|
+
const Root = (0, material_1.styled)(react_ui_1.FeedSkeleton, {
|
|
13
13
|
name: constants_1.PREFIX,
|
|
14
14
|
slot: 'SkeletonRoot'
|
|
15
15
|
})(() => ({}));
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
7
|
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
8
8
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
9
9
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
@@ -14,7 +14,7 @@ const constants_1 = require("./constants");
|
|
|
14
14
|
const classes = {
|
|
15
15
|
root: `${constants_1.PREFIX}-root`
|
|
16
16
|
};
|
|
17
|
-
const Root = (0,
|
|
17
|
+
const Root = (0, material_1.styled)(react_ui_1.Feed, {
|
|
18
18
|
name: constants_1.PREFIX,
|
|
19
19
|
slot: 'Root'
|
|
20
20
|
})(() => ({}));
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
7
|
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
9
|
const classes = {
|
|
10
10
|
root: `${constants_1.PREFIX}-skeleton-root`
|
|
11
11
|
};
|
|
12
|
-
const Root = (0,
|
|
12
|
+
const Root = (0, material_1.styled)(react_ui_1.FeedSkeleton, {
|
|
13
13
|
name: constants_1.PREFIX,
|
|
14
14
|
slot: 'SkeletonRoot'
|
|
15
15
|
})(() => ({}));
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
7
|
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
9
|
const classes = {
|
|
10
10
|
root: `${constants_1.PREFIX}-skeleton-root`
|
|
11
11
|
};
|
|
12
|
-
const Root = (0,
|
|
12
|
+
const Root = (0, material_1.styled)(react_ui_1.FeedSkeleton, {
|
|
13
13
|
name: constants_1.PREFIX,
|
|
14
14
|
slot: 'SkeletonRoot'
|
|
15
15
|
})(() => ({}));
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
7
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
8
8
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
9
9
|
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
@@ -16,7 +16,7 @@ const constants_1 = require("./constants");
|
|
|
16
16
|
const classes = {
|
|
17
17
|
root: `${constants_1.PREFIX}-root`
|
|
18
18
|
};
|
|
19
|
-
const Root = (0,
|
|
19
|
+
const Root = (0, material_1.styled)(react_ui_1.Feed, {
|
|
20
20
|
name: constants_1.PREFIX,
|
|
21
21
|
slot: 'Root'
|
|
22
22
|
})(() => ({}));
|
|
@@ -92,7 +92,8 @@ function UserFeed(inProps) {
|
|
|
92
92
|
const feedRef = (0, react_1.useRef)();
|
|
93
93
|
// HANDLERS
|
|
94
94
|
const handleComposerSuccess = (feedObject) => {
|
|
95
|
-
|
|
95
|
+
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.inlineComposerWidget.success';
|
|
96
|
+
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
96
97
|
variant: 'success',
|
|
97
98
|
autoHideDuration: 3000
|
|
98
99
|
});
|
|
@@ -103,7 +104,7 @@ function UserFeed(inProps) {
|
|
|
103
104
|
seen_by_id: [],
|
|
104
105
|
has_boost: false
|
|
105
106
|
};
|
|
106
|
-
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
107
|
+
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
107
108
|
};
|
|
108
109
|
// WIDGETS
|
|
109
110
|
const _widgets = (0, react_1.useMemo)(() => widgets.map((w) => {
|
|
@@ -3,14 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
|
-
const styles_1 = require("@mui/material/styles");
|
|
7
6
|
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
8
7
|
const Skeleton_1 = tslib_1.__importDefault(require("../UserFeed/Skeleton"));
|
|
9
8
|
const constants_1 = require("./constants");
|
|
10
9
|
const classes = {
|
|
11
10
|
root: `${constants_1.PREFIX}-skeleton-root`
|
|
12
11
|
};
|
|
13
|
-
const Root = (0,
|
|
12
|
+
const Root = (0, material_1.styled)(material_1.Box, {
|
|
14
13
|
name: constants_1.PREFIX,
|
|
15
14
|
slot: 'SkeletonRoot'
|
|
16
15
|
})(() => ({}));
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const styles_1 = require("@mui/material/styles");
|
|
7
6
|
const material_1 = require("@mui/material");
|
|
8
7
|
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
9
8
|
const UserFeed_1 = tslib_1.__importDefault(require("../UserFeed"));
|
|
@@ -23,7 +22,7 @@ const classes = {
|
|
|
23
22
|
feed: `${constants_1.PREFIX}-feed`,
|
|
24
23
|
actions: `${constants_1.PREFIX}-actions`
|
|
25
24
|
};
|
|
26
|
-
const Root = (0,
|
|
25
|
+
const Root = (0, material_1.styled)(material_1.Box, {
|
|
27
26
|
name: constants_1.PREFIX,
|
|
28
27
|
slot: 'Root'
|
|
29
28
|
})(() => ({}));
|
|
@@ -186,13 +185,16 @@ function UserProfile(inProps) {
|
|
|
186
185
|
const isMe = (0, react_1.useMemo)(() => scUserContext.user && (scUser === null || scUser === void 0 ? void 0 : scUser.id) === scUserContext.user.id, [scUserContext.user, scUser]);
|
|
187
186
|
const followEnabled = (0, react_1.useMemo)(() => react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED in scPreferencesContext.preferences &&
|
|
188
187
|
scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_FOLLOW_ENABLED].value, [scPreferencesContext.preferences]);
|
|
189
|
-
const
|
|
188
|
+
const connectionEnabled = react_core_1.SCPreferences.CONFIGURATIONS_CONNECTION_ENABLED in scPreferencesContext.preferences &&
|
|
189
|
+
scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONNECTION_ENABLED].value;
|
|
190
|
+
const privateMessagingEnabled = (0, react_1.useMemo)(() => react_core_1.SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED in scPreferencesContext.preferences &&
|
|
191
|
+
scPreferencesContext.preferences[react_core_1.SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED].value, [scPreferencesContext.preferences]);
|
|
190
192
|
const _widgets = (0, react_1.useMemo)(() => {
|
|
191
193
|
var _a, _b;
|
|
192
194
|
if (widgets !== null) {
|
|
193
195
|
return widgets;
|
|
194
196
|
}
|
|
195
|
-
if (!scUser) {
|
|
197
|
+
if (!scUser || (!followEnabled && !connectionEnabled)) {
|
|
196
198
|
return [];
|
|
197
199
|
}
|
|
198
200
|
let _widgets = [];
|
|
@@ -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 { CategoryHeader } from '@selfcommunity/react-ui';
|
|
5
4
|
import CategoryFeed from '../CategoryFeed';
|
|
6
5
|
import { useSCFetchCategory } from '@selfcommunity/react-core';
|
|
@@ -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 CategoryFeedSkeleton from '../CategoryFeed/Skeleton';
|
|
5
4
|
import { CategoryHeaderSkeleton } from '@selfcommunity/react-ui';
|
|
6
5
|
import { PREFIX } from './constants';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useRef } from 'react';
|
|
3
|
-
import { styled } from '@mui/material
|
|
4
|
-
import { CategoryTrendingFeedWidget, CategoryTrendingUsersWidget, ContributionUtils, Feed, FeedObject, FeedObjectSkeleton, InlineComposerWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
|
|
3
|
+
import { styled } from '@mui/material';
|
|
4
|
+
import { CategoryTrendingFeedWidget, CategoryTrendingUsersWidget, ContributionUtils, Feed, FeedObject, FeedObjectSkeleton, HiddenPurchasableContent, InlineComposerWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
|
|
5
5
|
import { Endpoints } from '@selfcommunity/api-services';
|
|
6
|
-
import { Link, SCRoutes, UserUtils, useSCFetchCategory, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
7
|
-
import { SCCustomAdvPosition, SCFeedTypologyType } from '@selfcommunity/types';
|
|
6
|
+
import { Link, SCPreferences, SCRoutes, UserUtils, useSCFetchCategory, useSCPreferences, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
7
|
+
import { SCCustomAdvPosition, SCFeatureName, SCFeedTypologyType } from '@selfcommunity/types';
|
|
8
8
|
import { CategoryFeedSkeleton } from './index';
|
|
9
9
|
import { useThemeProps } from '@mui/system';
|
|
10
10
|
import classNames from 'classnames';
|
|
@@ -61,6 +61,7 @@ const WIDGETS = [
|
|
|
61
61
|
* @param inProps
|
|
62
62
|
*/
|
|
63
63
|
export default function CategoryFeed(inProps) {
|
|
64
|
+
var _a;
|
|
64
65
|
// PROPS
|
|
65
66
|
const props = useThemeProps({
|
|
66
67
|
props: inProps,
|
|
@@ -70,16 +71,23 @@ export default function CategoryFeed(inProps) {
|
|
|
70
71
|
// CONTEXT
|
|
71
72
|
const scRoutingContext = useSCRouting();
|
|
72
73
|
const scUserContext = useSCUser();
|
|
74
|
+
const { preferences, features } = useSCPreferences();
|
|
73
75
|
const { enqueueSnackbar } = useSnackbar();
|
|
74
76
|
// REF
|
|
75
77
|
const feedRef = useRef();
|
|
76
78
|
// Hooks
|
|
77
79
|
const { scCategory } = useSCFetchCategory({ id: categoryId, category });
|
|
80
|
+
const isPaymentsEnabled = useMemo(() => preferences &&
|
|
81
|
+
features &&
|
|
82
|
+
features.includes(SCFeatureName.PAYMENTS) &&
|
|
83
|
+
SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED in preferences &&
|
|
84
|
+
preferences[SCPreferences.CONFIGURATIONS_PAYMENTS_ENABLED].value, [preferences]);
|
|
78
85
|
// HANDLERS
|
|
79
86
|
const handleComposerSuccess = (feedObject) => {
|
|
80
87
|
// Not insert if the category does not match
|
|
81
88
|
if (feedObject.categories.findIndex((c) => c.id === scCategory.id) === -1) {
|
|
82
|
-
|
|
89
|
+
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
|
|
90
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
83
91
|
action: (snackbarId) => (_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" }) }))),
|
|
84
92
|
variant: 'success',
|
|
85
93
|
autoHideDuration: 7000
|
|
@@ -93,7 +101,7 @@ export default function CategoryFeed(inProps) {
|
|
|
93
101
|
seen_by_id: [],
|
|
94
102
|
has_boost: false
|
|
95
103
|
};
|
|
96
|
-
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
104
|
+
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
97
105
|
};
|
|
98
106
|
// WIDGETS
|
|
99
107
|
const _widgets = useMemo(() => widgets.map((w) => {
|
|
@@ -105,6 +113,9 @@ export default function CategoryFeed(inProps) {
|
|
|
105
113
|
if (!scCategory) {
|
|
106
114
|
return _jsx(CategoryFeedSkeleton, {});
|
|
107
115
|
}
|
|
116
|
+
else if (scCategory && isPaymentsEnabled && !scCategory.followed && !scCategory.payment_order && ((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
117
|
+
return _jsx(HiddenPurchasableContent, {});
|
|
118
|
+
}
|
|
108
119
|
return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className), ref: feedRef, endpoint: Object.assign(Object.assign({}, Endpoints.CategoryFeed), { url: () => Endpoints.CategoryFeed.url({ id: scCategory.id }) }), widgets: _widgets, ItemComponent: FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
109
120
|
feedObject: item[item.type],
|
|
110
121
|
feedObjectType: item.type,
|
|
@@ -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,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 { EventHeader } from '@selfcommunity/react-ui';
|
|
5
4
|
import { useSCFetchEvent, useSCUser } from '@selfcommunity/react-core';
|
|
6
5
|
import { SCEventPrivacyType, SCEventSubscriptionStatusType } from '@selfcommunity/types';
|
|
@@ -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 EventFeedSkeleton from '../EventFeed/Skeleton';
|
|
5
4
|
import { EventHeaderSkeleton } from '@selfcommunity/react-ui';
|
|
6
5
|
import { PREFIX } from './constants';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } 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, Box } from '@mui/material';
|
|
4
4
|
import { ContributionUtils, EventInfoWidget, EventLocationWidget, EventMediaWidget, EventMembersWidget, Feed, FeedObject, FeedObjectSkeleton, InlineComposerWidget, RelatedEventsWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
|
|
5
5
|
import { Endpoints } from '@selfcommunity/api-services';
|
|
6
6
|
import { Link, SCRoutes, useSCFetchEvent, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
@@ -11,7 +11,6 @@ import { FormattedMessage } from 'react-intl';
|
|
|
11
11
|
import { useSnackbar } from 'notistack';
|
|
12
12
|
import { PREFIX } from './constants';
|
|
13
13
|
import EventFeedSkeleton from './Skeleton';
|
|
14
|
-
import { Box } from '@mui/material';
|
|
15
14
|
const classes = {
|
|
16
15
|
root: `${PREFIX}-root`
|
|
17
16
|
};
|
|
@@ -81,18 +80,33 @@ export default function EventFeed(inProps) {
|
|
|
81
80
|
name: PREFIX
|
|
82
81
|
});
|
|
83
82
|
const { id = 'event_feed', className, event, eventId, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
|
|
83
|
+
// STATUS
|
|
84
|
+
const [status, setStatus] = useState(undefined);
|
|
84
85
|
// CONTEXT
|
|
85
86
|
const scRoutingContext = useSCRouting();
|
|
86
87
|
const scUserContext = useSCUser();
|
|
88
|
+
const scEventsManager = scUserContext.managers.events;
|
|
87
89
|
const { enqueueSnackbar } = useSnackbar();
|
|
90
|
+
const { scEvent } = useSCFetchEvent({ id: eventId, event });
|
|
88
91
|
// REF
|
|
89
92
|
const feedRef = useRef();
|
|
90
|
-
//
|
|
91
|
-
const
|
|
93
|
+
// CONST
|
|
94
|
+
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
var _a;
|
|
97
|
+
/**
|
|
98
|
+
* Call scEventsManager.subscriptionStatus inside an effect
|
|
99
|
+
* to avoid warning rendering child during update parent state
|
|
100
|
+
*/
|
|
101
|
+
if (authUserId) {
|
|
102
|
+
setStatus((_a = scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus) === null || _a === void 0 ? void 0 : _a.call(scEventsManager, scEvent));
|
|
103
|
+
}
|
|
104
|
+
}, [authUserId, scEventsManager === null || scEventsManager === void 0 ? void 0 : scEventsManager.subscriptionStatus, scEvent]);
|
|
92
105
|
// HANDLERS
|
|
93
106
|
const handleComposerSuccess = (feedObject) => {
|
|
94
107
|
var _a;
|
|
95
|
-
|
|
108
|
+
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
|
|
109
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
96
110
|
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" }) }))),
|
|
97
111
|
variant: 'success',
|
|
98
112
|
autoHideDuration: 7000
|
|
@@ -105,7 +119,7 @@ export default function EventFeed(inProps) {
|
|
|
105
119
|
seen_by_id: [],
|
|
106
120
|
has_boost: false
|
|
107
121
|
};
|
|
108
|
-
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
122
|
+
!feedObject.draft && feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
109
123
|
}
|
|
110
124
|
};
|
|
111
125
|
// WIDGETS
|
|
@@ -116,17 +130,17 @@ export default function EventFeed(inProps) {
|
|
|
116
130
|
return w;
|
|
117
131
|
}), [widgets, scEvent]);
|
|
118
132
|
if (scUserContext.user === undefined ||
|
|
133
|
+
(scUserContext.user && status === undefined) ||
|
|
119
134
|
!scEvent ||
|
|
120
|
-
(scUserContext.user &&
|
|
121
|
-
((scEvent.privacy === SCEventPrivacyType.PUBLIC && !scEvent.subscription_status) ||
|
|
122
|
-
scEvent.subscription_status === SCEventSubscriptionStatusType.INVITED)) ||
|
|
135
|
+
(scUserContext.user && scEvent.privacy === SCEventPrivacyType.PUBLIC && !status) ||
|
|
123
136
|
(scEvent && ((eventId !== undefined && scEvent.id !== eventId) || (event && scEvent.id !== event.id)))) {
|
|
124
137
|
return _jsx(EventFeedSkeleton, {});
|
|
125
138
|
}
|
|
126
139
|
else if (scEvent.privacy === SCEventPrivacyType.PRIVATE &&
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
140
|
+
(status === SCEventSubscriptionStatusType.INVITED ||
|
|
141
|
+
(status !== SCEventSubscriptionStatusType.SUBSCRIBED &&
|
|
142
|
+
status !== SCEventSubscriptionStatusType.GOING &&
|
|
143
|
+
status !== SCEventSubscriptionStatusType.NOT_GOING))) {
|
|
130
144
|
return (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(EventInfoWidget, { className: classes.root, event: scEvent }) })));
|
|
131
145
|
}
|
|
132
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) => {
|
|
@@ -142,9 +156,9 @@ export default function EventFeed(inProps) {
|
|
|
142
156
|
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsxs(_Fragment, { children: [_jsx(EventInfoWidget, { className: classes.root, event: scEvent }), Boolean(scEvent &&
|
|
143
157
|
((!scUserContext.user && scEvent.privacy === SCEventPrivacyType.PUBLIC) ||
|
|
144
158
|
(scUserContext.user &&
|
|
145
|
-
(
|
|
146
|
-
|
|
147
|
-
|
|
159
|
+
(status === SCEventSubscriptionStatusType.SUBSCRIBED ||
|
|
160
|
+
status === SCEventSubscriptionStatusType.GOING ||
|
|
161
|
+
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: [
|
|
148
162
|
SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
149
163
|
SCCustomAdvPosition.POSITION_FEED,
|
|
150
164
|
SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
@@ -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, 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
|
});
|
|
@@ -98,7 +99,7 @@ export default function ExploreFeed(inProps) {
|
|
|
98
99
|
seen_by_id: [],
|
|
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) {
|
|
@@ -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,17 +66,32 @@ 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, setSCGroup } = 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
|
-
|
|
93
|
+
const messageId = feedObject.scheduled_at ? 'ui.composer.scheduled.success' : 'ui.composerIconButton.composer.success';
|
|
94
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: messageId, defaultMessage: messageId }), {
|
|
80
95
|
action: (snackbarId) => (_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
|
|
@@ -89,7 +104,7 @@ export default function GroupFeed(inProps) {
|
|
|
89
104
|
seen_by_id: [],
|
|
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,7 +117,7 @@ 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
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) => {
|
|
@@ -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';
|