@selfcommunity/react-ui 0.7.50-events.38 → 0.7.50-events.40

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 (99) hide show
  1. package/lib/cjs/components/BottomNavigation/BottomNavigation.js +14 -5
  2. package/lib/cjs/components/CreateEventButton/CreateEventButton.js +6 -7
  3. package/lib/cjs/components/EditEventButton/EditEventButton.d.ts +43 -0
  4. package/lib/cjs/components/EditEventButton/EditEventButton.js +61 -0
  5. package/lib/cjs/components/EditEventButton/index.d.ts +3 -0
  6. package/lib/cjs/components/EditEventButton/index.js +5 -0
  7. package/lib/cjs/components/EventForm/EventAddress.d.ts +2 -1
  8. package/lib/cjs/components/EventForm/EventAddress.js +4 -4
  9. package/lib/cjs/components/EventForm/EventForm.d.ts +6 -0
  10. package/lib/cjs/components/EventForm/EventForm.js +51 -25
  11. package/lib/cjs/components/EventForm/UploadEventCover.d.ts +10 -0
  12. package/lib/cjs/components/EventForm/UploadEventCover.js +34 -7
  13. package/lib/cjs/components/EventHeader/EventHeader.d.ts +67 -0
  14. package/lib/cjs/components/EventHeader/EventHeader.js +175 -0
  15. package/lib/cjs/components/EventHeader/Skeleton.d.ts +25 -0
  16. package/lib/cjs/components/EventHeader/Skeleton.js +56 -0
  17. package/lib/cjs/components/EventHeader/constants.d.ts +1 -0
  18. package/lib/cjs/components/EventHeader/constants.js +4 -0
  19. package/lib/cjs/components/EventHeader/index.d.ts +4 -0
  20. package/lib/cjs/components/EventHeader/index.js +8 -0
  21. package/lib/cjs/components/EventInfoWidget/EventInfoWidget.d.ts +24 -0
  22. package/lib/cjs/components/EventInfoWidget/EventInfoWidget.js +74 -0
  23. package/lib/cjs/components/EventInfoWidget/constants.d.ts +1 -0
  24. package/lib/cjs/components/EventInfoWidget/constants.js +4 -0
  25. package/lib/cjs/components/EventInfoWidget/index.d.ts +3 -0
  26. package/lib/cjs/components/EventInfoWidget/index.js +6 -0
  27. package/lib/cjs/components/EventInviteButton/EventInviteButton.js +11 -11
  28. package/lib/cjs/components/EventLocationWidget/EventLocationWidget.js +1 -0
  29. package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.d.ts +56 -0
  30. package/lib/cjs/components/EventSubscribeButton/EventSubscribeButton.js +193 -0
  31. package/lib/cjs/components/EventSubscribeButton/index.d.ts +3 -0
  32. package/lib/cjs/components/EventSubscribeButton/index.js +5 -0
  33. package/lib/cjs/components/Events/Events.js +12 -11
  34. package/lib/cjs/components/FeedObject/FeedObject.js +1 -1
  35. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +2 -0
  36. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +9 -1
  37. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +12 -2
  38. package/lib/cjs/components/User/User.d.ts +2 -1
  39. package/lib/cjs/components/User/User.js +9 -9
  40. package/lib/cjs/constants/PubSub.d.ts +5 -1
  41. package/lib/cjs/index.d.ts +104 -100
  42. package/lib/cjs/index.js +270 -260
  43. package/lib/cjs/shared/Bullet/index.js +1 -2
  44. package/lib/cjs/shared/Calendar/index.d.ts +1 -2
  45. package/lib/cjs/shared/Calendar/index.js +3 -5
  46. package/lib/cjs/shared/EventInfoDetails/index.d.ts +6 -0
  47. package/lib/cjs/shared/EventInfoDetails/index.js +67 -0
  48. package/lib/esm/components/BottomNavigation/BottomNavigation.js +14 -5
  49. package/lib/esm/components/CreateEventButton/CreateEventButton.js +6 -7
  50. package/lib/esm/components/EditEventButton/EditEventButton.d.ts +43 -0
  51. package/lib/esm/components/EditEventButton/EditEventButton.js +58 -0
  52. package/lib/esm/components/EditEventButton/index.d.ts +3 -0
  53. package/lib/esm/components/EditEventButton/index.js +2 -0
  54. package/lib/esm/components/EventForm/EventAddress.d.ts +2 -1
  55. package/lib/esm/components/EventForm/EventAddress.js +4 -4
  56. package/lib/esm/components/EventForm/EventForm.d.ts +6 -0
  57. package/lib/esm/components/EventForm/EventForm.js +51 -25
  58. package/lib/esm/components/EventForm/UploadEventCover.d.ts +10 -0
  59. package/lib/esm/components/EventForm/UploadEventCover.js +34 -7
  60. package/lib/esm/components/EventHeader/EventHeader.d.ts +67 -0
  61. package/lib/esm/components/EventHeader/EventHeader.js +172 -0
  62. package/lib/esm/components/EventHeader/Skeleton.d.ts +25 -0
  63. package/lib/esm/components/EventHeader/Skeleton.js +53 -0
  64. package/lib/esm/components/EventHeader/constants.d.ts +1 -0
  65. package/lib/esm/components/EventHeader/constants.js +1 -0
  66. package/lib/esm/components/EventHeader/index.d.ts +4 -0
  67. package/lib/esm/components/EventHeader/index.js +4 -0
  68. package/lib/esm/components/EventInfoWidget/EventInfoWidget.d.ts +24 -0
  69. package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +71 -0
  70. package/lib/esm/components/EventInfoWidget/constants.d.ts +1 -0
  71. package/lib/esm/components/EventInfoWidget/constants.js +1 -0
  72. package/lib/esm/components/EventInfoWidget/index.d.ts +3 -0
  73. package/lib/esm/components/EventInfoWidget/index.js +3 -0
  74. package/lib/esm/components/EventInviteButton/EventInviteButton.js +11 -11
  75. package/lib/esm/components/EventLocationWidget/EventLocationWidget.js +1 -0
  76. package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.d.ts +56 -0
  77. package/lib/esm/components/EventSubscribeButton/EventSubscribeButton.js +190 -0
  78. package/lib/esm/components/EventSubscribeButton/index.d.ts +3 -0
  79. package/lib/esm/components/EventSubscribeButton/index.js +2 -0
  80. package/lib/esm/components/Events/Events.js +12 -11
  81. package/lib/esm/components/FeedObject/FeedObject.js +1 -1
  82. package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +2 -0
  83. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +9 -1
  84. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +13 -3
  85. package/lib/esm/components/User/User.d.ts +2 -1
  86. package/lib/esm/components/User/User.js +9 -9
  87. package/lib/esm/constants/PubSub.d.ts +5 -1
  88. package/lib/esm/index.d.ts +104 -100
  89. package/lib/esm/index.js +109 -105
  90. package/lib/esm/shared/Bullet/index.js +0 -1
  91. package/lib/esm/shared/Calendar/index.d.ts +1 -2
  92. package/lib/esm/shared/Calendar/index.js +0 -1
  93. package/lib/esm/shared/EventInfoDetails/index.d.ts +6 -0
  94. package/lib/esm/shared/EventInfoDetails/index.js +64 -0
  95. package/lib/umd/84.js +2 -0
  96. package/lib/umd/react-ui.js +1 -1
  97. package/package.json +8 -7
  98. package/lib/umd/204.js +0 -2
  99. /package/lib/umd/{204.js.LICENSE.txt → 84.js.LICENSE.txt} +0 -0
