@selfcommunity/react-ui 0.11.0-alpha.92 → 0.11.0-alpha.94
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/BottomNavigation/BottomNavigation.d.ts +6 -1
- package/lib/cjs/components/BottomNavigation/BottomNavigation.js +2 -2
- package/lib/cjs/components/Feed/Feed.js +11 -7
- package/lib/cjs/components/Footer/Footer.js +4 -1
- package/lib/cjs/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +1 -1
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +4 -0
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +3 -3
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -2
- package/lib/cjs/components/PlatformWidget/PlatformWidget.js +1 -2
- package/lib/esm/components/BottomNavigation/BottomNavigation.d.ts +6 -1
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +2 -2
- package/lib/esm/components/Feed/Feed.js +11 -7
- package/lib/esm/components/Footer/Footer.js +5 -2
- package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +2 -2
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +4 -0
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +3 -3
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -2
- package/lib/esm/components/PlatformWidget/PlatformWidget.js +1 -2
- package/lib/umd/{362.js → 250.js} +2 -2
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
- /package/lib/umd/{362.js.LICENSE.txt → 250.js.LICENSE.txt} +0 -0
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { BottomNavigationProps as MuiBottomNavigationProps } from '@mui/material';
|
|
2
|
-
export
|
|
2
|
+
export interface BottomNavigationProps extends MuiBottomNavigationProps {
|
|
3
|
+
/**
|
|
4
|
+
* Callback on click home
|
|
5
|
+
*/
|
|
6
|
+
onClickHome?: () => void;
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* > API documentation for the Community-JS Bottom Navigation component. Learn about the available props and the CSS API.
|
|
5
10
|
*
|
|
@@ -55,7 +55,7 @@ function BottomNavigation(inProps) {
|
|
|
55
55
|
props: inProps,
|
|
56
56
|
name: PREFIX
|
|
57
57
|
});
|
|
58
|
-
const { className, children = null } = props, rest = tslib_1.__rest(props, ["className", "children"]);
|
|
58
|
+
const { className, children = null, onClickHome } = props, rest = tslib_1.__rest(props, ["className", "children", "onClickHome"]);
|
|
59
59
|
// CONTEXT
|
|
60
60
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
61
61
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
@@ -88,7 +88,7 @@ function BottomNavigation(inProps) {
|
|
|
88
88
|
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root, { [classes.ios]: isIOS }) }, rest, { children: children
|
|
89
89
|
? children
|
|
90
90
|
: [
|
|
91
|
-
(0, jsx_runtime_1.jsx)(material_1.BottomNavigationAction, { className: classes.action, component: react_core_1.Link, to: scUserContext.user ? scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}) : '/', value: scUserContext.user ? scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}) : '/', icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "home" }) }, "home"),
|
|
91
|
+
(0, jsx_runtime_1.jsx)(material_1.BottomNavigationAction, Object.assign({ className: classes.action, component: react_core_1.Link, to: scUserContext.user ? scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}) : '/', value: scUserContext.user ? scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}) : '/', icon: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "home" }) }, (onClickHome && { onClick: onClickHome })), "home"),
|
|
92
92
|
// (scUserContext.user || contentAvailable) && exploreStreamEnabled ? (
|
|
93
93
|
// <BottomNavigationAction
|
|
94
94
|
// key="explore"
|
|
@@ -170,13 +170,17 @@ const Feed = (inProps, ref) => {
|
|
|
170
170
|
}
|
|
171
171
|
]
|
|
172
172
|
: []),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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)(
|
|
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)(() => {
|
|
@@ -51,6 +51,10 @@ export interface NavigationToolbarProps extends ToolbarProps {
|
|
|
51
51
|
* Callback on close notification menu
|
|
52
52
|
*/
|
|
53
53
|
onCloseNotificationMenu?: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Callback on click home
|
|
56
|
+
*/
|
|
57
|
+
onClickHome?: () => void;
|
|
54
58
|
/**
|
|
55
59
|
* Props to spread to the NotificationsMenu
|
|
56
60
|
* @default {}
|
|
@@ -99,7 +99,7 @@ function NavigationToolbar(inProps) {
|
|
|
99
99
|
props: inProps,
|
|
100
100
|
name: constants_1.PREFIX
|
|
101
101
|
});
|
|
102
|
-
const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteComponentProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton_1.default, NavigationMenuIconButtonComponentProps = {}, NavigationMenuIconButtonComponent = NavigationMenuIconButton_1.default, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = tslib_1.__rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteComponentProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponentProps", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
|
|
102
|
+
const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteComponentProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton_1.default, NavigationMenuIconButtonComponentProps = {}, NavigationMenuIconButtonComponent = NavigationMenuIconButton_1.default, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onClickHome, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = tslib_1.__rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteComponentProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponentProps", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onClickHome", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
|
|
103
103
|
// CONTEXT
|
|
104
104
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
105
105
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
@@ -151,7 +151,7 @@ function NavigationToolbar(inProps) {
|
|
|
151
151
|
if (scUserContext.loading) {
|
|
152
152
|
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
153
153
|
}
|
|
154
|
-
const _children = children || ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.navigation }, { children: [scUserContext.user && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.home, { [classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {})) }), "aria-label": "Home", to: scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}), component: react_core_1.Link }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "home" }) }))), preferences[react_core_1.SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED] &&
|
|
154
|
+
const _children = children || ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.navigation }, { children: [scUserContext.user && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.home, { [classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {})) }), "aria-label": "Home", to: scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}), component: react_core_1.Link }, (onClickHome && { onClick: onClickHome }), { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "home" }) }))), preferences[react_core_1.SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED] &&
|
|
155
155
|
(preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) &&
|
|
156
156
|
(!scUserContext.user || (!groupsEnabled && !coursesEnabled && !eventsEnabled)) && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.explore, {
|
|
157
157
|
[classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.EXPLORE_ROUTE_NAME, {}))
|
|
@@ -163,7 +163,7 @@ function NavigationToolbar(inProps) {
|
|
|
163
163
|
}), "aria-label": "Groups", to: scRoutingContext.url(react_core_1.SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), component: react_core_1.Link }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "groups" }) }))), eventsEnabled && (scUserContext.user || preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY]) && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.events, {
|
|
164
164
|
[classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, {}))
|
|
165
165
|
}), "aria-label": "Events", to: scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, {}), component: react_core_1.Link }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "CalendarIcon" }) })))] })));
|
|
166
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: [(0, jsx_runtime_1.jsx)(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[react_core_1.SCPreferences.ADDONS_CLOSED_COMMUNITY] && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "inherit", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? ((0, jsx_runtime_1.jsx)(SearchAutocomplete_1.default, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteComponentProps))) : ((0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.search })), startActions, scUserContext.user ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showComposer && (0, jsx_runtime_1.jsx)(ComposerIconButton_1.default, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: scUserContext.user.username }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.notification, {
|
|
166
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: [(0, jsx_runtime_1.jsx)(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, (onClickHome && { onClick: onClickHome }), { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[react_core_1.SCPreferences.ADDONS_CLOSED_COMMUNITY] && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "inherit", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? ((0, jsx_runtime_1.jsx)(SearchAutocomplete_1.default, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteComponentProps))) : ((0, jsx_runtime_1.jsx)(material_1.Box, { className: classes.search })), startActions, scUserContext.user ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showComposer && (0, jsx_runtime_1.jsx)(ComposerIconButton_1.default, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: scUserContext.user.username }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.notification, {
|
|
167
167
|
[classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}))
|
|
168
168
|
}), "aria-label": "Notification", onClick: handleOpenNotificationMenu }, { children: (0, jsx_runtime_1.jsx)(material_1.Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "notifications_active" }) })) })), Boolean(anchorNotification) && ((0, jsx_runtime_1.jsx)(NotificationMenu_1.default, Object.assign({ className: classes.notificationsMenu, id: "notification-menu", anchorEl: anchorNotification, open: true, onClose: handleCloseNotificationMenu, onClick: handleCloseNotificationMenu, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, NotificationMenuProps)))] }), privateMessagingEnabled && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.messages, {
|
|
169
169
|
[classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}))
|
|
@@ -25,6 +25,10 @@ export interface NavigationToolbarMobileProps extends ToolbarProps {
|
|
|
25
25
|
* Actions to be inserted after Private Messages IconButton
|
|
26
26
|
*/
|
|
27
27
|
endActions?: React.ReactNode | null;
|
|
28
|
+
/**
|
|
29
|
+
* Callback on click home
|
|
30
|
+
*/
|
|
31
|
+
onClickHome?: () => void;
|
|
28
32
|
/**
|
|
29
33
|
* Component for Navigation Menu Icon Button
|
|
30
34
|
*/
|
|
@@ -70,7 +70,7 @@ function NavigationToolbarMobile(inProps) {
|
|
|
70
70
|
props: inProps,
|
|
71
71
|
name: constants_1.PREFIX
|
|
72
72
|
});
|
|
73
|
-
const { className = '', disableSearch = false, preserveDesktopLogo = false, SearchAutocompleteComponentProps = {}, children = null, startActions = null, endActions = null, NavigationMenuIconButtonComponent = NavigationMenuIconButton_1.default, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton_1.default, ComposerIconButtonProps = {} } = props, rest = tslib_1.__rest(props, ["className", "disableSearch", "preserveDesktopLogo", "SearchAutocompleteComponentProps", "children", "startActions", "endActions", "NavigationMenuIconButtonComponent", "NavigationSettingsIconButtonComponent", "ComposerIconButtonProps"]);
|
|
73
|
+
const { className = '', disableSearch = false, preserveDesktopLogo = false, SearchAutocompleteComponentProps = {}, children = null, startActions = null, endActions = null, NavigationMenuIconButtonComponent = NavigationMenuIconButton_1.default, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton_1.default, ComposerIconButtonProps = {}, onClickHome } = props, rest = tslib_1.__rest(props, ["className", "disableSearch", "preserveDesktopLogo", "SearchAutocompleteComponentProps", "children", "startActions", "endActions", "NavigationMenuIconButtonComponent", "NavigationSettingsIconButtonComponent", "ComposerIconButtonProps", "onClickHome"]);
|
|
74
74
|
// CONTEXT
|
|
75
75
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
76
76
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
@@ -107,7 +107,7 @@ function NavigationToolbarMobile(inProps) {
|
|
|
107
107
|
}
|
|
108
108
|
const _children = children || ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(NavigationMenuIconButtonComponent, {}), (0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}), className: (0, classnames_1.default)(className, classes.logo, {
|
|
109
109
|
[classes.logoFlex]: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL].value
|
|
110
|
-
}) }, { children: !preserveDesktopLogo ? ((0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.LOGO_NAVBAR_LOGO_MOBILE].value, alt: "logo" })) : ((0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.LOGO_NAVBAR_LOGO].value, alt: "logo" })) })), preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED].value && ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL].value, className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE].value, alt: "custom_item" }) })))] }));
|
|
110
|
+
}) }, (onClickHome && { onClick: onClickHome }), { children: !preserveDesktopLogo ? ((0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.LOGO_NAVBAR_LOGO_MOBILE].value, alt: "logo" })) : ((0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.LOGO_NAVBAR_LOGO].value, alt: "logo" })) })), preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED].value && ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ target: "blank", to: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL].value, className: classes.customItem }, { children: (0, jsx_runtime_1.jsx)("img", { src: preferences[react_core_1.SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE].value, alt: "custom_item" }) })))] }));
|
|
111
111
|
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: [_children, startActions, (contentAvailable || scUserContext.user) && !disableSearch && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.search, onClick: handleOpenSearch }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "search" }) })), (0, jsx_runtime_1.jsx)(SearchDialog_1.default, { className: classes.searchDialog, fullScreen: true, open: searchOpen, SearchAutocompleteComponentProps: Object.assign(Object.assign({}, SearchAutocompleteComponentProps), { onClear: handleCloseSearch }) })] })), endActions, (!postOnlyStaffEnabled || react_core_1.UserUtils.isStaff(scUserContext.user) || react_core_1.UserUtils.isPublisher(scUserContext.user)) &&
|
|
112
112
|
(scUserContext.user || contentAvailable) &&
|
|
113
113
|
exploreStreamEnabled && (0, jsx_runtime_1.jsx)(ComposerIconButton_1.default, Object.assign({}, ComposerIconButtonProps)), scUserContext.user && (groupsEnabled || eventsEnabled) && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.notifications, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}) }, { children: (0, jsx_runtime_1.jsx)(material_1.Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "notifications_active" }) })) }))), scUserContext.user ? ((0, jsx_runtime_1.jsx)(NavigationSettingsIconButtonComponent, { className: classes.settings })) : ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ className: classes.login, color: "inherit", component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.SIGNIN_ROUTE_NAME, {}) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.appBar.navigation.login", defaultMessage: "ui.appBar.navigation.login" }) })))] })));
|
|
@@ -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 && (
|
|
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, {});
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { BottomNavigationProps as MuiBottomNavigationProps } from '@mui/material';
|
|
2
|
-
export
|
|
2
|
+
export interface BottomNavigationProps extends MuiBottomNavigationProps {
|
|
3
|
+
/**
|
|
4
|
+
* Callback on click home
|
|
5
|
+
*/
|
|
6
|
+
onClickHome?: () => void;
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* > API documentation for the Community-JS Bottom Navigation component. Learn about the available props and the CSS API.
|
|
5
10
|
*
|
|
@@ -53,7 +53,7 @@ export default function BottomNavigation(inProps) {
|
|
|
53
53
|
props: inProps,
|
|
54
54
|
name: PREFIX
|
|
55
55
|
});
|
|
56
|
-
const { className, children = null } = props, rest = __rest(props, ["className", "children"]);
|
|
56
|
+
const { className, children = null, onClickHome } = props, rest = __rest(props, ["className", "children", "onClickHome"]);
|
|
57
57
|
// CONTEXT
|
|
58
58
|
const scUserContext = useSCUser();
|
|
59
59
|
const scRoutingContext = useSCRouting();
|
|
@@ -86,7 +86,7 @@ export default function BottomNavigation(inProps) {
|
|
|
86
86
|
return (_jsx(Root, Object.assign({ className: classNames(className, classes.root, { [classes.ios]: isIOS }) }, rest, { children: children
|
|
87
87
|
? children
|
|
88
88
|
: [
|
|
89
|
-
_jsx(BottomNavigationAction, { className: classes.action, component: Link, to: scUserContext.user ? scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}) : '/', value: scUserContext.user ? scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}) : '/', icon: _jsx(Icon, { children: "home" }) }, "home"),
|
|
89
|
+
_jsx(BottomNavigationAction, Object.assign({ className: classes.action, component: Link, to: scUserContext.user ? scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}) : '/', value: scUserContext.user ? scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}) : '/', icon: _jsx(Icon, { children: "home" }) }, (onClickHome && { onClick: onClickHome })), "home"),
|
|
90
90
|
// (scUserContext.user || contentAvailable) && exploreStreamEnabled ? (
|
|
91
91
|
// <BottomNavigationAction
|
|
92
92
|
// key="explore"
|
|
@@ -167,13 +167,17 @@ const Feed = (inProps, ref) => {
|
|
|
167
167
|
}
|
|
168
168
|
]
|
|
169
169
|
: []),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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(
|
|
88
|
+
const { _menu } = useFetchMenuFooter(SCCustomMenu.USER);
|
|
89
89
|
// PREFERENCES
|
|
90
90
|
const scPreferences = useSCPreferences();
|
|
91
91
|
const preferences = useMemo(() => {
|
|
@@ -51,6 +51,10 @@ export interface NavigationToolbarProps extends ToolbarProps {
|
|
|
51
51
|
* Callback on close notification menu
|
|
52
52
|
*/
|
|
53
53
|
onCloseNotificationMenu?: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Callback on click home
|
|
56
|
+
*/
|
|
57
|
+
onClickHome?: () => void;
|
|
54
58
|
/**
|
|
55
59
|
* Props to spread to the NotificationsMenu
|
|
56
60
|
* @default {}
|
|
@@ -97,7 +97,7 @@ export default function NavigationToolbar(inProps) {
|
|
|
97
97
|
props: inProps,
|
|
98
98
|
name: PREFIX
|
|
99
99
|
});
|
|
100
|
-
const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteComponentProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, NavigationMenuIconButtonComponentProps = {}, NavigationMenuIconButtonComponent = NavigationMenuIconButton, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = __rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteComponentProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponentProps", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
|
|
100
|
+
const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteComponentProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, NavigationMenuIconButtonComponentProps = {}, NavigationMenuIconButtonComponent = NavigationMenuIconButton, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onClickHome, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = __rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteComponentProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponentProps", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onClickHome", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
|
|
101
101
|
// CONTEXT
|
|
102
102
|
const scUserContext = useSCUser();
|
|
103
103
|
const scRoutingContext = useSCRouting();
|
|
@@ -149,7 +149,7 @@ export default function NavigationToolbar(inProps) {
|
|
|
149
149
|
if (scUserContext.loading) {
|
|
150
150
|
return _jsx(NavigationToolbarSkeleton, {});
|
|
151
151
|
}
|
|
152
|
-
const _children = children || (_jsxs(Box, Object.assign({ className: classes.navigation }, { children: [scUserContext.user && (_jsx(IconButton, Object.assign({ className: classNames(classes.home, { [classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {})) }), "aria-label": "Home", to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), component: Link }, { children: _jsx(Icon, { children: "home" }) }))), preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED] &&
|
|
152
|
+
const _children = children || (_jsxs(Box, Object.assign({ className: classes.navigation }, { children: [scUserContext.user && (_jsx(IconButton, Object.assign({ className: classNames(classes.home, { [classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {})) }), "aria-label": "Home", to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), component: Link }, (onClickHome && { onClick: onClickHome }), { children: _jsx(Icon, { children: "home" }) }))), preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED] &&
|
|
153
153
|
(preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) &&
|
|
154
154
|
(!scUserContext.user || (!groupsEnabled && !coursesEnabled && !eventsEnabled)) && (_jsx(IconButton, Object.assign({ className: classNames(classes.explore, {
|
|
155
155
|
[classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.EXPLORE_ROUTE_NAME, {}))
|
|
@@ -161,7 +161,7 @@ export default function NavigationToolbar(inProps) {
|
|
|
161
161
|
}), "aria-label": "Groups", to: scRoutingContext.url(SCRoutes.GROUPS_SUBSCRIBED_ROUTE_NAME, {}), component: Link }, { children: _jsx(Icon, { children: "groups" }) }))), eventsEnabled && (scUserContext.user || preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY]) && (_jsx(IconButton, Object.assign({ className: classNames(classes.events, {
|
|
162
162
|
[classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}))
|
|
163
163
|
}), "aria-label": "Events", to: scRoutingContext.url(SCRoutes.EVENTS_ROUTE_NAME, {}), component: Link }, { children: _jsx(Icon, { children: "CalendarIcon" }) })))] })));
|
|
164
|
-
return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsx(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, { children: _jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[SCPreferences.ADDONS_CLOSED_COMMUNITY] && (_jsx(Button, Object.assign({ color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && (_jsx(_Fragment, { children: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? (_jsx(Tooltip, Object.assign({ title: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: _jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? (_jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteComponentProps))) : (_jsx(Box, { className: classes.search })), startActions, scUserContext.user ? (_jsxs(_Fragment, { children: [showComposer && _jsx(ComposerIconButton, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), _jsx(Tooltip, Object.assign({ title: scUserContext.user.username }, { children: _jsx(IconButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: _jsx(Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), _jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classNames(classes.notification, {
|
|
164
|
+
return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_jsx(NavigationMenuIconButtonComponent, Object.assign({}, NavigationMenuIconButtonComponentProps)), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classes.logo }, (onClickHome && { onClick: onClickHome }), { children: _jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO], alt: "logo" }) })), !scUserContext.user && !preferences[SCPreferences.ADDONS_CLOSED_COMMUNITY] && (_jsx(Button, Object.assign({ color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNUP_ROUTE_NAME, {}), className: classes.register }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.register", defaultMessage: "ui.appBar.navigation.register" }) }))), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED] && (_jsx(_Fragment, { children: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] ? (_jsx(Tooltip, Object.assign({ title: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT] }, { children: _jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) })) }))) : (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL], className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE], alt: "custom_item" }) }))) })), _children, (preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY] || scUserContext.user) && !disableSearch ? (_jsx(SearchAutocomplete, Object.assign({ className: classes.search, blurOnSelect: true }, SearchAutocompleteComponentProps))) : (_jsx(Box, { className: classes.search })), startActions, scUserContext.user ? (_jsxs(_Fragment, { children: [showComposer && _jsx(ComposerIconButton, Object.assign({ className: classes.composer }, ComposerIconButtonProps)), _jsx(Tooltip, Object.assign({ title: scUserContext.user.username }, { children: _jsx(IconButton, Object.assign({ component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, scUserContext.user), "aria-label": "Profile", className: classes.profile }, { children: _jsx(Avatar, { alt: scUserContext.user.username, src: scUserContext.user.avatar }) })) })), _jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classNames(classes.notification, {
|
|
165
165
|
[classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}))
|
|
166
166
|
}), "aria-label": "Notification", onClick: handleOpenNotificationMenu }, { children: _jsx(Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: _jsx(Icon, { children: "notifications_active" }) })) })), Boolean(anchorNotification) && (_jsx(NotificationMenu, Object.assign({ className: classes.notificationsMenu, id: "notification-menu", anchorEl: anchorNotification, open: true, onClose: handleCloseNotificationMenu, onClick: handleCloseNotificationMenu, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' } }, NotificationMenuProps)))] }), privateMessagingEnabled && (_jsx(IconButton, Object.assign({ className: classNames(classes.messages, {
|
|
167
167
|
[classes.active]: value.startsWith(scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}))
|
|
@@ -25,6 +25,10 @@ export interface NavigationToolbarMobileProps extends ToolbarProps {
|
|
|
25
25
|
* Actions to be inserted after Private Messages IconButton
|
|
26
26
|
*/
|
|
27
27
|
endActions?: React.ReactNode | null;
|
|
28
|
+
/**
|
|
29
|
+
* Callback on click home
|
|
30
|
+
*/
|
|
31
|
+
onClickHome?: () => void;
|
|
28
32
|
/**
|
|
29
33
|
* Component for Navigation Menu Icon Button
|
|
30
34
|
*/
|
|
@@ -68,7 +68,7 @@ export default function NavigationToolbarMobile(inProps) {
|
|
|
68
68
|
props: inProps,
|
|
69
69
|
name: PREFIX
|
|
70
70
|
});
|
|
71
|
-
const { className = '', disableSearch = false, preserveDesktopLogo = false, SearchAutocompleteComponentProps = {}, children = null, startActions = null, endActions = null, NavigationMenuIconButtonComponent = NavigationMenuIconButton, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, ComposerIconButtonProps = {} } = props, rest = __rest(props, ["className", "disableSearch", "preserveDesktopLogo", "SearchAutocompleteComponentProps", "children", "startActions", "endActions", "NavigationMenuIconButtonComponent", "NavigationSettingsIconButtonComponent", "ComposerIconButtonProps"]);
|
|
71
|
+
const { className = '', disableSearch = false, preserveDesktopLogo = false, SearchAutocompleteComponentProps = {}, children = null, startActions = null, endActions = null, NavigationMenuIconButtonComponent = NavigationMenuIconButton, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton, ComposerIconButtonProps = {}, onClickHome } = props, rest = __rest(props, ["className", "disableSearch", "preserveDesktopLogo", "SearchAutocompleteComponentProps", "children", "startActions", "endActions", "NavigationMenuIconButtonComponent", "NavigationSettingsIconButtonComponent", "ComposerIconButtonProps", "onClickHome"]);
|
|
72
72
|
// CONTEXT
|
|
73
73
|
const scUserContext = useSCUser();
|
|
74
74
|
const scRoutingContext = useSCRouting();
|
|
@@ -105,7 +105,7 @@ export default function NavigationToolbarMobile(inProps) {
|
|
|
105
105
|
}
|
|
106
106
|
const _children = children || (_jsxs(_Fragment, { children: [_jsx(NavigationMenuIconButtonComponent, {}), _jsx(Link, Object.assign({ to: scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}), className: classNames(className, classes.logo, {
|
|
107
107
|
[classes.logoFlex]: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL].value
|
|
108
|
-
}) }, { children: !preserveDesktopLogo ? (_jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO_MOBILE].value, alt: "logo" })) : (_jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO].value, alt: "logo" })) })), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED].value && (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL].value, className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE].value, alt: "custom_item" }) })))] }));
|
|
108
|
+
}) }, (onClickHome && { onClick: onClickHome }), { children: !preserveDesktopLogo ? (_jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO_MOBILE].value, alt: "logo" })) : (_jsx("img", { src: preferences[SCPreferences.LOGO_NAVBAR_LOGO].value, alt: "logo" })) })), preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED].value && (_jsx(Link, Object.assign({ target: "blank", to: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL].value, className: classes.customItem }, { children: _jsx("img", { src: preferences[SCPreferences.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE].value, alt: "custom_item" }) })))] }));
|
|
109
109
|
return (_jsxs(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: [_children, startActions, (contentAvailable || scUserContext.user) && !disableSearch && (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ className: classes.search, onClick: handleOpenSearch }, { children: _jsx(Icon, { children: "search" }) })), _jsx(SearchDialog, { className: classes.searchDialog, fullScreen: true, open: searchOpen, SearchAutocompleteComponentProps: Object.assign(Object.assign({}, SearchAutocompleteComponentProps), { onClear: handleCloseSearch }) })] })), endActions, (!postOnlyStaffEnabled || UserUtils.isStaff(scUserContext.user) || UserUtils.isPublisher(scUserContext.user)) &&
|
|
110
110
|
(scUserContext.user || contentAvailable) &&
|
|
111
111
|
exploreStreamEnabled && _jsx(ComposerIconButton, Object.assign({}, ComposerIconButtonProps)), scUserContext.user && (groupsEnabled || eventsEnabled) && (_jsx(IconButton, Object.assign({ className: classes.notifications, component: Link, to: scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}) }, { children: _jsx(Badge, Object.assign({ badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" }, { children: _jsx(Icon, { children: "notifications_active" }) })) }))), scUserContext.user ? (_jsx(NavigationSettingsIconButtonComponent, { className: classes.settings })) : (_jsx(Button, Object.assign({ className: classes.login, color: "inherit", component: Link, to: scRoutingContext.url(SCRoutes.SIGNIN_ROUTE_NAME, {}) }, { children: _jsx(FormattedMessage, { id: "ui.appBar.navigation.login", defaultMessage: "ui.appBar.navigation.login" }) })))] })));
|
|
@@ -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 && (
|
|
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, {});
|