@selfcommunity/react-ui 0.11.0-alpha.90 → 0.11.0-alpha.92
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/CategoryHeader/CategoryHeader.js +2 -1
- package/lib/cjs/components/Feed/Feed.js +9 -1
- package/lib/cjs/components/UserCounters/UserCounters.js +3 -2
- package/lib/esm/components/CategoryHeader/CategoryHeader.js +3 -2
- package/lib/esm/components/Feed/Feed.js +9 -1
- package/lib/esm/components/UserCounters/UserCounters.js +4 -3
- package/lib/umd/react-ui.js +1 -1
- package/package.json +2 -2
|
@@ -67,6 +67,7 @@ function CategoryHeader(inProps) {
|
|
|
67
67
|
const { className, categoryId, category, CategoryFollowButtonProps = {}, CategoryFollowersButtonProps = {} } = props, rest = tslib_1.__rest(props, ["className", "categoryId", "category", "CategoryFollowButtonProps", "CategoryFollowersButtonProps"]);
|
|
68
68
|
// STATE
|
|
69
69
|
const { scCategory, setSCCategory } = (0, react_core_1.useSCFetchCategory)({ id: categoryId, category });
|
|
70
|
+
const categoryFollowEnabled = (0, react_core_1.useSCPreferenceEnabled)(react_core_1.SCPreferences.CONFIGURATIONS_CATEGORY_FOLLOW_ENABLED);
|
|
70
71
|
// PAYMENTS
|
|
71
72
|
const { isPaymentsEnabled } = (0, react_core_1.useSCPaymentsEnabled)();
|
|
72
73
|
/**
|
|
@@ -80,6 +81,6 @@ function CategoryHeader(inProps) {
|
|
|
80
81
|
if (!scCategory) {
|
|
81
82
|
return null;
|
|
82
83
|
}
|
|
83
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Paper, { style: _backgroundCover, classes: { root: classes.cover } }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.info }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3", className: classes.name, gutterBottom: true }, { children: scCategory.name })), scCategory.slogan && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.slogan }, { children: scCategory.slogan }))), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.followed }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.followedCounter, component: "div" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.categoryHeader.followedBy", defaultMessage: "ui.categoryHeader.followedBy", values: { total: scCategory.followers_counter } }) })), (0, jsx_runtime_1.jsx)(CategoryFollowersButton_1.default, Object.assign({ category: scCategory, categoryId: scCategory === null || scCategory === void 0 ? void 0 : scCategory.id }, CategoryFollowersButtonProps))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.action }, { children: [isPaymentsEnabled && ((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0 && scCategory.payment_order && ((0, jsx_runtime_1.jsx)(BuyButton_1.default, { contentType: types_1.SCContentType.CATEGORY, content: scCategory })), (0, jsx_runtime_1.jsx)(CategoryFollowButton_1.default, Object.assign({ category: scCategory, onFollow: handleFollow }, CategoryFollowButtonProps))] }))] }))] })));
|
|
84
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Paper, { style: _backgroundCover, classes: { root: classes.cover } }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.info }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h3", className: classes.name, gutterBottom: true }, { children: scCategory.name })), scCategory.slogan && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.slogan }, { children: scCategory.slogan }))), categoryFollowEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.followed }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.followedCounter, component: "div" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.categoryHeader.followedBy", defaultMessage: "ui.categoryHeader.followedBy", values: { total: scCategory.followers_counter } }) })), (0, jsx_runtime_1.jsx)(CategoryFollowersButton_1.default, Object.assign({ category: scCategory, categoryId: scCategory === null || scCategory === void 0 ? void 0 : scCategory.id }, CategoryFollowersButtonProps))] }))), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.action }, { children: [isPaymentsEnabled && ((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0 && scCategory.payment_order && ((0, jsx_runtime_1.jsx)(BuyButton_1.default, { contentType: types_1.SCContentType.CATEGORY, content: scCategory })), (0, jsx_runtime_1.jsx)(CategoryFollowButton_1.default, Object.assign({ category: scCategory, onFollow: handleFollow }, CategoryFollowButtonProps))] }))] }))] })));
|
|
84
85
|
}
|
|
85
86
|
exports.default = CategoryHeader;
|
|
@@ -25,6 +25,7 @@ const Skeleton_2 = tslib_1.__importDefault(require("./Skeleton"));
|
|
|
25
25
|
const use_deep_compare_effect_1 = require("use-deep-compare-effect");
|
|
26
26
|
const StickyBox_1 = tslib_1.__importDefault(require("../../shared/StickyBox"));
|
|
27
27
|
const constants_1 = require("./constants");
|
|
28
|
+
const FooterWidget_1 = tslib_1.__importDefault(require("../FooterWidget"));
|
|
28
29
|
const messages = (0, react_intl_1.defineMessages)({
|
|
29
30
|
refresh: {
|
|
30
31
|
id: 'ui.feed.refreshRelease',
|
|
@@ -168,7 +169,14 @@ const Feed = (inProps, ref) => {
|
|
|
168
169
|
position: 0
|
|
169
170
|
}
|
|
170
171
|
]
|
|
171
|
-
: [])
|
|
172
|
+
: []),
|
|
173
|
+
{
|
|
174
|
+
type: 'widget',
|
|
175
|
+
component: FooterWidget_1.default,
|
|
176
|
+
componentProps: {},
|
|
177
|
+
column: 'right',
|
|
178
|
+
position: 1
|
|
179
|
+
}
|
|
172
180
|
]
|
|
173
181
|
.map((w, i) => Object.assign({}, w, { position: w.position * (w.column === 'right' ? 5 : 1), id: `${w.column}_${i}` }))
|
|
174
182
|
.sort(feed_1.widgetSort), [widgets, advEnabled]);
|
|
@@ -58,6 +58,7 @@ function UserCounters(inProps) {
|
|
|
58
58
|
const connectionEnabled = react_core_1.SCPreferences.CONFIGURATIONS_CONNECTION_ENABLED in scPreferencesContext.preferences &&
|
|
59
59
|
scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONNECTION_ENABLED].value;
|
|
60
60
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
61
|
+
const categoryFollowEnabled = (0, react_core_1.useSCPreferenceEnabled)(react_core_1.SCPreferences.CONFIGURATIONS_CATEGORY_FOLLOW_ENABLED);
|
|
61
62
|
// HOOKS
|
|
62
63
|
const { scUser, refresh: refreshScUser, refreshing: refreshingScUser } = (0, react_core_1.useSCFetchUser)({ id: userId, user });
|
|
63
64
|
const isMe = (0, react_1.useMemo)(() => scUserContext.user && (scUser === null || scUser === void 0 ? void 0 : scUser.id) === scUserContext.user.id, [scUserContext.user, scUser]);
|
|
@@ -105,11 +106,11 @@ function UserCounters(inProps) {
|
|
|
105
106
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
106
107
|
// @ts-ignore
|
|
107
108
|
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|
|
108
|
-
} }) })), (0, jsx_runtime_1.jsx)(Bullet_1.default, {})] }))) }), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ className: classes.button, variant: "text", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_CATEGORIES_ROUTE_NAME, scUser) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.userCounters.categories", defaultMessage: "ui.userCounters.categories", values: {
|
|
109
|
+
} }) })), (0, jsx_runtime_1.jsx)(Bullet_1.default, {})] }))) }), categoryFollowEnabled && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ className: classes.button, variant: "text", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_CATEGORIES_ROUTE_NAME, scUser) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.userCounters.categories", defaultMessage: "ui.userCounters.categories", values: {
|
|
109
110
|
count: scUser === null || scUser === void 0 ? void 0 : scUser.categories_counter,
|
|
110
111
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
111
112
|
// @ts-ignore
|
|
112
113
|
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|
|
113
|
-
} }) }))] })));
|
|
114
|
+
} }) })))] })));
|
|
114
115
|
}
|
|
115
116
|
exports.default = UserCounters;
|
|
@@ -4,7 +4,7 @@ import { useMemo } from 'react';
|
|
|
4
4
|
import { Box, Paper, Typography, styled } from '@mui/material';
|
|
5
5
|
import CategoryFollowButton from '../CategoryFollowButton';
|
|
6
6
|
import { FormattedMessage } from 'react-intl';
|
|
7
|
-
import { useSCFetchCategory, useSCPaymentsEnabled } from '@selfcommunity/react-core';
|
|
7
|
+
import { SCPreferences, useSCFetchCategory, useSCPaymentsEnabled, useSCPreferenceEnabled } from '@selfcommunity/react-core';
|
|
8
8
|
import { SCContentType } from '@selfcommunity/types';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import { useThemeProps } from '@mui/system';
|
|
@@ -65,6 +65,7 @@ export default function CategoryHeader(inProps) {
|
|
|
65
65
|
const { className, categoryId, category, CategoryFollowButtonProps = {}, CategoryFollowersButtonProps = {} } = props, rest = __rest(props, ["className", "categoryId", "category", "CategoryFollowButtonProps", "CategoryFollowersButtonProps"]);
|
|
66
66
|
// STATE
|
|
67
67
|
const { scCategory, setSCCategory } = useSCFetchCategory({ id: categoryId, category });
|
|
68
|
+
const categoryFollowEnabled = useSCPreferenceEnabled(SCPreferences.CONFIGURATIONS_CATEGORY_FOLLOW_ENABLED);
|
|
68
69
|
// PAYMENTS
|
|
69
70
|
const { isPaymentsEnabled } = useSCPaymentsEnabled();
|
|
70
71
|
/**
|
|
@@ -78,5 +79,5 @@ export default function CategoryHeader(inProps) {
|
|
|
78
79
|
if (!scCategory) {
|
|
79
80
|
return null;
|
|
80
81
|
}
|
|
81
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsx(Paper, { style: _backgroundCover, classes: { root: classes.cover } }), _jsxs(Box, Object.assign({ className: classes.info }, { children: [_jsx(Typography, Object.assign({ variant: "h3", className: classes.name, gutterBottom: true }, { children: scCategory.name })), scCategory.slogan && (_jsx(Typography, Object.assign({ variant: "h5", className: classes.slogan }, { children: scCategory.slogan }))), _jsxs(Box, Object.assign({ className: classes.followed }, { children: [_jsx(Typography, Object.assign({ className: classes.followedCounter, component: "div" }, { children: _jsx(FormattedMessage, { id: "ui.categoryHeader.followedBy", defaultMessage: "ui.categoryHeader.followedBy", values: { total: scCategory.followers_counter } }) })), _jsx(CategoryFollowersButton, Object.assign({ category: scCategory, categoryId: scCategory === null || scCategory === void 0 ? void 0 : scCategory.id }, CategoryFollowersButtonProps))] })), _jsxs(Box, Object.assign({ className: classes.action }, { children: [isPaymentsEnabled && ((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0 && scCategory.payment_order && (_jsx(BuyButton, { contentType: SCContentType.CATEGORY, content: scCategory })), _jsx(CategoryFollowButton, Object.assign({ category: scCategory, onFollow: handleFollow }, CategoryFollowButtonProps))] }))] }))] })));
|
|
82
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsx(Paper, { style: _backgroundCover, classes: { root: classes.cover } }), _jsxs(Box, Object.assign({ className: classes.info }, { children: [_jsx(Typography, Object.assign({ variant: "h3", className: classes.name, gutterBottom: true }, { children: scCategory.name })), scCategory.slogan && (_jsx(Typography, Object.assign({ variant: "h5", className: classes.slogan }, { children: scCategory.slogan }))), categoryFollowEnabled && (_jsxs(Box, Object.assign({ className: classes.followed }, { children: [_jsx(Typography, Object.assign({ className: classes.followedCounter, component: "div" }, { children: _jsx(FormattedMessage, { id: "ui.categoryHeader.followedBy", defaultMessage: "ui.categoryHeader.followedBy", values: { total: scCategory.followers_counter } }) })), _jsx(CategoryFollowersButton, Object.assign({ category: scCategory, categoryId: scCategory === null || scCategory === void 0 ? void 0 : scCategory.id }, CategoryFollowersButtonProps))] }))), _jsxs(Box, Object.assign({ className: classes.action }, { children: [isPaymentsEnabled && ((_a = scCategory.paywalls) === null || _a === void 0 ? void 0 : _a.length) > 0 && scCategory.payment_order && (_jsx(BuyButton, { contentType: SCContentType.CATEGORY, content: scCategory })), _jsx(CategoryFollowButton, Object.assign({ category: scCategory, onFollow: handleFollow }, CategoryFollowButtonProps))] }))] }))] })));
|
|
82
83
|
}
|
|
@@ -22,6 +22,7 @@ import FeedSkeleton from './Skeleton';
|
|
|
22
22
|
import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect';
|
|
23
23
|
import StickyBoxComp from '../../shared/StickyBox';
|
|
24
24
|
import { PREFIX } from './constants';
|
|
25
|
+
import FooterWidget from '../FooterWidget';
|
|
25
26
|
const messages = defineMessages({
|
|
26
27
|
refresh: {
|
|
27
28
|
id: 'ui.feed.refreshRelease',
|
|
@@ -165,7 +166,14 @@ const Feed = (inProps, ref) => {
|
|
|
165
166
|
position: 0
|
|
166
167
|
}
|
|
167
168
|
]
|
|
168
|
-
: [])
|
|
169
|
+
: []),
|
|
170
|
+
{
|
|
171
|
+
type: 'widget',
|
|
172
|
+
component: FooterWidget,
|
|
173
|
+
componentProps: {},
|
|
174
|
+
column: 'right',
|
|
175
|
+
position: 1
|
|
176
|
+
}
|
|
169
177
|
]
|
|
170
178
|
.map((w, i) => Object.assign({}, w, { position: w.position * (w.column === 'right' ? 5 : 1), id: `${w.column}_${i}` }))
|
|
171
179
|
.sort(widgetSort), [widgets, advEnabled]);
|
|
@@ -4,7 +4,7 @@ import { useContext, useMemo } from 'react';
|
|
|
4
4
|
import { Box, Button, styled } from '@mui/material';
|
|
5
5
|
import { FormattedMessage } from 'react-intl';
|
|
6
6
|
import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect';
|
|
7
|
-
import { Link, SCPreferences, SCPreferencesContext, SCRoutes, useSCFetchUser, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
7
|
+
import { Link, SCPreferences, SCPreferencesContext, SCRoutes, useSCFetchUser, useSCPreferenceEnabled, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { useThemeProps } from '@mui/system';
|
|
10
10
|
import Bullet from '../../shared/Bullet';
|
|
@@ -56,6 +56,7 @@ export default function UserCounters(inProps) {
|
|
|
56
56
|
const connectionEnabled = SCPreferences.CONFIGURATIONS_CONNECTION_ENABLED in scPreferencesContext.preferences &&
|
|
57
57
|
scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_CONNECTION_ENABLED].value;
|
|
58
58
|
const scUserContext = useSCUser();
|
|
59
|
+
const categoryFollowEnabled = useSCPreferenceEnabled(SCPreferences.CONFIGURATIONS_CATEGORY_FOLLOW_ENABLED);
|
|
59
60
|
// HOOKS
|
|
60
61
|
const { scUser, refresh: refreshScUser, refreshing: refreshingScUser } = useSCFetchUser({ id: userId, user });
|
|
61
62
|
const isMe = useMemo(() => scUserContext.user && (scUser === null || scUser === void 0 ? void 0 : scUser.id) === scUserContext.user.id, [scUserContext.user, scUser]);
|
|
@@ -103,10 +104,10 @@ export default function UserCounters(inProps) {
|
|
|
103
104
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
104
105
|
// @ts-ignore
|
|
105
106
|
b: (chunks) => _jsx("strong", { children: chunks })
|
|
106
|
-
} }) })), _jsx(Bullet, {})] }))) }), _jsx(Button, Object.assign({ className: classes.button, variant: "text", component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_CATEGORIES_ROUTE_NAME, scUser) }, { children: _jsx(FormattedMessage, { id: "ui.userCounters.categories", defaultMessage: "ui.userCounters.categories", values: {
|
|
107
|
+
} }) })), _jsx(Bullet, {})] }))) }), categoryFollowEnabled && (_jsx(Button, Object.assign({ className: classes.button, variant: "text", component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_CATEGORIES_ROUTE_NAME, scUser) }, { children: _jsx(FormattedMessage, { id: "ui.userCounters.categories", defaultMessage: "ui.userCounters.categories", values: {
|
|
107
108
|
count: scUser === null || scUser === void 0 ? void 0 : scUser.categories_counter,
|
|
108
109
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
109
110
|
// @ts-ignore
|
|
110
111
|
b: (chunks) => _jsx("strong", { children: chunks })
|
|
111
|
-
} }) }))] })));
|
|
112
|
+
} }) })))] })));
|
|
112
113
|
}
|