@selfcommunity/react-ui 0.8.0-embeds.17 → 0.8.1-alpha.0
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/Categories/Categories.js +22 -0
- package/lib/cjs/components/CategoriesPopularWidget/CategoriesPopularWidget.js +21 -0
- package/lib/cjs/components/CategoriesSuggestionWidget/CategoriesSuggestionWidget.js +21 -0
- package/lib/cjs/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +1 -1
- package/lib/cjs/components/Events/Events.js +15 -5
- package/lib/cjs/components/Events/LocationEventsFilter.d.ts +14 -0
- package/lib/cjs/components/Events/LocationEventsFilter.js +45 -0
- package/lib/cjs/components/Events/PastEventsFilter.js +1 -2
- package/lib/cjs/components/Feed/Feed.js +3 -2
- package/lib/cjs/components/GroupActionsMenu/index.d.ts +57 -0
- package/lib/cjs/components/GroupActionsMenu/index.js +157 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +6 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.js +8 -4
- package/lib/cjs/components/Groups/Groups.js +26 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +31 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +35 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +4 -20
- package/lib/cjs/components/NavigationMenuIconButton/index.d.ts +2 -1
- package/lib/cjs/components/NavigationMenuIconButton/index.js +3 -1
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +2 -2
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +5 -1
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +55 -7
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +8 -4
- package/lib/cjs/components/OnBoardingWidget/Steps/Invite/Invite.js +56 -12
- package/lib/cjs/components/PlatformWidget/constants.d.ts +0 -4
- package/lib/cjs/components/PlatformWidget/constants.js +1 -5
- package/lib/cjs/constants/GroupActionsMenu.d.ts +5 -0
- package/lib/cjs/constants/GroupActionsMenu.js +8 -0
- package/lib/cjs/constants/PubSub.d.ts +8 -1
- package/lib/cjs/constants/PubSub.js +9 -1
- package/lib/cjs/index.d.ts +4 -2
- package/lib/cjs/index.js +11 -5
- package/lib/cjs/shared/EventInfoDetails/index.js +3 -3
- package/lib/cjs/shared/InfiniteScroll/index.js +4 -4
- package/lib/cjs/shared/Media/Link/DisplayComponent.js +5 -5
- package/lib/esm/components/Categories/Categories.js +23 -1
- package/lib/esm/components/CategoriesPopularWidget/CategoriesPopularWidget.js +22 -1
- package/lib/esm/components/CategoriesSuggestionWidget/CategoriesSuggestionWidget.js +22 -1
- package/lib/esm/components/Composer/TypeSwitchButtonGroup/TypeSwitchButtonGroup.js +2 -2
- package/lib/esm/components/Events/Events.js +16 -6
- package/lib/esm/components/Events/LocationEventsFilter.d.ts +14 -0
- package/lib/esm/components/Events/LocationEventsFilter.js +41 -0
- package/lib/esm/components/Events/PastEventsFilter.js +1 -2
- package/lib/esm/components/Feed/Feed.js +4 -3
- package/lib/esm/components/GroupActionsMenu/index.d.ts +57 -0
- package/lib/esm/components/GroupActionsMenu/index.js +154 -0
- package/lib/esm/components/GroupHeader/GroupHeader.d.ts +6 -0
- package/lib/esm/components/GroupHeader/GroupHeader.js +9 -5
- package/lib/esm/components/Groups/Groups.js +27 -1
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +31 -0
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +32 -0
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +6 -22
- package/lib/esm/components/NavigationMenuIconButton/index.d.ts +2 -1
- package/lib/esm/components/NavigationMenuIconButton/index.js +2 -1
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +2 -2
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +5 -1
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +57 -9
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +9 -5
- package/lib/esm/components/OnBoardingWidget/Steps/Invite/Invite.js +59 -14
- package/lib/esm/components/PlatformWidget/constants.d.ts +0 -4
- package/lib/esm/components/PlatformWidget/constants.js +0 -4
- package/lib/esm/constants/GroupActionsMenu.d.ts +5 -0
- package/lib/esm/constants/GroupActionsMenu.js +5 -0
- package/lib/esm/constants/PubSub.d.ts +8 -1
- package/lib/esm/constants/PubSub.js +8 -0
- package/lib/esm/index.d.ts +4 -2
- package/lib/esm/index.js +5 -3
- package/lib/esm/shared/EventInfoDetails/index.js +3 -3
- package/lib/esm/shared/InfiniteScroll/index.js +4 -4
- package/lib/esm/shared/Media/Link/DisplayComponent.js +5 -5
- package/lib/umd/148.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +9 -9
- package/lib/umd/99.js +0 -2
- /package/lib/umd/{99.js.LICENSE.txt → 148.js.LICENSE.txt} +0 -0
|
@@ -21,6 +21,7 @@ const GroupSubscribeButton_1 = tslib_1.__importDefault(require("../GroupSubscrib
|
|
|
21
21
|
const GroupInviteButton_1 = tslib_1.__importDefault(require("../GroupInviteButton"));
|
|
22
22
|
const PubSub_1 = require("../../constants/PubSub");
|
|
23
23
|
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
24
|
+
const GroupActionsMenu_1 = tslib_1.__importDefault(require("../GroupActionsMenu"));
|
|
24
25
|
const classes = {
|
|
25
26
|
root: `${constants_1.PREFIX}-root`,
|
|
26
27
|
cover: `${constants_1.PREFIX}-cover`,
|
|
@@ -32,7 +33,8 @@ const classes = {
|
|
|
32
33
|
visibility: `${constants_1.PREFIX}-visibility`,
|
|
33
34
|
visibilityItem: `${constants_1.PREFIX}-visibility-item`,
|
|
34
35
|
members: `${constants_1.PREFIX}-members`,
|
|
35
|
-
membersCounter: `${constants_1.PREFIX}-members-counter
|
|
36
|
+
membersCounter: `${constants_1.PREFIX}-members-counter`,
|
|
37
|
+
multiActions: `${constants_1.PREFIX}-multi-actions`
|
|
36
38
|
};
|
|
37
39
|
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
38
40
|
name: constants_1.PREFIX,
|
|
@@ -76,7 +78,7 @@ function GroupHeader(inProps) {
|
|
|
76
78
|
props: inProps,
|
|
77
79
|
name: constants_1.PREFIX
|
|
78
80
|
});
|
|
79
|
-
const { id = null, className = null, group, groupId = null, ChangePictureProps = {}, ChangeCoverProps = {}, GroupSubscribeButtonProps = {}, GroupMembersButtonProps = {} } = props, rest = tslib_1.__rest(props, ["id", "className", "group", "groupId", "ChangePictureProps", "ChangeCoverProps", "GroupSubscribeButtonProps", "GroupMembersButtonProps"]);
|
|
81
|
+
const { id = null, className = null, group, groupId = null, ChangePictureProps = {}, ChangeCoverProps = {}, GroupSubscribeButtonProps = {}, GroupMembersButtonProps = {}, GroupActionsProps } = props, rest = tslib_1.__rest(props, ["id", "className", "group", "groupId", "ChangePictureProps", "ChangeCoverProps", "GroupSubscribeButtonProps", "GroupMembersButtonProps", "GroupActionsProps"]);
|
|
80
82
|
// PREFERENCES
|
|
81
83
|
const scPreferences = (0, react_core_1.useSCPreferences)();
|
|
82
84
|
const visibilityEnabled = (0, react_1.useMemo)(() => scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_GROUPS_VISIBILITY_ENABLED].value, [scPreferences.preferences]);
|
|
@@ -85,6 +87,8 @@ function GroupHeader(inProps) {
|
|
|
85
87
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
86
88
|
// HOOKS
|
|
87
89
|
const { scGroup, setSCGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
|
|
90
|
+
const theme = (0, material_1.useTheme)();
|
|
91
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
88
92
|
// REFS
|
|
89
93
|
const updatesSubscription = (0, react_1.useRef)(null);
|
|
90
94
|
// CONST
|
|
@@ -147,8 +151,8 @@ function GroupHeader(inProps) {
|
|
|
147
151
|
const _backgroundCover = Object.assign({}, (scGroup.emotional_image
|
|
148
152
|
? { background: `url('${scGroup.emotional_image}') center / cover` }
|
|
149
153
|
: { background: `url('${scPreferences.preferences[react_core_1.SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
|
|
150
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.avatar }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { children: (0, jsx_runtime_1.jsx)("img", { alt: "group", src: scGroup.image_big ? scGroup.image_big : '' }) }) })), isGroupAdmin && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ChangeGroupPicture_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeAvatar, className: classes.changePicture }, ChangePictureProps)), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.changeCover }, { children: (0, jsx_runtime_1.jsx)(ChangeGroupCover_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeCover }, ChangeCoverProps)) }))] }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.info }, { children: [isGroupAdmin && (0, jsx_runtime_1.jsx)(EditGroupButton_1.default, { group: scGroup, groupId: scGroup.id, onEditSuccess: (data) => setSCGroup(data) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scGroup.name })), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [privateEnabled && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.public", defaultMessage: "ui.groupHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.private", defaultMessage: "ui.groupHeader.visibility.private" })] }))) })), visibilityEnabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [privateEnabled && (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), scGroup.visible ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.visible", defaultMessage: "ui.groupHeader.visibility.visible" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility_off" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.hidden", defaultMessage: "ui.groupHeader.visibility.hidden" })] })))] }))] }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: ((scGroup && scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC) ||
|
|
154
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.avatar }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { children: (0, jsx_runtime_1.jsx)("img", { alt: "group", src: scGroup.image_big ? scGroup.image_big : '' }) }) })), isGroupAdmin && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ChangeGroupPicture_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeAvatar, className: classes.changePicture }, ChangePictureProps)), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.changeCover }, { children: (0, jsx_runtime_1.jsx)(ChangeGroupCover_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeCover }, ChangeCoverProps)) }))] }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.info }, { children: [isGroupAdmin && !isMobile && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EditGroupButton_1.default, { group: scGroup, groupId: scGroup.id, onEditSuccess: (data) => setSCGroup(data) }), (0, jsx_runtime_1.jsx)(GroupActionsMenu_1.default, Object.assign({ group: scGroup, onEditSuccess: (data) => setSCGroup(data) }, GroupActionsProps))] }))), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scGroup.name })), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [privateEnabled && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.public", defaultMessage: "ui.groupHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.private", defaultMessage: "ui.groupHeader.visibility.private" })] }))) })), visibilityEnabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [privateEnabled && (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), scGroup.visible ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.visible", defaultMessage: "ui.groupHeader.visibility.visible" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility_off" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.hidden", defaultMessage: "ui.groupHeader.visibility.hidden" })] })))] }))] }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: ((scGroup && scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC) ||
|
|
151
155
|
scGroup.subscription_status === types_1.SCGroupSubscriptionStatusType.SUBSCRIBED ||
|
|
152
|
-
isGroupAdmin) && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.members }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.membersCounter, component: "div" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.members", defaultMessage: "ui.groupHeader.members", values: { total: scGroup.subscribers_counter } }) })), (0, jsx_runtime_1.jsx)(GroupMembersButton_1.default, Object.assign({ groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id, group: scGroup, autoHide: !isGroupAdmin }, GroupMembersButtonProps), scGroup.subscribers_counter)] }))) }), isGroupAdmin ? ((0, jsx_runtime_1.jsx)(GroupInviteButton_1.default, { group: scGroup, groupId: scGroup.id })) : ((0, jsx_runtime_1.jsx)(GroupSubscribeButton_1.default, Object.assign({ group: scGroup, onSubscribe: handleSubscribe }, GroupSubscribeButtonProps)))] }))] })));
|
|
156
|
+
isGroupAdmin) && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.members }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.membersCounter, component: "div" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.members", defaultMessage: "ui.groupHeader.members", values: { total: scGroup.subscribers_counter } }) })), (0, jsx_runtime_1.jsx)(GroupMembersButton_1.default, Object.assign({ groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id, group: scGroup, autoHide: !isGroupAdmin }, GroupMembersButtonProps), scGroup.subscribers_counter)] }))) }), isGroupAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(GroupInviteButton_1.default, { group: scGroup, groupId: scGroup.id }), isMobile && (0, jsx_runtime_1.jsx)(GroupActionsMenu_1.default, Object.assign({ group: scGroup, onEditSuccess: (data) => setSCGroup(data) }, GroupActionsProps))] })) : ((0, jsx_runtime_1.jsx)(GroupSubscribeButton_1.default, Object.assign({ group: scGroup, onSubscribe: handleSubscribe }, GroupSubscribeButtonProps)))] }))] })));
|
|
153
157
|
}
|
|
154
158
|
exports.default = GroupHeader;
|
|
@@ -18,6 +18,8 @@ const constants_1 = require("./constants");
|
|
|
18
18
|
const Group_1 = tslib_1.__importStar(require("../Group"));
|
|
19
19
|
const Pagination_1 = require("../../constants/Pagination");
|
|
20
20
|
const InfiniteScroll_1 = tslib_1.__importDefault(require("../../shared/InfiniteScroll"));
|
|
21
|
+
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
22
|
+
const PubSub_1 = require("../../constants/PubSub");
|
|
21
23
|
const classes = {
|
|
22
24
|
root: `${constants_1.PREFIX}-root`,
|
|
23
25
|
filters: `${constants_1.PREFIX}-filter`,
|
|
@@ -85,6 +87,8 @@ function Groups(inProps) {
|
|
|
85
87
|
scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value, [scPreferencesContext.preferences]);
|
|
86
88
|
// CONST
|
|
87
89
|
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
90
|
+
// REFS
|
|
91
|
+
const updatesSubscription = (0, react_1.useRef)(null);
|
|
88
92
|
// HANDLERS
|
|
89
93
|
const handleScrollUp = () => {
|
|
90
94
|
window.scrollTo({ left: 0, top: 0, behavior: 'smooth' });
|
|
@@ -121,6 +125,28 @@ function Groups(inProps) {
|
|
|
121
125
|
fetchGroups();
|
|
122
126
|
}
|
|
123
127
|
}, [contentAvailability, authUserId, search]);
|
|
128
|
+
/**
|
|
129
|
+
* Subscriber for pubsub callback
|
|
130
|
+
*/
|
|
131
|
+
const onDeleteGroupHandler = (0, react_1.useCallback)((_msg, deleted) => {
|
|
132
|
+
setGroups((prev) => {
|
|
133
|
+
if (prev.some((e) => e.id === deleted)) {
|
|
134
|
+
return prev.filter((e) => e.id !== deleted);
|
|
135
|
+
}
|
|
136
|
+
return prev;
|
|
137
|
+
});
|
|
138
|
+
}, [groups]);
|
|
139
|
+
/**
|
|
140
|
+
* On mount, subscribe to receive event updates (only delete)
|
|
141
|
+
*/
|
|
142
|
+
(0, react_1.useEffect)(() => {
|
|
143
|
+
if (groups) {
|
|
144
|
+
updatesSubscription.current = pubsub_js_1.default.subscribe(`${PubSub_1.SCTopicType.GROUP}.${PubSub_1.SCGroupEventType.DELETE}`, onDeleteGroupHandler);
|
|
145
|
+
}
|
|
146
|
+
return () => {
|
|
147
|
+
updatesSubscription.current && pubsub_js_1.default.unsubscribe(updatesSubscription.current);
|
|
148
|
+
};
|
|
149
|
+
}, [groups]);
|
|
124
150
|
const handleNext = (0, react_1.useMemo)(() => () => {
|
|
125
151
|
if (!next) {
|
|
126
152
|
return;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawerProps } from '@mui/material';
|
|
3
|
+
export interface NavigationMenuDrawerProps extends DrawerProps {
|
|
4
|
+
/**
|
|
5
|
+
* Hide drawer header
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
showDrawerHeader?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Custom Drawer header content
|
|
11
|
+
* @default null
|
|
12
|
+
*/
|
|
13
|
+
drawerHeaderContent?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Custom Drawer content
|
|
16
|
+
* @default null
|
|
17
|
+
*/
|
|
18
|
+
drawerContent?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Props to spread to ScrollContainer component
|
|
21
|
+
* This lib use 'react-custom-scrollbars' component to perform scrollbars
|
|
22
|
+
* For more info: https://github.com/malte-wessel/react-custom-scrollbars/blob/master/docs/API.md
|
|
23
|
+
* @default {}
|
|
24
|
+
*/
|
|
25
|
+
ScrollContainerProps?: Record<string, any>;
|
|
26
|
+
/**
|
|
27
|
+
* Any other properties
|
|
28
|
+
*/
|
|
29
|
+
[p: string]: any;
|
|
30
|
+
}
|
|
31
|
+
export default function NavigationMenuDrawer(inProps: NavigationMenuDrawerProps): JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
8
|
+
const system_1 = require("@mui/system");
|
|
9
|
+
const ScrollContainer_1 = tslib_1.__importDefault(require("../../shared/ScrollContainer"));
|
|
10
|
+
const DefaultDrawerContent_1 = tslib_1.__importDefault(require("./DefaultDrawerContent"));
|
|
11
|
+
const DefaultHeaderContent_1 = tslib_1.__importDefault(require("./DefaultHeaderContent"));
|
|
12
|
+
const PREFIX = 'SCNavigationMenuDrawer';
|
|
13
|
+
const classes = {
|
|
14
|
+
root: `${PREFIX}-root`,
|
|
15
|
+
logo: `${PREFIX}-logo`,
|
|
16
|
+
drawerRoot: `${PREFIX}-drawer-root`,
|
|
17
|
+
drawerHeader: `${PREFIX}-drawer-header`,
|
|
18
|
+
drawerHeaderAction: `${PREFIX}-drawer-header-action`,
|
|
19
|
+
drawerContent: `${PREFIX}-drawer-content`
|
|
20
|
+
};
|
|
21
|
+
const Root = (0, styles_1.styled)(material_1.Drawer, {
|
|
22
|
+
name: PREFIX,
|
|
23
|
+
slot: 'Root',
|
|
24
|
+
overridesResolver: (props, styles) => styles.root
|
|
25
|
+
})(({ theme }) => ({}));
|
|
26
|
+
function NavigationMenuDrawer(inProps) {
|
|
27
|
+
// PROPS
|
|
28
|
+
const props = (0, system_1.useThemeProps)({
|
|
29
|
+
props: inProps,
|
|
30
|
+
name: PREFIX
|
|
31
|
+
});
|
|
32
|
+
const { className = null, showDrawerHeader = true, drawerHeaderContent = (0, jsx_runtime_1.jsx)(DefaultHeaderContent_1.default, {}), drawerContent = (0, jsx_runtime_1.jsx)(DefaultDrawerContent_1.default, {}), ScrollContainerProps = {}, open, onClose } = props, rest = tslib_1.__rest(props, ["className", "showDrawerHeader", "drawerHeaderContent", "drawerContent", "ScrollContainerProps", "open", "onClose"]);
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ anchor: "left", className: (0, classnames_1.default)(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, Object.assign({}, ScrollContainerProps, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) }))] })));
|
|
34
|
+
}
|
|
35
|
+
exports.default = NavigationMenuDrawer;
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { IconButtonProps } from '@mui/material';
|
|
2
|
+
import { NavigationMenuDrawerProps } from './NavigationMenuDrawer';
|
|
3
3
|
export interface NavigationMenuIconButtonProps extends IconButtonProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @default
|
|
5
|
+
* Prop to show/hide the default drawer component
|
|
6
|
+
* @default true
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
showDrawer?: boolean;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Callback triggered on menu click
|
|
11
11
|
* @default null
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
onMenuIconClick?: () => void;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @default null
|
|
17
|
-
*/
|
|
18
|
-
drawerContent?: React.ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Props to spread to ScrollContainer component
|
|
21
|
-
* This lib use 'react-custom-scrollbars' component to perform scrollbars
|
|
22
|
-
* For more info: https://github.com/malte-wessel/react-custom-scrollbars/blob/master/docs/API.md
|
|
15
|
+
* Props to spread to default drawer root
|
|
23
16
|
* @default {}
|
|
24
17
|
*/
|
|
25
|
-
|
|
18
|
+
DrawerProps?: NavigationMenuDrawerProps;
|
|
26
19
|
}
|
|
27
20
|
/**
|
|
28
21
|
* > API documentation for the Community-JS Navigation Menu Icon Button component. Learn about the available props and the CSS API.
|
|
@@ -43,10 +36,6 @@ export interface NavigationMenuIconButtonProps extends IconButtonProps {
|
|
|
43
36
|
|Rule Name|Global class|Description|
|
|
44
37
|
|---|---|---|
|
|
45
38
|
|root|.SCNavigationMenuIconButton-root|Styles applied to the root element.|
|
|
46
|
-
|drawerRoot|.SCNavigationMenuIconButton-drawer-root|Styles applied to the drawer root element.|
|
|
47
|
-
|drawerHeader|.SCNavigationMenuIconButton-drawer-header|Styles applied to the drawer header.|
|
|
48
|
-
|drawerHeaderAction|.SCNavigationMenuIconButton-drawer-header-action|Styles applied to the drawer header action element.|
|
|
49
|
-
|drawerContent|.SCNavigationMenuIconButton-drawer-content|Styles applied to the drawer content.|
|
|
50
39
|
|
|
51
40
|
* @param inProps
|
|
52
41
|
*/
|
|
@@ -7,29 +7,17 @@ const styles_1 = require("@mui/material/styles");
|
|
|
7
7
|
const material_1 = require("@mui/material");
|
|
8
8
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
9
9
|
const system_1 = require("@mui/system");
|
|
10
|
-
const ScrollContainer_1 = tslib_1.__importDefault(require("../../shared/ScrollContainer"));
|
|
11
|
-
const DefaultDrawerContent_1 = tslib_1.__importDefault(require("./DefaultDrawerContent"));
|
|
12
|
-
const DefaultHeaderContent_1 = tslib_1.__importDefault(require("./DefaultHeaderContent"));
|
|
13
10
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
11
|
+
const NavigationMenuDrawer_1 = tslib_1.__importDefault(require("./NavigationMenuDrawer"));
|
|
14
12
|
const PREFIX = 'SCNavigationMenuIconButton';
|
|
15
13
|
const classes = {
|
|
16
|
-
root: `${PREFIX}-root
|
|
17
|
-
logo: `${PREFIX}-logo`,
|
|
18
|
-
drawerRoot: `${PREFIX}-drawer-root`,
|
|
19
|
-
drawerHeader: `${PREFIX}-drawer-header`,
|
|
20
|
-
drawerHeaderAction: `${PREFIX}-drawer-header-action`,
|
|
21
|
-
drawerContent: `${PREFIX}-drawer-content`
|
|
14
|
+
root: `${PREFIX}-root`
|
|
22
15
|
};
|
|
23
16
|
const Root = (0, styles_1.styled)(material_1.IconButton, {
|
|
24
17
|
name: PREFIX,
|
|
25
18
|
slot: 'Root',
|
|
26
19
|
overridesResolver: (props, styles) => styles.root
|
|
27
20
|
})(({ theme }) => ({}));
|
|
28
|
-
const DrawerRoot = (0, styles_1.styled)(material_1.Drawer, {
|
|
29
|
-
name: PREFIX,
|
|
30
|
-
slot: 'Root',
|
|
31
|
-
overridesResolver: (props, styles) => styles.drawerRoot
|
|
32
|
-
})(({ theme }) => ({}));
|
|
33
21
|
/**
|
|
34
22
|
* > API documentation for the Community-JS Navigation Menu Icon Button component. Learn about the available props and the CSS API.
|
|
35
23
|
|
|
@@ -49,10 +37,6 @@ const DrawerRoot = (0, styles_1.styled)(material_1.Drawer, {
|
|
|
49
37
|
|Rule Name|Global class|Description|
|
|
50
38
|
|---|---|---|
|
|
51
39
|
|root|.SCNavigationMenuIconButton-root|Styles applied to the root element.|
|
|
52
|
-
|drawerRoot|.SCNavigationMenuIconButton-drawer-root|Styles applied to the drawer root element.|
|
|
53
|
-
|drawerHeader|.SCNavigationMenuIconButton-drawer-header|Styles applied to the drawer header.|
|
|
54
|
-
|drawerHeaderAction|.SCNavigationMenuIconButton-drawer-header-action|Styles applied to the drawer header action element.|
|
|
55
|
-
|drawerContent|.SCNavigationMenuIconButton-drawer-content|Styles applied to the drawer content.|
|
|
56
40
|
|
|
57
41
|
* @param inProps
|
|
58
42
|
*/
|
|
@@ -63,7 +47,7 @@ function NavigationMenuIconButton(inProps) {
|
|
|
63
47
|
props: inProps,
|
|
64
48
|
name: PREFIX
|
|
65
49
|
});
|
|
66
|
-
const { className = null, DrawerProps = {
|
|
50
|
+
const { className = null, DrawerProps = {}, onMenuIconClick = null, showDrawer = true } = props, rest = tslib_1.__rest(props, ["className", "DrawerProps", "onMenuIconClick", "showDrawer"]);
|
|
67
51
|
// STATE
|
|
68
52
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
69
53
|
// CONTEXT
|
|
@@ -79,6 +63,6 @@ function NavigationMenuIconButton(inProps) {
|
|
|
79
63
|
if (!preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value && !((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
80
64
|
return null;
|
|
81
65
|
}
|
|
82
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick:
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: onMenuIconClick !== null && onMenuIconClick !== void 0 ? onMenuIconClick : handleOpen }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "menu" }) })), showDrawer && (0, jsx_runtime_1.jsx)(NavigationMenuDrawer_1.default, Object.assign({ open: Boolean(anchorEl), onClose: handleClose }, DrawerProps))] }));
|
|
83
67
|
}
|
|
84
68
|
exports.default = NavigationMenuIconButton;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import NavigationMenuIconButton, { NavigationMenuIconButtonProps } from './NavigationMenuIconButton';
|
|
2
2
|
import DefaultHeaderContent from './DefaultHeaderContent';
|
|
3
3
|
import DefaultDrawerContent from './DefaultDrawerContent';
|
|
4
|
+
import NavigationMenuDrawer, { NavigationMenuDrawerProps } from './NavigationMenuDrawer';
|
|
4
5
|
export default NavigationMenuIconButton;
|
|
5
|
-
export { NavigationMenuIconButtonProps, DefaultDrawerContent as NavigationMenuContent, DefaultHeaderContent as NavigationMenuHeader };
|
|
6
|
+
export { NavigationMenuIconButtonProps, DefaultDrawerContent as NavigationMenuContent, DefaultHeaderContent as NavigationMenuHeader, NavigationMenuDrawer, NavigationMenuDrawerProps };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NavigationMenuHeader = exports.NavigationMenuContent = void 0;
|
|
3
|
+
exports.NavigationMenuDrawer = exports.NavigationMenuHeader = exports.NavigationMenuContent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const NavigationMenuIconButton_1 = tslib_1.__importDefault(require("./NavigationMenuIconButton"));
|
|
6
6
|
const DefaultHeaderContent_1 = tslib_1.__importDefault(require("./DefaultHeaderContent"));
|
|
7
7
|
exports.NavigationMenuHeader = DefaultHeaderContent_1.default;
|
|
8
8
|
const DefaultDrawerContent_1 = tslib_1.__importDefault(require("./DefaultDrawerContent"));
|
|
9
9
|
exports.NavigationMenuContent = DefaultDrawerContent_1.default;
|
|
10
|
+
const NavigationMenuDrawer_1 = tslib_1.__importDefault(require("./NavigationMenuDrawer"));
|
|
11
|
+
exports.NavigationMenuDrawer = NavigationMenuDrawer_1.default;
|
|
10
12
|
exports.default = NavigationMenuIconButton_1.default;
|
|
@@ -34,6 +34,11 @@ export interface NavigationToolbarProps extends ToolbarProps {
|
|
|
34
34
|
* Component for Navigation Menu Icon Button
|
|
35
35
|
*/
|
|
36
36
|
NavigationMenuIconButtonComponent?: (inProps: NavigationMenuIconButtonProps) => JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* Props to spread to the NavigationMenuIconButtonComponent
|
|
39
|
+
* @default {}
|
|
40
|
+
*/
|
|
41
|
+
NavigationMenuIconButtonComponentProps?: NavigationMenuIconButtonProps;
|
|
37
42
|
/**
|
|
38
43
|
* Component for Navigation Settings
|
|
39
44
|
*/
|
|
@@ -98,7 +98,7 @@ function NavigationToolbar(inProps) {
|
|
|
98
98
|
props: inProps,
|
|
99
99
|
name: constants_1.PREFIX
|
|
100
100
|
});
|
|
101
|
-
const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteProps = {}, startActions = null, endActions = null, NavigationSettingsIconButtonComponent = NavigationSettingsIconButton_1.default, NavigationMenuIconButtonComponent = NavigationMenuIconButton_1.default, children = null, NotificationMenuProps = {}, ComposerIconButtonProps = {}, onOpenNotificationMenu, onCloseNotificationMenu } = props, rest = tslib_1.__rest(props, ["value", "className", "disableSearch", "disableComposer", "SearchAutocompleteProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
|
|
101
|
+
const { value = '', className = '', disableSearch = false, disableComposer = false, SearchAutocompleteProps = {}, 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", "SearchAutocompleteProps", "startActions", "endActions", "NavigationSettingsIconButtonComponent", "NavigationMenuIconButtonComponentProps", "NavigationMenuIconButtonComponent", "children", "NotificationMenuProps", "ComposerIconButtonProps", "onOpenNotificationMenu", "onCloseNotificationMenu"]);
|
|
102
102
|
// CONTEXT
|
|
103
103
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
104
104
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
@@ -147,7 +147,7 @@ function NavigationToolbar(inProps) {
|
|
|
147
147
|
}), "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)(Icon_1.default, { children: "groups" }) }))), eventsEnabled && ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: (0, classnames_1.default)(classes.events, {
|
|
148
148
|
[classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, {}))
|
|
149
149
|
}), "aria-label": "Groups", to: scRoutingContext.url(react_core_1.SCRoutes.EVENTS_ROUTE_NAME, {}), component: react_core_1.Link }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "CalendarIcon" }) })))] })));
|
|
150
|
-
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, {}), (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 }, SearchAutocompleteProps))) : ((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, {
|
|
150
|
+
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 }, SearchAutocompleteProps))) : ((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, {
|
|
151
151
|
[classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}))
|
|
152
152
|
}), "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)(Icon_1.default, { children: "notifications_active" }) })) })), (0, jsx_runtime_1.jsx)(NotificationMenu_1.default, Object.assign({ className: classes.notificationsMenu, id: "notification-menu", anchorEl: anchorNotification, open: Boolean(anchorNotification), 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, {
|
|
153
153
|
[classes.active]: value.startsWith(scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StartStepParams } from '@selfcommunity/api-services';
|
|
2
|
-
import { SCFeedObjectType } from '@selfcommunity/types';
|
|
2
|
+
import { SCFeedObjectType, SCOnBoardingStepType } from '@selfcommunity/types';
|
|
3
3
|
import { VirtualScrollerItemProps } from '../../types/virtualScroller';
|
|
4
4
|
export interface OnBoardingWidgetProps extends VirtualScrollerItemProps {
|
|
5
5
|
/**
|
|
@@ -23,6 +23,10 @@ export interface OnBoardingWidgetProps extends VirtualScrollerItemProps {
|
|
|
23
23
|
* @default false
|
|
24
24
|
*/
|
|
25
25
|
forceExpanded?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The initial step to display
|
|
28
|
+
*/
|
|
29
|
+
initialStep?: SCOnBoardingStepType;
|
|
26
30
|
}
|
|
27
31
|
declare const OnBoardingWidget: (inProps: OnBoardingWidgetProps) => JSX.Element;
|
|
28
32
|
export default OnBoardingWidget;
|
|
@@ -24,9 +24,10 @@ const utils_1 = require("@selfcommunity/utils");
|
|
|
24
24
|
const types_1 = require("@selfcommunity/types");
|
|
25
25
|
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
26
26
|
const notistack_1 = require("notistack");
|
|
27
|
-
const constants_2 = require("../PlatformWidget/constants");
|
|
28
27
|
const header_1 = tslib_1.__importDefault(require("../../assets/onBoarding/header"));
|
|
29
28
|
const BaseDialog_1 = tslib_1.__importDefault(require("../../shared/BaseDialog"));
|
|
29
|
+
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
30
|
+
const PubSub_1 = require("../../constants/PubSub");
|
|
30
31
|
const classes = {
|
|
31
32
|
root: `${constants_1.PREFIX}-root`,
|
|
32
33
|
content: `${constants_1.PREFIX}-content`,
|
|
@@ -53,13 +54,13 @@ const OnBoardingWidget = (inProps) => {
|
|
|
53
54
|
props: inProps,
|
|
54
55
|
name: constants_1.PREFIX
|
|
55
56
|
});
|
|
56
|
-
const { className, GenerateContentsParams = {}, onGeneratedContent = null, onHeightChange, onStateChange, forceExpanded = false } = props, rest = tslib_1.__rest(props, ["className", "GenerateContentsParams", "onGeneratedContent", "onHeightChange", "onStateChange", "forceExpanded"]);
|
|
57
|
+
const { className, GenerateContentsParams = {}, onGeneratedContent = null, onHeightChange, onStateChange, forceExpanded = false, initialStep } = props, rest = tslib_1.__rest(props, ["className", "GenerateContentsParams", "onGeneratedContent", "onHeightChange", "onStateChange", "forceExpanded", "initialStep"]);
|
|
57
58
|
// STATE
|
|
58
59
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
59
60
|
const [initialized, setInitialized] = (0, react_1.useState)(false);
|
|
60
61
|
const [steps, setSteps] = (0, react_1.useState)([]);
|
|
61
62
|
const nextStep = (0, react_1.useMemo)(() => {
|
|
62
|
-
const step = steps === null || steps === void 0 ? void 0 : steps.find((step) => step.status === 'in_progress' || step.status === 'not_started');
|
|
63
|
+
const step = steps === null || steps === void 0 ? void 0 : steps.find((step) => (initialStep ? step.step === initialStep : step.status === 'in_progress' || step.status === 'not_started'));
|
|
63
64
|
return step || (steps === null || steps === void 0 ? void 0 : steps[0]);
|
|
64
65
|
}, [steps]);
|
|
65
66
|
const allStepsDone = (0, react_1.useMemo)(() => {
|
|
@@ -79,7 +80,6 @@ const OnBoardingWidget = (inProps) => {
|
|
|
79
80
|
const scPreferencesContext = (0, react_core_1.useSCPreferences)();
|
|
80
81
|
const scThemeContext = (0, react_core_1.useSCTheme)();
|
|
81
82
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
82
|
-
const isStage = scContext.settings.portal.includes('stage');
|
|
83
83
|
const [isGenerating, setIsGenerating] = (0, react_1.useState)(false);
|
|
84
84
|
// HOOKS
|
|
85
85
|
const theme = (0, material_1.useTheme)();
|
|
@@ -112,10 +112,30 @@ const OnBoardingWidget = (inProps) => {
|
|
|
112
112
|
}
|
|
113
113
|
s.step === types_1.SCOnBoardingStepType.APPEARANCE && handlePreferencesUpdate();
|
|
114
114
|
});
|
|
115
|
+
/**
|
|
116
|
+
* Fetches platform url
|
|
117
|
+
*/
|
|
118
|
+
function fetchPlatform(query) {
|
|
119
|
+
api_services_1.http
|
|
120
|
+
.request({
|
|
121
|
+
url: api_services_1.Endpoints.Platform.url(),
|
|
122
|
+
method: api_services_1.Endpoints.Platform.method,
|
|
123
|
+
params: {
|
|
124
|
+
next: query
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
.then((res) => {
|
|
128
|
+
const platformUrl = res.data.platform_url;
|
|
129
|
+
window.open(platformUrl, '_blank').focus();
|
|
130
|
+
})
|
|
131
|
+
.catch((error) => {
|
|
132
|
+
console.log(error);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
115
135
|
const showSuccessAlert = (step) => {
|
|
116
136
|
setIsGenerating(false);
|
|
117
137
|
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.step.${step.step}.success`, defaultMessage: `ui.onBoardingWidget.step.${step.step}.success` }), {
|
|
118
|
-
action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [step.step === types_1.SCOnBoardingStepType.CATEGORIES && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ sx: { textTransform: 'uppercase', color: 'white' }, size: "small", variant: "text",
|
|
138
|
+
action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [step.step === types_1.SCOnBoardingStepType.CATEGORIES && ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ sx: { textTransform: 'uppercase', color: 'white' }, size: "small", variant: "text", onClick: () => fetchPlatform('/contents/interests/') }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.categories.success.link", defaultMessage: "ui.onBoardingWidget.step.categories.success.link" }) }))), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ sx: { color: 'white' }, onClick: () => (0, notistack_1.closeSnackbar)(snackbarId) }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })),
|
|
119
139
|
variant: 'success',
|
|
120
140
|
autoHideDuration: 7000
|
|
121
141
|
});
|
|
@@ -169,6 +189,17 @@ const OnBoardingWidget = (inProps) => {
|
|
|
169
189
|
scThemeContext.setTheme((0, react_core_1.getTheme)(scContext.settings.theme, prefs));
|
|
170
190
|
});
|
|
171
191
|
};
|
|
192
|
+
const handleCategoriesClick = () => {
|
|
193
|
+
fetchPlatform('/contents/interests/');
|
|
194
|
+
setShowCategoriesModal(false);
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Notify when a category info changes
|
|
198
|
+
* @param data
|
|
199
|
+
*/
|
|
200
|
+
const notifyCategoryChanges = (0, react_1.useCallback)((data) => {
|
|
201
|
+
pubsub_js_1.default.publish(`${PubSub_1.SCTopicType.CATEGORY}.${PubSub_1.SCCategoryEventType.EDIT}`, data);
|
|
202
|
+
}, []);
|
|
172
203
|
// EFFECTS
|
|
173
204
|
(0, react_1.useEffect)(() => {
|
|
174
205
|
if (prevContentsStep &&
|
|
@@ -204,6 +235,22 @@ const OnBoardingWidget = (inProps) => {
|
|
|
204
235
|
return () => clearInterval(intervalId);
|
|
205
236
|
}
|
|
206
237
|
}, [scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user, isGenerating, isAdmin]);
|
|
238
|
+
/**
|
|
239
|
+
* updates categories info when generating category content
|
|
240
|
+
*/
|
|
241
|
+
(0, react_1.useEffect)(() => {
|
|
242
|
+
const categoryStep = steps.find((step) => step.step === types_1.SCOnBoardingStepType.CATEGORIES);
|
|
243
|
+
if ((categoryStep === null || categoryStep === void 0 ? void 0 : categoryStep.status) === types_1.SCOnBoardingStepStatusType.IN_PROGRESS && categoryStep.results.length !== 0) {
|
|
244
|
+
categoryStep.results.forEach((c) => {
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
246
|
+
// @ts-ignore
|
|
247
|
+
const isAlreadyNotified = prevCategoriesStep === null || prevCategoriesStep === void 0 ? void 0 : prevCategoriesStep.results.some((result) => result.id === c.id);
|
|
248
|
+
if (!isAlreadyNotified) {
|
|
249
|
+
notifyCategoryChanges(c);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}, [steps, prevCategoriesStep]);
|
|
207
254
|
/**
|
|
208
255
|
* Render _step content section
|
|
209
256
|
*/
|
|
@@ -254,7 +301,8 @@ const OnBoardingWidget = (inProps) => {
|
|
|
254
301
|
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks }),
|
|
255
302
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
256
303
|
// @ts-ignore
|
|
257
|
-
|
|
258
|
-
|
|
304
|
+
// eslint-disable-next-line prettier/prettier
|
|
305
|
+
icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks }))
|
|
306
|
+
} }) }))) }) })), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsx)(Widget_1.default, Object.assign({ className: classes.content, elevation: 0 }, { children: loading ? ((0, jsx_runtime_1.jsx)(Skeleton_1.default, {})) : ((0, jsx_runtime_1.jsxs)(material_1.CardContent, { children: [(0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: isMobile ? classes.stepsMobile : classes.steps }, { children: steps === null || steps === void 0 ? void 0 : steps.map((step) => ((0, jsx_runtime_1.jsx)(material_1.ListItem, { children: isMobile ? ((0, jsx_runtime_1.jsx)(material_1.Chip, { size: "small", label: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }), ' ', step.status === types_1.SCOnBoardingStepStatusType.COMPLETED && ((0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: (step === null || step === void 0 ? void 0 : step.status) === types_1.SCOnBoardingStepStatusType.COMPLETED && (step === null || step === void 0 ? void 0 : step.step) !== (_step === null || _step === void 0 ? void 0 : _step.step) ? 'success' : 'inherit' }, { children: "check" })))] }), onClick: () => handleChange(step), variant: step.step === (_step === null || _step === void 0 ? void 0 : _step.step) ? 'filled' : 'outlined', color: step.status === types_1.SCOnBoardingStepStatusType.COMPLETED ? 'success' : 'default' })) : ((0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: () => handleChange(step), selected: (step === null || step === void 0 ? void 0 : step.step) === (_step === null || _step === void 0 ? void 0 : _step.step) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { edge: "start", checked: step.status === types_1.SCOnBoardingStepStatusType.COMPLETED, tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': step.step }, size: 'small' }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }) })] }))) }, step.id))) })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.stepContent }, { children: [(0, jsx_runtime_1.jsx)(material_1.Fade, Object.assign({ in: true, timeout: 2400 }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { children: getStepContent() }) })), showCategoriesModal && ((0, jsx_runtime_1.jsx)(BaseDialog_1.default, Object.assign({ title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories", defaultMessage: "ui.onBoardingWidget.ai.no.categories" }), DialogContentProps: { dividers: false }, open: showCategoriesModal, onClose: () => setShowCategoriesModal(false), actions: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", onClick: () => setShowCategoriesModal(false) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories.cancel", defaultMessage: "ui.onBoardingWidget.ai.no.categories.cancel" }) })) }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "primary", onClick: handleCategoriesClick, startIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "edit" })) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories.link", defaultMessage: "ui.onBoardingWidget.ai.no.categories.link" }) })) })))] }))] })) })) })] })) })));
|
|
259
307
|
};
|
|
260
308
|
exports.default = OnBoardingWidget;
|
|
@@ -35,7 +35,9 @@ const classes = {
|
|
|
35
35
|
root: `${constants_1.PREFIX}-appearance-root`,
|
|
36
36
|
title: `${constants_1.PREFIX}-appearance-title`,
|
|
37
37
|
summary: `${constants_1.PREFIX}-appearance-summary`,
|
|
38
|
+
colorContainer: `${constants_1.PREFIX}-appearance-color-container`,
|
|
38
39
|
color: `${constants_1.PREFIX}-appearance-color`,
|
|
40
|
+
colorProgress: `${constants_1.PREFIX}-appearance-color-progress`,
|
|
39
41
|
logoContainer: `${constants_1.PREFIX}-appearance-logo-container`,
|
|
40
42
|
logo: `${constants_1.PREFIX}-appearance-logo`,
|
|
41
43
|
uploadButton: `${constants_1.PREFIX}-appearance-upload-button`,
|
|
@@ -68,6 +70,7 @@ function Appearance(inProps) {
|
|
|
68
70
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
69
71
|
const [tab, setTab] = (0, react_1.useState)(0);
|
|
70
72
|
const [updating, setUpdating] = (0, react_1.useState)(false);
|
|
73
|
+
const [updatingColor, setUpdatingColor] = (0, react_1.useState)('');
|
|
71
74
|
// INTL
|
|
72
75
|
const intl = (0, react_intl_1.useIntl)();
|
|
73
76
|
// HANDLERS
|
|
@@ -140,6 +143,7 @@ function Appearance(inProps) {
|
|
|
140
143
|
}
|
|
141
144
|
finally {
|
|
142
145
|
setUpdating(false);
|
|
146
|
+
setUpdatingColor('');
|
|
143
147
|
onCompleteAction();
|
|
144
148
|
}
|
|
145
149
|
});
|
|
@@ -195,15 +199,15 @@ function Appearance(inProps) {
|
|
|
195
199
|
}, []);
|
|
196
200
|
// HANDLERS
|
|
197
201
|
const handleColorChange = (color, name) => {
|
|
202
|
+
setUpdatingColor(name);
|
|
198
203
|
const currentColor = state.colors.find((col) => col.name === name);
|
|
199
204
|
if (currentColor && currentColor.value !== color) {
|
|
205
|
+
setUpdating(true);
|
|
200
206
|
dispatch({
|
|
201
207
|
type: reducer_1.actionTypes.SET_COLORS,
|
|
202
208
|
payload: { colors: state.colors.map((col) => (col.name === name ? Object.assign(Object.assign({}, col), { value: color }) : col)) }
|
|
203
209
|
});
|
|
204
|
-
|
|
205
|
-
updatePreference({ [`${name}`]: color });
|
|
206
|
-
}, 2000);
|
|
210
|
+
updatePreference({ [`${name}`]: color });
|
|
207
211
|
}
|
|
208
212
|
};
|
|
209
213
|
const handleChange = (event) => {
|
|
@@ -213,7 +217,7 @@ function Appearance(inProps) {
|
|
|
213
217
|
payload: { slogans: state.slogans.map((s) => (s.name === name ? Object.assign(Object.assign({}, s), { value: value }) : s)) }
|
|
214
218
|
});
|
|
215
219
|
};
|
|
216
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), (0, jsx_runtime_1.jsxs)(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [(0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerHeader }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "close" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, { children: (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.colors.map((color) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatColorLabel)(color) })), (0, jsx_runtime_1.jsx)(mui_color_input_1.MuiColorInput, { className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name) })] }, color.id))) })), tab === 1 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.logos.map((logo) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatLogoLabel)(logo.name) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.logoContainer }, { children: [(0, jsx_runtime_1.jsx)("img", { src: logo.value, className: classes.logo }), (0, jsx_runtime_1.jsx)("input", { type: "file", onChange: (event) => handleUpload(event, logo.name), ref: fileInput, hidden: true, accept: ".gif,.png,.jpg,.jpeg" }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ className: classes.uploadButton, onClick: () => fileInput.current.click(), loading: loadingLogo, disabled: loadingLogo }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "upload" }) }))] }))] }, logo.id))) })), tab === 2 && ((0, jsx_runtime_1.jsxs)(Box_1.default, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, fullWidth: true,
|
|
220
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.summary }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), (0, jsx_runtime_1.jsxs)(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [(0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerHeader }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h4", color: "primary" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "close" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, { children: (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.colors.map((color) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatColorLabel)(color) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.colorContainer }, { children: [(0, jsx_runtime_1.jsx)(mui_color_input_1.MuiColorInput, { className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name), isAlphaHidden: true }), updatingColor && updatingColor === color.name && ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { className: classes.colorProgress, color: "secondary", size: 24 }))] }))] }, color.id))) })), tab === 1 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: state.logos.map((logo) => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h6" }, { children: (0, onBoarding_1.formatLogoLabel)(logo.name) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.logoContainer }, { children: [(0, jsx_runtime_1.jsx)("img", { src: logo.value, className: classes.logo }), (0, jsx_runtime_1.jsx)("input", { type: "file", onChange: (event) => handleUpload(event, logo.name), ref: fileInput, hidden: true, accept: ".gif,.png,.jpg,.jpeg" }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ className: classes.uploadButton, onClick: () => fileInput.current.click(), loading: loadingLogo, disabled: loadingLogo }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "upload" }) }))] }))] }, logo.id))) })), tab === 2 && ((0, jsx_runtime_1.jsxs)(Box_1.default, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, fullWidth: true,
|
|
217
221
|
//className={classes.field}
|
|
218
222
|
label: `${intl.formatMessage(messages.titleField)}`, margin: "normal", value: (_a = state === null || state === void 0 ? void 0 : state.slogans[0]) === null || _a === void 0 ? void 0 : _a.value, name: "application_slogan1", onChange: handleChange, InputProps: {
|
|
219
223
|
endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_b = state.slogans[0].value) === null || _b === void 0 ? void 0 : _b.length) ? 50 - ((_c = state.slogans[0].value) === null || _c === void 0 ? void 0 : _c.length) : 50 }))
|