@selfcommunity/react-ui 0.11.0-alpha.54 → 0.11.0-alpha.56

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.
@@ -98,7 +98,7 @@ function EventSubscribeButton(inProps) {
98
98
  const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({
99
99
  id: eventId,
100
100
  event,
101
- cacheStrategy: authUserId ? utils_1.CacheStrategies.CACHE_FIRST : utils_1.CacheStrategies.STALE_WHILE_REVALIDATE
101
+ cacheStrategy: authUserId ? utils_1.CacheStrategies.NETWORK_ONLY : utils_1.CacheStrategies.STALE_WHILE_REVALIDATE
102
102
  });
103
103
  const isEventAdmin = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
104
104
  // HANDLERS
@@ -22,7 +22,7 @@ const classes = {
22
22
  const Root = (0, styles_1.styled)(material_1.Box, {
23
23
  name: constants_1.PREFIX,
24
24
  slot: 'Root'
25
- })(({ theme }) => ({}));
25
+ })(() => ({}));
26
26
  /**
27
27
  * > API documentation for the Community-JS Footer component. Learn about the available props and the CSS API.
28
28
  *
@@ -57,12 +57,13 @@ function Footer(inProps) {
57
57
  });
58
58
  const { className, menu = null, startActions = null, endActions = null } = props, rest = tslib_1.__rest(props, ["className", "menu", "startActions", "endActions"]);
59
59
  // PREFERENCES
60
- const scPreferences = (0, react_core_1.useSCPreferences)();
60
+ const { preferences } = (0, react_core_1.useSCPreferences)();
61
61
  const copyright = (0, react_1.useMemo)(() => {
62
- return scPreferences.preferences && react_core_1.SCPreferences.TEXT_APPLICATION_COPYRIGHT in scPreferences.preferences
63
- ? scPreferences.preferences[react_core_1.SCPreferences.TEXT_APPLICATION_COPYRIGHT].value.replace('$year', new Date().getFullYear())
62
+ return preferences && react_core_1.SCPreferences.TEXT_APPLICATION_COPYRIGHT in preferences
63
+ ? preferences[react_core_1.SCPreferences.TEXT_APPLICATION_COPYRIGHT].value.replace('$year', new Date().getFullYear())
64
64
  : null;
65
- }, [scPreferences.preferences]);
65
+ }, [preferences]);
66
+ const exploreStreamEnabled = preferences[react_core_1.SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
66
67
  // STATE
67
68
  const [_menu, setMenu] = (0, react_1.useState)(menu);
68
69
  const [loading, setLoading] = (0, react_1.useState)(!menu);
@@ -95,6 +96,8 @@ function Footer(inProps) {
95
96
  if (loading) {
96
97
  return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
97
98
  }
98
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({}, rest, { className: (0, classnames_1.default)(classes.root, className) }, { children: [startActions, (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.itemList }, { children: (0, utils_1.sortByAttr)(_menu.items, 'order').map((item, index) => ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, className: classes.item, to: item.url, variant: "text" }, { children: item.label }), item.id))) })), endActions, (0, jsx_runtime_1.jsx)(material_1.Typography, { textAlign: "center", className: classes.copyright, variant: "body2", dangerouslySetInnerHTML: { __html: copyright } })] })));
99
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({}, rest, { className: (0, classnames_1.default)(classes.root, className) }, { children: [startActions, (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.itemList }, { children: (0, utils_1.sortByAttr)(_menu.items, 'order')
100
+ .filter((item) => exploreStreamEnabled || item.url !== constants_1.EXPLORE_MENU_ITEM)
101
+ .map((item, index) => ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ component: react_core_1.Link, className: classes.item, to: item.url, variant: "text" }, { children: item.label }), item.id))) })), endActions, (0, jsx_runtime_1.jsx)(material_1.Typography, { textAlign: "center", className: classes.copyright, variant: "body2", dangerouslySetInnerHTML: { __html: copyright } })] })));
99
102
  }
100
103
  exports.default = Footer;
@@ -1 +1,2 @@
1
1
  export declare const PREFIX = "SCFooter";
2
+ export declare const EXPLORE_MENU_ITEM = "/explore/";
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PREFIX = void 0;
3
+ exports.EXPLORE_MENU_ITEM = exports.PREFIX = void 0;
4
4
  exports.PREFIX = 'SCFooter';
5
+ exports.EXPLORE_MENU_ITEM = '/explore/';
@@ -96,7 +96,7 @@ export default function EventSubscribeButton(inProps) {
96
96
  const { scEvent, setSCEvent } = useSCFetchEvent({
97
97
  id: eventId,
98
98
  event,
99
- cacheStrategy: authUserId ? CacheStrategies.CACHE_FIRST : CacheStrategies.STALE_WHILE_REVALIDATE
99
+ cacheStrategy: authUserId ? CacheStrategies.NETWORK_ONLY : CacheStrategies.STALE_WHILE_REVALIDATE
100
100
  });
101
101
  const isEventAdmin = useMemo(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
102
102
  // HANDLERS
@@ -10,7 +10,7 @@ import { Logger, sortByAttr } from '@selfcommunity/utils';
10
10
  import { Link, SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
11
11
  import { SCOPE_SC_UI } from '../../constants/Errors';
12
12
  import FooterSkeleton from './Skeleton';
13
- import { PREFIX } from './constants';
13
+ import { PREFIX, EXPLORE_MENU_ITEM } from './constants';
14
14
  const classes = {
15
15
  root: `${PREFIX}-root`,
16
16
  itemList: `${PREFIX}-item-list`,
@@ -20,7 +20,7 @@ const classes = {
20
20
  const Root = styled(Box, {
21
21
  name: PREFIX,
22
22
  slot: 'Root'
23
- })(({ theme }) => ({}));
23
+ })(() => ({}));
24
24
  /**
25
25
  * > API documentation for the Community-JS Footer component. Learn about the available props and the CSS API.
26
26
  *
@@ -55,12 +55,13 @@ export default function Footer(inProps) {
55
55
  });
56
56
  const { className, menu = null, startActions = null, endActions = null } = props, rest = __rest(props, ["className", "menu", "startActions", "endActions"]);
57
57
  // PREFERENCES
58
- const scPreferences = useSCPreferences();
58
+ const { preferences } = useSCPreferences();
59
59
  const copyright = useMemo(() => {
60
- return scPreferences.preferences && SCPreferences.TEXT_APPLICATION_COPYRIGHT in scPreferences.preferences
61
- ? scPreferences.preferences[SCPreferences.TEXT_APPLICATION_COPYRIGHT].value.replace('$year', new Date().getFullYear())
60
+ return preferences && SCPreferences.TEXT_APPLICATION_COPYRIGHT in preferences
61
+ ? preferences[SCPreferences.TEXT_APPLICATION_COPYRIGHT].value.replace('$year', new Date().getFullYear())
62
62
  : null;
63
- }, [scPreferences.preferences]);
63
+ }, [preferences]);
64
+ const exploreStreamEnabled = preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
64
65
  // STATE
65
66
  const [_menu, setMenu] = useState(menu);
66
67
  const [loading, setLoading] = useState(!menu);
@@ -93,5 +94,7 @@ export default function Footer(inProps) {
93
94
  if (loading) {
94
95
  return _jsx(FooterSkeleton, {});
95
96
  }
96
- return (_jsxs(Root, Object.assign({}, rest, { className: classNames(classes.root, className) }, { children: [startActions, _jsx(Box, Object.assign({ className: classes.itemList }, { children: sortByAttr(_menu.items, 'order').map((item, index) => (_jsx(Button, Object.assign({ component: Link, className: classes.item, to: item.url, variant: "text" }, { children: item.label }), item.id))) })), endActions, _jsx(Typography, { textAlign: "center", className: classes.copyright, variant: "body2", dangerouslySetInnerHTML: { __html: copyright } })] })));
97
+ return (_jsxs(Root, Object.assign({}, rest, { className: classNames(classes.root, className) }, { children: [startActions, _jsx(Box, Object.assign({ className: classes.itemList }, { children: sortByAttr(_menu.items, 'order')
98
+ .filter((item) => exploreStreamEnabled || item.url !== EXPLORE_MENU_ITEM)
99
+ .map((item, index) => (_jsx(Button, Object.assign({ component: Link, className: classes.item, to: item.url, variant: "text" }, { children: item.label }), item.id))) })), endActions, _jsx(Typography, { textAlign: "center", className: classes.copyright, variant: "body2", dangerouslySetInnerHTML: { __html: copyright } })] })));
97
100
  }
@@ -1 +1,2 @@
1
1
  export declare const PREFIX = "SCFooter";
2
+ export declare const EXPLORE_MENU_ITEM = "/explore/";
@@ -1 +1,2 @@
1
1
  export const PREFIX = 'SCFooter';
2
+ export const EXPLORE_MENU_ITEM = '/explore/';