@@ -0,0 +1,67 @@
1
+ import { SCEventType } from '@selfcommunity/types';
2
+ import { EventSubscribeButtonProps } from '../EventSubscribeButton';
3
+ export interface EventHeaderProps {
4
+ /**
5
+ * Id of event object
6
+ * @default null
7
+ */
8
+ id?: string;
9
+ /**
10
+ * Overrides or extends the styles applied to the component.
11
+ * @default null
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Event Object
16
+ * @default null
17
+ */
18
+ event?: SCEventType;
19
+ /**
20
+ * Id of the event
21
+ * @default null
22
+ */
23
+ eventId?: number;
24
+ /**
25
+ * Props to spread event button followed
26
+ * @default {}
27
+ */
28
+ EventSubscribeButtonProps?: EventSubscribeButtonProps;
29
+ /**
30
+ * Any other properties
31
+ */
32
+ [p: string]: any;
33
+ }
34
+ /**
35
+ * > API documentation for the Community-JS Event Header component. Learn about the available props and the CSS API.
36
+ *
37
+ *
38
+ * This component renders the events top section.
39
+
40
+ #### Import
41
+
42
+ ```jsx
43
+ import {UserProfileHeader} from '@selfcommunity/react-ui';
44
+ ```
45
+
46
+ #### Component Name
47
+
48
+ The name `SCEventHeader` can be used when providing style overrides in the theme.
49
+
50
+
51
+ #### CSS
52
+
53
+ |Rule Name|Global class|Description|
54
+ |---|---|---|
55
+ |root|.SCEventHeader-root|Styles applied to the root element.|
56
+ |cover|.SCEventHeader-cover|Styles applied to the cover element.|
57
+ |time|.SCEventHeader-time|Styles applied to the time element.|
58
+ |calendar|.SCEventHeader-calendar|Styles applied to the calendar element.|
59
+ |info|SCEventHeader-info|Styles applied to the info section.|
60
+ |name|SCEventHeader-username|Styles applied to the username element.|
61
+ |visibility|SCEventHeader-visibility|Styles applied to the visibility section.|
62
+ |visibilityItem|SCEventHeader-visibility-item|Styles applied to the visibility element.|
63
+ |multiActions|SCEventHeader-multi-action|Styles applied to the multi actions section.|
64
+
65
+ * @param inProps
66
+ */
67
+ export default function EventHeader(inProps: EventHeaderProps): JSX.Element;
@@ -0,0 +1,172 @@
1
+ import { __rest } from "tslib";
2
+ import React, { useCallback, useEffect, useMemo, useRef } from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import { Box, Icon, Paper, Typography } from '@mui/material';
5
+ import { SCEventLocationType, SCEventPrivacyType } from '@selfcommunity/types';
6
+ import { SCPreferences, useSCFetchEvent, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
7
+ import EventHeaderSkeleton from './Skeleton';
8
+ import classNames from 'classnames';
9
+ import { useThemeProps } from '@mui/system';
10
+ import { PREFIX } from './constants';
11
+ import { FormattedMessage, useIntl } from 'react-intl';
12
+ import Bullet from '../../shared/Bullet';
13
+ import EventSubscribeButton from '../EventSubscribeButton';
14
+ import EventInviteButton from '../EventInviteButton';
15
+ import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
16
+ import PubSub from 'pubsub-js';
17
+ import EditEventButton from '../EditEventButton';
18
+ import User from '../User';
19
+ import Calendar from '../../shared/Calendar';
20
+ const classes = {
21
+ root: `${PREFIX}-root`,
22
+ cover: `${PREFIX}-cover`,
23
+ time: `${PREFIX}-time`,
24
+ calendar: `${PREFIX}-calendar`,
25
+ info: `${PREFIX}-info`,
26
+ name: `${PREFIX}-name`,
27
+ visibility: `${PREFIX}-visibility`,
28
+ visibilityItem: `${PREFIX}-visibility-item`,
29
+ multiActions: `${PREFIX}-multi-actions`
30
+ };
31
+ const Root = styled(Box, {
32
+ name: PREFIX,
33
+ slot: 'Root'
34
+ })(() => ({}));
35
+ /**
36
+ * > API documentation for the Community-JS Event Header component. Learn about the available props and the CSS API.
37
+ *
38
+ *
39
+ * This component renders the events top section.
40
+
41
+ #### Import
42
+
43
+ ```jsx
44
+ import {UserProfileHeader} from '@selfcommunity/react-ui';
45
+ ```
46
+
47
+ #### Component Name
48
+
49
+ The name `SCEventHeader` can be used when providing style overrides in the theme.
50
+
51
+
52
+ #### CSS
53
+
54
+ |Rule Name|Global class|Description|
55
+ |---|---|---|
56
+ |root|.SCEventHeader-root|Styles applied to the root element.|
57
+ |cover|.SCEventHeader-cover|Styles applied to the cover element.|
58
+ |time|.SCEventHeader-time|Styles applied to the time element.|
59
+ |calendar|.SCEventHeader-calendar|Styles applied to the calendar element.|
60
+ |info|SCEventHeader-info|Styles applied to the info section.|
61
+ |name|SCEventHeader-username|Styles applied to the username element.|
62
+ |visibility|SCEventHeader-visibility|Styles applied to the visibility section.|
63
+ |visibilityItem|SCEventHeader-visibility-item|Styles applied to the visibility element.|
64
+ |multiActions|SCEventHeader-multi-action|Styles applied to the multi actions section.|
65
+
66
+ * @param inProps
67
+ */
68
+ export default function EventHeader(inProps) {
69
+ var _a, _b;
70
+ // PROPS
71
+ const props = useThemeProps({
72
+ props: inProps,
73
+ name: PREFIX
74
+ });
75
+ const { id = null, className = null, event, eventId = null, EventSubscribeButtonProps = {} } = props, rest = __rest(props, ["id", "className", "event", "eventId", "EventSubscribeButtonProps"]);
76
+ // PREFERENCES
77
+ const scPreferences = useSCPreferences();
78
+ // CONTEXT
79
+ const scUserContext = useSCUser();
80
+ // HOOKS
81
+ const { scEvent, setSCEvent } = useSCFetchEvent({ id: eventId, event });
82
+ // INTL
83
+ const intl = useIntl();
84
+ // REFS
85
+ const updatesSubscription = useRef(null);
86
+ // CONST
87
+ const isEventAdmin = useMemo(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
88
+ /**
89
+ * Subscriber for pubsub callback
90
+ */
91
+ const onChangeEventMembersHandler = useCallback((msg, data) => {
92
+ var _a;
93
+ if (data && ((_a = data === null || data === void 0 ? void 0 : data.event) === null || _a === void 0 ? void 0 : _a.id) === (scEvent === null || scEvent === void 0 ? void 0 : scEvent.id)) {
94
+ let _event = Object.assign({}, scEvent);
95
+ if (msg === `${SCTopicType.GROUP}.${SCGroupEventType.ADD_MEMBER}`) {
96
+ _event.subscribers_counter = _event.subscribers_counter + 1;
97
+ }
98
+ else if (msg === `${SCTopicType.GROUP}.${SCGroupEventType.REMOVE_MEMBER}`) {
99
+ _event.subscribers_counter = Math.max(_event.subscribers_counter - 1, 0);
100
+ }
101
+ setSCEvent(_event);
102
+ }
103
+ }, [scEvent, setSCEvent]);
104
+ /**
105
+ * On mount, subscribe to receive events updates (only edit)
106
+ */
107
+ useEffect(() => {
108
+ if (scEvent) {
109
+ updatesSubscription.current = PubSub.subscribe(`${SCTopicType.EVENT}.${SCGroupEventType.MEMBERS}`, onChangeEventMembersHandler);
110
+ }
111
+ return () => {
112
+ updatesSubscription.current && PubSub.unsubscribe(updatesSubscription.current);
113
+ };
114
+ }, [scEvent]);
115
+ // RENDER
116
+ if (!scEvent) {
117
+ return React.createElement(EventHeaderSkeleton, null);
118
+ }
119
+ const _backgroundCover = Object.assign({}, (scEvent.image_bigger
120
+ ? { background: `url('${scEvent.image_bigger}') center / cover` }
121
+ : { background: `url('${scPreferences.preferences[SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
122
+ return (React.createElement(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, rest),
123
+ React.createElement(Paper, { style: _backgroundCover, classes: { root: classes.cover } },
124
+ React.createElement(Box, { className: classes.calendar },
125
+ React.createElement(Calendar, { day: new Date(scEvent.start_date).getDate() }))),
126
+ React.createElement(Box, { className: classes.info },
127
+ React.createElement(Typography, { className: classes.time }, scEvent.end_date && scEvent.end_date !== scEvent.start_date ? (new Date(scEvent.start_date).getDate() !== new Date(scEvent.end_date).getDate() ? (React.createElement(FormattedMessage, { id: "ui.eventHeader.startEndTimeDiff", defaultMessage: "ui.eventHeader.startEndTimeDiff", values: {
128
+ startDate: intl.formatDate(scEvent.start_date, {
129
+ weekday: 'long',
130
+ day: 'numeric',
131
+ year: 'numeric',
132
+ month: 'long'
133
+ }),
134
+ endDate: intl.formatDate(scEvent.end_date, {
135
+ weekday: 'long',
136
+ day: 'numeric',
137
+ year: 'numeric',
138
+ month: 'long'
139
+ }),
140
+ startTime: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' }),
141
+ endTime: intl.formatDate(scEvent.end_date, { hour: 'numeric', minute: 'numeric' })
142
+ } })) : (React.createElement(FormattedMessage, { id: "ui.eventHeader.startEndTime", defaultMessage: "ui.eventHeader.startEndTime", values: {
143
+ date: intl.formatDate(scEvent.start_date, {
144
+ weekday: 'long',
145
+ day: 'numeric',
146
+ year: 'numeric',
147
+ month: 'long'
148
+ }),
149
+ start: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' }),
150
+ end: intl.formatDate(scEvent.end_date, { hour: 'numeric', minute: 'numeric' })
151
+ } }))) : (React.createElement(FormattedMessage, { id: "ui.eventHeader.dateTime", defaultMessage: "ui.eventHeader.dateTime", values: {
152
+ date: intl.formatDate(scEvent.start_date, {
153
+ weekday: 'long',
154
+ day: 'numeric',
155
+ year: 'numeric',
156
+ month: 'long'
157
+ }),
158
+ hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
159
+ } }))),
160
+ React.createElement(Typography, { variant: "h5", className: classes.name }, scEvent.name),
161
+ React.createElement(Box, { className: classes.visibility },
162
+ React.createElement(React.Fragment, null, scEvent.privacy === SCEventPrivacyType.PUBLIC ? (React.createElement(Typography, { className: classes.visibilityItem },
163
+ React.createElement(Icon, null, "public"),
164
+ React.createElement(FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" }))) : (React.createElement(Typography, { className: classes.visibilityItem },
165
+ React.createElement(Icon, null, "private"),
166
+ React.createElement(FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })))),
167
+ React.createElement(Bullet, null),
168
+ React.createElement(Typography, { className: classes.visibilityItem }, scEvent.location === SCEventLocationType.PERSON ? (React.createElement(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : (React.createElement(FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.online" })))),
169
+ React.createElement(User, { userId: (_b = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _b === void 0 ? void 0 : _b.id, elevation: 0, actions: React.createElement(React.Fragment, null, isEventAdmin ? (React.createElement(Box, { className: classes.multiActions },
170
+ React.createElement(EventInviteButton, { size: "small", event: scEvent, eventId: scEvent.id }),
171
+ React.createElement(EditEventButton, { size: "small", event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data) }))) : (React.createElement(EventSubscribeButton, Object.assign({ event: scEvent }, EventSubscribeButtonProps)))) }))));
172
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * > API documentation for the Community-JS Event Header Skeleton component. Learn about the available props and the CSS API.
3
+
4
+ #### Import
5
+
6
+ ```jsx
7
+ import {EventHeaderSkeleton} from '@selfcommunity/react-ui';
8
+ ```
9
+
10
+ #### Component Name
11
+
12
+ The name `SCEventHeader-skeleton-root` can be used when providing style overrides in the theme.
13
+
14
+ #### CSS
15
+
16
+ |Rule Name|Global class|Description|
17
+ |---|---|---|
18
+ |root|.SCEventHeader-skeleton-root|Styles applied to the root element.|
19
+ |avatar|.SCEventHeader-avatar|Styles applied to the avatar element.|
20
+ |cover|.SCEventHeader-cover|Styles applied to the cover element.|
21
+ |info|.SCEventHeader-info|Styles applied to the info info.|
22
+ *
23
+ */
24
+ declare function EventHeaderSkeleton(): JSX.Element;
25
+ export default EventHeaderSkeleton;
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { Box, Typography, useTheme } from '@mui/material';
3
+ import { styled } from '@mui/material/styles';
4
+ import Skeleton from '@mui/material/Skeleton';
5
+ import { PREFIX } from './constants';
6
+ const classes = {
7
+ root: `${PREFIX}-skeleton-root`,
8
+ cover: `${PREFIX}-cover`,
9
+ avatar: `${PREFIX}-avatar`,
10
+ info: `${PREFIX}-info`
11
+ };
12
+ const Root = styled(Box, {
13
+ name: PREFIX,
14
+ slot: 'SkeletonRoot'
15
+ })(() => ({}));
16
+ /**
17
+ * > API documentation for the Community-JS Event Header Skeleton component. Learn about the available props and the CSS API.
18
+
19
+ #### Import
20
+
21
+ ```jsx
22
+ import {EventHeaderSkeleton} from '@selfcommunity/react-ui';
23
+ ```
24
+
25
+ #### Component Name
26
+
27
+ The name `SCEventHeader-skeleton-root` can be used when providing style overrides in the theme.
28
+
29
+ #### CSS
30
+
31
+ |Rule Name|Global class|Description|
32
+ |---|---|---|
33
+ |root|.SCEventHeader-skeleton-root|Styles applied to the root element.|
34
+ |avatar|.SCEventHeader-avatar|Styles applied to the avatar element.|
35
+ |cover|.SCEventHeader-cover|Styles applied to the cover element.|
36
+ |info|.SCEventHeader-info|Styles applied to the info info.|
37
+ *
38
+ */
39
+ function EventHeaderSkeleton() {
40
+ const theme = useTheme();
41
+ return (React.createElement(Root, { className: classes.root },
42
+ React.createElement(Skeleton, { className: classes.cover, animation: "wave", variant: "rectangular" }),
43
+ React.createElement(Box, { className: classes.avatar },
44
+ React.createElement(Skeleton, { animation: "wave", variant: "rectangular", width: theme.selfcommunity.group.avatar.sizeLarge, height: theme.selfcommunity.group.avatar.sizeLarge })),
45
+ React.createElement(Box, { className: classes.info },
46
+ React.createElement(Typography, { variant: "h5", mb: 1 },
47
+ React.createElement(Skeleton, { animation: "wave", variant: "rectangular", sx: { height: 20, width: '50%' } })),
48
+ React.createElement(Typography, { mb: 1 },
49
+ React.createElement(Skeleton, { animation: "wave", variant: "rectangular", sx: { height: 30, width: '30%' } })),
50
+ React.createElement(Typography, null,
51
+ React.createElement(Skeleton, { animation: "wave", variant: "rectangular", sx: { height: 15, width: '20%' } })))));
52
+ }
53
+ export default EventHeaderSkeleton;
@@ -0,0 +1 @@
1
+ export declare const PREFIX = "SCEventHeader";
@@ -0,0 +1 @@
1
+ export const PREFIX = 'SCEventHeader';
@@ -0,0 +1,4 @@
1
+ import EventHeader, { EventHeaderProps } from './EventHeader';
2
+ import EventHeaderSkeleton from './Skeleton';
3
+ export default EventHeader;
4
+ export { EventHeaderProps, EventHeaderSkeleton };
@@ -0,0 +1,4 @@
1
+ import EventHeader from './EventHeader';
2
+ import EventHeaderSkeleton from './Skeleton';
3
+ export default EventHeader;
4
+ export { EventHeaderSkeleton };
@@ -0,0 +1,24 @@
1
+ import { SCEventType } from '@selfcommunity/types';
2
+ import { WidgetProps } from '../Widget';
3
+ export interface EventInfoWidgetProps extends WidgetProps {
4
+ /**
5
+ * Event Object
6
+ * @default null
7
+ */
8
+ event?: SCEventType;
9
+ /**
10
+ * Id of event object
11
+ * @default null
12
+ */
13
+ eventId?: number;
14
+ /**
15
+ * True if summary must be already expanded
16
+ * @default false
17
+ */
18
+ summaryExpanded?: boolean;
19
+ /**
20
+ * Other props
21
+ */
22
+ [p: string]: any;
23
+ }
24
+ export default function EventInfoWidget(inProps: EventInfoWidgetProps): JSX.Element;
@@ -0,0 +1,71 @@
1
+ import { __rest } from "tslib";
2
+ import { Box, Button, CardContent, Icon, Stack, styled, Typography, useThemeProps } from '@mui/material';
3
+ import { useSCFetchEvent } from '@selfcommunity/react-core';
4
+ import { useCallback, useEffect, useState } from 'react';
5
+ import { FormattedMessage } from 'react-intl';
6
+ import EventInfoDetails from '../../shared/EventInfoDetails';
7
+ import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
8
+ import Widget from '../Widget';
9
+ import { PREFIX } from './constants';
10
+ const classes = {
11
+ root: `${PREFIX}-root`,
12
+ content: `${PREFIX}-content`,
13
+ titleWrapper: `${PREFIX}-title-wrapper`,
14
+ textWrapper: `${PREFIX}-text-wrapper`,
15
+ showMore: `${PREFIX}-show-more`
16
+ };
17
+ const Root = styled(Widget, {
18
+ name: PREFIX,
19
+ slot: 'Root',
20
+ overridesResolver: (_props, styles) => styles.root
21
+ })();
22
+ function isTextLongerThanLimit(text, limit = 125) {
23
+ return text.length > limit;
24
+ }
25
+ function getTruncatedText(text, limit = 125) {
26
+ return isTextLongerThanLimit(text, limit) ? text.substring(0, limit).concat('...') : text;
27
+ }
28
+ export default function EventInfoWidget(inProps) {
29
+ // PROPS
30
+ const props = useThemeProps({
31
+ props: inProps,
32
+ name: PREFIX
33
+ });
34
+ const { event, eventId, summaryExpanded = false } = props, rest = __rest(props, ["event", "eventId", "summaryExpanded"]);
35
+ // STATE
36
+ const [expanded, setExpanded] = useState(summaryExpanded);
37
+ const [showButton, setShowButton] = useState(!summaryExpanded);
38
+ // HOOKS
39
+ const { scEvent } = useSCFetchEvent({ id: eventId, event });
40
+ useEffect(() => {
41
+ if (!scEvent) {
42
+ return;
43
+ }
44
+ const _showButton = isTextLongerThanLimit(scEvent.description, 220);
45
+ if (_showButton !== !summaryExpanded) {
46
+ setShowButton(_showButton);
47
+ }
48
+ }, [scEvent]);
49
+ /**
50
+ * Handle toggle summary
51
+ */
52
+ const handleToggleSummary = useCallback(() => {
53
+ setExpanded(!expanded);
54
+ }, [expanded]);
55
+ if (!scEvent) {
56
+ return React.createElement(HiddenPlaceholder, null);
57
+ }
58
+ const description = expanded ? scEvent.description : getTruncatedText(scEvent.description, 220);
59
+ return (React.createElement(Root, Object.assign({ className: classes.root }, rest, { expanded: expanded }),
60
+ React.createElement(CardContent, { className: classes.content },
61
+ React.createElement(Stack, { className: classes.titleWrapper },
62
+ React.createElement(Icon, { fontSize: "small" }, "info"),
63
+ React.createElement(Typography, { variant: "h5" },
64
+ React.createElement(FormattedMessage, { id: "ui.infoEventWidget.title", defaultMessage: "ui.infoEventWidget.title" }))),
65
+ React.createElement(Box, { className: classes.textWrapper },
66
+ React.createElement(Typography, { component: "span", variant: "body1" },
67
+ description,
68
+ showButton && !expanded && (React.createElement(Button, { size: "small", variant: "text", className: classes.showMore, onClick: handleToggleSummary },
69
+ React.createElement(FormattedMessage, { id: "ui.infoEventWidget.showMore", defaultMessage: "ui.infoEventWidget.showMore" }))))),
70
+ React.createElement(EventInfoDetails, { event: scEvent }))));
71
+ }
@@ -0,0 +1 @@
1
+ export declare const PREFIX = "SCEventInfoWidget";
@@ -0,0 +1 @@
1
+ export const PREFIX = 'SCEventInfoWidget';
@@ -0,0 +1,3 @@
1
+ import EventInfoWidget, { EventInfoWidgetProps } from './EventInfoWidget';
2
+ export default EventInfoWidget;
3
+ export { type EventInfoWidgetProps };
@@ -0,0 +1,3 @@
1
+ import EventInfoWidget from './EventInfoWidget';
2
+ // import EventInfoWidgetSkeleton from './Skeleton';
3
+ export default EventInfoWidget;
@@ -1,20 +1,20 @@
1
1
  import { __rest } from "tslib";
2
- import React, { useContext, useEffect, useMemo, useState } from 'react';
3
- import { useThemeProps } from '@mui/system';
4
- import { styled } from '@mui/material/styles';
2
+ import { LoadingButton } from '@mui/lab';
5
3
  import { Avatar, Box, Button, Chip, Icon, IconButton, InputAdornment, TextField, Typography } from '@mui/material';
6
- import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
4
+ import Autocomplete from '@mui/material/Autocomplete';
5
+ import { styled } from '@mui/material/styles';
6
+ import { useThemeProps } from '@mui/system';
7
+ import { EventService } from '@selfcommunity/api-services';
7
8
  import { SCUserContext, useSCFetchEvent } from '@selfcommunity/react-core';
9
+ import { Logger } from '@selfcommunity/utils';
8
10
  import classNames from 'classnames';
9
- import BaseDialog from '../../shared/BaseDialog';
10
- import { LoadingButton } from '@mui/lab';
11
- import { EventService } from '@selfcommunity/api-services';
12
- import Autocomplete from '@mui/material/Autocomplete';
13
- import User from '../User';
11
+ import PubSub from 'pubsub-js';
12
+ import React, { useContext, useEffect, useMemo, useState } from 'react';
13
+ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
14
14
  import { SCOPE_SC_UI } from '../../constants/Errors';
15
- import { Logger } from '@selfcommunity/utils';
16
15
  import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
17
- import PubSub from 'pubsub-js';
16
+ import BaseDialog from '../../shared/BaseDialog';
17
+ import User from '../User';
18
18
  const messages = defineMessages({
19
19
  placeholder: {
20
20
  id: 'ui.eventInviteButton.searchBar.placeholder',
@@ -76,6 +76,7 @@ export default function EventLocationWidget(inProps) {
76
76
  /**
77
77
  * Loading event
78
78
  */
79
+ console.log(isLoaded, scEvent);
79
80
  if (!isLoaded || !scEvent) {
80
81
  return React.createElement(EventLocationWidgetSkeleton, null);
81
82
  }
@@ -0,0 +1,56 @@
1
+ import { SCEventType, SCUserType } from '@selfcommunity/types';
2
+ export interface EventSubscribeButtonProps {
3
+ /**
4
+ * Overrides or extends the styles applied to the component.
5
+ * @default null
6
+ */
7
+ className?: string;
8
+ /**
9
+ * Event Object
10
+ * @default null
11
+ */
12
+ event?: SCEventType;
13
+ /**
14
+ * Id of the event
15
+ * @default null
16
+ */
17
+ eventId?: number;
18
+ /**
19
+ * The user to be accepted into the event
20
+ * @default null
21
+ */
22
+ user?: SCUserType;
23
+ /**
24
+ * onSubscribe callback
25
+ * @param user
26
+ * @param joined
27
+ */
28
+ onSubscribe?: (event: SCEventType, status: string | null) => any;
29
+ /**
30
+ * Others properties
31
+ */
32
+ [p: string]: any;
33
+ }
34
+ /**
35
+ * > API documentation for the Community-JS Event Subscribe Button component. Learn about the available props and the CSS API.
36
+
37
+ #### Import
38
+
39
+ ```jsx
40
+ import {EventSubscribeButton} from '@selfcommunity/react-ui';
41
+ ```
42
+
43
+ #### Component Name
44
+
45
+ The name `SCEventSubscribeButton` can be used when providing style overrides in the theme.
46
+
47
+
48
+ #### CSS
49
+
50
+ |Rule Name|Global class|Description|
51
+ |---|---|---|
52
+ |root|.SCEventSubscribeButton-root|Styles applied to the root element.|
53
+
54
+ * @param inProps
55
+ */
56
+ export default function EventSubscribeButton(inProps: EventSubscribeButtonProps): JSX.Element;