@selfcommunity/react-ui 0.8.0-alpha.1 → 0.8.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/BottomNavigation/BottomNavigation.js +11 -2
- package/lib/cjs/components/Composer/Composer.js +8 -2
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +12 -3
- package/lib/cjs/components/CreateEventButton/CreateEventButton.js +5 -1
- package/lib/cjs/components/CreateEventWidget/CreateEventWidget.js +5 -1
- package/lib/cjs/components/EventForm/EventAddress.d.ts +3 -8
- package/lib/cjs/components/EventForm/EventAddress.js +20 -20
- package/lib/cjs/components/EventForm/EventForm.d.ts +1 -1
- package/lib/cjs/components/EventForm/EventForm.js +90 -76
- package/lib/cjs/components/EventForm/constants.d.ts +4 -0
- package/lib/cjs/components/EventForm/constants.js +5 -1
- package/lib/cjs/components/EventForm/types.d.ts +27 -0
- package/lib/cjs/components/EventForm/types.js +2 -0
- package/lib/cjs/components/EventForm/utils.d.ts +4 -0
- package/lib/cjs/components/EventForm/utils.js +28 -0
- package/lib/cjs/components/EventHeader/EventHeader.js +1 -1
- package/lib/cjs/components/EventInfoWidget/EventInfoWidget.js +24 -1
- package/lib/cjs/components/Events/Events.js +10 -5
- package/lib/cjs/components/MyEventsWidget/MyEventsWidget.js +34 -2
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +12 -3
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -2
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +23 -15
- package/lib/cjs/components/SuggestedEventsWidget/SuggestedEventsWidget.js +26 -0
- package/lib/cjs/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +7 -2
- package/lib/cjs/shared/ContributionActionsMenu/index.js +6 -6
- package/lib/cjs/shared/EventActionsMenu/index.d.ts +4 -0
- package/lib/cjs/shared/EventActionsMenu/index.js +13 -3
- package/lib/cjs/shared/Media/Link/DisplayComponent.js +21 -5
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +11 -2
- package/lib/esm/components/Composer/Composer.js +8 -2
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +13 -4
- package/lib/esm/components/CreateEventButton/CreateEventButton.js +5 -1
- package/lib/esm/components/CreateEventWidget/CreateEventWidget.js +5 -1
- package/lib/esm/components/EventForm/EventAddress.d.ts +3 -8
- package/lib/esm/components/EventForm/EventAddress.js +20 -20
- package/lib/esm/components/EventForm/EventForm.d.ts +1 -1
- package/lib/esm/components/EventForm/EventForm.js +92 -78
- package/lib/esm/components/EventForm/constants.d.ts +4 -0
- package/lib/esm/components/EventForm/constants.js +4 -0
- package/lib/esm/components/EventForm/types.d.ts +27 -0
- package/lib/esm/components/EventForm/types.js +1 -0
- package/lib/esm/components/EventForm/utils.d.ts +4 -0
- package/lib/esm/components/EventForm/utils.js +21 -0
- package/lib/esm/components/EventHeader/EventHeader.js +1 -1
- package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +25 -2
- package/lib/esm/components/Events/Events.js +10 -5
- package/lib/esm/components/MyEventsWidget/MyEventsWidget.js +36 -4
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +12 -3
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -2
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +24 -16
- package/lib/esm/components/SuggestedEventsWidget/SuggestedEventsWidget.js +27 -1
- package/lib/esm/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +8 -3
- package/lib/esm/shared/ContributionActionsMenu/index.js +6 -6
- package/lib/esm/shared/EventActionsMenu/index.d.ts +4 -0
- package/lib/esm/shared/EventActionsMenu/index.js +13 -3
- package/lib/esm/shared/Media/Link/DisplayComponent.js +21 -5
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
|
@@ -61,8 +61,17 @@ export default function BottomNavigation(inProps) {
|
|
|
61
61
|
const { preferences, features } = useSCPreferences();
|
|
62
62
|
// MEMO
|
|
63
63
|
const privateMessagingEnabled = useMemo(() => features.includes(SCFeatureName.PRIVATE_MESSAGING), [features]);
|
|
64
|
-
const groupsEnabled = useMemo(() =>
|
|
65
|
-
|
|
64
|
+
const groupsEnabled = useMemo(() => preferences &&
|
|
65
|
+
features &&
|
|
66
|
+
features.includes(SCFeatureName.TAGGING) &&
|
|
67
|
+
features.includes(SCFeatureName.GROUPING) &&
|
|
68
|
+
SCPreferences.CONFIGURATIONS_GROUPS_ENABLED in preferences &&
|
|
69
|
+
preferences[SCPreferences.CONFIGURATIONS_GROUPS_ENABLED].value, [preferences, features]);
|
|
70
|
+
const eventsEnabled = useMemo(() => preferences &&
|
|
71
|
+
features &&
|
|
72
|
+
features.includes(SCFeatureName.TAGGING) &&
|
|
73
|
+
SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
|
|
74
|
+
preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
|
|
66
75
|
const exploreStreamEnabled = preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
|
|
67
76
|
const postOnlyStaffEnabled = preferences[SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value;
|
|
68
77
|
const contentAvailable = preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value;
|
|
@@ -428,10 +428,16 @@ export default function Composer(inProps) {
|
|
|
428
428
|
if (features.includes(SCFeatureName.TAGGING) && addressing !== null) {
|
|
429
429
|
data.addressing = addressing.map((t) => t.id);
|
|
430
430
|
}
|
|
431
|
-
if (features.includes(SCFeatureName.
|
|
431
|
+
if (features.includes(SCFeatureName.TAGGING) &&
|
|
432
|
+
features.includes(SCFeatureName.GROUPING) &&
|
|
433
|
+
preferences[SCPreferences.CONFIGURATIONS_GROUPS_ENABLED].value &&
|
|
434
|
+
group !== null) {
|
|
432
435
|
data.group = group.id;
|
|
433
436
|
}
|
|
434
|
-
if (features.includes(SCFeatureName.
|
|
437
|
+
if (features.includes(SCFeatureName.TAGGING) &&
|
|
438
|
+
features.includes(SCFeatureName.EVENT) &&
|
|
439
|
+
preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value &&
|
|
440
|
+
event !== null) {
|
|
435
441
|
data.event = event.id;
|
|
436
442
|
}
|
|
437
443
|
setIsSubmitting(true);
|
|
@@ -11,7 +11,7 @@ import TagChip from '../../../../shared/TagChip';
|
|
|
11
11
|
import classNames from 'classnames';
|
|
12
12
|
import Icon from '@mui/material/Icon';
|
|
13
13
|
import DialogContent from '@mui/material/DialogContent';
|
|
14
|
-
import { useSCFetchAddressingTagList, useSCPreferences } from '@selfcommunity/react-core';
|
|
14
|
+
import { SCPreferences, useSCFetchAddressingTagList, useSCPreferences } from '@selfcommunity/react-core';
|
|
15
15
|
import { PREFIX } from '../../constants';
|
|
16
16
|
import GroupAutocomplete from '../../../GroupAutocomplete';
|
|
17
17
|
import { SCFeatureName } from '@selfcommunity/types';
|
|
@@ -57,10 +57,19 @@ const AudienceLayer = React.forwardRef((props, ref) => {
|
|
|
57
57
|
const [value, setValue] = useState(defaultValue || undefined);
|
|
58
58
|
// HOOKS
|
|
59
59
|
const { scAddressingTags } = useSCFetchAddressingTagList({ fetch: autocompleteOpen });
|
|
60
|
-
const { features } = useSCPreferences();
|
|
60
|
+
const { preferences, features } = useSCPreferences();
|
|
61
61
|
// MEMO
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const groupsEnabled = useMemo(() => preferences &&
|
|
63
|
+
features &&
|
|
64
|
+
features.includes(SCFeatureName.TAGGING) &&
|
|
65
|
+
features.includes(SCFeatureName.GROUPING) &&
|
|
66
|
+
SCPreferences.CONFIGURATIONS_GROUPS_ENABLED in preferences &&
|
|
67
|
+
preferences[SCPreferences.CONFIGURATIONS_GROUPS_ENABLED].value, [preferences, features]);
|
|
68
|
+
const eventsEnabled = useMemo(() => preferences &&
|
|
69
|
+
features &&
|
|
70
|
+
features.includes(SCFeatureName.TAGGING) &&
|
|
71
|
+
SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
|
|
72
|
+
preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
|
|
64
73
|
// HANDLERS
|
|
65
74
|
const handleSave = useCallback(() => {
|
|
66
75
|
audience === AudienceTypes.AUDIENCE_GROUP || audience === AudienceTypes.AUDIENCE_EVENT
|
|
@@ -52,7 +52,11 @@ export default function CreateEventButton(inProps) {
|
|
|
52
52
|
// CONST
|
|
53
53
|
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
54
54
|
const { preferences, features } = useSCPreferences();
|
|
55
|
-
const eventsEnabled = useMemo(() =>
|
|
55
|
+
const eventsEnabled = useMemo(() => preferences &&
|
|
56
|
+
features &&
|
|
57
|
+
features.includes(SCFeatureName.TAGGING) &&
|
|
58
|
+
SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
|
|
59
|
+
preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
|
|
56
60
|
const onlyStaffEnabled = useMemo(() => preferences[SCPreferences.CONFIGURATIONS_EVENTS_ONLY_STAFF_ENABLED].value, [preferences]);
|
|
57
61
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
58
62
|
// @ts-ignore
|
|
@@ -38,7 +38,11 @@ export default function CreateEventWidget(inProps) {
|
|
|
38
38
|
const scUserContext = useContext(SCUserContext);
|
|
39
39
|
// HOOK
|
|
40
40
|
const { preferences, features } = useSCPreferences();
|
|
41
|
-
const eventsEnabled = useMemo(() =>
|
|
41
|
+
const eventsEnabled = useMemo(() => preferences &&
|
|
42
|
+
features &&
|
|
43
|
+
features.includes(SCFeatureName.TAGGING) &&
|
|
44
|
+
SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
|
|
45
|
+
preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
|
|
42
46
|
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
43
47
|
const onlyStaffEnabled = useMemo(() => preferences[SCPreferences.CONFIGURATIONS_GROUPS_ONLY_STAFF_ENABLED].value, [preferences]);
|
|
44
48
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SCEventType } from '@selfcommunity/types';
|
|
2
|
+
import { Geolocation } from './types';
|
|
2
3
|
export interface EventAddressProps {
|
|
3
4
|
event?: SCEventType;
|
|
4
|
-
forwardGeolocationData: (data:
|
|
5
|
-
location: SCEventLocationType;
|
|
6
|
-
geolocation?: string;
|
|
7
|
-
lat?: number;
|
|
8
|
-
lng?: number;
|
|
9
|
-
link?: string;
|
|
10
|
-
}) => void;
|
|
5
|
+
forwardGeolocationData: (data: Geolocation) => void;
|
|
11
6
|
className?: string;
|
|
12
7
|
}
|
|
13
8
|
export default function EventAddress(inProps: EventAddressProps): JSX.Element;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
5
3
|
import { Autocomplete, Box, InputAdornment, Tab, Tabs, TextField } from '@mui/material';
|
|
6
4
|
import Icon from '@mui/material/Icon';
|
|
7
|
-
import
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
8
6
|
import { useThemeProps } from '@mui/system';
|
|
9
|
-
import {
|
|
10
|
-
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
11
|
-
import UrlTextField from '../../shared/UrlTextField';
|
|
12
|
-
import axios from 'axios';
|
|
7
|
+
import { useLoadScript } from '@react-google-maps/api';
|
|
13
8
|
import { useSCContext } from '@selfcommunity/react-core';
|
|
14
|
-
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
15
9
|
import { SCEventLocationType } from '@selfcommunity/types';
|
|
16
|
-
import
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
import classNames from 'classnames';
|
|
12
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
14
|
+
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
15
|
+
import UrlTextField from '../../shared/UrlTextField';
|
|
16
|
+
import { PREFIX } from './constants';
|
|
17
17
|
const messages = defineMessages({
|
|
18
18
|
virtualPlaceholder: {
|
|
19
19
|
id: 'ui.eventForm.address.online.placeholder',
|
|
@@ -41,8 +41,8 @@ export default function EventAddress(inProps) {
|
|
|
41
41
|
// PROPS
|
|
42
42
|
const { className, forwardGeolocationData, event } = props;
|
|
43
43
|
// STATE
|
|
44
|
-
const [location, setLocation] = useState(event ? event.location
|
|
45
|
-
const [geolocation, setGeoLocation] = useState(event ? event.geolocation : null);
|
|
44
|
+
const [location, setLocation] = useState((event === null || event === void 0 ? void 0 : event.location) || SCEventLocationType.PERSON);
|
|
45
|
+
const [geolocation, setGeoLocation] = useState(event ? { description: event.geolocation } : null);
|
|
46
46
|
const [inputValue, setInputValue] = useState('');
|
|
47
47
|
const [suggestions, setSuggestions] = useState([]);
|
|
48
48
|
const [timeoutId, setTimeoutId] = useState(null);
|
|
@@ -54,22 +54,22 @@ export default function EventAddress(inProps) {
|
|
|
54
54
|
libraries: ['places', 'geocoding']
|
|
55
55
|
});
|
|
56
56
|
// HANDLERS
|
|
57
|
-
const handleChange = (
|
|
57
|
+
const handleChange = (_event, newValue) => {
|
|
58
58
|
setLocation(newValue);
|
|
59
59
|
};
|
|
60
|
-
const handleSelection = (
|
|
60
|
+
const handleSelection = (_event, newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
61
61
|
if (newValue) {
|
|
62
62
|
try {
|
|
63
63
|
const response = yield axios.get(`https://maps.googleapis.com/maps/api/geocode/json`, {
|
|
64
64
|
params: {
|
|
65
|
-
place_id: newValue.
|
|
65
|
+
place_id: newValue.id,
|
|
66
66
|
key: geocodingApiKey
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
const place = response.data.results[0];
|
|
70
70
|
setGeoLocation(newValue);
|
|
71
71
|
forwardGeolocationData({
|
|
72
|
-
location
|
|
72
|
+
location,
|
|
73
73
|
geolocation: place.formatted_address,
|
|
74
74
|
lat: place.geometry.location.lat,
|
|
75
75
|
lng: place.geometry.location.lng
|
|
@@ -80,11 +80,11 @@ export default function EventAddress(inProps) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
|
-
const handleLocationChange = (
|
|
83
|
+
const handleLocationChange = (_event, newInputValue) => {
|
|
84
84
|
setInputValue(newInputValue);
|
|
85
85
|
};
|
|
86
86
|
const handleLinkChange = (event) => {
|
|
87
|
-
forwardGeolocationData({ location
|
|
87
|
+
forwardGeolocationData({ location, link: event.target.value });
|
|
88
88
|
};
|
|
89
89
|
useEffect(() => {
|
|
90
90
|
if (timeoutId) {
|
|
@@ -95,13 +95,13 @@ export default function EventAddress(inProps) {
|
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
if (inputValue.length >= 3) {
|
|
98
|
-
const newTimeoutId =
|
|
98
|
+
const newTimeoutId = setTimeout(() => {
|
|
99
99
|
const autocompleteService = new window.google.maps.places.AutocompleteService();
|
|
100
100
|
autocompleteService.getPlacePredictions({ input: inputValue }, (predictions, status) => {
|
|
101
101
|
if (status === window.google.maps.places.PlacesServiceStatus.OK && predictions) {
|
|
102
102
|
setSuggestions(predictions.map((prediction) => ({
|
|
103
103
|
description: prediction.description,
|
|
104
|
-
|
|
104
|
+
id: prediction.place_id
|
|
105
105
|
})));
|
|
106
106
|
}
|
|
107
107
|
});
|
|
@@ -112,7 +112,7 @@ export default function EventAddress(inProps) {
|
|
|
112
112
|
if (!geocodingApiKey && !isLoaded) {
|
|
113
113
|
return _jsx(HiddenPlaceholder, {});
|
|
114
114
|
}
|
|
115
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsxs(Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [_jsx(Tab, { value: SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "add_location_alt" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) }), _jsx(Tab, { value: SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "play_circle_outline" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) })] })), _jsxs(Box, Object.assign({ className: classes.tabContent }, { children: [location === SCEventLocationType.PERSON && (_jsx(Autocomplete, {
|
|
115
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsxs(Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [_jsx(Tab, { value: SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "add_location_alt" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) }), _jsx(Tab, { value: SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "play_circle_outline" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) })] })), _jsxs(Box, Object.assign({ className: classes.tabContent }, { children: [location === SCEventLocationType.PERSON && (_jsx(Autocomplete, { size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description || geolocation.description, noOptionsText: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), isOptionEqualToValue: (option, value) => option.description === value.description, renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.placeholder", defaultMessage: "ui.eventForm.address.live.placeholder" }), variant: "outlined", fullWidth: true, InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: (_jsxs(_Fragment, { children: [_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(Icon, { children: "add_location_alt" }) })), params.InputProps.endAdornment] })) }) }))) })), location === SCEventLocationType.ONLINE && (_jsx(UrlTextField, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
|
|
116
116
|
endAdornment: _jsx(Icon, { children: "play_circle_outline" })
|
|
117
117
|
}, onChange: handleLinkChange }))] }))] })));
|
|
118
118
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { LoadingButton } from '@mui/lab';
|
|
4
|
-
import { Box,
|
|
4
|
+
import { Box, FormControl, FormGroup, Icon, IconButton, InputAdornment, InputLabel, MenuItem, Paper, Select, Stack, Switch, TextField, Typography } from '@mui/material';
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
6
6
|
import { useThemeProps } from '@mui/system';
|
|
7
7
|
import { LocalizationProvider, MobileDatePicker, MobileTimePicker } from '@mui/x-date-pickers';
|
|
@@ -14,15 +14,16 @@ import classNames from 'classnames';
|
|
|
14
14
|
import enLocale from 'date-fns/locale/en-US';
|
|
15
15
|
import itLocale from 'date-fns/locale/it';
|
|
16
16
|
import PubSub from 'pubsub-js';
|
|
17
|
-
import { useMemo, useState } from 'react';
|
|
17
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
18
18
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
19
19
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
20
20
|
import { EVENT_DESCRIPTION_MAX_LENGTH, EVENT_TITLE_MAX_LENGTH } from '../../constants/Event';
|
|
21
21
|
import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
|
|
22
22
|
import BaseDialog from '../../shared/BaseDialog';
|
|
23
|
-
import { PREFIX } from './constants';
|
|
23
|
+
import { DAILY_LATER_DAYS, MONTHLY_LATER_DAYS, NEVER_LATER_DAYS, PREFIX, WEEKLY_LATER_DAYS } from './constants';
|
|
24
24
|
import EventAddress from './EventAddress';
|
|
25
25
|
import UploadEventCover from './UploadEventCover';
|
|
26
|
+
import { combineDateAndTime, getLaterDaysDate, getLaterHoursDate, getNewDate } from './utils';
|
|
26
27
|
const messages = defineMessages({
|
|
27
28
|
name: {
|
|
28
29
|
id: 'ui.eventForm.name.placeholder',
|
|
@@ -111,7 +112,7 @@ const Root = styled(BaseDialog, {
|
|
|
111
112
|
* @param inProps
|
|
112
113
|
*/
|
|
113
114
|
export default function EventForm(inProps) {
|
|
114
|
-
var _a, _b, _c, _d
|
|
115
|
+
var _a, _b, _c, _d;
|
|
115
116
|
//PROPS
|
|
116
117
|
const props = useThemeProps({
|
|
117
118
|
props: inProps,
|
|
@@ -122,24 +123,25 @@ export default function EventForm(inProps) {
|
|
|
122
123
|
const scContext = useSCContext();
|
|
123
124
|
// INTL
|
|
124
125
|
const intl = useIntl();
|
|
126
|
+
const startDateTime = useMemo(() => getNewDate(event === null || event === void 0 ? void 0 : event.start_date), [event]);
|
|
127
|
+
const endDateTime = useMemo(() => getNewDate(event === null || event === void 0 ? void 0 : event.end_date), [event]);
|
|
125
128
|
const initialFieldState = {
|
|
126
|
-
imageOriginal: event ? event.image_bigger
|
|
129
|
+
imageOriginal: (event === null || event === void 0 ? void 0 : event.image_bigger) || '',
|
|
127
130
|
imageOriginalFile: '',
|
|
128
|
-
startDate: event ?
|
|
129
|
-
startTime: event ?
|
|
130
|
-
endDate: event
|
|
131
|
-
endTime: event
|
|
132
|
-
location: event ? event.location
|
|
133
|
-
geolocation: event ? event.geolocation
|
|
134
|
-
lat: event ? event.geolocation_lat
|
|
135
|
-
lng: event ? event.geolocation_lng
|
|
136
|
-
link: event ? event.link
|
|
137
|
-
recurring: event ? event.recurring
|
|
138
|
-
name: event ? event.name
|
|
131
|
+
startDate: event ? startDateTime : getNewDate(),
|
|
132
|
+
startTime: event ? startDateTime : getLaterHoursDate(1),
|
|
133
|
+
endDate: (event === null || event === void 0 ? void 0 : event.end_date) ? endDateTime : getNewDate(),
|
|
134
|
+
endTime: (event === null || event === void 0 ? void 0 : event.end_date) ? endDateTime : getLaterHoursDate(3),
|
|
135
|
+
location: (event === null || event === void 0 ? void 0 : event.location) || SCEventLocationType.PERSON,
|
|
136
|
+
geolocation: (event === null || event === void 0 ? void 0 : event.geolocation) || '',
|
|
137
|
+
lat: (event === null || event === void 0 ? void 0 : event.geolocation_lat) || null,
|
|
138
|
+
lng: (event === null || event === void 0 ? void 0 : event.geolocation_lng) || null,
|
|
139
|
+
link: (event === null || event === void 0 ? void 0 : event.link) || '',
|
|
140
|
+
recurring: (event === null || event === void 0 ? void 0 : event.recurring) || SCEventRecurrenceType.NEVER,
|
|
141
|
+
name: (event === null || event === void 0 ? void 0 : event.name) || '',
|
|
139
142
|
description: event ? event.description : '',
|
|
140
|
-
isPublic: (_a = (event
|
|
141
|
-
isSubmitting: false
|
|
142
|
-
showEndDateTime: (_b = (event && event.end_date)) !== null && _b !== void 0 ? _b : false
|
|
143
|
+
isPublic: (_a = (event === null || event === void 0 ? void 0 : event.privacy) === SCEventPrivacyType.PUBLIC) !== null && _a !== void 0 ? _a : true,
|
|
144
|
+
isSubmitting: false
|
|
143
145
|
};
|
|
144
146
|
// STATE
|
|
145
147
|
const [field, setField] = useState(initialFieldState);
|
|
@@ -148,23 +150,12 @@ export default function EventForm(inProps) {
|
|
|
148
150
|
const scPreferences = useSCPreferences();
|
|
149
151
|
const privateEnabled = useMemo(() => scPreferences.preferences[SCPreferences.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED].value, [scPreferences.preferences]);
|
|
150
152
|
const visibilityEnabled = useMemo(() => scPreferences.preferences[SCPreferences.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED].value, [scPreferences.preferences]);
|
|
151
|
-
const disablePastStartTime = useMemo(() =>
|
|
152
|
-
const disablePastEndTime = useMemo(() =>
|
|
153
|
+
const disablePastStartTime = useMemo(() => field.startDate.getDate() === getNewDate().getDate(), [field]);
|
|
154
|
+
const disablePastEndTime = useMemo(() => field.endDate.getDate() === getNewDate().getDate(), [field]);
|
|
153
155
|
const _backgroundCover = Object.assign({}, (field.imageOriginal
|
|
154
156
|
? { background: `url('${field.imageOriginal}') center / cover` }
|
|
155
157
|
: { background: `url('${scPreferences.preferences[SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
|
|
156
|
-
const
|
|
157
|
-
if (date && time) {
|
|
158
|
-
const combined = new Date(date);
|
|
159
|
-
combined.setHours(time.getHours());
|
|
160
|
-
combined.setMinutes(time.getMinutes());
|
|
161
|
-
combined.setSeconds(time.getSeconds());
|
|
162
|
-
combined.setMilliseconds(time.getMilliseconds());
|
|
163
|
-
return combined.toISOString();
|
|
164
|
-
}
|
|
165
|
-
return null;
|
|
166
|
-
};
|
|
167
|
-
function handleChangeCover(cover) {
|
|
158
|
+
const handleChangeCover = useCallback((cover) => {
|
|
168
159
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['imageOriginalFile']: cover })));
|
|
169
160
|
const reader = new FileReader();
|
|
170
161
|
reader.onloadend = () => {
|
|
@@ -175,27 +166,25 @@ export default function EventForm(inProps) {
|
|
|
175
166
|
delete error.imageOriginalError;
|
|
176
167
|
setError(error);
|
|
177
168
|
}
|
|
178
|
-
}
|
|
169
|
+
}, [error]);
|
|
179
170
|
/**
|
|
180
171
|
* Notify when a group info changed
|
|
181
172
|
* @param data
|
|
182
173
|
*/
|
|
183
|
-
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
PubSub.publish(`${SCTopicType.EVENT}.${SCGroupEventType.EDIT}`, data);
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
// Create group
|
|
191
|
-
PubSub.publish(`${SCTopicType.EVENT}.${SCGroupEventType.CREATE}`, data);
|
|
192
|
-
}
|
|
174
|
+
const notifyChanges = useCallback((data) => {
|
|
175
|
+
if (event) {
|
|
176
|
+
// Edit group
|
|
177
|
+
PubSub.publish(`${SCTopicType.EVENT}.${SCGroupEventType.EDIT}`, data);
|
|
193
178
|
}
|
|
194
|
-
|
|
195
|
-
|
|
179
|
+
else {
|
|
180
|
+
// Create group
|
|
181
|
+
PubSub.publish(`${SCTopicType.EVENT}.${SCGroupEventType.CREATE}`, data);
|
|
182
|
+
}
|
|
183
|
+
}, [event]);
|
|
184
|
+
const handleGeoData = useCallback((data) => {
|
|
196
185
|
setField((prev) => (Object.assign(Object.assign({}, prev), data)));
|
|
197
|
-
};
|
|
198
|
-
const handleSubmit = () => {
|
|
186
|
+
}, []);
|
|
187
|
+
const handleSubmit = useCallback(() => {
|
|
199
188
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: true })));
|
|
200
189
|
const formData = new FormData();
|
|
201
190
|
if (field.imageOriginalFile) {
|
|
@@ -204,23 +193,21 @@ export default function EventForm(inProps) {
|
|
|
204
193
|
formData.append('name', field.name);
|
|
205
194
|
formData.append('start_date', combineDateAndTime(field.startDate, field.startTime));
|
|
206
195
|
formData.append('recurring', field.recurring);
|
|
207
|
-
|
|
208
|
-
formData.append('end_date', combineDateAndTime(field.endDate, field.endTime));
|
|
209
|
-
}
|
|
196
|
+
formData.append('end_date', combineDateAndTime(field.endDate, field.endTime));
|
|
210
197
|
formData.append('location', field.location);
|
|
211
198
|
if (field.location === SCEventLocationType.ONLINE) {
|
|
212
199
|
formData.append('link', field.link);
|
|
213
200
|
}
|
|
214
|
-
if (field.location === SCEventLocationType.PERSON) {
|
|
201
|
+
else if (field.location === SCEventLocationType.PERSON) {
|
|
215
202
|
formData.append('geolocation', field.geolocation);
|
|
216
|
-
formData.append('geolocation_lat', field.lat);
|
|
217
|
-
formData.append('geolocation_lng', field.lng);
|
|
203
|
+
formData.append('geolocation_lat', field.lat.toString());
|
|
204
|
+
formData.append('geolocation_lng', field.lng.toString());
|
|
218
205
|
}
|
|
219
206
|
if (privateEnabled) {
|
|
220
207
|
formData.append('privacy', field.isPublic ? SCEventPrivacyType.PUBLIC : SCEventPrivacyType.PRIVATE);
|
|
221
208
|
}
|
|
222
209
|
if (visibilityEnabled) {
|
|
223
|
-
formData.append('visible', true);
|
|
210
|
+
formData.append('visible', 'true');
|
|
224
211
|
}
|
|
225
212
|
formData.append('description', field.description);
|
|
226
213
|
let eventService;
|
|
@@ -232,9 +219,9 @@ export default function EventForm(inProps) {
|
|
|
232
219
|
}
|
|
233
220
|
eventService
|
|
234
221
|
.then((data) => {
|
|
235
|
-
onSuccess
|
|
222
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data);
|
|
236
223
|
notifyChanges(data);
|
|
237
|
-
onClose
|
|
224
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
238
225
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
|
|
239
226
|
})
|
|
240
227
|
.catch((e) => {
|
|
@@ -250,28 +237,56 @@ export default function EventForm(inProps) {
|
|
|
250
237
|
setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
|
|
251
238
|
Logger.error(SCOPE_SC_UI, e);
|
|
252
239
|
});
|
|
253
|
-
};
|
|
254
|
-
const handleChange = (event) => {
|
|
240
|
+
}, [field, privateEnabled, visibilityEnabled]);
|
|
241
|
+
const handleChange = useCallback((event) => {
|
|
255
242
|
const { name, value } = event.target;
|
|
256
243
|
setField((prev) => (Object.assign(Object.assign({}, prev), { [name]: value })));
|
|
257
244
|
if (error[`${name}Error`]) {
|
|
258
245
|
delete error[`${name}Error`];
|
|
259
246
|
setError(error);
|
|
260
247
|
}
|
|
261
|
-
};
|
|
262
|
-
const handleChangeDateTime = (value, name) => {
|
|
248
|
+
}, [error]);
|
|
249
|
+
const handleChangeDateTime = useCallback((value, name) => {
|
|
263
250
|
setField((prev) => (Object.assign(Object.assign({}, prev), { [name]: value })));
|
|
264
251
|
if (error[`${name}Error`]) {
|
|
265
252
|
delete error[`${name}Error`];
|
|
266
253
|
setError(error);
|
|
267
254
|
}
|
|
268
|
-
|
|
255
|
+
else if (error['endDateError']) {
|
|
256
|
+
delete error['endDateError'];
|
|
257
|
+
setError(error);
|
|
258
|
+
}
|
|
259
|
+
}, [error]);
|
|
260
|
+
const shouldDisabledDate = useCallback((date) => {
|
|
261
|
+
let disabled = false;
|
|
262
|
+
switch (field.recurring) {
|
|
263
|
+
case SCEventRecurrenceType.DAILY:
|
|
264
|
+
disabled = date.getTime() > getLaterDaysDate(DAILY_LATER_DAYS).getTime();
|
|
265
|
+
break;
|
|
266
|
+
case SCEventRecurrenceType.WEEKLY:
|
|
267
|
+
disabled = date.getTime() > getLaterDaysDate(WEEKLY_LATER_DAYS).getTime();
|
|
268
|
+
break;
|
|
269
|
+
case SCEventRecurrenceType.MONTHLY:
|
|
270
|
+
disabled = date.getTime() > getLaterDaysDate(MONTHLY_LATER_DAYS).getTime();
|
|
271
|
+
break;
|
|
272
|
+
case SCEventRecurrenceType.NEVER:
|
|
273
|
+
default:
|
|
274
|
+
disabled = date.getTime() > getLaterDaysDate(NEVER_LATER_DAYS).getTime();
|
|
275
|
+
}
|
|
276
|
+
if (field.startDate.getDate() > date.getDate()) {
|
|
277
|
+
disabled = true;
|
|
278
|
+
}
|
|
279
|
+
return disabled;
|
|
280
|
+
}, [field]);
|
|
281
|
+
const shouldDisabledTime = useCallback((date, _view) => field.startTime.getTime() > date.getTime(), [field]);
|
|
269
282
|
/**
|
|
270
283
|
* Renders root object
|
|
271
284
|
*/
|
|
272
285
|
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, title: event ? (_jsx(FormattedMessage, { id: "ui.eventForm.title.edit", defaultMessage: "ui.eventForm.title.edit" })) : (_jsx(FormattedMessage, { id: "ui.eventForm.title", defaultMessage: "ui.eventForm.title" })), open: open, onClose: onClose, className: classNames(classes.root, className), actions: _jsx(LoadingButton, Object.assign({ loading: field.isSubmitting, disabled: !field.name ||
|
|
273
286
|
!field.startDate ||
|
|
274
287
|
!field.startTime ||
|
|
288
|
+
!field.endDate ||
|
|
289
|
+
!field.endTime ||
|
|
275
290
|
(field.location === SCEventLocationType.ONLINE && !field.link) ||
|
|
276
291
|
(field.location === SCEventLocationType.PERSON && !field.geolocation) ||
|
|
277
292
|
(field.recurring !== SCEventRecurrenceType.NEVER && !field.endDate && !field.endTime) ||
|
|
@@ -279,7 +294,7 @@ export default function EventForm(inProps) {
|
|
|
279
294
|
field.name.length > EVENT_TITLE_MAX_LENGTH ||
|
|
280
295
|
field.description.length > EVENT_DESCRIPTION_MAX_LENGTH, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: event ? (_jsx(FormattedMessage, { id: "ui.eventForm.button.edit", defaultMessage: "ui.eventForm.button.edit" })) : (_jsx(FormattedMessage, { id: "ui.eventForm.button.create", defaultMessage: "ui.eventForm.button.create" })) })) }, rest, { children: _jsxs(_Fragment, { children: [_jsx(Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: _jsx(UploadEventCover, { isCreationMode: true, onChange: handleChangeCover }) })), _jsxs(FormGroup, Object.assign({ className: classes.form }, { children: [_jsx(TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
|
|
281
296
|
endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: EVENT_TITLE_MAX_LENGTH - field.name.length }))
|
|
282
|
-
}, error: Boolean(
|
|
297
|
+
}, error: Boolean(field.name.length > EVENT_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: field.name.length > EVENT_TITLE_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.eventForm.name.error.maxLength", defaultMessage: "ui.eventForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), _jsx(Box, Object.assign({ className: classes.dateTime }, { children: _jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? itLocale : enLocale }, { children: [_jsx(MobileDatePicker, { className: classes.picker, disablePast: true, label: field.startDate && _jsx(FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, slots: {
|
|
283
298
|
textField: (params) => (_jsx(TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.startDate)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "CalendarIcon" }) }) }))) }) })))
|
|
284
299
|
}, slotProps: {
|
|
285
300
|
toolbar: {
|
|
@@ -300,23 +315,22 @@ export default function EventForm(inProps) {
|
|
|
300
315
|
return _jsx("em", { children: `${intl.formatMessage(messages.frequencyPlaceholder)}` });
|
|
301
316
|
}
|
|
302
317
|
return (_jsx(FormattedMessage, { id: `ui.eventForm.frequency.${selected}.placeholder`, defaultMessage: `ui.eventForm.frequency.${selected}.placeholder` }));
|
|
303
|
-
}, startAdornment: _jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "frequency" }) }) })) }, { children: Object.values(SCEventRecurrenceType).map((f) => (_jsx(MenuItem, Object.assign({ value: f }, { children: _jsx(FormattedMessage, { id: `ui.eventForm.frequency.${f}.placeholder`, defaultMessage: `ui.eventForm.frequency.${f}.placeholder` }) }), f))) }))] })),
|
|
318
|
+
}, startAdornment: _jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "frequency" }) }) })) }, { children: Object.values(SCEventRecurrenceType).map((f) => (_jsx(MenuItem, Object.assign({ value: f }, { children: _jsx(FormattedMessage, { id: `ui.eventForm.frequency.${f}.placeholder`, defaultMessage: `ui.eventForm.frequency.${f}.placeholder` }) }), f))) }))] })), _jsx(Box, Object.assign({ className: classes.dateTime }, { children: _jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? itLocale : enLocale }, { children: [_jsx(MobileDatePicker, { className: classes.picker, disablePast: true, minDate: field.startDate, label: _jsx(FormattedMessage, { id: "ui.eventForm.date.end.placeholder", defaultMessage: "ui.eventForm.date.end.placeholder" }), value: field.endDate, slots: {
|
|
304
319
|
textField: (params) => (_jsx(TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.endDate)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "calendar_off" }) }) }))) }) })))
|
|
305
|
-
}, onChange: (value) => handleChangeDateTime(value, 'endDate') }), _jsx(MobileTimePicker, { className: classes.picker, disablePast: disablePastEndTime, label: field.endTime && _jsx(FormattedMessage, { id: "ui.eventForm.time.end.placeholder", defaultMessage: "ui.eventForm.time.end.placeholder" }), value: field.endTime, slots: {
|
|
306
|
-
textField: (params) =>
|
|
307
|
-
|
|
320
|
+
}, onChange: (value) => handleChangeDateTime(value, 'endDate'), shouldDisableDate: shouldDisabledDate }), _jsx(MobileTimePicker, { className: classes.picker, disablePast: disablePastEndTime, label: field.endTime && _jsx(FormattedMessage, { id: "ui.eventForm.time.end.placeholder", defaultMessage: "ui.eventForm.time.end.placeholder" }), value: field.endTime, slots: {
|
|
321
|
+
textField: (params) => {
|
|
322
|
+
var _a;
|
|
323
|
+
return (_jsx(TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.endTime)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "access_time" }) }) }))) }), error: Boolean(error['endDateError']), helperText: ((_a = error['endDateError']) === null || _a === void 0 ? void 0 : _a.error) ? (_jsx(FormattedMessage, { id: "ui.eventForm.time.end.error.invalid", defaultMessage: "ui.eventForm.time.end.error.invalid" })) : null })));
|
|
324
|
+
}
|
|
325
|
+
}, onChange: (value) => handleChangeDateTime(value, 'endTime'), shouldDisableTime: shouldDisabledTime })] })) })), _jsx(EventAddress, { forwardGeolocationData: handleGeoData, event: event !== null && event !== void 0 ? event : null }), privateEnabled && (_jsxs(Box, Object.assign({ className: classes.privacySection }, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", justifyContent: "center" }, { children: [_jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.private", defaultMessage: "ui.eventForm.privacy.private" })] })), _jsx(Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: event && !field.isPublic }), _jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.eventForm.privacy.public", defaultMessage: "ui.eventForm.privacy.public" })] }))] })), _jsx(Typography, Object.assign({ variant: "body2", textAlign: "center", className: classes.privacySectionInfo }, { children: field.isPublic ? (_jsx(FormattedMessage, { id: "ui.eventForm.privacy.public.info", defaultMessage: "ui.eventForm.privacy.public.info", values: {
|
|
308
326
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
309
327
|
// @ts-ignore
|
|
310
328
|
b: (chunks) => _jsx("strong", { children: chunks })
|
|
311
|
-
} })) : (_jsx(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
b: (chunks) => _jsx("strong", { children: chunks })
|
|
319
|
-
} })) })) }))] }))), _jsx(TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
320
|
-
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) ? EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : EVENT_DESCRIPTION_MAX_LENGTH })))
|
|
321
|
-
}, error: Boolean(((_f = field.description) === null || _f === void 0 ? void 0 : _f.length) > EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_g = field.description) === null || _g === void 0 ? void 0 : _g.length) > EVENT_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null })] }))] }) })));
|
|
329
|
+
} })) : (_jsx(FormattedMessage, { id: "ui.eventForm.privacy.private.info", defaultMessage: "ui.eventForm.private.public.info", values: {
|
|
330
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
331
|
+
// @ts-ignore
|
|
332
|
+
b: (chunks) => _jsx("strong", { children: chunks })
|
|
333
|
+
} })) }))] }))), _jsx(TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
|
|
334
|
+
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_b = field.description) === null || _b === void 0 ? void 0 : _b.length) ? EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : EVENT_DESCRIPTION_MAX_LENGTH })))
|
|
335
|
+
}, error: Boolean(((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) > EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > EVENT_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null })] }))] }) })));
|
|
322
336
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SCEventLocationType, SCEventRecurrenceType } from '@selfcommunity/types';
|
|
2
|
+
export declare type Place = {
|
|
3
|
+
description: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type Geolocation = {
|
|
7
|
+
location: SCEventLocationType;
|
|
8
|
+
geolocation?: string;
|
|
9
|
+
lat?: number;
|
|
10
|
+
lng?: number;
|
|
11
|
+
link?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare type InitialFieldState = Geolocation & {
|
|
14
|
+
imageOriginal: string | ArrayBuffer;
|
|
15
|
+
imageOriginalFile: string | Blob;
|
|
16
|
+
startDate: Date | null;
|
|
17
|
+
startTime: Date | null;
|
|
18
|
+
endDate: Date | null;
|
|
19
|
+
endTime: Date | null;
|
|
20
|
+
recurring: SCEventRecurrenceType;
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
isPublic: boolean;
|
|
24
|
+
isSubmitting: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare type FieldStateKeys = keyof InitialFieldState;
|
|
27
|
+
export declare type FieldStateValues = InitialFieldState[FieldStateKeys];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|