@selfcommunity/react-templates 0.4.8-alpha.7 → 0.4.8-alpha.71
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 +2 -1
- package/lib/esm/components/CategoryFeed/CategoryFeed.js +4 -3
- package/lib/umd/123.js +2 -0
- package/lib/umd/react-templates.js +1 -1
- package/package.json +8 -8
- package/lib/umd/920.js +0 -2
- /package/lib/umd/{920.js.LICENSE.txt → 123.js.LICENSE.txt} +0 -0
|
@@ -72,6 +72,7 @@ function CategoryFeed(inProps) {
|
|
|
72
72
|
const { id = 'category_feed', className, category, categoryId, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
|
|
73
73
|
// CONTEXT
|
|
74
74
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
75
|
+
const scUserContext = (0, react_core_1.useSCUser)();
|
|
75
76
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
76
77
|
// REF
|
|
77
78
|
const feedRef = (0, react_1.useRef)();
|
|
@@ -114,7 +115,7 @@ function CategoryFeed(inProps) {
|
|
|
114
115
|
markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
|
|
115
116
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
116
117
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
117
|
-
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { categories: [scCategory] }, feedType: types_1.SCFeedTypologyType.CATEGORY }), CustomAdvProps: { categoriesId: [scCategory.id] }, enabledCustomAdvPositions: [
|
|
118
|
+
}, 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: [
|
|
118
119
|
types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
119
120
|
types_1.SCCustomAdvPosition.POSITION_FEED,
|
|
120
121
|
types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useRef } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { CategoryTrendingFeedWidget, CategoryTrendingUsersWidget, ContributionUtils, Feed, FeedObject, FeedObjectSkeleton, InlineComposerWidget, SCFeedObjectTemplateType } from '@selfcommunity/react-ui';
|
|
5
5
|
import { Endpoints } from '@selfcommunity/api-services';
|
|
6
|
-
import { Link, SCRoutes, useSCFetchCategory, useSCRouting } from '@selfcommunity/react-core';
|
|
6
|
+
import { Link, SCRoutes, UserUtils, useSCFetchCategory, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
7
7
|
import { SCCustomAdvPosition, SCFeedTypologyType } from '@selfcommunity/types';
|
|
8
8
|
import { CategoryFeedSkeleton } from './index';
|
|
9
9
|
import { useThemeProps } from '@mui/system';
|
|
@@ -69,6 +69,7 @@ export default function CategoryFeed(inProps) {
|
|
|
69
69
|
const { id = 'category_feed', className, category, categoryId, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
|
|
70
70
|
// CONTEXT
|
|
71
71
|
const scRoutingContext = useSCRouting();
|
|
72
|
+
const scUserContext = useSCUser();
|
|
72
73
|
const { enqueueSnackbar } = useSnackbar();
|
|
73
74
|
// REF
|
|
74
75
|
const feedRef = useRef();
|
|
@@ -111,7 +112,7 @@ export default function CategoryFeed(inProps) {
|
|
|
111
112
|
markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
|
|
112
113
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: FeedObjectSkeleton, ItemSkeletonProps: {
|
|
113
114
|
template: SCFeedObjectTemplateType.PREVIEW
|
|
114
|
-
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: _jsx(InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { categories: [scCategory] }, feedType: SCFeedTypologyType.CATEGORY }), CustomAdvProps: { categoriesId: [scCategory.id] }, enabledCustomAdvPositions: [
|
|
115
|
+
}, 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: [
|
|
115
116
|
SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
116
117
|
SCCustomAdvPosition.POSITION_FEED,
|
|
117
118
|
SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|