@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,81 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { Icon, IconButton, List, ListItem, ListItemButton, ListItemIcon, Menu, MenuItem, SwipeableDrawer, useMediaQuery, useTheme } from '@mui/material';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { useThemeProps } from '@mui/system';
|
|
8
|
+
import { FormattedMessage } from 'react-intl';
|
|
9
|
+
import { PreferenceService } from '@selfcommunity/api-services';
|
|
10
|
+
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
11
|
+
import { Logger } from '@selfcommunity/utils';
|
|
12
|
+
import { SCPreferenceName } from '@selfcommunity/types';
|
|
13
|
+
import { PREFIX } from './constants';
|
|
14
|
+
const classes = {
|
|
15
|
+
root: `${PREFIX}-actions-button-root`,
|
|
16
|
+
drawerRoot: `${PREFIX}-actions-drawer-root`,
|
|
17
|
+
menuRoot: `${PREFIX}-actions-menu-root`,
|
|
18
|
+
paper: `${PREFIX}-actions-paper`,
|
|
19
|
+
item: `${PREFIX}-actions-item`
|
|
20
|
+
};
|
|
21
|
+
const Root = styled(IconButton, {
|
|
22
|
+
name: PREFIX,
|
|
23
|
+
slot: 'Root',
|
|
24
|
+
overridesResolver: (props, styles) => styles.root
|
|
25
|
+
})(() => ({}));
|
|
26
|
+
const SwipeableDrawerRoot = styled(SwipeableDrawer, {
|
|
27
|
+
name: PREFIX,
|
|
28
|
+
slot: 'Root',
|
|
29
|
+
overridesResolver: (props, styles) => styles.drawerRoot
|
|
30
|
+
})(() => ({}));
|
|
31
|
+
const MenuRoot = styled(Menu, {
|
|
32
|
+
name: PREFIX,
|
|
33
|
+
slot: 'Root',
|
|
34
|
+
overridesResolver: (props, styles) => styles.menuRoot
|
|
35
|
+
})(() => ({}));
|
|
36
|
+
export default function OnBoardingActionsButton(inProps) {
|
|
37
|
+
// PROPS
|
|
38
|
+
const props = useThemeProps({
|
|
39
|
+
props: inProps,
|
|
40
|
+
name: PREFIX
|
|
41
|
+
});
|
|
42
|
+
const { className = null, isExpanded, onExpandChange, onHideOnBoarding } = props, rest = __rest(props, ["className", "isExpanded", "onExpandChange", "onHideOnBoarding"]);
|
|
43
|
+
// STATE
|
|
44
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
45
|
+
const theme = useTheme();
|
|
46
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
47
|
+
// HANDLERS
|
|
48
|
+
const handleOpen = (event) => {
|
|
49
|
+
setAnchorEl(event.currentTarget);
|
|
50
|
+
};
|
|
51
|
+
const handleClose = () => {
|
|
52
|
+
setAnchorEl(null);
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Updates onBoarding dynamic preference
|
|
56
|
+
*/
|
|
57
|
+
const hideOnBoarding = () => {
|
|
58
|
+
PreferenceService.updatePreferences({ [`${SCPreferenceName.ONBOARDING_HIDDEN}`]: true })
|
|
59
|
+
.then(() => {
|
|
60
|
+
onHideOnBoarding();
|
|
61
|
+
})
|
|
62
|
+
.catch((e) => {
|
|
63
|
+
Logger.error(SCOPE_SC_UI, e);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const renderList = () => {
|
|
67
|
+
if (isMobile) {
|
|
68
|
+
return [
|
|
69
|
+
isExpanded ? (_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsxs(ListItemButton, Object.assign({ onClick: onExpandChange }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "expand_less" }) }), _jsx(FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.less", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.less" })] })) }), "expand_less")) : (_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsxs(ListItemButton, Object.assign({ onClick: onExpandChange }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "expand_more" }) }), _jsx(FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.more", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.more" })] })) }), "expand_more")),
|
|
70
|
+
_jsx(ListItem, Object.assign({ className: classes.item }, { children: _jsxs(ListItemButton, Object.assign({ onClick: hideOnBoarding }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "close" }) }), _jsx(FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.close", defaultMessage: "ui.onBoardingWidget.actionsMenu.close" })] })) }), "close")
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return [
|
|
75
|
+
isExpanded ? (_jsxs(MenuItem, Object.assign({ className: classes.item, onClick: onExpandChange }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "expand_less" }) }), _jsx(FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.less", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.less" })] }), "expand_less")) : (_jsxs(MenuItem, Object.assign({ className: classes.item, onClick: onExpandChange }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "expand_more" }) }), _jsx(FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.view.more", defaultMessage: "ui.onBoardingWidget.actionsMenu.view.more" })] }), "expand_more")),
|
|
76
|
+
_jsxs(MenuItem, Object.assign({ className: classes.item, onClick: hideOnBoarding }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "close" }) }), _jsx(FormattedMessage, { id: "ui.onBoardingWidget.actionsMenu.close", defaultMessage: "ui.onBoardingWidget.actionsMenu.close" })] }), "close")
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return (_jsxs(_Fragment, { children: [_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { onClick: handleOpen }, { children: _jsx(Icon, { children: "more_vert" }) })), isMobile ? (_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: _jsx(List, { children: renderList() }) }))) : (_jsx(MenuRoot, Object.assign({ onClick: () => setAnchorEl(null), className: classes.menuRoot, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, PaperProps: { className: classes.paper } }, { children: renderList() })))] }));
|
|
81
|
+
}
|
|
@@ -8,7 +8,7 @@ import classNames from 'classnames';
|
|
|
8
8
|
import { useThemeProps } from '@mui/system';
|
|
9
9
|
import Category from './Steps/Category';
|
|
10
10
|
import { PREFIX } from './constants';
|
|
11
|
-
import { getTheme, usePreviousValue, UserUtils, useSCContext, useSCFetchCategories, useSCPreferences, useSCTheme, useSCUser } from '@selfcommunity/react-core';
|
|
11
|
+
import { getTheme, SCPreferences, usePreviousValue, UserUtils, useSCContext, useSCFetchCategories, useSCPreferences, useSCTheme, useSCUser } from '@selfcommunity/react-core';
|
|
12
12
|
import Appearance from './Steps/Appearance';
|
|
13
13
|
import Profile from './Steps/Profile';
|
|
14
14
|
import Invite from './Steps/Invite';
|
|
@@ -19,13 +19,14 @@ import Content from './Steps/Content';
|
|
|
19
19
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
20
20
|
import { Endpoints, http, OnBoardingService, PreferenceService } from '@selfcommunity/api-services';
|
|
21
21
|
import { Logger } from '@selfcommunity/utils';
|
|
22
|
-
import { SCOnBoardingStepStatusType, SCOnBoardingStepType } from '@selfcommunity/types';
|
|
22
|
+
import { SCOnBoardingStepStatusType, SCOnBoardingStepType, SCOnBoardingStepIdType } from '@selfcommunity/types';
|
|
23
23
|
import OnBoardingWidgetSkeleton from './Skeleton';
|
|
24
24
|
import { closeSnackbar, useSnackbar } from 'notistack';
|
|
25
25
|
import HeaderPlaceholder from '../../assets/onBoarding/header';
|
|
26
26
|
import BaseDialog from '../../shared/BaseDialog';
|
|
27
27
|
import PubSub from 'pubsub-js';
|
|
28
28
|
import { SCCategoryEventType, SCTopicType } from '../../constants/PubSub';
|
|
29
|
+
import OnBoardingActionsButton from './ActionsButton';
|
|
29
30
|
const classes = {
|
|
30
31
|
root: `${PREFIX}-root`,
|
|
31
32
|
content: `${PREFIX}-content`,
|
|
@@ -34,7 +35,9 @@ const classes = {
|
|
|
34
35
|
intro: `${PREFIX}-intro`,
|
|
35
36
|
steps: `${PREFIX}-steps`,
|
|
36
37
|
stepsMobile: `${PREFIX}-steps-mobile`,
|
|
37
|
-
stepContent: `${PREFIX}-step-content
|
|
38
|
+
stepContent: `${PREFIX}-step-content`,
|
|
39
|
+
dialogRoot: `${PREFIX}-dialog-root`,
|
|
40
|
+
dialogContent: `${PREFIX}-dialog-content`
|
|
38
41
|
};
|
|
39
42
|
const Root = styled(Widget, {
|
|
40
43
|
name: PREFIX,
|
|
@@ -46,6 +49,11 @@ const AccordionRoot = styled(Accordion, {
|
|
|
46
49
|
slot: 'AccordionRoot',
|
|
47
50
|
overridesResolver: (props, styles) => styles.accordionRoot
|
|
48
51
|
})(() => ({}));
|
|
52
|
+
const DialogRoot = styled(BaseDialog, {
|
|
53
|
+
name: PREFIX,
|
|
54
|
+
slot: 'Root',
|
|
55
|
+
overridesResolver: (props, styles) => styles.dialogRoot
|
|
56
|
+
})(({ theme }) => ({}));
|
|
49
57
|
const OnBoardingWidget = (inProps) => {
|
|
50
58
|
// PROPS
|
|
51
59
|
const props = useThemeProps({
|
|
@@ -70,7 +78,9 @@ const OnBoardingWidget = (inProps) => {
|
|
|
70
78
|
const prevContentsStep = usePreviousValue(currentContentsStep);
|
|
71
79
|
const currentCategoriesStep = steps === null || steps === void 0 ? void 0 : steps.find((s) => s.step === SCOnBoardingStepType.CATEGORIES);
|
|
72
80
|
const prevCategoriesStep = usePreviousValue(currentCategoriesStep);
|
|
73
|
-
const [
|
|
81
|
+
const [showNoCategoriesModal, setShowNoCategoriesModal] = useState(false);
|
|
82
|
+
const [showCategoriesWarningModal, setShowWarningCategoriesModal] = useState(false);
|
|
83
|
+
const [isGenerating, setIsGenerating] = useState(false);
|
|
74
84
|
// CONTEXT
|
|
75
85
|
const scUserContext = useSCUser();
|
|
76
86
|
const isAdmin = useMemo(() => UserUtils.isCommunityCreator(scUserContext.user), [scUserContext.user]);
|
|
@@ -78,7 +88,11 @@ const OnBoardingWidget = (inProps) => {
|
|
|
78
88
|
const scPreferencesContext = useSCPreferences();
|
|
79
89
|
const scThemeContext = useSCTheme();
|
|
80
90
|
const { enqueueSnackbar } = useSnackbar();
|
|
81
|
-
const
|
|
91
|
+
const showOnBoarding = useMemo(() => scPreferencesContext.preferences &&
|
|
92
|
+
SCPreferences.CONFIGURATIONS_ONBOARDING_ENABLED in scPreferencesContext.preferences &&
|
|
93
|
+
SCPreferences.CONFIGURATIONS_ONBOARDING_HIDDEN in scPreferencesContext.preferences &&
|
|
94
|
+
scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_ONBOARDING_ENABLED].value &&
|
|
95
|
+
!scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_ONBOARDING_HIDDEN].value, [scPreferencesContext.preferences]);
|
|
82
96
|
// HOOKS
|
|
83
97
|
const theme = useTheme();
|
|
84
98
|
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
@@ -164,22 +178,29 @@ const OnBoardingWidget = (inProps) => {
|
|
|
164
178
|
};
|
|
165
179
|
const generateContent = (stepId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
166
180
|
if (!isLoading && !categories.length) {
|
|
167
|
-
|
|
181
|
+
setShowNoCategoriesModal(true);
|
|
182
|
+
}
|
|
183
|
+
else if (stepId === SCOnBoardingStepIdType.CATEGORIES) {
|
|
184
|
+
setShowWarningCategoriesModal(true);
|
|
168
185
|
}
|
|
169
186
|
else {
|
|
170
|
-
yield
|
|
171
|
-
.then(() => {
|
|
172
|
-
setIsGenerating(true);
|
|
173
|
-
})
|
|
174
|
-
.catch((error) => {
|
|
175
|
-
Logger.error(SCOPE_SC_UI, error);
|
|
176
|
-
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
177
|
-
variant: 'error',
|
|
178
|
-
autoHideDuration: 3000
|
|
179
|
-
});
|
|
180
|
-
});
|
|
187
|
+
yield startStep(stepId);
|
|
181
188
|
}
|
|
182
189
|
});
|
|
190
|
+
const startStep = (stepId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
191
|
+
showCategoriesWarningModal && setShowWarningCategoriesModal(false);
|
|
192
|
+
yield OnBoardingService.startAStep(stepId, GenerateContentsParams)
|
|
193
|
+
.then(() => {
|
|
194
|
+
setIsGenerating(true);
|
|
195
|
+
})
|
|
196
|
+
.catch((error) => {
|
|
197
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
198
|
+
enqueueSnackbar(_jsx(FormattedMessage, { id: "ui.common.error.action", defaultMessage: "ui.common.error.action" }), {
|
|
199
|
+
variant: 'error',
|
|
200
|
+
autoHideDuration: 3000
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
});
|
|
183
204
|
const handlePreferencesUpdate = () => {
|
|
184
205
|
PreferenceService.getAllPreferences().then((preferences) => {
|
|
185
206
|
const prefs = preferences['results'].reduce((obj, p) => (Object.assign(Object.assign({}, obj), { [`${p.section}.${p.name}`]: p })), {});
|
|
@@ -189,7 +210,7 @@ const OnBoardingWidget = (inProps) => {
|
|
|
189
210
|
};
|
|
190
211
|
const handleCategoriesClick = () => {
|
|
191
212
|
fetchPlatform('/contents/interests/');
|
|
192
|
-
|
|
213
|
+
setShowNoCategoriesModal(false);
|
|
193
214
|
};
|
|
194
215
|
/**
|
|
195
216
|
* Notify when a category info changes
|
|
@@ -279,10 +300,10 @@ const OnBoardingWidget = (inProps) => {
|
|
|
279
300
|
}
|
|
280
301
|
return content;
|
|
281
302
|
};
|
|
282
|
-
if (!isAdmin) {
|
|
303
|
+
if (!isAdmin || !showOnBoarding) {
|
|
283
304
|
return _jsx(HiddenPlaceholder, {});
|
|
284
305
|
}
|
|
285
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(AccordionRoot, Object.assign({ defaultExpanded: true,
|
|
306
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(AccordionRoot, Object.assign({ defaultExpanded: true, className: classes.accordionRoot, expanded: expanded }, { children: [_jsx(AccordionSummary, Object.assign({ expandIcon: _jsx(OnBoardingActionsButton, { isExpanded: expanded, onExpandChange: handleExpand, onHideOnBoarding: handlePreferencesUpdate }), "aria-controls": "accordion", id: "onBoarding-accordion" }, { children: _jsx(_Fragment, { children: expanded ? (_jsxs(_Fragment, { children: [!isMobile ? (_jsx(CardMedia, { className: classes.logo, component: "img", src: HeaderPlaceholder })) : (_jsxs(Typography, Object.assign({ variant: "h4" }, { children: [_jsx(Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: "ai_stars" })), _jsx(FormattedMessage, { id: "ui.onBoardingWidget.accordion.expanded.title.mobile", defaultMessage: "ui.onBoardingWidget.accordion.expanded.title.mobile", values: {
|
|
286
307
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
287
308
|
// @ts-ignore
|
|
288
309
|
b: (chunks) => _jsx("strong", { children: chunks })
|
|
@@ -301,6 +322,10 @@ const OnBoardingWidget = (inProps) => {
|
|
|
301
322
|
// @ts-ignore
|
|
302
323
|
// eslint-disable-next-line prettier/prettier
|
|
303
324
|
icon: (...chunks) => _jsx(Icon, Object.assign({ color: "secondary", fontSize: "medium" }, { children: chunks }))
|
|
304
|
-
} }) }))) }) })), _jsx(AccordionDetails, { children: _jsx(Widget, Object.assign({ className: classes.content, elevation: 0 }, { children: loading ? (_jsx(OnBoardingWidgetSkeleton, {})) : (_jsxs(CardContent, { children: [_jsx(List, Object.assign({ className: isMobile ? classes.stepsMobile : classes.steps }, { children: steps === null || steps === void 0 ? void 0 : steps.map((step) => (_jsx(ListItem, { children: isMobile ? (_jsx(Chip, { size: "small", label: _jsxs(_Fragment, { children: [_jsx(FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }), ' ', step.status === SCOnBoardingStepStatusType.COMPLETED && (_jsx(Icon, Object.assign({ color: (step === null || step === void 0 ? void 0 : step.status) === 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 === SCOnBoardingStepStatusType.COMPLETED ? 'success' : 'default' })) : (_jsxs(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: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { edge: "start", checked: step.status === SCOnBoardingStepStatusType.COMPLETED, tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': step.step }, size: 'small' }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }) })] }))) }, step.id))) })), _jsxs(Box, Object.assign({ className: classes.stepContent }, { children: [_jsx(Fade, Object.assign({ in: true, timeout: 2400 }, { children: _jsx(Box, { children: getStepContent() }) })),
|
|
325
|
+
} }) }))) }) })), _jsx(AccordionDetails, { children: _jsx(Widget, Object.assign({ className: classes.content, elevation: 0 }, { children: loading ? (_jsx(OnBoardingWidgetSkeleton, {})) : (_jsxs(CardContent, { children: [_jsx(List, Object.assign({ className: isMobile ? classes.stepsMobile : classes.steps }, { children: steps === null || steps === void 0 ? void 0 : steps.map((step) => (_jsx(ListItem, { children: isMobile ? (_jsx(Chip, { size: "small", label: _jsxs(_Fragment, { children: [_jsx(FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }), ' ', step.status === SCOnBoardingStepStatusType.COMPLETED && (_jsx(Icon, Object.assign({ color: (step === null || step === void 0 ? void 0 : step.status) === 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 === SCOnBoardingStepStatusType.COMPLETED ? 'success' : 'default' })) : (_jsxs(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: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { edge: "start", checked: step.status === SCOnBoardingStepStatusType.COMPLETED, tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': step.step }, size: 'small' }) }), _jsx(ListItemText, { primary: _jsx(FormattedMessage, { id: `ui.onBoardingWidget.${step.step}`, defaultMessage: `ui.onBoardingWidget.${step.step}` }) })] }))) }, step.id))) })), _jsxs(Box, Object.assign({ className: classes.stepContent }, { children: [_jsx(Fade, Object.assign({ in: true, timeout: 2400 }, { children: _jsx(Box, { children: getStepContent() }) })), showNoCategoriesModal && (_jsx(BaseDialog, Object.assign({ title: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories", defaultMessage: "ui.onBoardingWidget.ai.no.categories" }), DialogContentProps: { dividers: false }, open: showNoCategoriesModal, onClose: () => setShowNoCategoriesModal(false), actions: _jsx(Button, Object.assign({ color: "secondary", onClick: () => setShowNoCategoriesModal(false) }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories.cancel", defaultMessage: "ui.onBoardingWidget.ai.no.categories.cancel" }) })) }, { children: _jsx(Button, Object.assign({ color: "primary", onClick: handleCategoriesClick, startIcon: _jsx(Icon, Object.assign({ fontSize: "small" }, { children: "edit" })) }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.ai.no.categories.link", defaultMessage: "ui.onBoardingWidget.ai.no.categories.link" }) })) }))), showCategoriesWarningModal && (_jsx(DialogRoot, Object.assign({ className: classes.dialogRoot, title: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.title", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.title" }), DialogContentProps: { dividers: false }, open: showCategoriesWarningModal, onClose: () => setShowWarningCategoriesModal(false), actions: _jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ size: "small", variant: "outlined", color: "primary", onClick: () => setShowWarningCategoriesModal(false) }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.button.close", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.button.close" }) })), _jsx(Button, Object.assign({ size: "small", variant: "contained", color: "secondary", onClick: () => startStep(SCOnBoardingStepIdType.CATEGORIES), endIcon: _jsx(Icon, Object.assign({ fontSize: "small" }, { children: "magic_wand" })) }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.button.generate", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.button.generate" }) }))] }) }, { children: _jsxs(Typography, Object.assign({ className: classes.dialogContent }, { children: [_jsx(FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.info", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.info" }), _jsx(FormattedMessage, { id: "ui.onBoardingWidget.ai.categories.warning.confirm", defaultMessage: "ui.onBoardingWidget.ai.categories.warning.confirm", values: {
|
|
326
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
327
|
+
// @ts-ignore
|
|
328
|
+
b: (chunks) => _jsx("b", { children: chunks })
|
|
329
|
+
} })] })) })))] }))] })) })) })] })) })));
|
|
305
330
|
};
|
|
306
331
|
export default OnBoardingWidget;
|
|
@@ -18,6 +18,7 @@ const classes = {
|
|
|
18
18
|
summary: `${PREFIX}-app-summary`,
|
|
19
19
|
step: `${PREFIX}-app-step`,
|
|
20
20
|
image: `${PREFIX}-app-image`,
|
|
21
|
+
imageAndroid: `${PREFIX}-app-image-android`,
|
|
21
22
|
action: `${PREFIX}-app-action`,
|
|
22
23
|
button: `${PREFIX}-app-button`
|
|
23
24
|
};
|
|
@@ -53,7 +54,7 @@ export default function App(inProps) {
|
|
|
53
54
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
54
55
|
// @ts-ignore
|
|
55
56
|
b: (...chunks) => _jsx("strong", { children: chunks })
|
|
56
|
-
} }) })), _jsx(CardMedia, { className: classes.
|
|
57
|
+
} }) })), _jsx(CardMedia, { className: classes.imageAndroid, component: "img", src: AndroidPlaceholder })] })), tab === 1 && (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios", defaultMessage: "ui.onBoardingWidget.step.app.ios" }) })), _jsx(Typography, Object.assign({ className: classes.step }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.app.ios.a", defaultMessage: "ui.onBoardingWidget.step.app.ios.a", values: {
|
|
57
58
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
58
59
|
// @ts-ignore
|
|
59
60
|
icon: (...chunks) => _jsx(Icon, Object.assign({ fontSize: "medium" }, { children: chunks })),
|
|
@@ -63,8 +63,7 @@ export default function Appearance(inProps) {
|
|
|
63
63
|
const { className, onCompleteAction } = props;
|
|
64
64
|
// STATE
|
|
65
65
|
const [state, dispatch] = useReducer(reducer, getInitialState(null));
|
|
66
|
-
|
|
67
|
-
const [loadingLogo, setLoadingLogo] = useState(false);
|
|
66
|
+
const [loadingLogo, setLoadingLogo] = useState('');
|
|
68
67
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
69
68
|
const [tab, setTab] = useState(0);
|
|
70
69
|
const [updating, setUpdating] = useState(false);
|
|
@@ -160,15 +159,13 @@ export default function Appearance(inProps) {
|
|
|
160
159
|
setUpdating(false);
|
|
161
160
|
}
|
|
162
161
|
});
|
|
163
|
-
const updateLogoPreference = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
setLoadingLogo(
|
|
162
|
+
const updateLogoPreference = (name, file) => __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
setLoadingLogo(name);
|
|
165
164
|
const formData = new FormData();
|
|
166
|
-
|
|
167
|
-
// @ts-ignore
|
|
168
|
-
formData.append(name, fileInput);
|
|
165
|
+
formData.append(name, file);
|
|
169
166
|
yield PreferenceService.updatePreferences(formData)
|
|
170
167
|
.then((preference) => {
|
|
171
|
-
setLoadingLogo(
|
|
168
|
+
setLoadingLogo('');
|
|
172
169
|
dispatch({
|
|
173
170
|
type: actionTypes.SET_LOGOS,
|
|
174
171
|
payload: { logos: state.logos.map((l) => (l.name === name ? Object.assign(Object.assign({}, l), { value: preference[name].value }) : l)) }
|
|
@@ -176,7 +173,7 @@ export default function Appearance(inProps) {
|
|
|
176
173
|
onCompleteAction();
|
|
177
174
|
})
|
|
178
175
|
.catch((e) => {
|
|
179
|
-
setLoadingLogo(
|
|
176
|
+
setLoadingLogo('');
|
|
180
177
|
Logger.error(SCOPE_SC_UI, e);
|
|
181
178
|
});
|
|
182
179
|
});
|
|
@@ -186,9 +183,9 @@ export default function Appearance(inProps) {
|
|
|
186
183
|
* @param name
|
|
187
184
|
*/
|
|
188
185
|
const handleUpload = (event, name) => {
|
|
189
|
-
|
|
190
|
-
if (
|
|
191
|
-
updateLogoPreference(name);
|
|
186
|
+
const file = event.target.files[0];
|
|
187
|
+
if (file) {
|
|
188
|
+
updateLogoPreference(name, file);
|
|
192
189
|
}
|
|
193
190
|
};
|
|
194
191
|
useEffect(() => {
|
|
@@ -221,7 +218,7 @@ export default function Appearance(inProps) {
|
|
|
221
218
|
colorRef.current.blur();
|
|
222
219
|
}
|
|
223
220
|
};
|
|
224
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), _jsx(Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), _jsxs(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [_jsx(Typography, Object.assign({ variant: "h4", color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsxs(Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [_jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), _jsx(ScrollContainer, { children: _jsxs(Box, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && (_jsx(_Fragment, { children: state.colors.map((color) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatColorLabel(color) })), _jsxs(Box, Object.assign({ className: classes.colorContainer }, { children: [_jsx(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 && (_jsx(CircularProgress, { className: classes.colorProgress, color: "secondary", size: 24 }))] }))] }, color.id))) })), tab === 1 && (_jsx(_Fragment, { children: state.logos.map((logo) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatLogoLabel(logo.name) })), _jsxs(Box, Object.assign({ className: classes.logoContainer }, { children: [_jsx("img", { src: logo.value, className: classes.logo }), _jsx("input", { type: "file", onChange: (event) => handleUpload(event, logo.name),
|
|
221
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), _jsx(Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), _jsxs(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [_jsx(Typography, Object.assign({ variant: "h4", color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsxs(Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [_jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), _jsx(ScrollContainer, { children: _jsxs(Box, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && (_jsx(_Fragment, { children: state.colors.map((color) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatColorLabel(color) })), _jsxs(Box, Object.assign({ className: classes.colorContainer }, { children: [_jsx(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 && (_jsx(CircularProgress, { className: classes.colorProgress, color: "secondary", size: 24 }))] }))] }, color.id))) })), tab === 1 && (_jsx(_Fragment, { children: state.logos.map((logo) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatLogoLabel(logo.name) })), _jsxs(Box, Object.assign({ className: classes.logoContainer }, { children: [_jsx("img", { src: logo.value, className: classes.logo }), _jsx("input", { type: "file", onChange: (event) => handleUpload(event, logo.name), hidden: true, accept: ".gif,.png,.jpg,.jpeg", id: logo.name }), _jsx(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: _jsx(Icon, { children: "upload" }) }))] }))] }, logo.id))) })), tab === 2 && (_jsxs(Box, { children: [_jsx(TextField, { multiline: true, fullWidth: true,
|
|
225
222
|
//className={classes.field}
|
|
226
223
|
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: {
|
|
227
224
|
endAdornment: _jsx(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 }))
|
|
@@ -152,6 +152,7 @@ export default function PublicInfo(props) {
|
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
154
|
let content = null;
|
|
155
|
+
console.log(metadataDefinitions);
|
|
155
156
|
switch (field) {
|
|
156
157
|
case SCUserProfileFields.USERNAME:
|
|
157
158
|
component.element = UsernameTextField;
|
|
@@ -220,7 +221,7 @@ export default function PublicInfo(props) {
|
|
|
220
221
|
return null;
|
|
221
222
|
default:
|
|
222
223
|
if (metadataDefinitions && metadataDefinitions[field]) {
|
|
223
|
-
return (_jsx(MetadataField, 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 && _jsx(FormattedMessage, { id: `ui.userInfo.metadata.error.${_error}`, defaultMessage: `ui.userInfo.metadata.error.${_error}` }), metadata: metadataDefinitions[field] }, props), field));
|
|
224
|
+
return (_jsx(MetadataField, 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 && _jsx(FormattedMessage, { id: `ui.userInfo.metadata.error.${_error}`, defaultMessage: `ui.userInfo.metadata.error.${_error}` }), metadata: metadataDefinitions[field] }, props), field));
|
|
224
225
|
}
|
|
225
226
|
break;
|
|
226
227
|
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo, useState } from 'react';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
5
3
|
import { Divider, IconButton, List, ListItemIcon, Menu, MenuItem, SwipeableDrawer, useMediaQuery, useTheme } from '@mui/material';
|
|
6
|
-
import { FormattedMessage } from 'react-intl';
|
|
7
4
|
import Icon from '@mui/material/Icon';
|
|
8
|
-
import
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
9
6
|
import { useThemeProps } from '@mui/system';
|
|
10
|
-
import { SCRoutes, useSCFetchEvent, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
11
|
-
import ConfirmDialog from '../../shared/ConfirmDialog/ConfirmDialog';
|
|
12
7
|
import { EventService } from '@selfcommunity/api-services';
|
|
13
|
-
import {
|
|
8
|
+
import { SCRoutes, useSCFetchEvent, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
14
9
|
import { copyTextToClipboard } from '@selfcommunity/utils';
|
|
10
|
+
import classNames from 'classnames';
|
|
15
11
|
import { enqueueSnackbar } from 'notistack';
|
|
16
12
|
import PubSub from 'pubsub-js';
|
|
17
|
-
import {
|
|
13
|
+
import { useMemo, useState } from 'react';
|
|
14
|
+
import { FormattedMessage } from 'react-intl';
|
|
18
15
|
import EventForm from '../../components/EventForm';
|
|
16
|
+
import { ADD_EVENT_TO_CALENDAR, CANCEL_EVENT, GET_EVENT_LINK } from '../../constants/EventActionsMenu';
|
|
17
|
+
import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
|
|
18
|
+
import ConfirmDialog from '../../shared/ConfirmDialog/ConfirmDialog';
|
|
19
|
+
import { checkEventFinished } from '../../utils/events';
|
|
19
20
|
const PREFIX = 'SCEventActionsMenu';
|
|
20
21
|
const classes = {
|
|
21
22
|
root: `${PREFIX}-root`,
|
|
@@ -82,12 +83,7 @@ export default function EventActionsMenu(inProps) {
|
|
|
82
83
|
const scUserContext = useSCUser();
|
|
83
84
|
const { scEvent, setSCEvent } = useSCFetchEvent({ id: eventId, event });
|
|
84
85
|
const isEventAdmin = useMemo(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
|
|
85
|
-
const isEventFinished = useMemo(() =>
|
|
86
|
-
if (scEvent && !scEvent.running) {
|
|
87
|
-
return new Date().getTime() > new Date(scEvent.end_date || scEvent.start_date).getTime();
|
|
88
|
-
}
|
|
89
|
-
return false;
|
|
90
|
-
}, [scEvent]);
|
|
86
|
+
const isEventFinished = useMemo(() => checkEventFinished(scEvent), [scEvent]);
|
|
91
87
|
// HANDLERS
|
|
92
88
|
const handleOpen = (event) => {
|
|
93
89
|
setAnchorEl(event.currentTarget);
|
|
@@ -153,7 +149,7 @@ export default function EventActionsMenu(inProps) {
|
|
|
153
149
|
const renderList = () => {
|
|
154
150
|
return [
|
|
155
151
|
_jsxs(MenuItem, Object.assign({ className: classes.item, onClick: () => handleAction(GET_EVENT_LINK) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "link" }) }), _jsx(FormattedMessage, { id: "ui.shared.eventActionsMenu.item.link", defaultMessage: "ui.shared.eventActionsMenu.item.link" })] }), "link"),
|
|
156
|
-
_jsxs(MenuItem, Object.assign({ className: classes.item, onClick: () => handleAction(ADD_EVENT_TO_CALENDAR) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "CalendarIcon" }) }), _jsx(FormattedMessage, { id: "ui.shared.eventActionsMenu.item.calendar", defaultMessage: "ui.shared.eventActionsMenu.item.calendar" })] }), "calendar"),
|
|
152
|
+
!isEventFinished && (_jsxs(MenuItem, Object.assign({ className: classes.item, onClick: () => handleAction(ADD_EVENT_TO_CALENDAR) }, { children: [_jsx(ListItemIcon, { children: _jsx(Icon, { children: "CalendarIcon" }) }), _jsx(FormattedMessage, { id: "ui.shared.eventActionsMenu.item.calendar", defaultMessage: "ui.shared.eventActionsMenu.item.calendar" })] }), "calendar")),
|
|
157
153
|
isEventAdmin &&
|
|
158
154
|
!isEventFinished && [
|
|
159
155
|
_jsx(Divider, {}, "divider"),
|
package/lib/esm/utils/widget.js
CHANGED
|
@@ -55,7 +55,17 @@ export function dataWidgetReducer(state, action) {
|
|
|
55
55
|
_state = { isLoadingNext: false, next: null, results: [], count: 0, errorLoadNext: null, initialized: false };
|
|
56
56
|
break;
|
|
57
57
|
case actionWidgetTypes.INITIALIZE:
|
|
58
|
-
_state =
|
|
58
|
+
_state = {
|
|
59
|
+
cacheKey: action.payload.cacheKey ? action.payload.cacheKey : null,
|
|
60
|
+
count: action.payload.count ? action.payload.count : 0,
|
|
61
|
+
results: action.payload.results ? action.payload.results : [],
|
|
62
|
+
next: action.payload.next ? action.payload.next : null,
|
|
63
|
+
previous: action.payload.previous ? action.payload.previous : null,
|
|
64
|
+
isLoadingNext: action.payload.isLoadingNext ? action.payload.isLoadingNext : false,
|
|
65
|
+
isLoadingPrevious: action.payload.isLoadingPrevious ? action.payload.isLoadingPrevious : false,
|
|
66
|
+
visibleItems: action.payload.visibleItems ? action.payload.visibleItems : null,
|
|
67
|
+
initialized: false
|
|
68
|
+
};
|
|
59
69
|
break;
|
|
60
70
|
}
|
|
61
71
|
LRUCache.set(_state.cacheKey, _state);
|