@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.
Files changed (32) hide show
  1. package/lib/cjs/components/Event/Event.d.ts +5 -0
  2. package/lib/cjs/components/Event/Event.js +10 -4
  3. package/lib/cjs/components/EventHeader/EventHeader.js +1 -1
  4. package/lib/cjs/components/EventInfoWidget/EventInfoWidget.js +1 -1
  5. package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +36 -10
  6. package/lib/cjs/components/EventMembersWidget/TabContentComponent.d.ts +3 -2
  7. package/lib/cjs/components/EventMembersWidget/TabContentComponent.js +33 -13
  8. package/lib/cjs/components/EventMembersWidget/types.d.ts +6 -0
  9. package/lib/cjs/components/EventMembersWidget/types.js +9 -0
  10. package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
  11. package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +8 -5
  12. package/lib/cjs/components/FeedObject/FeedObject.js +6 -2
  13. package/lib/cjs/shared/ContributionActionsMenu/index.js +8 -1
  14. package/lib/cjs/shared/EventInfoDetails/index.d.ts +1 -0
  15. package/lib/cjs/shared/EventInfoDetails/index.js +18 -14
  16. package/lib/esm/components/Event/Event.d.ts +5 -0
  17. package/lib/esm/components/Event/Event.js +11 -5
  18. package/lib/esm/components/EventHeader/EventHeader.js +1 -1
  19. package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +1 -1
  20. package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +36 -10
  21. package/lib/esm/components/EventMembersWidget/TabContentComponent.d.ts +3 -2
  22. package/lib/esm/components/EventMembersWidget/TabContentComponent.js +34 -14
  23. package/lib/esm/components/EventMembersWidget/types.d.ts +6 -0
  24. package/lib/esm/components/EventMembersWidget/types.js +6 -0
  25. package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.d.ts +2 -2
  26. package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +8 -5
  27. package/lib/esm/components/FeedObject/FeedObject.js +6 -2
  28. package/lib/esm/shared/ContributionActionsMenu/index.js +8 -1
  29. package/lib/esm/shared/EventInfoDetails/index.d.ts +1 -0
  30. package/lib/esm/shared/EventInfoDetails/index.js +19 -15
  31. package/lib/umd/react-ui.js +1 -1
  32. package/package.json +7 -7
@@ -2,6 +2,7 @@ import { SCEventType } from '@selfcommunity/types';
2
2
  import { ReactNode } from 'react';
3
3
  export interface EventInfoDetailsProps {
4
4
  event: SCEventType;
5
+ eventId?: number;
5
6
  hideDateIcon?: boolean;
6
7
  hideRecurringIcon?: boolean;
7
8
  hidePrivacyIcon?: boolean;
@@ -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
- live: `${PREFIX}-live`,
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 = true, beforeDateInfo, beforeRecurringInfo, beforePrivacyInfo, beforeLocationInfo, beforeCreatedInfo } = props;
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 privacy = useMemo(() => (event.privacy === SCEventPrivacyType.PUBLIC ? 'ui.eventInfoDetails.privacy.public' : 'ui.eventInfoDetails.privacy.private'), [event]);
31
- const location = useMemo(() => (event.location === SCEventLocationType.ONLINE ? 'ui.eventInfoDetails.location.virtual' : 'ui.eventInfoDetails.location.inPerson'), [event]);
32
- 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: "CalendarIcon" })), _jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsx(FormattedMessage, { id: "ui.eventInfoDetails.date.startEndTime", defaultMessage: "ui.eventInfoDetails.date.startEndTime", values: {
33
- date: intl.formatDate(event.running ? event.running_start_date : event.next_start_date, {
34
- weekday: 'long',
35
- day: 'numeric',
36
- year: 'numeric',
37
- month: 'long'
38
- }),
39
- start: intl.formatDate(event.running ? event.running_start_date : event.next_start_date, { hour: 'numeric', minute: 'numeric' })
40
- } }) })), hasInProgress && (_jsx(Tooltip, Object.assign({ title: _jsx(FormattedMessage, { id: "ui.eventInfoDetails.inProgress", defaultMessage: "ui.eventInfoDetails.inProgress" }) }, { children: _jsx(Box, { className: classes.live }) })))] }))), beforeRecurringInfo, hasRecurringInfo && event.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.${event.recurring}.placeholder`, defaultMessage: `ui.eventInfoDetails.frequency.${event.recurring}.placeholder` }) }))] }))), beforePrivacyInfo, hasPrivacyInfo && (_jsxs(Stack, Object.assign({ className: classes.iconTextWrapper }, { children: [!hidePrivacyIcon && _jsx(Icon, Object.assign({ fontSize: "small" }, { children: event.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: event.location === SCEventLocationType.ONLINE ? 'play_circle_outline' : 'add_location_alt' }))), event.location === SCEventLocationType.ONLINE ? (_jsx(Link, Object.assign({ to: event.link, target: "_blank", className: classes.link }, { children: _jsx(Typography, Object.assign({ variant: "body1", className: classes.url }, { children: event.link })) }))) : (_jsx(Typography, Object.assign({ variant: "body1", className: classes.url }, { children: event.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: {
41
- date: intl.formatDate(event.created_at, {
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',