@selfcommunity/react-ui 0.11.0-mui7.23 → 0.11.0-mui7.26
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/Composer/Layer/ScheduledLayer/ScheduledLayer.js +1 -1
- package/lib/cjs/components/EventForm/EventAddress.js +3 -3
- package/lib/cjs/components/EventForm/EventForm.js +75 -56
- package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +2 -2
- package/lib/cjs/components/GroupForm/GroupForm.js +3 -3
- package/lib/cjs/components/LessonReleaseMenu/LessonReleaseMenu.js +13 -14
- package/lib/cjs/components/PaymentOrders/PaymentOrders.js +27 -25
- package/lib/cjs/components/UserCounters/UserCounters.js +4 -4
- package/lib/cjs/components/UserProfileEdit/Section/PublicInfo.js +11 -9
- package/lib/cjs/shared/Media/File/DocComponent.d.ts +2 -0
- package/lib/cjs/shared/Media/File/DocComponent.js +3 -2
- package/lib/cjs/shared/Media/File/PreviewComponent.js +4 -3
- package/lib/esm/components/Composer/Layer/ScheduledLayer/ScheduledLayer.js +1 -1
- package/lib/esm/components/EventForm/EventAddress.js +3 -3
- package/lib/esm/components/EventForm/EventForm.js +76 -57
- package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +2 -2
- package/lib/esm/components/GroupForm/GroupForm.js +3 -3
- package/lib/esm/components/LessonReleaseMenu/LessonReleaseMenu.js +13 -14
- package/lib/esm/components/PaymentOrders/PaymentOrders.js +27 -25
- package/lib/esm/components/UserCounters/UserCounters.js +4 -4
- package/lib/esm/components/UserProfileEdit/Section/PublicInfo.js +11 -9
- package/lib/esm/shared/Media/File/DocComponent.d.ts +2 -0
- package/lib/esm/shared/Media/File/DocComponent.js +3 -2
- package/lib/esm/shared/Media/File/PreviewComponent.js +4 -3
- package/lib/umd/484.js +1 -1
- package/lib/umd/484.js.LICENSE.txt +1 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +8 -8
- package/lib/cjs/shared/UpScalingTierBadge/UpScalingTierBadge.d.ts +0 -5
- package/lib/cjs/shared/UpScalingTierBadge/UpScalingTierBadge.js +0 -14
- package/lib/esm/shared/UpScalingTierBadge/UpScalingTierBadge.d.ts +0 -5
- package/lib/esm/shared/UpScalingTierBadge/UpScalingTierBadge.js +0 -10
|
@@ -46,7 +46,7 @@ const ScheduledLayer = React.forwardRef((props, ref) => {
|
|
|
46
46
|
const restOfDate = format(value, 'd MMMM yyyy • HH:mm', { locale });
|
|
47
47
|
return _jsx(Typography, Object.assign({ variant: "h4" }, { children: `${dayName} ${restOfDate}` }));
|
|
48
48
|
};
|
|
49
|
-
return (_jsxs(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest, { children: [_jsxs(DialogTitle, Object.assign({ className: classes.title }, { children: [_jsx(IconButton, Object.assign({ onClick: onClose }, { children: _jsx(Icon, { children: "arrow_back" }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.title", defaultMessage: "Programma la Pubblicazione" }) }), _jsx(Button, Object.assign({ size: "small", color: "secondary", variant: "contained", onClick: () => onSave(scheduledAt), disabled: !scheduledAt }, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.submit", defaultMessage: "Attiva Programmazione" }) }))] })), _jsxs(DialogContent, Object.assign({ className: classes.content }, { children: [_jsx(Typography, Object.assign({ className: classes.message }, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.message", defaultMessage: "ui.composer.audience.scheduled.message" }) })), _jsx(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: locale }, { children: _jsx(StaticDateTimePicker, { className: classes.picker, disablePast: true, value: scheduledAt, onChange:
|
|
49
|
+
return (_jsxs(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest, { children: [_jsxs(DialogTitle, Object.assign({ className: classes.title }, { children: [_jsx(IconButton, Object.assign({ onClick: onClose }, { children: _jsx(Icon, { children: "arrow_back" }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.title", defaultMessage: "Programma la Pubblicazione" }) }), _jsx(Button, Object.assign({ size: "small", color: "secondary", variant: "contained", onClick: () => onSave(scheduledAt), disabled: !scheduledAt }, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.submit", defaultMessage: "Attiva Programmazione" }) }))] })), _jsxs(DialogContent, Object.assign({ className: classes.content }, { children: [_jsx(Typography, Object.assign({ className: classes.message }, { children: _jsx(FormattedMessage, { id: "ui.composer.layer.scheduled.message", defaultMessage: "ui.composer.audience.scheduled.message" }) })), _jsx(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: locale }, { children: _jsx(StaticDateTimePicker, { className: classes.picker, disablePast: true, value: scheduledAt, onChange: setScheduledAt, onAccept: handleUpdate, slots: {
|
|
50
50
|
toolbar: CustomToolbar,
|
|
51
51
|
tabs: (props) => _jsx(DateTimePickerTabs, Object.assign({}, props)),
|
|
52
52
|
actionBar: () => null
|
|
@@ -84,7 +84,7 @@ export default function EventAddress(inProps) {
|
|
|
84
84
|
(event.live_stream && event.live_stream.created_at);
|
|
85
85
|
}, [liveStreamEnabled, (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission, event]);
|
|
86
86
|
// HOOKS
|
|
87
|
-
const { isLoaded, geocodingApiKey } = useSCGoogleApiLoader();
|
|
87
|
+
const { isLoaded, geocodingApiKey, placesLibrary } = useSCGoogleApiLoader();
|
|
88
88
|
// HANDLERS
|
|
89
89
|
const handleChange = (_event, newValue) => {
|
|
90
90
|
setLocation(newValue);
|
|
@@ -132,9 +132,9 @@ export default function EventAddress(inProps) {
|
|
|
132
132
|
}
|
|
133
133
|
if (inputValue.length >= 3) {
|
|
134
134
|
const newTimeoutId = setTimeout(() => {
|
|
135
|
-
const autocompleteService = new
|
|
135
|
+
const autocompleteService = new placesLibrary.AutocompleteService(); // TODO - deprecated, to fix when possibile
|
|
136
136
|
autocompleteService.getPlacePredictions({ input: inputValue }, (predictions, status) => {
|
|
137
|
-
if (status ===
|
|
137
|
+
if (status === placesLibrary.PlacesServiceStatus.OK && predictions) {
|
|
138
138
|
setSuggestions(predictions.map((prediction) => ({
|
|
139
139
|
description: prediction.description,
|
|
140
140
|
id: prediction.place_id
|
|
@@ -5,7 +5,7 @@ import { useThemeProps } from '@mui/system';
|
|
|
5
5
|
import { LocalizationProvider, MobileDatePicker, MobileTimePicker } from '@mui/x-date-pickers';
|
|
6
6
|
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
7
7
|
import { EventService, formatHttpErrorCode } from '@selfcommunity/api-services';
|
|
8
|
-
import { SCPreferences, UserUtils, useSCContext, useSCPaymentsEnabled, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
8
|
+
import { SCPreferences, UserUtils, useSCContext, useSCGoogleApiLoader, useSCPaymentsEnabled, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
9
9
|
import { SCContentType, SCEventLocationType, SCEventPrivacyType, SCEventRecurrenceType, SCFeatureName } from '@selfcommunity/types';
|
|
10
10
|
import { Logger } from '@selfcommunity/utils';
|
|
11
11
|
import classNames from 'classnames';
|
|
@@ -25,7 +25,16 @@ import { LIVESTREAM_DEFAULT_SETTINGS } from '../LiveStreamForm/constants';
|
|
|
25
25
|
import CoverPlaceholder from '../../assets/deafultCover';
|
|
26
26
|
import PaywallsConfigurator from '../PaywallsConfigurator';
|
|
27
27
|
import { ContentAccessType } from '../PaywallsConfigurator/constants';
|
|
28
|
+
import { APIProvider } from '@vis.gl/react-google-maps';
|
|
28
29
|
const messages = defineMessages({
|
|
30
|
+
titleDate: {
|
|
31
|
+
id: 'ui.eventForm.date.title',
|
|
32
|
+
defaultMessage: 'ui.eventForm.date.title'
|
|
33
|
+
},
|
|
34
|
+
titleTime: {
|
|
35
|
+
id: 'ui.eventForm.time.title',
|
|
36
|
+
defaultMessage: 'ui.eventForm.time.title'
|
|
37
|
+
},
|
|
29
38
|
name: {
|
|
30
39
|
id: 'ui.eventForm.name.placeholder',
|
|
31
40
|
defaultMessage: 'ui.eventForm.name.placeholder'
|
|
@@ -170,6 +179,8 @@ export default function EventForm(inProps) {
|
|
|
170
179
|
const [field, setField] = useState(initialFieldState);
|
|
171
180
|
const [error, setError] = useState({});
|
|
172
181
|
const [genericError, setGenericError] = useState(null);
|
|
182
|
+
// HOOKS
|
|
183
|
+
const { geocodingApiKey, libraries } = useSCGoogleApiLoader();
|
|
173
184
|
// PREFERENCES
|
|
174
185
|
const scPreferences = useSCPreferences();
|
|
175
186
|
const liveStreamEnabled = useMemo(() => scPreferences.preferences &&
|
|
@@ -374,89 +385,97 @@ export default function EventForm(inProps) {
|
|
|
374
385
|
endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: EVENT_TITLE_MAX_LENGTH - field.name.length }))
|
|
375
386
|
}
|
|
376
387
|
}, 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' ? it : enUS, localeText: {
|
|
377
|
-
cancelButtonLabel:
|
|
378
|
-
} }, { children: [_jsx(MobileDatePicker, { className: classes.picker, disablePast: !event, minDate: minStartDate, label: field.startDate && _jsx(FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, enableAccessibleFieldDOMStructure: false,
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.startDate)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "CalendarIcon" }) }) }))) })
|
|
383
|
-
} })));
|
|
384
|
-
}
|
|
388
|
+
cancelButtonLabel: intl.formatMessage(messages.pickerCancelAction)
|
|
389
|
+
} }, { children: [_jsx(MobileDatePicker, { className: classes.picker, disablePast: !event, minDate: minStartDate, label: field.startDate && _jsx(FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
390
|
+
toolbarTitle: intl.formatMessage(messages.titleDate)
|
|
391
|
+
}, slots: {
|
|
392
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { sx: { marginLeft: 0 } }, { children: _jsx(Icon, { children: "CalendarIcon" }) })))
|
|
385
393
|
}, slotProps: {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
394
|
+
field: {
|
|
395
|
+
openPickerButtonPosition: 'start'
|
|
396
|
+
},
|
|
397
|
+
textField: {
|
|
398
|
+
slotProps: {
|
|
399
|
+
input: {
|
|
400
|
+
placeholder: intl.formatMessage(messages.startDate)
|
|
401
|
+
}
|
|
402
|
+
}
|
|
390
403
|
}
|
|
391
404
|
}, onChange: (value) => {
|
|
392
405
|
handleChangeDateTime(value, 'startDate');
|
|
393
406
|
handleChangeDateTime(value, 'startTime');
|
|
394
|
-
} }), _jsx(MobileTimePicker, { className: classes.picker, disablePast: disablePastStartTime, minTime: minStartTime, label: field.startTime && _jsx(FormattedMessage, { id: "ui.eventForm.time.placeholder", defaultMessage: "ui.eventForm.time.placeholder" }), value: field.startTime, enableAccessibleFieldDOMStructure: false,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.startTime)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "access_time" }) }) }))) })
|
|
399
|
-
} })));
|
|
400
|
-
}
|
|
407
|
+
} }), _jsx(MobileTimePicker, { className: classes.picker, disablePast: disablePastStartTime, minTime: minStartTime, label: field.startTime && _jsx(FormattedMessage, { id: "ui.eventForm.time.placeholder", defaultMessage: "ui.eventForm.time.placeholder" }), value: field.startTime, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
408
|
+
toolbarTitle: intl.formatMessage(messages.titleTime)
|
|
409
|
+
}, slots: {
|
|
410
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { sx: { marginLeft: 0 } }, { children: _jsx(Icon, { children: "access_time" }) })))
|
|
401
411
|
}, slotProps: {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
412
|
+
field: {
|
|
413
|
+
openPickerButtonPosition: 'start'
|
|
414
|
+
},
|
|
415
|
+
textField: {
|
|
416
|
+
slotProps: {
|
|
417
|
+
input: {
|
|
418
|
+
placeholder: intl.formatMessage(messages.startTime)
|
|
419
|
+
}
|
|
420
|
+
}
|
|
406
421
|
}
|
|
407
422
|
}, onChange: (value) => {
|
|
408
423
|
handleChangeDateTime(value, 'startDate');
|
|
409
424
|
handleChangeDateTime(value, 'startTime');
|
|
410
|
-
} })] })) })), _jsxs(FormControl, Object.assign({ className: classes.frequency }, { children: [field.recurring !== SCEventRecurrenceType.NEVER && _jsx(InputLabel, Object.assign({ id: "recurring" }, { children:
|
|
425
|
+
} })] })) })), _jsxs(FormControl, Object.assign({ className: classes.frequency }, { children: [field.recurring !== SCEventRecurrenceType.NEVER && _jsx(InputLabel, Object.assign({ id: "recurring" }, { children: intl.formatMessage(messages.frequency) })), _jsx(Select, Object.assign({ name: "recurring", label: field.recurring !== SCEventRecurrenceType.NEVER && intl.formatMessage(messages.frequency), labelId: "recurring", value: field.recurring, onChange: handleChange, displayEmpty: true, renderValue: (selected) => {
|
|
411
426
|
if (!selected) {
|
|
412
|
-
return _jsx("em", { children:
|
|
427
|
+
return _jsx("em", { children: intl.formatMessage(messages.frequencyPlaceholder) });
|
|
413
428
|
}
|
|
414
429
|
return (_jsx(FormattedMessage, { id: `ui.eventForm.frequency.${selected}.placeholder`, defaultMessage: `ui.eventForm.frequency.${selected}.placeholder` }));
|
|
415
430
|
}, 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' ? it : enUS, localeText: {
|
|
416
|
-
cancelButtonLabel:
|
|
417
|
-
} }, { children: [_jsx(MobileDatePicker, { className: classes.picker, minDate: field.startDate, label: _jsx(FormattedMessage, { id: "ui.eventForm.date.end.placeholder", defaultMessage: "ui.eventForm.date.end.placeholder" }), value: field.endDate, enableAccessibleFieldDOMStructure: false,
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.endDate)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "calendar_off" }) }) }))) })
|
|
422
|
-
} })));
|
|
423
|
-
}
|
|
431
|
+
cancelButtonLabel: intl.formatMessage(messages.pickerCancelAction)
|
|
432
|
+
} }, { children: [_jsx(MobileDatePicker, { className: classes.picker, minDate: field.startDate, label: _jsx(FormattedMessage, { id: "ui.eventForm.date.end.placeholder", defaultMessage: "ui.eventForm.date.end.placeholder" }), value: field.endDate, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
433
|
+
toolbarTitle: intl.formatMessage(messages.titleDate)
|
|
434
|
+
}, slots: {
|
|
435
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { sx: { marginLeft: 0 } }, { children: _jsx(Icon, { children: "calendar_off" }) })))
|
|
424
436
|
}, slotProps: {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
437
|
+
field: {
|
|
438
|
+
openPickerButtonPosition: 'start'
|
|
439
|
+
},
|
|
440
|
+
textField: {
|
|
441
|
+
slotProps: {
|
|
442
|
+
input: {
|
|
443
|
+
placeholder: intl.formatMessage(messages.endDate)
|
|
444
|
+
}
|
|
445
|
+
}
|
|
429
446
|
}
|
|
430
447
|
}, onChange: (value) => {
|
|
431
448
|
handleChangeDateTime(value, 'endDate');
|
|
432
449
|
handleChangeDateTime(value, 'endTime');
|
|
433
|
-
}, shouldDisableDate: shouldDisableDate }), _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, enableAccessibleFieldDOMStructure: false,
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.endTime)}`, startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "access_time" }) }) }))) })
|
|
438
|
-
} })));
|
|
439
|
-
}
|
|
450
|
+
}, shouldDisableDate: shouldDisableDate }), _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, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
451
|
+
toolbarTitle: intl.formatMessage(messages.titleTime)
|
|
452
|
+
}, slots: {
|
|
453
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { sx: { marginLeft: 0 } }, { children: _jsx(Icon, { children: "access_time" }) })))
|
|
440
454
|
}, slotProps: {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
455
|
+
field: {
|
|
456
|
+
openPickerButtonPosition: 'start'
|
|
457
|
+
},
|
|
458
|
+
textField: {
|
|
459
|
+
slotProps: {
|
|
460
|
+
input: {
|
|
461
|
+
placeholder: intl.formatMessage(messages.endTime)
|
|
462
|
+
}
|
|
463
|
+
}
|
|
445
464
|
}
|
|
446
465
|
}, onChange: (value) => {
|
|
447
466
|
handleChangeDateTime(value, 'endDate');
|
|
448
467
|
handleChangeDateTime(value, 'endTime');
|
|
449
|
-
}, shouldDisableTime: shouldDisableTime })] })) })), _jsx(EventAddress, Object.assign({ forwardGeolocationData: handleGeoData, forwardLivestreamSettingsData: handleLiveStreamSettingsData, event: Object.assign(Object.assign({}, event), {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
468
|
+
}, shouldDisableTime: shouldDisableTime })] })) })), _jsx(APIProvider, Object.assign({ apiKey: geocodingApiKey, libraries: libraries }, { children: _jsx(EventAddress, Object.assign({ forwardGeolocationData: handleGeoData, forwardLivestreamSettingsData: handleLiveStreamSettingsData, event: Object.assign(Object.assign({}, event), {
|
|
469
|
+
name: field.name,
|
|
470
|
+
start_date: field.startDate,
|
|
471
|
+
location: field.location,
|
|
472
|
+
geolocation: field.geolocation,
|
|
473
|
+
live_stream: Object.assign(Object.assign({ title: field.name || intl.formatMessage(messages.name) }, (event && ((_e = event.live_stream) === null || _e === void 0 ? void 0 : _e.created_at) && { created_at: field.startDate })), { settings: field.liveStreamSettings })
|
|
474
|
+
}) }, EventAddressComponentProps)) })), 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 === null || event === void 0 ? void 0 : event.privacy) === SCEventPrivacyType.PRIVATE }), _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: {
|
|
456
475
|
b: (chunks) => _jsx("strong", { children: chunks }, "ui.eventForm.privacy.public.info.b")
|
|
457
476
|
} })) : (_jsx(FormattedMessage, { id: "ui.eventForm.privacy.private.info", defaultMessage: "ui.eventForm.private.public.info", values: {
|
|
458
477
|
b: (chunks) => _jsx("strong", { children: chunks }, "ui.eventForm.privacy.private.info.b")
|
|
459
|
-
} })) }))] }))), _jsx(TextField, { multiline: true, className: classes.description, placeholder:
|
|
478
|
+
} })) }))] }))), _jsx(TextField, { multiline: true, className: classes.description, placeholder: intl.formatMessage(messages.description), margin: "normal", value: field.description, name: "description", onChange: handleChange, slotProps: {
|
|
460
479
|
input: {
|
|
461
480
|
endAdornment: (_jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_f = field.description) === null || _f === void 0 ? void 0 : _f.length) ? EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : EVENT_DESCRIPTION_MAX_LENGTH })))
|
|
462
481
|
}
|
|
@@ -64,7 +64,7 @@ export default function EventLocationWidget(inProps) {
|
|
|
64
64
|
// STATE
|
|
65
65
|
const { scEvent } = useSCFetchEvent({ id: eventId, event });
|
|
66
66
|
// HOOKS
|
|
67
|
-
const { isLoaded, geocodingApiKey } = useSCGoogleApiLoader();
|
|
67
|
+
const { isLoaded, geocodingApiKey, libraries } = useSCGoogleApiLoader();
|
|
68
68
|
if (!geocodingApiKey || (scEvent === null || scEvent === void 0 ? void 0 : scEvent.location) === SCEventLocationType.ONLINE) {
|
|
69
69
|
return _jsx(HiddenPlaceholder, {});
|
|
70
70
|
}
|
|
@@ -77,7 +77,7 @@ export default function EventLocationWidget(inProps) {
|
|
|
77
77
|
/**
|
|
78
78
|
* Renders root object
|
|
79
79
|
*/
|
|
80
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(CardContent, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, gutterBottom: true }, { children: _jsx(FormattedMessage, { id: "ui.eventLocationWidget.title", defaultMessage: "ui.eventLocationWidget.title" }) })), _jsx(Box, Object.assign({ className: classes.map }, { children: _jsx(APIProvider, Object.assign({ apiKey: geocodingApiKey }, { children: _jsx(Map, Object.assign({ className: classes.map, center: {
|
|
80
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: _jsxs(CardContent, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, gutterBottom: true }, { children: _jsx(FormattedMessage, { id: "ui.eventLocationWidget.title", defaultMessage: "ui.eventLocationWidget.title" }) })), _jsx(Box, Object.assign({ className: classes.map }, { children: _jsx(APIProvider, Object.assign({ apiKey: geocodingApiKey, libraries: libraries }, { children: _jsx(Map, Object.assign({ className: classes.map, center: {
|
|
81
81
|
lat: scEvent.geolocation_lat,
|
|
82
82
|
lng: scEvent.geolocation_lng
|
|
83
83
|
}, zoom: 15, fullscreenControl: false, mapTypeControl: false, streetViewControl: false, zoomControl: false }, { children: _jsx(Marker, { position: {
|
|
@@ -260,11 +260,11 @@ export default function GroupForm(inProps) {
|
|
|
260
260
|
}, error: Boolean(((_f = field.description) === null || _f === void 0 ? void 0 : _f.length) > GROUP_DESCRIPTION_MAX_LENGTH), helperText: ((_g = field.description) === null || _g === void 0 ? void 0 : _g.length) > GROUP_DESCRIPTION_MAX_LENGTH ? (_jsx(FormattedMessage, { id: "ui.groupForm.description.error.maxLength", defaultMessage: "ui.groupForm.description.error.maxLength" })) : null }), privateEnabled && (_jsxs(Box, Object.assign({ className: classes.privacySection }, { children: [_jsx(Typography, Object.assign({ variant: "h4" }, { children: _jsx(FormattedMessage, { id: "ui.groupForm.privacy.title", defaultMessage: "ui.groupForm.privacy.title", values: {
|
|
261
261
|
b: (chunks) => _jsx("strong", { children: chunks }, "ui.groupForm.privacy.title.b")
|
|
262
262
|
} }) })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: !field.isPublic }) }, { children: [_jsx(Icon, { children: "private" }), _jsx(FormattedMessage, { id: "ui.groupForm.privacy.private", defaultMessage: "ui.groupForm.privacy.private" })] })), _jsx(Switch, { className: classes.switch, checked: field.isPublic, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isPublic']: !field.isPublic }))), disabled: group && group.privacy === SCGroupPrivacyType.PRIVATE }), _jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: field.isPublic }) }, { children: [_jsx(Icon, { children: "public" }), _jsx(FormattedMessage, { id: "ui.groupForm.privacy.public", defaultMessage: "ui.groupForm.privacy.public" })] }))] })), _jsx(Typography, Object.assign({ variant: "body2", className: classes.privacySectionInfo }, { children: field.isPublic ? (_jsx(FormattedMessage, { id: "ui.groupForm.privacy.public.info", defaultMessage: "ui.groupForm.privacy.public.info", values: {
|
|
263
|
-
b: (chunks) => _jsx("strong", { children: chunks },
|
|
263
|
+
b: (chunks) => _jsx("strong", { children: chunks }, Math.random())
|
|
264
264
|
} })) : (_jsx(_Fragment, { children: group && group.privacy === SCGroupPrivacyType.PRIVATE ? (_jsx(FormattedMessage, { id: "ui.groupForm.privacy.private.info.edit", defaultMessage: "ui.groupForm.private.public.info.edit", values: {
|
|
265
|
-
b: (chunks) => _jsx("strong", { children: chunks },
|
|
265
|
+
b: (chunks) => _jsx("strong", { children: chunks }, Math.random())
|
|
266
266
|
} })) : (_jsx(FormattedMessage, { id: "ui.groupForm.privacy.private.info", defaultMessage: "ui.groupForm.private.public.info", values: {
|
|
267
|
-
b: (chunks) => _jsx("strong", { children: chunks },
|
|
267
|
+
b: (chunks) => _jsx("strong", { children: chunks }, Math.random())
|
|
268
268
|
} })) })) }))] }))), privateEnabled && visibilityEnabled && (_jsx(Box, Object.assign({ className: classes.visibilitySection }, { children: ((!field.isPublic && !group) || (group && !field.isPublic)) && (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h4" }, { children: _jsx(FormattedMessage, { id: "ui.groupForm.visibility.title", defaultMessage: "ui.groupForm.visibility.title", values: {
|
|
269
269
|
b: (chunks) => _jsx("strong", { children: chunks }, "ui.groupForm.visibility.title.b")
|
|
270
270
|
} }) })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: !field.isVisible }) }, { children: [_jsx(Icon, { children: "visibility_off" }), _jsx(FormattedMessage, { id: "ui.groupForm.visibility.hidden", defaultMessage: "ui.groupForm.visibility.hidden" })] })), _jsx(Switch, { className: classes.switch, checked: field.isVisible, onChange: () => setField((prev) => (Object.assign(Object.assign({}, prev), { ['isVisible']: !field.isVisible }))) }), _jsxs(Typography, Object.assign({ className: classNames(classes.switchLabel, { [classes.active]: field.isVisible }) }, { children: [_jsx(Icon, { children: "visibility" }), _jsx(FormattedMessage, { id: "ui.groupForm.visibility.visible", defaultMessage: "ui.groupForm.visibility.visible" })] }))] })), _jsx(Typography, Object.assign({ variant: "body2", className: classes.visibilitySectionInfo }, { children: !field.isVisible ? (_jsx(FormattedMessage, { id: "ui.groupForm.visibility.hidden.info", defaultMessage: "ui.groupForm.visibility.hidden.info", values: {
|
|
@@ -137,28 +137,27 @@ export default function LessonReleaseMenu(inProps) {
|
|
|
137
137
|
okButtonLabel: `${intl.formatMessage(messages.pickerOkMessage)}`,
|
|
138
138
|
cancelButtonLabel: `${intl.formatMessage(messages.pickerCancelMessage)}`,
|
|
139
139
|
clearButtonLabel: `${intl.formatMessage(messages.pickerClearMessage)}`
|
|
140
|
-
} }, { children: _jsx(MobileDateTimePicker, { className: classes.picker, disablePast: true, label: drippedAt && (_jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.scheduled.picker.placeholder", defaultMessage: "ui.lessonReleaseMenu.scheduled.picker.placeholder" })), value: drippedAt, enableAccessibleFieldDOMStructure: false,
|
|
141
|
-
|
|
140
|
+
} }, { children: _jsx(MobileDateTimePicker, { className: classes.picker, disablePast: true, label: drippedAt && (_jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.scheduled.picker.placeholder", defaultMessage: "ui.lessonReleaseMenu.scheduled.picker.placeholder" })), value: drippedAt, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
141
|
+
toolbarTitle: intl.formatMessage(messages.pickerPlaceholder)
|
|
142
|
+
}, slots: {
|
|
142
143
|
tabs: (props) => _jsx(DateTimePickerTabs, Object.assign({}, props)),
|
|
143
|
-
|
|
144
|
-
var _a;
|
|
145
|
-
return (_jsx(TextField, Object.assign({}, params, { error: false, slotProps: {
|
|
146
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.pickerPlaceholder)}`, endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(IconButton, Object.assign({ disabled: isDisabled }, { children: _jsx(Icon, { children: "expand_more" }) })) }))) })
|
|
147
|
-
} })));
|
|
148
|
-
}
|
|
144
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { children: _jsx(Icon, { children: "expand_more" }) })))
|
|
149
145
|
}, slotProps: {
|
|
150
146
|
tabs: {
|
|
151
147
|
hidden: false
|
|
152
148
|
},
|
|
153
|
-
toolbar: {
|
|
154
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore,@typescript-eslint/ban-ts-comment
|
|
155
|
-
// @ts-ignore
|
|
156
|
-
toolbarTitle: (_jsx(FormattedMessage, { id: "ui.lessonReleaseMenu.scheduled.picker.placeholder", defaultMessage: "ui.lessonReleaseMenu.scheduled.picker.placeholder" }))
|
|
157
|
-
},
|
|
158
149
|
actionBar: {
|
|
159
150
|
actions: ['cancel', 'clear', 'accept']
|
|
151
|
+
},
|
|
152
|
+
textField: {
|
|
153
|
+
error: false,
|
|
154
|
+
slotProps: {
|
|
155
|
+
input: {
|
|
156
|
+
placeholder: intl.formatMessage(messages.pickerPlaceholder)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
160
159
|
}
|
|
161
|
-
}, onChange:
|
|
160
|
+
}, onChange: setDrippedAt, onAccept: handleUpdate, disabled: isDisabled }) }))) : (_jsxs(_Fragment, { children: [_jsx(TextField, { size: "small", value: placeholderStructured, onClick: isDisabled ? undefined : handleClick, slotProps: {
|
|
162
161
|
input: {
|
|
163
162
|
endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(IconButton, Object.assign({ onClick: handleClick, disabled: isDisabled }, { children: _jsx(Icon, { children: "expand_more" }) })) })))
|
|
164
163
|
}
|
|
@@ -26,6 +26,10 @@ import { enUS } from 'date-fns/locale/en-US';
|
|
|
26
26
|
import Category from '../Category';
|
|
27
27
|
const PREFIX = 'SCPaymentOrders';
|
|
28
28
|
const messages = defineMessages({
|
|
29
|
+
datePicker: {
|
|
30
|
+
id: 'ui.paymentOrders.picker.date',
|
|
31
|
+
defaultMessage: 'ui.paymentOrders.picker.date'
|
|
32
|
+
},
|
|
29
33
|
dateFrom: {
|
|
30
34
|
id: 'ui.paymentOrders.dateFrom',
|
|
31
35
|
defaultMessage: 'ui.paymentOrders.dateFrom'
|
|
@@ -219,41 +223,39 @@ export default function PaymentOrders(inProps) {
|
|
|
219
223
|
}, disabled: isLoading }, { children: _jsx(Icon, { children: "close" }) }))), isMobile ? (_jsx(IconButton, { onClick: () => fetchInvoices(), disabled: isLoading })) : (_jsx(Button, { size: "small", variant: "contained", color: "secondary", onClick: () => fetchInvoices(), endIcon: _jsx(Icon, { children: "search" }), disabled: isLoading }))] })))
|
|
220
224
|
}
|
|
221
225
|
} }) })), _jsx(Grid, Object.assign({ size: { xs: 12, md: 3 } }, { children: _jsx(TextField, Object.assign({ select: true, fullWidth: true, disabled: isLoading, size: "small", label: _jsx(FormattedMessage, { id: "ui.paymentOrders.contentTypeFilter", defaultMessage: "ui.paymentOrders.contentTypeFilter" }), value: contentTypeFilter, onChange: handleContentTypeChange }, { children: options.map((option) => (_jsx(MenuItem, Object.assign({ value: option.value }, { children: option.label }), option.value))) })) })), _jsx(Grid, Object.assign({ size: { xs: 12, sm: 8, md: 4 } }, { children: _jsx(LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it : enUS, localeText: {
|
|
222
|
-
cancelButtonLabel:
|
|
223
|
-
clearButtonLabel:
|
|
224
|
-
} }, { children: _jsxs(Grid, Object.assign({ container: true, width: "100%", spacing: 2 }, { children: [_jsx(Grid, Object.assign({ size: 6 }, { children: _jsx(MobileDatePicker, { className: classes.picker, label: _jsx(FormattedMessage, { id: "ui.paymentOrders.dateFrom", defaultMessage: "ui.paymentOrders.dateFrom" }), value: startDate, enableAccessibleFieldDOMStructure: false,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.dateFrom)}`, endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "CalendarIcon" }) }) }))) })
|
|
229
|
-
} })));
|
|
230
|
-
}
|
|
226
|
+
cancelButtonLabel: intl.formatMessage(messages.pickerCancelAction),
|
|
227
|
+
clearButtonLabel: intl.formatMessage(messages.pickerClearAction)
|
|
228
|
+
} }, { children: _jsxs(Grid, Object.assign({ container: true, width: "100%", spacing: 2 }, { children: [_jsx(Grid, Object.assign({ size: 6 }, { children: _jsx(MobileDatePicker, { className: classes.picker, label: _jsx(FormattedMessage, { id: "ui.paymentOrders.dateFrom", defaultMessage: "ui.paymentOrders.dateFrom" }), value: startDate, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
229
|
+
toolbarTitle: intl.formatMessage(messages.datePicker)
|
|
230
|
+
}, slots: {
|
|
231
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { children: _jsx(Icon, { children: "CalendarIcon" }) })))
|
|
231
232
|
}, slotProps: {
|
|
232
233
|
actionBar: {
|
|
233
234
|
actions: ['cancel', 'clear', 'accept']
|
|
234
235
|
},
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
textField: (params) => {
|
|
242
|
-
var _a;
|
|
243
|
-
return (_jsx(TextField, Object.assign({}, params, { size: "small", slotProps: {
|
|
244
|
-
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { placeholder: `${intl.formatMessage(messages.dateTo)}`, endAdornment: (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: _jsx(IconButton, { children: _jsx(Icon, { children: "CalendarIcon" }) }) }))) })
|
|
245
|
-
} })));
|
|
236
|
+
textField: {
|
|
237
|
+
slotProps: {
|
|
238
|
+
input: {
|
|
239
|
+
placeholder: intl.formatMessage(messages.dateFrom)
|
|
240
|
+
}
|
|
241
|
+
}
|
|
246
242
|
}
|
|
243
|
+
}, onChange: setStartDate }) })), _jsx(Grid, Object.assign({ size: 6 }, { children: _jsx(MobileDatePicker, { className: classes.picker, label: _jsx(FormattedMessage, { id: "ui.paymentOrders.dateTo", defaultMessage: "ui.paymentOrders.dateTo" }), value: endDate, enableAccessibleFieldDOMStructure: false, localeText: {
|
|
244
|
+
toolbarTitle: intl.formatMessage(messages.datePicker)
|
|
245
|
+
}, slots: {
|
|
246
|
+
openPickerButton: (params) => (_jsx(IconButton, Object.assign({}, params, { children: _jsx(Icon, { children: "CalendarIcon" }) })))
|
|
247
247
|
}, slotProps: {
|
|
248
248
|
actionBar: {
|
|
249
249
|
actions: ['cancel', 'clear', 'accept']
|
|
250
250
|
},
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
251
|
+
textField: {
|
|
252
|
+
slotProps: {
|
|
253
|
+
input: {
|
|
254
|
+
placeholder: intl.formatMessage(messages.dateTo)
|
|
255
|
+
}
|
|
256
|
+
}
|
|
255
257
|
}
|
|
256
|
-
}, onChange:
|
|
258
|
+
}, onChange: setEndDate }) }))] })) })) }))] })), _jsx(Box, Object.assign({ className: classes.content }, { children: !isLoading ? (_jsx(TableContainer, Object.assign({ style: { margin: 'auto', borderRadius: 0 } }, { children: _jsxs(Table, Object.assign({ sx: { minWidth: 650 }, "aria-label": "simple table", stickyHeader: true }, { children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, Object.assign({ width: "5%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.number", defaultMessage: "ui.paymentOrders.number" }) })), _jsx(TableCell, Object.assign({ width: "7%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.contentType", defaultMessage: "ui.paymentOrders.contentType" }) })), _jsx(TableCell, Object.assign({ width: "38%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.content", defaultMessage: "ui.paymentOrders.content" }) })), _jsx(TableCell, Object.assign({ width: "10%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.price", defaultMessage: "ui.paymentOrders.price" }) })), _jsx(TableCell, Object.assign({ width: "12%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.createdAt", defaultMessage: "ui.paymentOrders.createdAt" }) })), _jsx(TableCell, Object.assign({ width: "13%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.expired_at", defaultMessage: "ui.paymentOrders.expired_at" }) })), _jsx(TableCell, Object.assign({ width: "10%" }, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.status", defaultMessage: "ui.paymentOrders.status" }) })), _jsx(TableCell, { children: _jsx(FormattedMessage, { id: "ui.paymentOrders.actions", defaultMessage: "ui.paymentOrders.actions" }) })] }) }), _jsxs(TableBody, { children: [orders.map((order, index) => (_jsxs(TableRow, { children: [_jsx(TableCell, Object.assign({ scope: "row" }, { children: _jsx("b", { children: order.id }) })), _jsx(TableCell, Object.assign({ scope: "row" }, { children: _jsx(FormattedMessage, { id: `ui.paymentOrders.contentType.${order.content_type}`, defaultMessage: `ui.paymentOrders.contentType.${order.content_type}` }) })), _jsx(TableCell, Object.assign({ scope: "row" }, { children: renderContent(order) })), _jsx(TableCell, Object.assign({ scope: "row" }, { children: getConvertedAmount(order.payment_price) })), _jsx(TableCell, Object.assign({ scope: "row" }, { children: order.created_at &&
|
|
257
259
|
intl.formatDate(new Date(order.created_at), {
|
|
258
260
|
year: 'numeric',
|
|
259
261
|
month: 'numeric',
|
|
@@ -91,15 +91,15 @@ export default function UserCounters(inProps) {
|
|
|
91
91
|
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsx(_Fragment, { children: (followEnabled || connectionEnabled) &&
|
|
92
92
|
(followEnabled ? (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ className: classes.button, variant: "text", component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_FOLLOWINGS_ROUTE_NAME, scUser) }, { children: _jsx(FormattedMessage, { id: "ui.userCounters.followings", defaultMessage: "ui.userCounters.followings", values: {
|
|
93
93
|
count: scUser === null || scUser === void 0 ? void 0 : scUser.followings_counter,
|
|
94
|
-
b: (chunks) => _jsx("strong", { children: chunks },
|
|
94
|
+
b: (chunks) => _jsx("strong", { children: chunks }, Math.random())
|
|
95
95
|
} }) })), _jsx(Bullet, {}), _jsx(Button, Object.assign({ className: classes.button, variant: "text", component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_FOLLOWERS_ROUTE_NAME, scUser) }, { children: _jsx(FormattedMessage, { id: "ui.userCounters.followers", defaultMessage: "ui.userCounters.followers", values: {
|
|
96
96
|
count: scUser === null || scUser === void 0 ? void 0 : scUser.followers_counter,
|
|
97
|
-
b: (chunks) => _jsx("strong", { children: chunks },
|
|
97
|
+
b: (chunks) => _jsx("strong", { children: chunks }, Math.random())
|
|
98
98
|
} }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ className: classes.button, variant: "text", component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_CONNECTIONS_ROUTE_NAME, scUser) }, { children: _jsx(FormattedMessage, { id: "ui.userCounters.connections", defaultMessage: "ui.userCounters.connections", values: {
|
|
99
99
|
count: scUser === null || scUser === void 0 ? void 0 : scUser.connections_counter,
|
|
100
|
-
b: (chunks) => _jsx("strong", { children: chunks },
|
|
100
|
+
b: (chunks) => _jsx("strong", { children: chunks }, Math.random())
|
|
101
101
|
} }) })), _jsx(Bullet, {})] }))) }), categoryFollowEnabled && (_jsx(Button, Object.assign({ className: classes.button, variant: "text", component: Link, to: scRoutingContext.url(SCRoutes.USER_PROFILE_CATEGORIES_ROUTE_NAME, scUser) }, { children: _jsx(FormattedMessage, { id: "ui.userCounters.categories", defaultMessage: "ui.userCounters.categories", values: {
|
|
102
102
|
count: scUser === null || scUser === void 0 ? void 0 : scUser.categories_counter,
|
|
103
|
-
b: (chunks) => _jsx("strong", { children: chunks },
|
|
103
|
+
b: (chunks) => _jsx("strong", { children: chunks }, Math.random())
|
|
104
104
|
} }) })))] })));
|
|
105
105
|
}
|
|
@@ -69,7 +69,7 @@ export default function PublicInfo(props) {
|
|
|
69
69
|
// STATE
|
|
70
70
|
const theme = useTheme();
|
|
71
71
|
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
72
|
-
const [user, setUser] = useState();
|
|
72
|
+
const [user, setUser] = useState(null);
|
|
73
73
|
const [error, setError] = useState({});
|
|
74
74
|
const [editing, setEditing] = useState([]);
|
|
75
75
|
const [saving, setSaving] = useState([]);
|
|
@@ -181,12 +181,12 @@ export default function PublicInfo(props) {
|
|
|
181
181
|
}
|
|
182
182
|
setUser(u);
|
|
183
183
|
setEditing([...editing, field]);
|
|
184
|
-
}, disableFuture: true, disabled: isSaving, slots: {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
184
|
+
}, disableFuture: true, disabled: isSaving, enableAccessibleFieldDOMStructure: false, slots: {
|
|
185
|
+
textField: (params) => {
|
|
186
|
+
var _a, _b, _c;
|
|
187
|
+
return (_jsx(TextField, Object.assign({}, params, { slotProps: {
|
|
188
|
+
input: Object.assign(Object.assign({}, (_a = params.slotProps) === null || _a === void 0 ? void 0 : _a.input), { endAdornment: (_jsxs(InputAdornment, Object.assign({ position: "end" }, { children: [(_c = (_b = params.slotProps) === null || _b === void 0 ? void 0 : _b.input) === null || _c === void 0 ? void 0 : _c.endAdornment, isSaving && _jsx(CircularProgress, { size: 10 })] }))) })
|
|
189
|
+
} })));
|
|
190
190
|
}
|
|
191
191
|
},
|
|
192
192
|
// onAccept={isMobile ? handleSave(SCUserProfileFields.DATE_OF_BIRTH) : null}
|
|
@@ -196,8 +196,10 @@ export default function PublicInfo(props) {
|
|
|
196
196
|
fullWidth: true,
|
|
197
197
|
variant: 'outlined',
|
|
198
198
|
helperText: _error || null,
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
slotProps: {
|
|
200
|
+
input: {
|
|
201
|
+
endAdornment: isMobile && (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ disabled: !isEditing }, { children: _jsx(Icon, { children: "CalendarIcon" }) })), isSaving && _jsx(CircularProgress, { size: 10 })] }))
|
|
202
|
+
}
|
|
201
203
|
}
|
|
202
204
|
}
|
|
203
205
|
} }) }), field));
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { SCMediaType } from '@selfcommunity/types';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
2
3
|
interface DocComponentProps {
|
|
3
4
|
document: SCMediaType;
|
|
4
5
|
index?: number;
|
|
5
6
|
onDelete?: (id: number) => void;
|
|
6
7
|
handleDownload?: (id: number) => void;
|
|
7
8
|
onMediaClick?: (media: SCMediaType) => void;
|
|
9
|
+
className?: HTMLAttributes<HTMLDivElement>['className'];
|
|
8
10
|
}
|
|
9
11
|
export default function DocComponent(props: DocComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export {};
|
|
@@ -4,6 +4,7 @@ import { PREFIX } from './constants';
|
|
|
4
4
|
import { Link } from '@selfcommunity/react-core';
|
|
5
5
|
import { SCMimeTypes } from '@selfcommunity/types';
|
|
6
6
|
import { useCallback } from 'react';
|
|
7
|
+
import classNames from 'classnames';
|
|
7
8
|
import txt from '../../../assets/composer/txt';
|
|
8
9
|
import pdf from '../../../assets/composer/pdf';
|
|
9
10
|
import doc from '../../../assets/composer/doc';
|
|
@@ -33,7 +34,7 @@ function formatBytes(bytes, decimals = 2) {
|
|
|
33
34
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
34
35
|
}
|
|
35
36
|
export default function DocComponent(props) {
|
|
36
|
-
const { document, index, onDelete, handleDownload, onMediaClick } = props;
|
|
37
|
+
const { document, index, onDelete, handleDownload, onMediaClick, className } = props;
|
|
37
38
|
const getImage = useCallback(() => {
|
|
38
39
|
switch (document.mimetype) {
|
|
39
40
|
case SCMimeTypes.PLAIN_TEXT:
|
|
@@ -68,5 +69,5 @@ export default function DocComponent(props) {
|
|
|
68
69
|
return fallback;
|
|
69
70
|
}
|
|
70
71
|
}, [document.mimetype]);
|
|
71
|
-
return (_jsxs(Root, Object.assign({ className: classes.docRoot }, { children: [_jsx(Box, { component: "img", alt: document.title, src: getImage() }), _jsxs(Stack, Object.assign({ className: classes.textWrapper }, { children: [_jsx(Typography, Object.assign({ className: classes.title }, { children: document.title })), document.size && _jsx(Typography, Object.assign({ className: classes.subtitle }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && (_jsxs(Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && (_jsx(IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: _jsx(Icon, { children: "delete" }) }))), handleDownload && (_jsxs(_Fragment, { children: [document.mimetype === SCMimeTypes.PDF && (_jsx(IconButton, Object.assign({ className: classes.action, component: Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: _jsx(Icon, { children: "visibility" }) }))), _jsx(IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: _jsx(Icon, { children: "download" }) }))] }))] })))] })));
|
|
72
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.docRoot, className) }, { children: [_jsx(Box, { component: "img", alt: document.title, src: getImage() }), _jsxs(Stack, Object.assign({ className: classes.textWrapper }, { children: [_jsx(Typography, Object.assign({ className: classes.title }, { children: document.title })), document.size && _jsx(Typography, Object.assign({ className: classes.subtitle }, { children: formatBytes(document.size) }))] })), (handleDownload || onDelete) && (_jsxs(Stack, Object.assign({ className: classes.actionWrapper }, { children: [onDelete && (_jsx(IconButton, Object.assign({ className: classes.action, onClick: () => onDelete(document.id) }, { children: _jsx(Icon, { children: "delete" }) }))), handleDownload && (_jsxs(_Fragment, { children: [document.mimetype === SCMimeTypes.PDF && (_jsx(IconButton, Object.assign({ className: classes.action, component: Link, to: document.url, target: "_blank", onClick: () => onMediaClick === null || onMediaClick === void 0 ? void 0 : onMediaClick(document) }, { children: _jsx(Icon, { children: "visibility" }) }))), _jsx(IconButton, Object.assign({ className: classes.action, onClick: () => handleDownload(index) }, { children: _jsx(Icon, { children: "download" }) }))] }))] })))] })));
|
|
72
73
|
}
|
|
@@ -12,7 +12,8 @@ const classes = {
|
|
|
12
12
|
media: `${PREFIX}-media`,
|
|
13
13
|
delete: `${PREFIX}-delete`,
|
|
14
14
|
title: `${PREFIX}-title`,
|
|
15
|
-
docsWrapper: `${PREFIX}-docs-wrapper
|
|
15
|
+
docsWrapper: `${PREFIX}-docs-wrapper`,
|
|
16
|
+
doc: `${PREFIX}-doc`
|
|
16
17
|
};
|
|
17
18
|
const Root = styled(Box, {
|
|
18
19
|
name: PREFIX,
|
|
@@ -41,7 +42,7 @@ const PreviewComponent = forwardRef((props, ref) => {
|
|
|
41
42
|
const handleDelete = useCallback((id) => onChange && onChange(value.filter((media) => media.id !== id)), [onChange, value]);
|
|
42
43
|
// RENDER
|
|
43
44
|
const imageElements = useMemo(() => images.map((media) => (_jsxs(Box, Object.assign({ className: classes.media, sx: { backgroundImage: `url(${(media === null || media === void 0 ? void 0 : media.image_thumbnail) ? media.image_thumbnail.url : media.image})` } }, { children: [_jsx(IconButton, Object.assign({ className: classes.delete, onClick: () => handleDelete(media.id), size: "small" }, { children: _jsx(Icon, { children: "delete" }) })), media.title && _jsx(Typography, Object.assign({ className: classes.title }, { children: media.title }))] }), media.id))), [images]);
|
|
44
|
-
const docElements = useMemo(() => docs.map((doc) => _jsx(DocComponent, { document: doc, onDelete: handleDelete }, doc.id)), [docs]);
|
|
45
|
-
return (_jsx(Root, Object.assign({ ref: ref, className: classNames(
|
|
45
|
+
const docElements = useMemo(() => docs.map((doc) => _jsx(DocComponent, { document: doc, onDelete: handleDelete, className: classes.doc }, doc.id)), [docs]);
|
|
46
|
+
return (_jsx(Root, Object.assign({ ref: ref, className: classNames(classes.previewRoot, className) }, rest, { children: mediasLength > 0 && (_jsxs(_Fragment, { children: [_jsx(ReactSortable, Object.assign({ list: images, setList: handleSort, scroll: true, animation: 200, scrollSensitivity: 50 }, { children: imageElements })), _jsx(ReactSortable, Object.assign({ list: docs, setList: handleSort, animation: 200, direction: "vertical", className: classes.docsWrapper }, { children: docElements }))] })) })));
|
|
46
47
|
});
|
|
47
48
|
export default PreviewComponent;
|