@selfcommunity/react-ui 0.11.0-alpha.92 → 0.11.0-alpha.93

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.
@@ -170,13 +170,17 @@ const Feed = (inProps, ref) => {
170
170
  }
171
171
  ]
172
172
  : []),
173
- {
174
- type: 'widget',
175
- component: FooterWidget_1.default,
176
- componentProps: {},
177
- column: 'right',
178
- position: 1
179
- }
173
+ ...(oneColLayout
174
+ ? []
175
+ : [
176
+ {
177
+ type: 'widget',
178
+ component: FooterWidget_1.default,
179
+ componentProps: {},
180
+ column: 'right',
181
+ position: 1
182
+ }
183
+ ])
180
184
  ]
181
185
  .map((w, i) => Object.assign({}, w, { position: w.position * (w.column === 'right' ? 5 : 1), id: `${w.column}_${i}` }))
182
186
  .sort(feed_1.widgetSort), [widgets, advEnabled]);
@@ -6,6 +6,7 @@ const react_1 = require("react");
6
6
  const system_1 = require("@mui/system");
7
7
  const material_1 = require("@mui/material");
8
8
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
9
+ const types_1 = require("@selfcommunity/types");
9
10
  const utils_1 = require("@selfcommunity/utils");
10
11
  const react_core_1 = require("@selfcommunity/react-core");
11
12
  const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
@@ -53,8 +54,10 @@ function Footer(inProps) {
53
54
  name: constants_1.PREFIX
54
55
  });
55
56
  const { className, menu = null, startActions = null, endActions = null } = props, rest = tslib_1.__rest(props, ["className", "menu", "startActions", "endActions"]);
57
+ // CONTEXT
58
+ const scUserContext = (0, react_core_1.useSCUser)();
56
59
  // HOOKS
57
- const { _menu, loading } = (0, react_core_1.useFetchMenuFooter)(menu);
60
+ const { _menu, loading } = (0, react_core_1.useFetchMenuFooter)(scUserContext.user ? types_1.SCCustomMenu.BASE : types_1.SCCustomMenu.NOT_LOGGED, menu);
58
61
  // PREFERENCES
59
62
  const { preferences } = (0, react_core_1.useSCPreferences)();
60
63
  const copyright = (0, react_1.useMemo)(() => {
@@ -87,7 +87,7 @@ function NavigationSettingsIconButton(inProps) {
87
87
  const theme = (0, material_1.useTheme)();
88
88
  const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
89
89
  const scRoutingContext = (0, react_core_1.useSCRouting)();
90
- const { _menu } = (0, react_core_1.useFetchMenuFooter)(null);
90
+ const { _menu } = (0, react_core_1.useFetchMenuFooter)(types_1.SCCustomMenu.USER);
91
91
  // PREFERENCES
92
92
  const scPreferences = (0, react_core_1.useSCPreferences)();
93
93
  const preferences = (0, react_1.useMemo)(() => {
@@ -172,7 +172,6 @@ const Root = (0, material_1.styled)(Widget_1.default, {
172
172
  * @param inProps
173
173
  */
174
174
  function PlatformWidget(inProps) {
175
- var _a;
176
175
  // PROPS
177
176
  const props = (0, system_1.useThemeProps)({
178
177
  props: inProps,
@@ -304,7 +303,7 @@ function PlatformWidget(inProps) {
304
303
  /**
305
304
  * Renders root object (if not hidden by autoHide prop)
306
305
  */
307
- if (!autoHide && ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.role)) {
306
+ if (!autoHide && (isAdmin || isEditor || isModerator)) {
308
307
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className, { [classes.tutorialOpen]: isTutorialOpen }) }, rest, { children: [content, tutorial] })), (0, jsx_runtime_1.jsx)(material_1.Backdrop, { sx: { color: '#fff', zIndex: (theme) => theme.zIndex.drawer + 1 }, open: isTutorialOpen, onClick: handleCloseTutorial })] }));
309
308
  }
310
309
  return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
@@ -167,13 +167,17 @@ const Feed = (inProps, ref) => {
167
167
  }
168
168
  ]
169
169
  : []),
170
- {
171
- type: 'widget',
172
- component: FooterWidget,
173
- componentProps: {},
174
- column: 'right',
175
- position: 1
176
- }
170
+ ...(oneColLayout
171
+ ? []
172
+ : [
173
+ {
174
+ type: 'widget',
175
+ component: FooterWidget,
176
+ componentProps: {},
177
+ column: 'right',
178
+ position: 1
179
+ }
180
+ ])
177
181
  ]
