@selfcommunity/react-ui 0.10.2-alpha.0 → 0.10.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/CategoryFollowersButton/CategoryFollowersButton.js +7 -4
- package/lib/cjs/components/EventParticipantsButton/EventParticipantsButton.js +5 -3
- package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +6 -3
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +65 -104
- package/lib/cjs/components/Skeleton/AvatarGroupSkeleton.js +4 -4
- package/lib/esm/components/CategoryFollowersButton/CategoryFollowersButton.js +7 -4
- package/lib/esm/components/EventParticipantsButton/EventParticipantsButton.js +5 -3
- package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +6 -3
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +67 -106
- package/lib/esm/components/Skeleton/AvatarGroupSkeleton.js +4 -4
- package/lib/umd/react-ui.js +1 -1
- package/package.json +3 -3
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/reducer.d.ts +0 -15
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/reducer.js +0 -42
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/reducer.d.ts +0 -15
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/reducer.js +0 -37
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import React, { useCallback, useEffect,
|
|
3
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
import Box from '@mui/material/Box';
|
|
6
6
|
import { useThemeProps } from '@mui/system';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { Preferences } from '@selfcommunity/react-core';
|
|
9
9
|
import { PREFIX } from '../../constants';
|
|
10
|
-
import { Button,
|
|
10
|
+
import { Button, Drawer, IconButton, Tab, Tabs, TextField, Typography } from '@mui/material';
|
|
11
11
|
import { MuiColorInput } from 'mui-color-input';
|
|
12
|
-
import { actionTypes } from './reducer';
|
|
13
|
-
import { getInitialState, reducer } from './reducer';
|
|
14
12
|
import { PreferenceService } from '@selfcommunity/api-services';
|
|
13
|
+
import { SCPreferenceSection } from '@selfcommunity/types';
|
|
15
14
|
import { formatColorLabel, formatLogoLabel } from '../../../../utils/onBoarding';
|
|
16
15
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
17
16
|
import Icon from '@mui/material/Icon';
|
|
@@ -44,6 +43,12 @@ const classes = {
|
|
|
44
43
|
drawerHeaderAction: `${PREFIX}-appearance-drawer-header-action`,
|
|
45
44
|
drawerContent: `${PREFIX}-appearance-drawer-content`
|
|
46
45
|
};
|
|
46
|
+
var AppearanceTabType;
|
|
47
|
+
(function (AppearanceTabType) {
|
|
48
|
+
AppearanceTabType["COLOR"] = "color";
|
|
49
|
+
AppearanceTabType["LOGO"] = "logo";
|
|
50
|
+
AppearanceTabType["SLOGAN"] = "slogan";
|
|
51
|
+
})(AppearanceTabType || (AppearanceTabType = {}));
|
|
47
52
|
const Root = styled(Box, {
|
|
48
53
|
name: PREFIX,
|
|
49
54
|
slot: 'AppearanceRoot'
|
|
@@ -54,7 +59,7 @@ const DrawerRoot = styled(Drawer, {
|
|
|
54
59
|
overridesResolver: (props, styles) => styles.appearanceDrawerRoot
|
|
55
60
|
})(({ theme }) => ({}));
|
|
56
61
|
export default function Appearance(inProps) {
|
|
57
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
62
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
58
63
|
// PROPS
|
|
59
64
|
const props = useThemeProps({
|
|
60
65
|
props: inProps,
|
|
@@ -62,18 +67,20 @@ export default function Appearance(inProps) {
|
|
|
62
67
|
});
|
|
63
68
|
const { className, onCompleteAction } = props;
|
|
64
69
|
// STATE
|
|
65
|
-
const [
|
|
70
|
+
const [preferences, setPreferences] = useState([]);
|
|
71
|
+
const [data, setData] = useState({});
|
|
72
|
+
const [loading, setLoading] = useState(true);
|
|
66
73
|
const [loadingLogo, setLoadingLogo] = useState('');
|
|
67
74
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
68
|
-
const [tab, setTab] = useState(
|
|
75
|
+
const [tab, setTab] = useState(AppearanceTabType.COLOR);
|
|
69
76
|
const [updating, setUpdating] = useState(false);
|
|
70
|
-
const [updatingColor, setUpdatingColor] = useState('');
|
|
71
77
|
const colorRef = useRef(null);
|
|
72
78
|
// INTL
|
|
73
79
|
const intl = useIntl();
|
|
74
80
|
// HANDLERS
|
|
75
81
|
const handleTabChange = (event, newValue) => {
|
|
76
82
|
setTab(newValue);
|
|
83
|
+
setData({});
|
|
77
84
|
};
|
|
78
85
|
const handleOpen = useCallback((event) => {
|
|
79
86
|
setAnchorEl(event.currentTarget);
|
|
@@ -81,82 +88,58 @@ export default function Appearance(inProps) {
|
|
|
81
88
|
const handleClose = useCallback(() => {
|
|
82
89
|
setAnchorEl(null);
|
|
83
90
|
}, []);
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
})
|
|
96
|
-
.catch((e) => {
|
|
97
|
-
Logger.error(SCOPE_SC_UI, e);
|
|
98
|
-
dispatch({ type: actionTypes.SET_COLORS, payload: { loading: false, colors: [] } });
|
|
91
|
+
const handleClosePopover = () => {
|
|
92
|
+
if (colorRef.current) {
|
|
93
|
+
colorRef.current.blur();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const handleChange = (event) => {
|
|
97
|
+
const { name, value } = event.target;
|
|
98
|
+
setPreferences((prev) => {
|
|
99
|
+
return prev.map((p) => Object.assign({}, p, { value: p.name === name ? value : p.value }));
|
|
99
100
|
});
|
|
101
|
+
handleDataUpdate(name, value);
|
|
100
102
|
};
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
.then((res) => {
|
|
105
|
-
dispatch({
|
|
106
|
-
type: actionTypes.SET_LOGOS,
|
|
107
|
-
payload: {
|
|
108
|
-
loading: false,
|
|
109
|
-
logos: res.results
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
})
|
|
113
|
-
.catch((e) => {
|
|
114
|
-
Logger.error(SCOPE_SC_UI, e);
|
|
115
|
-
dispatch({ type: actionTypes.SET_LOGOS, payload: { loading: false, logos: [] } });
|
|
103
|
+
const handleColorChange = (newColor, name) => {
|
|
104
|
+
setPreferences((prev) => {
|
|
105
|
+
return prev.map((p) => Object.assign({}, p, { value: p.name === name ? newColor : p.value }));
|
|
116
106
|
});
|
|
107
|
+
handleDataUpdate(name, newColor);
|
|
117
108
|
};
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
109
|
+
const handleDataUpdate = (key, value) => {
|
|
110
|
+
const elementInDict = preferences.filter((p) => p.name === key && p.value === value);
|
|
111
|
+
if (elementInDict.length) {
|
|
112
|
+
const newData = Object.assign({}, data);
|
|
113
|
+
delete newData[key];
|
|
114
|
+
setData(newData);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
setData((prevData) => (Object.assign(Object.assign({}, prevData), { [key]: value })));
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const fetchPreferences = () => {
|
|
121
|
+
PreferenceService.searchPreferences('', '', `${Preferences.COLORS_COLORBACK},${Preferences.COLORS_COLORPRIMARY},${Preferences.COLORS_COLORSECONDARY},${Preferences.COLORS_NAVBARBACK},${Preferences.COLORS_COLORFONT},${Preferences.COLORS_COLORFONTSECONDARY}, ${Preferences.LOGO_NAVBAR_LOGO},${Preferences.LOGO_NAVBAR_LOGO_MOBILE}, ${Preferences.TEXT_APPLICATION_SLOGAN1},${Preferences.TEXT_APPLICATION_SLOGAN2}`)
|
|
121
122
|
.then((res) => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
payload: {
|
|
125
|
-
loading: false,
|
|
126
|
-
slogans: res.results
|
|
127
|
-
}
|
|
128
|
-
});
|
|
123
|
+
setPreferences(res.results);
|
|
124
|
+
setLoading(false);
|
|
129
125
|
})
|
|
130
126
|
.catch((e) => {
|
|
131
127
|
Logger.error(SCOPE_SC_UI, e);
|
|
132
|
-
|
|
128
|
+
setLoading(false);
|
|
133
129
|
});
|
|
134
130
|
};
|
|
135
|
-
const updatePreference = (
|
|
136
|
-
try {
|
|
137
|
-
yield PreferenceService.updatePreferences(preference);
|
|
138
|
-
}
|
|
139
|
-
catch (e) {
|
|
140
|
-
Logger.error(SCOPE_SC_UI, e);
|
|
141
|
-
}
|
|
142
|
-
finally {
|
|
143
|
-
setUpdating(false);
|
|
144
|
-
setUpdatingColor('');
|
|
145
|
-
onCompleteAction();
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
const updateSlogans = () => __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
const updatePreference = () => __awaiter(this, void 0, void 0, function* () {
|
|
149
132
|
setUpdating(true);
|
|
150
133
|
try {
|
|
151
|
-
yield
|
|
152
|
-
return updatePreference({ [name]: value });
|
|
153
|
-
}));
|
|
134
|
+
yield PreferenceService.updatePreferences(data);
|
|
154
135
|
}
|
|
155
136
|
catch (e) {
|
|
156
137
|
Logger.error(SCOPE_SC_UI, e);
|
|
157
138
|
}
|
|
158
139
|
finally {
|
|
159
140
|
setUpdating(false);
|
|
141
|
+
setData({});
|
|
142
|
+
onCompleteAction();
|
|
160
143
|
}
|
|
161
144
|
});
|
|
162
145
|
const updateLogoPreference = (name, file) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -166,14 +149,15 @@ export default function Appearance(inProps) {
|
|
|
166
149
|
yield PreferenceService.updatePreferences(formData)
|
|
167
150
|
.then((preference) => {
|
|
168
151
|
setLoadingLogo('');
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
152
|
+
setData({});
|
|
153
|
+
setPreferences((prev) => {
|
|
154
|
+
return prev.map((p) => Object.assign({}, p, { value: p.name === name ? preference[name].value : p.value }));
|
|
172
155
|
});
|
|
173
156
|
onCompleteAction();
|
|
174
157
|
})
|
|
175
158
|
.catch((e) => {
|
|
176
159
|
setLoadingLogo('');
|
|
160
|
+
setData({});
|
|
177
161
|
Logger.error(SCOPE_SC_UI, e);
|
|
178
162
|
});
|
|
179
163
|
});
|
|
@@ -189,42 +173,19 @@ export default function Appearance(inProps) {
|
|
|
189
173
|
}
|
|
190
174
|
};
|
|
191
175
|
useEffect(() => {
|
|
192
|
-
|
|
193
|
-
fetchLogos();
|
|
194
|
-
fetchSlogans();
|
|
176
|
+
fetchPreferences();
|
|
195
177
|
}, []);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
const handleChange = (event) => {
|
|
210
|
-
const { name, value } = event.target;
|
|
211
|
-
dispatch({
|
|
212
|
-
type: actionTypes.SET_SLOGANS,
|
|
213
|
-
payload: { slogans: state.slogans.map((s) => (s.name === name ? Object.assign(Object.assign({}, s), { value: value }) : s)) }
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
const handleClosePopover = () => {
|
|
217
|
-
if (colorRef.current) {
|
|
218
|
-
colorRef.current.blur();
|
|
219
|
-
}
|
|
220
|
-
};
|
|
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,
|
|
222
|
-
//className={classes.field}
|
|
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: {
|
|
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 }))
|
|
225
|
-
}, error: Boolean(((_e = (_d = state === null || state === void 0 ? void 0 : state.slogans[0]) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.length) > 50) }), _jsx(TextField, { multiline: true, fullWidth: true,
|
|
226
|
-
//className={classes.field}
|
|
227
|
-
label: `${intl.formatMessage(messages.sloganField)}`, margin: "normal", value: (_f = state === null || state === void 0 ? void 0 : state.slogans[1]) === null || _f === void 0 ? void 0 : _f.value, name: "application_slogan2", onChange: handleChange, InputProps: {
|
|
228
|
-
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_g = state.slogans[1].value) === null || _g === void 0 ? void 0 : _g.length) ? 150 - ((_h = state.slogans[1].value) === null || _h === void 0 ? void 0 : _h.length) : 150 })))
|
|
229
|
-
}, error: Boolean(((_k = (_j = state === null || state === void 0 ? void 0 : state.slogans[1]) === null || _j === void 0 ? void 0 : _j.value) === null || _k === void 0 ? void 0 : _k.length) > 150) }), _jsx(LoadingButton, Object.assign({ loading: updating, disabled: updating, variant: "outlined", size: "small", color: "primary", onClick: updateSlogans }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.button", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.button" }) }))] }))] })) })] }))] })));
|
|
178
|
+
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, { value: AppearanceTabType.COLOR, label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), _jsx(Tab, { value: AppearanceTabType.LOGO, label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), _jsx(Tab, { value: AppearanceTabType.SLOGAN, 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 === AppearanceTabType.COLOR && (_jsxs(Box, Object.assign({ className: classes.colorContainer }, { children: [preferences
|
|
179
|
+
.filter((item) => item.section === SCPreferenceSection.COLORS)
|
|
180
|
+
.map((color) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatColorLabel(color) })), _jsx(Box, { children: _jsx(MuiColorInput, { inputRef: colorRef, className: classes.color, format: "hex", value: color.value, onChange: (value) => handleColorChange(value, color.name), isAlphaHidden: true, PopoverProps: { onClose: handleClosePopover } }) })] }, color.id))), _jsx(LoadingButton, Object.assign({ loading: loading || updating, disabled: loading || updating || Object.keys(data).length === 0, variant: "outlined", size: "small", color: "primary", onClick: updatePreference }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.button", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.button" }) }))] }))), tab === AppearanceTabType.LOGO && (_jsx(_Fragment, { children: preferences
|
|
181
|
+
.filter((item) => item.section === SCPreferenceSection.LOGO)
|
|
182
|
+
.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 === AppearanceTabType.SLOGAN && (_jsxs(Box, { children: [_jsx(TextField, { multiline: true, fullWidth: true, label: `${intl.formatMessage(messages.titleField)}`, margin: "normal", value: ((_a = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan1')) === null || _a === void 0 ? void 0 : _a.value) || '', name: "application_slogan1", onChange: handleChange, InputProps: {
|
|
183
|
+
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_c = (_b = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan1')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.length)
|
|
184
|
+
? 50 - ((_d = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan1')) === null || _d === void 0 ? void 0 : _d.value.length)
|
|
185
|
+
: 50 })))
|
|
186
|
+
}, error: Boolean(((_f = (_e = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan1')) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.length) > 50) }), _jsx(TextField, { multiline: true, fullWidth: true, label: `${intl.formatMessage(messages.sloganField)}`, margin: "normal", value: ((_g = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan2')) === null || _g === void 0 ? void 0 : _g.value) || '', name: "application_slogan2", onChange: handleChange, InputProps: {
|
|
187
|
+
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_j = (_h = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan2')) === null || _h === void 0 ? void 0 : _h.value) === null || _j === void 0 ? void 0 : _j.length)
|
|
188
|
+
? 150 - ((_k = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan2')) === null || _k === void 0 ? void 0 : _k.value.length)
|
|
189
|
+
: 150 })))
|
|
190
|
+
}, error: Boolean(((_m = (_l = preferences === null || preferences === void 0 ? void 0 : preferences.find((item) => item.section === 'text' && item.name === 'application_slogan2')) === null || _l === void 0 ? void 0 : _l.value) === null || _m === void 0 ? void 0 : _m.length) > 150) }), _jsx(LoadingButton, Object.assign({ loading: updating, disabled: updating || Object.keys(data).length === 0, variant: "outlined", size: "small", color: "primary", onClick: updatePreference }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.button", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.button" }) }))] }))] })) })] }))] })));
|
|
230
191
|
}
|
|
@@ -10,8 +10,8 @@ const classes = {
|
|
|
10
10
|
const Root = styled(AvatarGroup, {
|
|
11
11
|
name: PREFIX,
|
|
12
12
|
slot: 'Root',
|
|
13
|
-
overridesResolver: (
|
|
14
|
-
})((
|
|
13
|
+
overridesResolver: (_props, styles) => styles.root
|
|
14
|
+
})(() => ({}));
|
|
15
15
|
/**
|
|
16
16
|
* > API documentation for the Community-JS Avatar Group Skeleton component. Learn about the available props and the CSS API.
|
|
17
17
|
|
|
@@ -38,7 +38,7 @@ export default function AvatarGroupSkeleton(inProps) {
|
|
|
38
38
|
props: inProps,
|
|
39
39
|
name: PREFIX
|
|
40
40
|
});
|
|
41
|
-
const {
|
|
41
|
+
const { skeletonsAnimation = 'wave', count = 3 } = props, rest = __rest(props, ["skeletonsAnimation", "count"]);
|
|
42
42
|
const theme = useTheme();
|
|
43
|
-
return (_jsx(Root, Object.assign({ className: classes.root }, rest, { children: [...Array(count
|
|
43
|
+
return (_jsx(Root, Object.assign({ className: classes.root }, rest, { children: [...Array(count)].map((_x, i) => (_jsx(Avatar, { children: _jsx(Skeleton, { variant: "circular", width: theme.selfcommunity.user.avatar.sizeSmall, height: theme.selfcommunity.user.avatar.sizeSmall, animation: skeletonsAnimation }) }, i))) })));
|
|
44
44
|
}
|