@selfcommunity/react-ui 0.7.50-events.110 → 0.7.50-events.112
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/Event/Event.d.ts +5 -0
- package/lib/cjs/components/Event/Event.js +10 -4
- package/lib/cjs/components/EventHeader/EventHeader.js +1 -1
- package/lib/cjs/components/EventInfoWidget/EventInfoWidget.js +1 -1
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +36 -10
- package/lib/cjs/components/EventMembersWidget/TabContentComponent.d.ts +3 -2
- package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +33 -13
- package/lib/cjs/components/EventMembersWidget/types.d.ts +6 -0
- package/lib/cjs/components/EventMembersWidget/types.js +9 -0
- package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
- package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +8 -5
- package/lib/cjs/components/FeedObject/FeedObject.js +6 -2
- package/lib/cjs/shared/ContributionActionsMenu/index.js +8 -1
- package/lib/cjs/shared/EventInfoDetails/index.d.ts +1 -0
- package/lib/cjs/shared/EventInfoDetails/index.js +18 -14
- package/lib/esm/components/Event/Event.d.ts +5 -0
- package/lib/esm/components/Event/Event.js +11 -5
- package/lib/esm/components/EventHeader/EventHeader.js +1 -1
- package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +1 -1
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +36 -10
- package/lib/esm/components/EventMembersWidget/TabContentComponent.d.ts +3 -2
- package/lib/esm/components/EventMembersWidget/TabContentComponent.js +34 -14
- package/lib/esm/components/EventMembersWidget/types.d.ts +6 -0
- package/lib/esm/components/EventMembersWidget/types.js +6 -0
- package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
- package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +8 -5
- package/lib/esm/components/FeedObject/FeedObject.js +6 -2
- package/lib/esm/shared/ContributionActionsMenu/index.js +8 -1
- package/lib/esm/shared/EventInfoDetails/index.d.ts +1 -0
- package/lib/esm/shared/EventInfoDetails/index.js +19 -15
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Icon, Stack, styled, Tooltip, Typography, useThemeProps } from '@mui/material';
|
|
3
|
-
import { Link } from '@selfcommunity/react-core';
|
|
3
|
+
import { Link, useSCFetchEvent } from '@selfcommunity/react-core';
|
|
4
4
|
import { SCEventLocationType, SCEventPrivacyType, SCEventRecurrenceType } from '@selfcommunity/types';
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
import { FormattedMessage, useIntl } from 'react-intl';
|
|
@@ -8,7 +8,7 @@ const PREFIX = 'SCEventInfoDetails';
|
|
|
8
8
|
const classes = {
|
|
9
9
|
root: `${PREFIX}-root`,
|
|
10
10
|
iconTextWrapper: `${PREFIX}-icon-text-wrapper`,
|
|
11
|
-
|
|
11
|
+
inProgress: `${PREFIX}-in-progress`,
|
|
12
12
|
link: `${PREFIX}-link`,
|
|
13
13
|
url: `${PREFIX}-url`,
|
|
14
14
|
creationWrapper: `${PREFIX}-creation-wrapper`
|
|
@@ -24,21 +24,25 @@ export default function EventInfoDetails(inProps) {
|
|
|
24
24
|
props: inProps,
|
|
25
25
|
name: PREFIX
|
|
26
26
|
});
|
|
27
|
-
const { event, hideDateIcon = false, hideRecurringIcon = false, hidePrivacyIcon = false, hideLocationIcon = false, hideCreatedIcon = false, hasDateInfo = true, hasRecurringInfo = false, hasPrivacyInfo = true, hasLocationInfo = true, hasCreatedInfo = false, hasInProgress =
|
|
27
|
+
const { event, eventId, hideDateIcon = false, hideRecurringIcon = false, hidePrivacyIcon = false, hideLocationIcon = false, hideCreatedIcon = false, hasDateInfo = true, hasRecurringInfo = false, hasPrivacyInfo = true, hasLocationInfo = true, hasCreatedInfo = false, hasInProgress = false, beforeDateInfo, beforeRecurringInfo, beforePrivacyInfo, beforeLocationInfo, beforeCreatedInfo } = props;
|
|
28
28
|
// HOOKS
|
|
29
29
|
const intl = useIntl();
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
const { scEvent } = useSCFetchEvent({ id: eventId, event });
|
|
31
|
+
const privacy = useMemo(() => (scEvent && scEvent.privacy === SCEventPrivacyType.PUBLIC ? 'ui.eventInfoDetails.privacy.public' : 'ui.eventInfoDetails.privacy.private'), [scEvent]);
|
|
32
|
+
const location = useMemo(() => (scEvent && scEvent.location === SCEventLocationType.ONLINE ? 'ui.eventInfoDetails.location.virtual' : 'ui.eventInfoDetails.location.inPerson'), [scEvent]);
|
|
33
|
+
if (!scEvent) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return (_jsxs(Root, Object.assign({ className: classes.root }, { children: [beforeDateInfo, hasDateInfo && (_jsxs(Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hideDateIcon && _jsx(Icon, Object.assign({ fontSize: "small" }, { children: scEvent.active ? 'CalendarIcon' : 'calendar_off' })), _jsx(Tooltip, Object.assign({ title: !scEvent.active ? (_jsx(FormattedMessage, { id: "ui.eventInfoDetails.deleted.tooltip", defaultMessage: "ui.eventInfoDetails.deleted.tooltip" })) : null }, { children: _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.eventInfoDetails.date.startEndTime", defaultMessage: "ui.eventInfoDetails.date.startEndTime", values: {
|
|
37
|
+
date: intl.formatDate(scEvent.running ? scEvent.running_start_date : scEvent.next_start_date, {
|
|
38
|
+
weekday: 'long',
|
|
39
|
+
day: 'numeric',
|
|
40
|
+
year: 'numeric',
|
|
41
|
+
month: 'long'
|
|
42
|
+
}),
|
|
43
|
+
start: intl.formatDate(scEvent.running ? scEvent.running_start_date : scEvent.next_start_date, { hour: 'numeric', minute: 'numeric' })
|
|
44
|
+
} }) })) })), hasInProgress && scEvent.active && scEvent.running && (_jsx(Tooltip, Object.assign({ title: _jsx(FormattedMessage, { id: "ui.eventInfoDetails.inProgress", defaultMessage: "ui.eventInfoDetails.inProgress" }) }, { children: _jsx(Box, { className: classes.inProgress }) })))] }))), beforeRecurringInfo, hasRecurringInfo && scEvent.recurring !== SCEventRecurrenceType.NEVER && (_jsxs(Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hideRecurringIcon && _jsx(Icon, Object.assign({ fontSize: "small" }, { children: "frequency" })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: `ui.eventInfoDetails.frequency.${scEvent.recurring}.placeholder`, defaultMessage: `ui.eventInfoDetails.frequency.${scEvent.recurring}.placeholder` }) }))] }))), beforePrivacyInfo, hasPrivacyInfo && (_jsxs(Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hidePrivacyIcon && _jsx(Icon, Object.assign({ fontSize: "small" }, { children: scEvent.privacy === SCEventPrivacyType.PUBLIC ? 'public' : 'private' })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: privacy, defaultMessage: privacy }) })), "-", _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: location, defaultMessage: location }) }))] }))), beforeLocationInfo, hasLocationInfo && (_jsxs(Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hideLocationIcon && (_jsx(Icon, Object.assign({ fontSize: "small" }, { children: scEvent.location === SCEventLocationType.ONLINE ? 'play_circle_outline' : 'add_location_alt' }))), scEvent.location === SCEventLocationType.ONLINE ? (_jsx(Link, Object.assign({ to: scEvent.link, target: "_blank", className: classes.link }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.url }, { children: scEvent.link })) }))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classes.url }, { children: scEvent.geolocation })))] }))), beforeCreatedInfo, hasCreatedInfo && (_jsxs(Stack, Object.assign({ className: classes.creationWrapper }, { children: [!hideCreatedIcon && _jsx(Icon, Object.assign({ fontSize: "small" }, { children: "create" })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.eventInfoDetails.date.create", defaultMessage: "ui.eventInfoDetails.date.create", values: {
|
|
45
|
+
date: intl.formatDate(scEvent.created_at, {
|
|
42
46
|
weekday: 'long',
|
|
43
47
|
day: 'numeric',
|
|
44
48
|
year: 'numeric',
|