178
182
  .map((w, i) => Object.assign({}, w, { position: w.position * (w.column === 'right' ? 5 : 1), id: `${w.column}_${i}` }))
179
183
  .sort(widgetSort), [widgets, advEnabled]);
@@ -4,8 +4,9 @@ import { useMemo } from 'react';
4
4
  import { useThemeProps } from '@mui/system';
5
5
  import { Box, Button, Typography, styled } from '@mui/material';
6
6
  import classNames from 'classnames';
7
+ import { SCCustomMenu } from '@selfcommunity/types';
7
8
  import { sortByAttr } from '@selfcommunity/utils';
8
- import { Link, SCPreferences, useFetchMenuFooter, useSCPreferences } from '@selfcommunity/react-core';
9
+ import { Link, SCPreferences, useFetchMenuFooter, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
9
10
  import FooterSkeleton from './Skeleton';
10
11
  import { PREFIX, EXPLORE_MENU_ITEM } from './constants';
11
12
  const classes = {
@@ -51,8 +52,10 @@ export default function Footer(inProps) {
51
52
  name: PREFIX
52
53
  });
53
54
  const { className, menu = null, startActions = null, endActions = null } = props, rest = __rest(props, ["className", "menu", "startActions", "endActions"]);
55
+ // CONTEXT
56
+ const scUserContext = useSCUser();
54
57
  // HOOKS
55
- const { _menu, loading } = useFetchMenuFooter(menu);
58
+ const { _menu, loading } = useFetchMenuFooter(scUserContext.user ? SCCustomMenu.BASE : SCCustomMenu.NOT_LOGGED, menu);
56
59
  // PREFERENCES
57
60
  const { preferences } = useSCPreferences();
58
61
  const copyright = useMemo(() => {
@@ -9,7 +9,7 @@ import { FormattedMessage } from 'react-intl';
9
9
  import { PreferenceService, UserService } from '@selfcommunity/api-services';
10
10
  import { SCOPE_SC_UI } from '../../constants/Errors';
11
11
  import { Logger, sortByAttr } from '@selfcommunity/utils';
12
- import { SCPreferenceName } from '@selfcommunity/types';
12
+ import { SCCustomMenu, SCPreferenceName } from '@selfcommunity/types';
13
13
  import { EXPLORE_MENU_ITEM } from '../Footer/constants';
14
14
  const PREFIX = 'SCNavigationSettingsIconButton';
15
15
  const classes = {
@@ -85,7 +85,7 @@ export default function NavigationSettingsIconButton(inProps) {
85
85
  const theme = useTheme();
86
86
  const isMobile = useMediaQuery(theme.breakpoints.down('md'));
87
87
  const scRoutingContext = useSCRouting();
88
- const { _menu } = useFetchMenuFooter(null);
88
+ const { _menu } = useFetchMenuFooter(SCCustomMenu.USER);
89
89
  // PREFERENCES
90
90
  const scPreferences = useSCPreferences();
91
91
  const preferences = useMemo(() => {
@@ -170,7 +170,6 @@ const Root = styled(Widget, {
170
170
  * @param inProps
171
171
  */
172
172
  export default function PlatformWidget(inProps) {
173
- var _a;
174
173
  // PROPS
175
174
  const props = useThemeProps({
176
175
  props: inProps,
@@ -302,7 +301,7 @@ export default function PlatformWidget(inProps) {
302
301
  /**
303
302
  * Renders root object (if not hidden by autoHide prop)
304
303
  */
305
- if (!autoHide && ((_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.role)) {
304
+ if (!autoHide && (isAdmin || isEditor || isModerator)) {
306
305
  return (_jsxs(_Fragment, { children: [_jsxs(Root, Object.assign({ className: classNames(classes.root, className, { [classes.tutorialOpen]: isTutorialOpen }) }, rest, { children: [content, tutorial] })), _jsx(Backdrop, { sx: { color: '#fff', zIndex: (theme) => theme.zIndex.drawer + 1 }, open: isTutorialOpen, onClick: handleCloseTutorial })] }));
307
306
  }
308
307
  return _jsx(HiddenPlaceholder, {});