@selfcommunity/react-ui 0.9.0-alpha.2 → 0.9.0-alpha.21
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/assets/onBoarding/android.d.ts +1 -1
- package/lib/cjs/assets/onBoarding/android.js +1 -1
- package/lib/cjs/components/Event/Event.js +1 -1
- package/lib/cjs/components/EventHeader/EventHeader.js +5 -40
- package/lib/cjs/components/EventMediaWidget/EventMediaWidget.js +37 -34
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.d.ts +3 -0
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +15 -34
- package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +1 -1
- package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
- package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +14 -16
- package/lib/cjs/components/Events/Events.js +3 -4
- package/lib/cjs/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +35 -2
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +1 -1
- package/lib/cjs/components/OnBoardingWidget/ActionsButton.d.ts +7 -0
- package/lib/cjs/components/OnBoardingWidget/ActionsButton.js +84 -0
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +44 -19
- package/lib/cjs/components/OnBoardingWidget/Steps/App/App.js +2 -1
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +10 -13
- package/lib/cjs/components/UserProfileEdit/Section/PublicInfo.js +2 -1
- package/lib/cjs/shared/EventActionsMenu/index.d.ts +1 -1
- package/lib/cjs/shared/EventActionsMenu/index.js +11 -15
- package/lib/cjs/utils/events.d.ts +2 -0
- package/lib/cjs/utils/events.js +10 -0
- package/lib/cjs/utils/widget.js +11 -1
- package/lib/esm/assets/onBoarding/android.d.ts +1 -1
- package/lib/esm/assets/onBoarding/android.js +1 -1
- package/lib/esm/components/Event/Event.js +1 -1
- package/lib/esm/components/EventHeader/EventHeader.js +6 -41
- package/lib/esm/components/EventMediaWidget/EventMediaWidget.js +37 -34
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.d.ts +3 -0
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +15 -34
- package/lib/esm/components/EventMembersWidget/TabContentComponent.js +1 -1
- package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
- package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +16 -18
- package/lib/esm/components/Events/Events.js +3 -4
- package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +38 -5
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +1 -1
- package/lib/esm/components/OnBoardingWidget/ActionsButton.d.ts +7 -0
- package/lib/esm/components/OnBoardingWidget/ActionsButton.js +81 -0
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +46 -21
- package/lib/esm/components/OnBoardingWidget/Steps/App/App.js +2 -1
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +10 -13
- package/lib/esm/components/UserProfileEdit/Section/PublicInfo.js +2 -1
- package/lib/esm/shared/EventActionsMenu/index.d.ts +1 -1
- package/lib/esm/shared/EventActionsMenu/index.js +11 -15
- package/lib/esm/utils/events.d.ts +2 -0
- package/lib/esm/utils/events.js +6 -0
- package/lib/esm/utils/widget.js +11 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,84 @@
|
|
|
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 react_1 = require("react");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
9
|
+
const system_1 = require("@mui/system");
|
|
10
|
+
const react_intl_1 = require("react-intl");
|
|
11
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
12
|
+
const Errors_1 = require("../../constants/Errors");
|
|
13
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
14
|
+
const types_1 = require("@selfcommunity/types");
|
|
15
|
+
const constants_1 = require("./constants");
|
|
16
|
+
const classes = {
|
|
17
|
+
root: `${constants_1.PREFIX}-actions-button-root`,
|
|
18
|
+
drawerRoot: `${constants_1.PREFIX}-actions-drawer-root`,
|
|
19
|
+
menuRoot: `${constants_1.PREFIX}-actions-menu-root`,
|
|
20
|
+
paper: `${constants_1.PREFIX}-actions-paper`,
|
|
21
|
+
item: `${constants_1.PREFIX}-actions-item`
|
|
22
|
+
};
|
|
23
|
+
const Root = (0, styles_1.styled)(material_1.IconButton, {
|
|
24
|
+
name: constants_1.PREFIX,
|
|
25
|
+
slot: 'Root',
|
|
26
|
+
overridesResolver: (props, styles) => styles.root
|
|
27
|
+
})(() => ({}));
|
|
28
|
+
const SwipeableDrawerRoot = (0, styles_1.styled)(material_1.SwipeableDrawer, {
|
|
29
|
+
name: constants_1.PREFIX,
|
|
30
|
+
slot: 'Root',
|
|
31
|
+
overridesResolver: (props, styles) => styles.drawerRoot
|
|
32
|
+
})(() => ({}));
|
|
33
|
+
const MenuRoot = (0, styles_1.styled)(material_1.Menu, {
|
|
34
|
+
name: constants_1.PREFIX,
|
|
35
|
+
slot: 'Root',
|
|
36
|
+
overridesResolver: (props, styles) => styles.menuRoot
|
|
37
|
+
})(() => ({}));
|
|
38
|
+
function OnBoardingActionsButton(inProps) {
|
|
39
|
+
// PROPS
|
|
40
|
+
const props = (0, system_1.useThemeProps)({
|
|
41
|
+
props: inProps,
|
|
42
|
+
name: constants_1.PREFIX
|
|
43
|
+
});
|
|
44
|
+
const { className = null, isExpanded, onExpandChange, onHideOnBoarding } = props, rest = tslib_1.__rest(props, ["className", "isExpanded", "onExpandChange", "onHideOnBoarding"]);
|
|
45
|
+
// STATE
|
|
46
|
+
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
47
|
+
const theme = (0, material_1.useTheme)();
|
|
48
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
49
|
+
// HANDLERS
|
|
50
|
+
const handleOpen = (event) => {
|
|
51
|
+
setAnchorEl(event.currentTarget);
|
|
52
|
+
};
|
|
53
|
+
const handleClose = () => {
|
|
54
|
+
setAnchorEl(null);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Updates onBoarding dynamic preference
|
|
58
|
+
*/
|
|
59
|
+
const hideOnBoarding = () => {
|
|
60
|
+
api_services_1.PreferenceService.updatePreferences({ [`${types_1.SCPreferenceName.ONBOARDING_HIDDEN}`]: true })
|
|
61
|
+
.then(() => {
|
|
62
|
+
onHideOnBoarding();
|
|
63
|
+
})
|
|
64
|
+
.catch((e) => {
|
|
65
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const renderList = () => {
|
|
69
|
+
if (isMobile) {
|
|
70
|
+
return [
|
|
71
|
+
isExpanded ? ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: onExpandChange }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_less" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.less", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.less" })] })) }), "expand_less")) : ((0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: onExpandChange }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_more" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.more", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.more" })] })) }), "expand_more")),
|
|
72
|
+
(0, jsx_runtime_1.jsx)(material_1.ListItem, Object.assign({ className: classes.item }, { children: (0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({ onClick: hideOnBoarding }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.close", defaultMessage: "ui.onBoardingWidget.actionsMenu.close" })] })) }), "close")
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return [
|
|
77
|
+
isExpanded ? ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: onExpandChange }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_less" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.less", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.less" })] }), "expand_less")) : ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: onExpandChange }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "expand_more" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.more", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.more" })] }), "expand_more")),
|
|
78
|
+
(0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: hideOnBoarding }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.close", defaultMessage: "ui.onBoardingWidget.actionsMenu.close" })] }), "close")
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
};
|
|
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: handleOpen }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "more_vert" }) })), isMobile ? ((0, jsx_runtime_1.jsx)(SwipeableDrawerRoot, Object.assign({ onClick: () => setAnchorEl(null), className: classes.drawerRoot, anchor: "bottom", open: Boolean(anchorEl), onClose: handleClose, onOpen: handleOpen, PaperProps: { className: classes.paper }, disableSwipeToOpen: true }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: renderList() }) }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ onClick: () => setAnchorEl(null), className: classes.menuRoot, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, PaperProps: { className: classes.paper } }, { children: renderList() })))] }));
|
|
83
|
+
}
|
|
84
|
+
exports.default = OnBoardingActionsButton;
|
|
@@ -28,6 +28,7 @@ const header_1 = tslib_1.__importDefault(require("../../assets/onBoarding/header
|
|
|
28
28
|
const BaseDialog_1 = tslib_1.__importDefault(require("../../shared/BaseDialog"));
|
|
29
29
|
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
30
30
|
const PubSub_1 = require("../../constants/PubSub");
|
|
31
|
+
const ActionsButton_1 = tslib_1.__importDefault(require("./ActionsButton"));
|
|
31
32
|
const classes = {
|
|
32
33
|
root: `${constants_1.PREFIX}-root`,
|
|
33
34
|
content: `${constants_1.PREFIX}-content`,
|
|
@@ -36,7 +37,9 @@ const classes = {
|
|
|
36
37
|
intro: `${constants_1.PREFIX}-intro`,
|
|
37
38
|
steps: `${constants_1.PREFIX}-steps`,
|
|
38
39
|
stepsMobile: `${constants_1.PREFIX}-steps-mobile`,
|
|
39
|
-
stepContent: `${constants_1.PREFIX}-step-content
|
|
40
|
+
stepContent: `${constants_1.PREFIX}-step-content`,
|
|
41
|
+
dialogRoot: `${constants_1.PREFIX}-dialog-root`,
|
|
42
|
+
dialogContent: `${constants_1.PREFIX}-dialog-content`
|
|
40
43
|
};
|
|
41
44
|
const Root = (0, styles_1.styled)(Widget_1.default, {
|
|
42
45
|
name: constants_1.PREFIX,
|
|
@@ -48,6 +51,11 @@ const AccordionRoot = (0, styles_1.styled)(material_1.Accordion, {
|
|
|
48
51
|
slot: 'AccordionRoot',
|
|
49
52
|
overridesResolver: (props, styles) => styles.accordionRoot
|
|
50
53
|
})(() => ({}));
|
|
54
|
+
const DialogRoot = (0, styles_1.styled)(BaseDialog_1.default, {
|
|
55
|
+
name: constants_1.PREFIX,
|
|
56
|
+
slot: 'Root',
|
|
57
|
+
overridesResolver: (props, styles) => styles.dialogRoot
|
|
58
|
+
})(({ theme }) => ({}));
|
|
51
59
|
const OnBoardingWidget = (inProps) => {
|
|
52
60
|
// PROPS
|
|
53
61
|
const props = (0, system_1.useThemeProps)({
|
|
@@ -72,7 +80,9 @@ const OnBoardingWidget = (inProps) => {
|
|
|
72
80
|
const prevContentsStep = (0, react_core_1.usePreviousValue)(currentContentsStep);
|
|
73
81
|
const currentCategoriesStep = steps === null || steps === void 0 ? void 0 : steps.find((s) => s.step === types_1.SCOnBoardingStepType.CATEGORIES);
|
|
74
82
|
const prevCategoriesStep = (0, react_core_1.usePreviousValue)(currentCategoriesStep);
|
|
75
|
-
const [
|
|
83
|
+
const [showNoCategoriesModal, setShowNoCategoriesModal] = (0, react_1.useState)(false);
|
|
84
|
+
const [showCategoriesWarningModal, setShowWarningCategoriesModal] = (0, react_1.useState)(false);
|
|
85
|
+
const [isGenerating, setIsGenerating] = (0, react_1.useState)(false);
|
|
76
86
|
// CONTEXT
|
|
77
87
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
78
88
|
const isAdmin = (0, react_1.useMemo)(() => react_core_1.UserUtils.isCommunityCreator(scUserContext.user), [scUserContext.user]);
|
|
@@ -80,7 +90,11 @@ const OnBoardingWidget = (inProps) => {
|
|
|
80
90
|
const scPreferencesContext = (0, react_core_1.useSCPreferences)();
|
|
81
91
|
const scThemeContext = (0, react_core_1.useSCTheme)();
|
|
82
92
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
83
|
-
const
|
|
93
|
+
const showOnBoarding = (0, react_1.useMemo)(() => scPreferencesContext.preferences &&
|
|
94
|
+
react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_ENABLED in scPreferencesContext.preferences &&
|
|
95
|
+
react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_HIDDEN in scPreferencesContext.preferences &&
|
|
96
|
+
scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_ENABLED].value &&
|
|
97
|
+
!scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_HIDDEN].value, [scPreferencesContext.preferences]);
|
|
84
98
|
// HOOKS
|
|
85
99
|
const theme = (0, material_1.useTheme)();
|
|
86
100
|
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
@@ -166,22 +180,29 @@ const OnBoardingWidget = (inProps) => {
|
|
|
166
180
|
};
|
|
167
181
|
const generateContent = (stepId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
168
182
|
if (!isLoading && !categories.length) {
|
|
169
|
-
|
|
183
|
+
setShowNoCategoriesModal(true);
|
|
184
|
+
}
|
|
185
|
+
else if (stepId === types_1.SCOnBoardingStepIdType.CATEGORIES) {
|
|
186
|
+
setShowWarningCategoriesModal(true);
|
|
170
187
|
}
|
|
171
188
|
else {
|
|
172
|
-
yield
|
|
173
|
-
.then(() => {
|
|
174
|
-
setIsGenerating(true);
|
|
175
|
-
})
|
|
176
|
-
.catch((error) => {
|
|
177
|
-
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
|
|
178
|
-
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
179
|
-
variant: 'error',
|
|
180
|
-
autoHideDuration: 3000
|
|
181
|
-
});
|
|
182
|
-
});
|
|
189
|
+
yield startStep(stepId);
|
|
183
190
|
}
|
|
184
191
|
});
|
|
192
|
+
const startStep = (stepId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
193
|
+
showCategoriesWarningModal && setShowWarningCategoriesModal(false);
|
|
194
|
+
yield api_services_1.OnBoardingService.startAStep(stepId, GenerateContentsParams)
|
|
195
|
+
.then(() => {
|
|
196
|
+
setIsGenerating(true);
|
|
197
|
+
})
|
|
198
|
+
.catch((error) => {
|
|
199
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, error);
|
|
200
|
+
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
201
|
+
variant: 'error',
|
|
202
|
+
autoHideDuration: 3000
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
});
|
|
185
206
|
const handlePreferencesUpdate = () => {
|
|
186
207
|
api_services_1.PreferenceService.getAllPreferences().then((preferences) => {
|
|
187
208
|
const prefs = preferences['results'].reduce((obj, p) => (Object.assign(Object.assign({}, obj), { [`${p.section}.${p.name}`]: p })), {});
|
|
@@ -191,7 +212,7 @@ const OnBoardingWidget = (inProps) => {
|
|
|
191
212
|
};
|
|
192
213
|
const handleCategoriesClick = () => {
|
|
193
214
|
fetchPlatform('/contents/interests/');
|
|
194
|
-
|
|
215
|
+
setShowNoCategoriesModal(false);
|
|
195
216
|
};
|
|
196
217
|
/**
|
|
197
218
|
* Notify when a category info changes
|
|
@@ -281,10 +302,10 @@ const OnBoardingWidget = (inProps) => {
|
|
|
281
302
|
}
|
|
282
303
|
return content;
|
|
283
304
|
};
|
|
284
|
-
if (!isAdmin) {
|
|
305
|
+
if (!isAdmin || !showOnBoarding) {
|
|
285
306
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
286
307
|
}
|
|
287
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(AccordionRoot, Object.assign({ defaultExpanded: true,
|
|
308
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsxs)(AccordionRoot, Object.assign({ defaultExpanded: true, className: classes.accordionRoot, expanded: expanded }, { children: [(0, jsx_runtime_1.jsx)(material_1.AccordionSummary, Object.assign({ expandIcon: (0, jsx_runtime_1.jsx)(ActionsButton_1.default, { isExpanded: expanded, onExpandChange: handleExpand, onHideOnBoarding: handlePreferencesUpdate }), "aria-controls": "accordion", id: "onBoarding-accordion" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: expanded ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!isMobile ? ((0, jsx_runtime_1.jsx)(material_1.CardMedia, { className: classes.logo, component: "img", src: header_1.default })) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ variant: "h4" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: "ai_stars" })), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title.mobile", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title.mobile", values: {
|
|
288
309
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
289
310
|
// @ts-ignore
|
|
290
311
|
b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|
|
@@ -303,6 +324,10 @@ const OnBoardingWidget = (inProps) => {
|
|
|
303
324
|
// @ts-ignore
|
|
304
325
|
// eslint-disable-next-line prettier/prettier
|
|
305
326
|
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() }) })),
|
|
327
|
+
} }) }))) }) })), (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() }) })), showNoCategoriesModal && ((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: showNoCategoriesModal, onClose: () => setShowNoCategoriesModal(false), actions: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", onClick: () => setShowNoCategoriesModal(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" }) })) }))), showCategoriesWarningModal && ((0, jsx_runtime_1.jsx)(DialogRoot, Object.assign({ className: classes.dialogRoot, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.title", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.title" }), DialogContentProps: { dividers: false }, open: showCategoriesWarningModal, onClose: () => setShowWarningCategoriesModal(false), actions: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "outlined", color: "primary", onClick: () => setShowWarningCategoriesModal(false) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.button.close", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.button.close" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", variant: "contained", color: "secondary", onClick: () => startStep(types_1.SCOnBoardingStepIdType.CATEGORIES), endIcon: (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "small" }, { children: "magic_wand" })) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.button.generate", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.button.generate" }) }))] }) }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.dialogContent }, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.info", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.info" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.confirm", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.confirm", values: {
|
|
328
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
329
|
+
// @ts-ignore
|
|
330
|
+
b: (chunks) => (0, jsx_runtime_1.jsx)("b", { children: chunks })
|
|
331
|
+
} })] })) })))] }))] })) })) })] })) })));
|
|
307
332
|
};
|
|
308
333
|
exports.default = OnBoardingWidget;
|
|
@@ -21,6 +21,7 @@ const classes = {
|
|
|
21
21
|
summary: `${constants_1.PREFIX}-app-summary`,
|
|
22
22
|
step: `${constants_1.PREFIX}-app-step`,
|
|
23
23
|
image: `${constants_1.PREFIX}-app-image`,
|
|
24
|
+
imageAndroid: `${constants_1.PREFIX}-app-image-android`,
|
|
24
25
|
action: `${constants_1.PREFIX}-app-action`,
|
|
25
26
|
button: `${constants_1.PREFIX}-app-button`
|
|
26
27
|
};
|
|
@@ -56,7 +57,7 @@ function App(inProps) {
|
|
|
56
57
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
57
58
|
// @ts-ignore
|
|
58
59
|
b: (...chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
|
|
59
|
-
} }) })), (0, jsx_runtime_1.jsx)(material_1.CardMedia, { className: classes.
|
|
60
|
+
} }) })), (0, jsx_runtime_1.jsx)(material_1.CardMedia, { className: classes.imageAndroid, component: "img", src: android_1.default })] })), tab === 1 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(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.app.ios", defaultMessage: "ui.onBoardingWidget.step.app.ios" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.step }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.a", defaultMessage: "ui.onBoardingWidget.step.app.ios.a", values: {
|
|
60
61
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
61
62
|
// @ts-ignore
|
|
62
63
|
icon: (...chunks) => (0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
|
|
@@ -65,8 +65,7 @@ function Appearance(inProps) {
|
|
|
65
65
|
const { className, onCompleteAction } = props;
|
|
66
66
|
// STATE
|
|
67
67
|
const [state, dispatch] = (0, react_1.useReducer)(reducer_2.reducer, (0, reducer_2.getInitialState)(null));
|
|
68
|
-
|
|
69
|
-
const [loadingLogo, setLoadingLogo] = (0, react_1.useState)(false);
|
|
68
|
+
const [loadingLogo, setLoadingLogo] = (0, react_1.useState)('');
|
|
70
69
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
71
70
|
const [tab, setTab] = (0, react_1.useState)(0);
|
|
72
71
|
const [updating, setUpdating] = (0, react_1.useState)(false);
|
|
@@ -162,15 +161,13 @@ function Appearance(inProps) {
|
|
|
162
161
|
setUpdating(false);
|
|
163
162
|
}
|
|
164
163
|
});
|
|
165
|
-
const updateLogoPreference = (name) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
166
|
-
setLoadingLogo(
|
|
164
|
+
const updateLogoPreference = (name, file) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
setLoadingLogo(name);
|
|
167
166
|
const formData = new FormData();
|
|
168
|
-
|
|
169
|
-
// @ts-ignore
|
|
170
|
-
formData.append(name, fileInput);
|
|
167
|
+
formData.append(name, file);
|
|
171
168
|
yield api_services_1.PreferenceService.updatePreferences(formData)
|
|
172
169
|
.then((preference) => {
|
|
173
|
-
setLoadingLogo(
|
|
170
|
+
setLoadingLogo('');
|
|
174
171
|
dispatch({
|
|
175
172
|
type: reducer_1.actionTypes.SET_LOGOS,
|
|
176
173
|
payload: { logos: state.logos.map((l) => (l.name === name ? Object.assign(Object.assign({}, l), { value: preference[name].value }) : l)) }
|
|
@@ -178,7 +175,7 @@ function Appearance(inProps) {
|
|
|
178
175
|
onCompleteAction();
|
|
179
176
|
})
|
|
180
177
|
.catch((e) => {
|
|
181
|
-
setLoadingLogo(
|
|
178
|
+
setLoadingLogo('');
|
|
182
179
|
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
|
|
183
180
|
});
|
|
184
181
|
});
|
|
@@ -188,9 +185,9 @@ function Appearance(inProps) {
|
|
|
188
185
|
* @param name
|
|
189
186
|
*/
|
|
190
187
|
const handleUpload = (event, name) => {
|
|
191
|
-
|
|
192
|
-
if (
|
|
193
|
-
updateLogoPreference(name);
|
|
188
|
+
const file = event.target.files[0];
|
|
189
|
+
if (file) {
|
|
190
|
+
updateLogoPreference(name, file);
|
|
194
191
|
}
|
|
195
192
|
};
|
|
196
193
|
(0, react_1.useEffect)(() => {
|
|
@@ -223,7 +220,7 @@ function Appearance(inProps) {
|
|
|
223
220
|
colorRef.current.blur();
|
|
224
221
|
}
|
|
225
222
|
};
|
|
226
|
-
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, { inputRef: colorRef, className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name), isAlphaHidden: true, PopoverProps: { onClose: handleClosePopover } }), 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),
|
|
223
|
+
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, { inputRef: colorRef, className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name), isAlphaHidden: true, PopoverProps: { onClose: handleClosePopover } }), 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), hidden: true, accept: ".gif,.png,.jpg,.jpeg", id: logo.name }), (0, jsx_runtime_1.jsx)(lab_1.LoadingButton, Object.assign({ className: classes.uploadButton, onClick: () => document.getElementById(`${logo.name}`).click(), loading: Boolean(loadingLogo) && Boolean(logo.name === loadingLogo), disabled: Boolean(loadingLogo) && Boolean(logo.name !== 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,
|
|
227
224
|
//className={classes.field}
|
|
228
225
|
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: {
|
|
229
226
|
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 }))
|
|
@@ -154,6 +154,7 @@ function PublicInfo(props) {
|
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
let content = null;
|
|
157
|
+
console.log(metadataDefinitions);
|
|
157
158
|
switch (field) {
|
|
158
159
|
case types_1.SCUserProfileFields.USERNAME:
|
|
159
160
|
component.element = UsernameTextField_1.default;
|
|
@@ -222,7 +223,7 @@ function PublicInfo(props) {
|
|
|
222
223
|
return null;
|
|
223
224
|
default:
|
|
224
225
|
if (metadataDefinitions && metadataDefinitions[field]) {
|
|
225
|
-
return ((0, jsx_runtime_1.jsx)(MetadataField_1.default, Object.assign({ id: field, className: classes.field, name: field, fullWidth: true, label: label, value: user[field] || '', onChange: handleChange(field), disabled: isSaving, error: Boolean(_error), helperText: _error && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.userInfo.metadata.error.${_error}`, defaultMessage: `ui.userInfo.metadata.error.${_error}` }), metadata: metadataDefinitions[field] }, props), field));
|
|
226
|
+
return ((0, jsx_runtime_1.jsx)(MetadataField_1.default, Object.assign({ id: field, className: classes.field, name: field, fullWidth: true, label: label, value: user[field] || '', onChange: handleChange(field), disabled: isSaving || (user[field] && 'editable' in metadataDefinitions[field] && !metadataDefinitions[field].editable), error: Boolean(_error), helperText: _error && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.userInfo.metadata.error.${_error}`, defaultMessage: `ui.userInfo.metadata.error.${_error}` }), metadata: metadataDefinitions[field] }, props), field));
|
|
226
227
|
}
|
|
227
228
|
break;
|
|
228
229
|
}
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const styles_1 = require("@mui/material/styles");
|
|
7
5
|
const material_1 = require("@mui/material");
|
|
8
|
-
const react_intl_1 = require("react-intl");
|
|
9
6
|
const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
|
|
10
|
-
const
|
|
7
|
+
const styles_1 = require("@mui/material/styles");
|
|
11
8
|
const system_1 = require("@mui/system");
|
|
12
|
-
const react_core_1 = require("@selfcommunity/react-core");
|
|
13
|
-
const ConfirmDialog_1 = tslib_1.__importDefault(require("../../shared/ConfirmDialog/ConfirmDialog"));
|
|
14
9
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
15
|
-
const
|
|
10
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
16
11
|
const utils_1 = require("@selfcommunity/utils");
|
|
12
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
17
13
|
const notistack_1 = require("notistack");
|
|
18
14
|
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
19
|
-
const
|
|
15
|
+
const react_1 = require("react");
|
|
16
|
+
const react_intl_1 = require("react-intl");
|
|
20
17
|
const EventForm_1 = tslib_1.__importDefault(require("../../components/EventForm"));
|
|
18
|
+
const EventActionsMenu_1 = require("../../constants/EventActionsMenu");
|
|
19
|
+
const PubSub_1 = require("../../constants/PubSub");
|
|
20
|
+
const ConfirmDialog_1 = tslib_1.__importDefault(require("../../shared/ConfirmDialog/ConfirmDialog"));
|
|
21
|
+
const events_1 = require("../../utils/events");
|
|
21
22
|
const PREFIX = 'SCEventActionsMenu';
|
|
22
23
|
const classes = {
|
|
23
24
|
root: `${PREFIX}-root`,
|
|
@@ -84,12 +85,7 @@ function EventActionsMenu(inProps) {
|
|
|
84
85
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
85
86
|
const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
|
|
86
87
|
const isEventAdmin = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
|
|
87
|
-
const isEventFinished = (0, react_1.useMemo)(() =>
|
|
88
|
-
if (scEvent && !scEvent.running) {
|
|
89
|
-
return new Date().getTime() > new Date(scEvent.end_date || scEvent.start_date).getTime();
|
|
90
|
-
}
|
|
91
|
-
return false;
|
|
92
|
-
}, [scEvent]);
|
|
88
|
+
const isEventFinished = (0, react_1.useMemo)(() => (0, events_1.checkEventFinished)(scEvent), [scEvent]);
|
|
93
89
|
// HANDLERS
|
|
94
90
|
const handleOpen = (event) => {
|
|
95
91
|
setAnchorEl(event.currentTarget);
|
|
@@ -155,7 +151,7 @@ function EventActionsMenu(inProps) {
|
|
|
155
151
|
const renderList = () => {
|
|
156
152
|
return [
|
|
157
153
|
(0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: () => handleAction(EventActionsMenu_1.GET_EVENT_LINK) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "link" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.shared.eventActionsMenu.item.link", defaultMessage: "ui.shared.eventActionsMenu.item.link" })] }), "link"),
|
|
158
|
-
(0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: () => handleAction(EventActionsMenu_1.ADD_EVENT_TO_CALENDAR) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "CalendarIcon" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.shared.eventActionsMenu.item.calendar", defaultMessage: "ui.shared.eventActionsMenu.item.calendar" })] }), "calendar"),
|
|
154
|
+
!isEventFinished && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: () => handleAction(EventActionsMenu_1.ADD_EVENT_TO_CALENDAR) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "CalendarIcon" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.shared.eventActionsMenu.item.calendar", defaultMessage: "ui.shared.eventActionsMenu.item.calendar" })] }), "calendar")),
|
|
159
155
|
isEventAdmin &&
|
|
160
156
|
!isEventFinished && [
|
|
161
157
|
(0, jsx_runtime_1.jsx)(material_1.Divider, {}, "divider"),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkEventFinished = void 0;
|
|
4
|
+
function checkEventFinished(event) {
|
|
5
|
+
if (event && !event.running) {
|
|
6
|
+
return new Date().getTime() > new Date(event.end_date || event.start_date).getTime();
|
|
7
|
+
}
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
exports.checkEventFinished = checkEventFinished;
|
package/lib/cjs/utils/widget.js
CHANGED
|
@@ -58,7 +58,17 @@ function dataWidgetReducer(state, action) {
|
|
|
58
58
|
_state = { isLoadingNext: false, next: null, results: [], count: 0, errorLoadNext: null, initialized: false };
|
|
59
59
|
break;
|
|
60
60
|
case exports.actionWidgetTypes.INITIALIZE:
|
|
61
|
-
_state =
|
|
61
|
+
_state = {
|
|
62
|
+
cacheKey: action.payload.cacheKey ? action.payload.cacheKey : null,
|
|
63
|
+
count: action.payload.count ? action.payload.count : 0,
|
|
64
|
+
results: action.payload.results ? action.payload.results : [],
|
|
65
|
+
next: action.payload.next ? action.payload.next : null,
|
|
66
|
+
previous: action.payload.previous ? action.payload.previous : null,
|
|
67
|
+
isLoadingNext: action.payload.isLoadingNext ? action.payload.isLoadingNext : false,
|
|
68
|
+
isLoadingPrevious: action.payload.isLoadingPrevious ? action.payload.isLoadingPrevious : false,
|
|
69
|
+
visibleItems: action.payload.visibleItems ? action.payload.visibleItems : null,
|
|
70
|
+
initialized: false
|
|
71
|
+
};
|
|
62
72
|
break;
|
|
63
73
|
}
|
|
64
74
|
utils_1.LRUCache.set(_state.cacheKey, _state);
|