@selfcommunity/react-templates 0.3.50-events.38 → 0.3.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.
- package/lib/cjs/components/Event/Event.d.ts +72 -0
- package/lib/cjs/components/Event/Event.js +67 -0
- package/lib/cjs/components/Event/Skeleton.d.ts +21 -0
- package/lib/cjs/components/Event/Skeleton.js +42 -0
- package/lib/cjs/components/Event/constants.d.ts +1 -0
- package/lib/cjs/components/Event/constants.js +4 -0
- package/lib/cjs/components/Event/index.d.ts +4 -0
- package/lib/cjs/components/Event/index.js +8 -0
- package/lib/cjs/components/EventFeed/EventFeed.d.ts +69 -0
- package/lib/cjs/components/EventFeed/EventFeed.js +127 -0
- package/lib/cjs/components/EventFeed/Skeleton.d.ts +21 -0
- package/lib/cjs/components/EventFeed/Skeleton.js +42 -0
- package/lib/cjs/components/EventFeed/constants.d.ts +1 -0
- package/lib/cjs/components/EventFeed/constants.js +4 -0
- package/lib/cjs/components/EventFeed/index.d.ts +4 -0
- package/lib/cjs/components/EventFeed/index.js +8 -0
- package/lib/esm/components/Event/Event.d.ts +72 -0
- package/lib/esm/components/Event/Event.js +63 -0
- package/lib/esm/components/Event/Skeleton.d.ts +21 -0
- package/lib/esm/components/Event/Skeleton.js +38 -0
- package/lib/esm/components/Event/constants.d.ts +1 -0
- package/lib/esm/components/Event/constants.js +1 -0
- package/lib/esm/components/Event/index.d.ts +4 -0
- package/lib/esm/components/Event/index.js +4 -0
- package/lib/esm/components/EventFeed/EventFeed.d.ts +69 -0
- package/lib/esm/components/EventFeed/EventFeed.js +123 -0
- package/lib/esm/components/EventFeed/Skeleton.d.ts +21 -0
- package/lib/esm/components/EventFeed/Skeleton.js +38 -0
- package/lib/esm/components/EventFeed/constants.d.ts +1 -0
- package/lib/esm/components/EventFeed/constants.js +1 -0
- package/lib/esm/components/EventFeed/index.d.ts +4 -0
- package/lib/esm/components/EventFeed/index.js +4 -0
- package/lib/umd/876.js +2 -0
- package/lib/umd/react-templates.js +1 -1
- package/package.json +6 -6
- package/lib/umd/574.js +0 -2
- /package/lib/umd/{574.js.LICENSE.txt → 876.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { FeedObjectProps, FeedSidebarProps, SCFeedWidgetType } from '@selfcommunity/react-ui';
|
|
2
|
+
import { SCEventType } from '@selfcommunity/types';
|
|
3
|
+
import { EventFeedProps } from '../EventFeed';
|
|
4
|
+
export interface EventProps {
|
|
5
|
+
/**
|
|
6
|
+
* Id of the feed object
|
|
7
|
+
* @default 'feed'
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Overrides or extends the styles applied to the component.
|
|
12
|
+
* @default null
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Event Object
|
|
17
|
+
* @default null
|
|
18
|
+
*/
|
|
19
|
+
event?: SCEventType;
|
|
20
|
+
/**
|
|
21
|
+
* Id of the event for filter the feed
|
|
22
|
+
* @default null
|
|
23
|
+
*/
|
|
24
|
+
eventId?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Widgets to be rendered into the feed
|
|
27
|
+
* @default []
|
|
28
|
+
*/
|
|
29
|
+
widgets?: SCFeedWidgetType[] | null;
|
|
30
|
+
/**
|
|
31
|
+
* Props to spread to single feed object
|
|
32
|
+
* @default empty object
|
|
33
|
+
*/
|
|
34
|
+
FeedObjectProps?: FeedObjectProps;
|
|
35
|
+
/**
|
|
36
|
+
* Props to spread to single feed object
|
|
37
|
+
* @default {top: 0, bottomBoundary: `#${id}`}
|
|
38
|
+
*/
|
|
39
|
+
FeedSidebarProps?: FeedSidebarProps;
|
|
40
|
+
/**
|
|
41
|
+
* Props to spread to EventFeed component
|
|
42
|
+
* @default {}
|
|
43
|
+
*/
|
|
44
|
+
EventFeedProps?: EventFeedProps;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* > API documentation for the Community-JS Category Template. Learn about the available props and the CSS API.
|
|
48
|
+
*
|
|
49
|
+
*
|
|
50
|
+
* This component renders a specific event's template.
|
|
51
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-templates/Components/Group)
|
|
52
|
+
|
|
53
|
+
#### Import
|
|
54
|
+
|
|
55
|
+
```jsx
|
|
56
|
+
import {Group} from '@selfcommunity/react-templates';
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Component Name
|
|
60
|
+
|
|
61
|
+
The name `SCGroupTemplate` can be used when providing style overrides in the theme.
|
|
62
|
+
|
|
63
|
+
#### CSS
|
|
64
|
+
|
|
65
|
+
|Rule Name|Global class|Description|
|
|
66
|
+
|---|---|---|
|
|
67
|
+
|root|.SCGroupTemplate-root|Styles applied to the root element.|
|
|
68
|
+
|feed|.SCGroupTemplate-feed|Styles applied to the feed element.|
|
|
69
|
+
*
|
|
70
|
+
* @param inProps
|
|
71
|
+
*/
|
|
72
|
+
export default function Event(inProps: EventProps): JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
8
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
9
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
10
|
+
const system_1 = require("@mui/system");
|
|
11
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
12
|
+
const constants_1 = require("./constants");
|
|
13
|
+
const EventFeed_1 = tslib_1.__importDefault(require("../EventFeed"));
|
|
14
|
+
const classes = {
|
|
15
|
+
root: `${constants_1.PREFIX}-root`,
|
|
16
|
+
feed: `${constants_1.PREFIX}-feed`
|
|
17
|
+
};
|
|
18
|
+
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
19
|
+
name: constants_1.PREFIX,
|
|
20
|
+
slot: 'Root'
|
|
21
|
+
})(() => ({}));
|
|
22
|
+
/**
|
|
23
|
+
* > API documentation for the Community-JS Category Template. Learn about the available props and the CSS API.
|
|
24
|
+
*
|
|
25
|
+
*
|
|
26
|
+
* This component renders a specific event's template.
|
|
27
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-templates/Components/Group)
|
|
28
|
+
|
|
29
|
+
#### Import
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
import {Group} from '@selfcommunity/react-templates';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### Component Name
|
|
36
|
+
|
|
37
|
+
The name `SCGroupTemplate` can be used when providing style overrides in the theme.
|
|
38
|
+
|
|
39
|
+
#### CSS
|
|
40
|
+
|
|
41
|
+
|Rule Name|Global class|Description|
|
|
42
|
+
|---|---|---|
|
|
43
|
+
|root|.SCGroupTemplate-root|Styles applied to the root element.|
|
|
44
|
+
|feed|.SCGroupTemplate-feed|Styles applied to the feed element.|
|
|
45
|
+
*
|
|
46
|
+
* @param inProps
|
|
47
|
+
*/
|
|
48
|
+
function Event(inProps) {
|
|
49
|
+
// PROPS
|
|
50
|
+
const props = (0, system_1.useThemeProps)({
|
|
51
|
+
props: inProps,
|
|
52
|
+
name: constants_1.PREFIX
|
|
53
|
+
});
|
|
54
|
+
const { id = 'event', className, event, eventId, widgets, FeedObjectProps, FeedSidebarProps, EventFeedProps = {} } = props;
|
|
55
|
+
// HOOKS
|
|
56
|
+
const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
|
|
57
|
+
const handleSubscribe = (group, status) => {
|
|
58
|
+
setSCEvent(Object.assign({}, scEvent, { subscription_status: status }));
|
|
59
|
+
};
|
|
60
|
+
if (!scEvent) {
|
|
61
|
+
return react_1.default.createElement(Skeleton_1.default, null);
|
|
62
|
+
}
|
|
63
|
+
return (react_1.default.createElement(Root, { id: id, className: (0, classnames_1.default)(classes.root, className) },
|
|
64
|
+
react_1.default.createElement(react_ui_1.EventHeader, { eventId: scEvent.id, GroupSubscribeButtonProps: { onSubscribe: handleSubscribe } }),
|
|
65
|
+
react_1.default.createElement(EventFeed_1.default, Object.assign({ className: classes.feed, event: scEvent, widgets: widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, EventFeedProps))));
|
|
66
|
+
}
|
|
67
|
+
exports.default = Event;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* > API documentation for the Community-JS Group Skeleton Template. Learn about the available props and the CSS API.
|
|
3
|
+
|
|
4
|
+
#### Import
|
|
5
|
+
|
|
6
|
+
```jsx
|
|
7
|
+
import {EventSkeletonTemplate} from '@selfcommunity/react-templates';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
#### Component Name
|
|
11
|
+
|
|
12
|
+
The name `SCEventTemplate-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|.SCEventTemplate-skeleton-root|Styles applied to the root element.|
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export default function EventSkeletonTemplate(): JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const Skeleton_1 = tslib_1.__importDefault(require("../EventFeed/Skeleton"));
|
|
8
|
+
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
const classes = {
|
|
11
|
+
root: `${constants_1.PREFIX}-skeleton-root`
|
|
12
|
+
};
|
|
13
|
+
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
14
|
+
name: constants_1.PREFIX,
|
|
15
|
+
slot: 'SkeletonRoot'
|
|
16
|
+
})(() => ({}));
|
|
17
|
+
/**
|
|
18
|
+
* > API documentation for the Community-JS Group Skeleton Template. Learn about the available props and the CSS API.
|
|
19
|
+
|
|
20
|
+
#### Import
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
import {EventSkeletonTemplate} from '@selfcommunity/react-templates';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### Component Name
|
|
27
|
+
|
|
28
|
+
The name `SCEventTemplate-skeleton-root` can be used when providing style overrides in the theme.
|
|
29
|
+
|
|
30
|
+
#### CSS
|
|
31
|
+
|
|
32
|
+
|Rule Name|Global class|Description|
|
|
33
|
+
|---|---|---|
|
|
34
|
+
|root|.SCEventTemplate-skeleton-root|Styles applied to the root element.|
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
function EventSkeletonTemplate() {
|
|
38
|
+
return (react_1.default.createElement(Root, { className: classes.root },
|
|
39
|
+
react_1.default.createElement(react_ui_1.EventHeaderSkeleton, null),
|
|
40
|
+
react_1.default.createElement(Skeleton_1.default, null)));
|
|
41
|
+
}
|
|
42
|
+
exports.default = EventSkeletonTemplate;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCEventTemplate";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventSkeleton = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
6
|
+
exports.EventSkeleton = Skeleton_1.default;
|
|
7
|
+
const Event_1 = tslib_1.__importDefault(require("./Event"));
|
|
8
|
+
exports.default = Event_1.default;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { FeedObjectProps, FeedProps, FeedSidebarProps, SCFeedWidgetType } from '@selfcommunity/react-ui';
|
|
2
|
+
import { SCEventType } from '@selfcommunity/types';
|
|
3
|
+
export interface EventFeedProps {
|
|
4
|
+
/**
|
|
5
|
+
* Id of the feed object
|
|
6
|
+
* @default 'feed'
|
|
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 for filter the feed
|
|
21
|
+
* @default null
|
|
22
|
+
*/
|
|
23
|
+
eventId?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Widgets to be rendered into the feed
|
|
26
|
+
* @default [EventInfoWidget]
|
|
27
|
+
*/
|
|
28
|
+
widgets?: SCFeedWidgetType[] | null;
|
|
29
|
+
/**
|
|
30
|
+
* Props to spread to single feed object
|
|
31
|
+
* @default empty object
|
|
32
|
+
*/
|
|
33
|
+
FeedObjectProps?: FeedObjectProps;
|
|
34
|
+
/**
|
|
35
|
+
* Props to spread to single feed object
|
|
36
|
+
* @default {top: 0, bottomBoundary: `#${id}`}
|
|
37
|
+
*/
|
|
38
|
+
FeedSidebarProps?: FeedSidebarProps;
|
|
39
|
+
/**
|
|
40
|
+
* Props to spread to feed component
|
|
41
|
+
* @default {}
|
|
42
|
+
*/
|
|
43
|
+
FeedProps?: Omit<FeedProps, 'endpoint' | 'widgets' | 'ItemComponent' | 'itemPropsGenerator' | 'itemIdGenerator' | 'ItemSkeleton' | 'ItemSkeletonProps' | 'FeedSidebarProps'>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* > API documentation for the Community-JS Group Feed Template. Learn about the available props and the CSS API.
|
|
47
|
+
*
|
|
48
|
+
*
|
|
49
|
+
* This component renders a specific event's feed.
|
|
50
|
+
|
|
51
|
+
#### Import
|
|
52
|
+
|
|
53
|
+
```jsx
|
|
54
|
+
import {EventFeed} from '@selfcommunity/react-templates';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Component Name
|
|
58
|
+
|
|
59
|
+
The name `SCEventFeedTemplate` can be used when providing style overrides in the theme.
|
|
60
|
+
|
|
61
|
+
#### CSS
|
|
62
|
+
|
|
63
|
+
|Rule Name|Global class|Description|
|
|
64
|
+
|---|---|---|
|
|
65
|
+
|root|.SCEventFeedTemplate-root|Styles applied to the root element.|
|
|
66
|
+
*
|
|
67
|
+
* @param inProps
|
|
68
|
+
*/
|
|
69
|
+
export default function EventFeed(inProps: EventFeedProps): JSX.Element;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
7
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
8
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
9
|
+
const types_1 = require("@selfcommunity/types");
|
|
10
|
+
const system_1 = require("@mui/system");
|
|
11
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
12
|
+
const react_intl_1 = require("react-intl");
|
|
13
|
+
const notistack_1 = require("notistack");
|
|
14
|
+
const constants_1 = require("./constants");
|
|
15
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
16
|
+
const classes = {
|
|
17
|
+
root: `${constants_1.PREFIX}-root`
|
|
18
|
+
};
|
|
19
|
+
const Root = (0, styles_1.styled)(react_ui_1.Feed, {
|
|
20
|
+
name: constants_1.PREFIX,
|
|
21
|
+
slot: 'Root'
|
|
22
|
+
})(() => ({}));
|
|
23
|
+
// Widgets for feed
|
|
24
|
+
const WIDGETS = [
|
|
25
|
+
{
|
|
26
|
+
type: 'widget',
|
|
27
|
+
component: react_ui_1.EventLocationWidget,
|
|
28
|
+
componentProps: {},
|
|
29
|
+
column: 'right',
|
|
30
|
+
position: 0
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* > API documentation for the Community-JS Group Feed Template. Learn about the available props and the CSS API.
|
|
35
|
+
*
|
|
36
|
+
*
|
|
37
|
+
* This component renders a specific event's feed.
|
|
38
|
+
|
|
39
|
+
#### Import
|
|
40
|
+
|
|
41
|
+
```jsx
|
|
42
|
+
import {EventFeed} from '@selfcommunity/react-templates';
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
#### Component Name
|
|
46
|
+
|
|
47
|
+
The name `SCEventFeedTemplate` can be used when providing style overrides in the theme.
|
|
48
|
+
|
|
49
|
+
#### CSS
|
|
50
|
+
|
|
51
|
+
|Rule Name|Global class|Description|
|
|
52
|
+
|---|---|---|
|
|
53
|
+
|root|.SCEventFeedTemplate-root|Styles applied to the root element.|
|
|
54
|
+
*
|
|
55
|
+
* @param inProps
|
|
56
|
+
*/
|
|
57
|
+
function EventFeed(inProps) {
|
|
58
|
+
// PROPS
|
|
59
|
+
const props = (0, system_1.useThemeProps)({
|
|
60
|
+
props: inProps,
|
|
61
|
+
name: constants_1.PREFIX
|
|
62
|
+
});
|
|
63
|
+
const { id = 'event_feed', className, event, eventId, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
|
|
64
|
+
// CONTEXT
|
|
65
|
+
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
66
|
+
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
67
|
+
// REF
|
|
68
|
+
const feedRef = (0, react_1.useRef)();
|
|
69
|
+
// Hooks
|
|
70
|
+
const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
|
|
71
|
+
// HANDLERS
|
|
72
|
+
const handleComposerSuccess = (feedObject) => {
|
|
73
|
+
var _a;
|
|
74
|
+
enqueueSnackbar(react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
|
|
75
|
+
action: (snackbarId) => (react_1.default.createElement(react_core_1.Link, { to: scRoutingContext.url(react_core_1.SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], react_ui_1.ContributionUtils.getRouteData(feedObject)) },
|
|
76
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }))),
|
|
77
|
+
variant: 'success',
|
|
78
|
+
autoHideDuration: 7000
|
|
79
|
+
});
|
|
80
|
+
if (((_a = feedObject.event) === null || _a === void 0 ? void 0 : _a.id) === scEvent.id) {
|
|
81
|
+
// Hydrate feedUnit
|
|
82
|
+
const feedUnit = {
|
|
83
|
+
type: feedObject.type,
|
|
84
|
+
[feedObject.type]: feedObject,
|
|
85
|
+
seen_by_id: [],
|
|
86
|
+
has_boost: false
|
|
87
|
+
};
|
|
88
|
+
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
// WIDGETS
|
|
92
|
+
const _widgets = (0, react_1.useMemo)(() => widgets.map((w) => {
|
|
93
|
+
if (scEvent) {
|
|
94
|
+
return Object.assign(Object.assign({}, w), { componentProps: Object.assign(Object.assign({}, w.componentProps), { eventId: scEvent.id }) });
|
|
95
|
+
}
|
|
96
|
+
return w;
|
|
97
|
+
}), [widgets, scEvent]);
|
|
98
|
+
if (!scEvent) {
|
|
99
|
+
return react_1.default.createElement(Skeleton_1.default, null);
|
|
100
|
+
}
|
|
101
|
+
else if (scEvent &&
|
|
102
|
+
scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.SUBSCRIBED &&
|
|
103
|
+
scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.GOING &&
|
|
104
|
+
scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.NOT_GOING) {
|
|
105
|
+
return react_1.default.createElement(react_ui_1.EventInfoWidget, { className: classes.root, event: scEvent });
|
|
106
|
+
}
|
|
107
|
+
return (react_1.default.createElement(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), id: id, ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.GetEventFeed), { url: () => api_services_1.Endpoints.GetEventFeed.url({ id: scEvent.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => {
|
|
108
|
+
var _a;
|
|
109
|
+
return ({
|
|
110
|
+
feedObject: item[item.type],
|
|
111
|
+
feedObjectType: item.type,
|
|
112
|
+
feedObjectActivities: item.activities ? item.activities : null,
|
|
113
|
+
markRead: scUser ? !((_a = item === null || item === void 0 ? void 0 : item.seen_by_id) === null || _a === void 0 ? void 0 : _a.includes(scUser.id)) : null
|
|
114
|
+
});
|
|
115
|
+
}, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
116
|
+
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
117
|
+
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: react_1.default.createElement(react_1.default.Fragment, null,
|
|
118
|
+
react_1.default.createElement(react_ui_1.EventInfoWidget, { className: classes.root, event: scEvent }),
|
|
119
|
+
scEvent && scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.SUBSCRIBED && (react_1.default.createElement(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess,
|
|
120
|
+
// defaultValue={{event: scEvent}}
|
|
121
|
+
label: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "templates.eventFeed.composer.label", defaultMessage: "templates.eventFeed.composer.label" }), feedType: types_1.SCFeedTypologyType.EVENT }))), CustomAdvProps: { position: types_1.SCCustomAdvPosition.POSITION_FEED, groupsId: [scEvent.id] }, enabledCustomAdvPositions: [
|
|
122
|
+
types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
123
|
+
types_1.SCCustomAdvPosition.POSITION_FEED,
|
|
124
|
+
types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
125
|
+
] }, FeedProps)));
|
|
126
|
+
}
|
|
127
|
+
exports.default = EventFeed;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* > API documentation for the Community-JS Group Feed Skeleton Template. Learn about the available props and the CSS API.
|
|
3
|
+
|
|
4
|
+
#### Import
|
|
5
|
+
|
|
6
|
+
```jsx
|
|
7
|
+
import {GroupFeedSkeleton} from '@selfcommunity/react-templates';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
#### Component Name
|
|
11
|
+
|
|
12
|
+
The name `SCGroupFeedTemplate-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|.SCGroupFeedTemplate-skeleton-root|Styles applied to the root element.|
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export default function EventFeedSkeleton(): JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const classes = {
|
|
9
|
+
root: `${constants_1.PREFIX}-skeleton-root`
|
|
10
|
+
};
|
|
11
|
+
const Root = (0, styles_1.styled)(react_ui_1.FeedSkeleton, {
|
|
12
|
+
name: constants_1.PREFIX,
|
|
13
|
+
slot: 'SkeletonRoot'
|
|
14
|
+
})(() => ({}));
|
|
15
|
+
/**
|
|
16
|
+
* > API documentation for the Community-JS Group Feed Skeleton Template. Learn about the available props and the CSS API.
|
|
17
|
+
|
|
18
|
+
#### Import
|
|
19
|
+
|
|
20
|
+
```jsx
|
|
21
|
+
import {GroupFeedSkeleton} from '@selfcommunity/react-templates';
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
#### Component Name
|
|
25
|
+
|
|
26
|
+
The name `SCGroupFeedTemplate-skeleton-root` can be used when providing style overrides in the theme.
|
|
27
|
+
|
|
28
|
+
#### CSS
|
|
29
|
+
|
|
30
|
+
|Rule Name|Global class|Description|
|
|
31
|
+
|---|---|---|
|
|
32
|
+
|root|.SCGroupFeedTemplate-skeleton-root|Styles applied to the root element.|
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
function EventFeedSkeleton() {
|
|
36
|
+
return (react_1.default.createElement(Root, { className: classes.root, sidebar: react_1.default.createElement(react_1.default.Fragment, null,
|
|
37
|
+
react_1.default.createElement(react_ui_1.GenericSkeleton, { sx: { mb: 2 } }),
|
|
38
|
+
react_1.default.createElement(react_ui_1.GenericSkeleton, { sx: { mb: 2 } })) },
|
|
39
|
+
react_1.default.createElement(react_ui_1.InlineComposerWidgetSkeleton, null),
|
|
40
|
+
Array.from({ length: 5 }).map((e, i) => (react_1.default.createElement(react_ui_1.FeedObjectSkeleton, { key: i, template: react_ui_1.SCFeedObjectTemplateType.DETAIL })))));
|
|
41
|
+
}
|
|
42
|
+
exports.default = EventFeedSkeleton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCEventFeedTemplate";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventFeedSkeleton = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
6
|
+
exports.EventFeedSkeleton = Skeleton_1.default;
|
|
7
|
+
const EventFeed_1 = tslib_1.__importDefault(require("./EventFeed"));
|
|
8
|
+
exports.default = EventFeed_1.default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { FeedObjectProps, FeedSidebarProps, SCFeedWidgetType } from '@selfcommunity/react-ui';
|
|
2
|
+
import { SCEventType } from '@selfcommunity/types';
|
|
3
|
+
import { EventFeedProps } from '../EventFeed';
|
|
4
|
+
export interface EventProps {
|
|
5
|
+
/**
|
|
6
|
+
* Id of the feed object
|
|
7
|
+
* @default 'feed'
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Overrides or extends the styles applied to the component.
|
|
12
|
+
* @default null
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Event Object
|
|
17
|
+
* @default null
|
|
18
|
+
*/
|
|
19
|
+
event?: SCEventType;
|
|
20
|
+
/**
|
|
21
|
+
* Id of the event for filter the feed
|
|
22
|
+
* @default null
|
|
23
|
+
*/
|
|
24
|
+
eventId?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Widgets to be rendered into the feed
|
|
27
|
+
* @default []
|
|
28
|
+
*/
|
|
29
|
+
widgets?: SCFeedWidgetType[] | null;
|
|
30
|
+
/**
|
|
31
|
+
* Props to spread to single feed object
|
|
32
|
+
* @default empty object
|
|
33
|
+
*/
|
|
34
|
+
FeedObjectProps?: FeedObjectProps;
|
|
35
|
+
/**
|
|
36
|
+
* Props to spread to single feed object
|
|
37
|
+
* @default {top: 0, bottomBoundary: `#${id}`}
|
|
38
|
+
*/
|
|
39
|
+
FeedSidebarProps?: FeedSidebarProps;
|
|
40
|
+
/**
|
|
41
|
+
* Props to spread to EventFeed component
|
|
42
|
+
* @default {}
|
|
43
|
+
*/
|
|
44
|
+
EventFeedProps?: EventFeedProps;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* > API documentation for the Community-JS Category Template. Learn about the available props and the CSS API.
|
|
48
|
+
*
|
|
49
|
+
*
|
|
50
|
+
* This component renders a specific event's template.
|
|
51
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-templates/Components/Group)
|
|
52
|
+
|
|
53
|
+
#### Import
|
|
54
|
+
|
|
55
|
+
```jsx
|
|
56
|
+
import {Group} from '@selfcommunity/react-templates';
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Component Name
|
|
60
|
+
|
|
61
|
+
The name `SCGroupTemplate` can be used when providing style overrides in the theme.
|
|
62
|
+
|
|
63
|
+
#### CSS
|
|
64
|
+
|
|
65
|
+
|Rule Name|Global class|Description|
|
|
66
|
+
|---|---|---|
|
|
67
|
+
|root|.SCGroupTemplate-root|Styles applied to the root element.|
|
|
68
|
+
|feed|.SCGroupTemplate-feed|Styles applied to the feed element.|
|
|
69
|
+
*
|
|
70
|
+
* @param inProps
|
|
71
|
+
*/
|
|
72
|
+
export default function Event(inProps: EventProps): JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import { EventHeader } from '@selfcommunity/react-ui';
|
|
5
|
+
import { useSCFetchEvent } from '@selfcommunity/react-core';
|
|
6
|
+
import EventSkeletonTemplate from './Skeleton';
|
|
7
|
+
import { useThemeProps } from '@mui/system';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import { PREFIX } from './constants';
|
|
10
|
+
import EventFeed from '../EventFeed';
|
|
11
|
+
const classes = {
|
|
12
|
+
root: `${PREFIX}-root`,
|
|
13
|
+
feed: `${PREFIX}-feed`
|
|
14
|
+
};
|
|
15
|
+
const Root = styled(Box, {
|
|
16
|
+
name: PREFIX,
|
|
17
|
+
slot: 'Root'
|
|
18
|
+
})(() => ({}));
|
|
19
|
+
/**
|
|
20
|
+
* > API documentation for the Community-JS Category Template. Learn about the available props and the CSS API.
|
|
21
|
+
*
|
|
22
|
+
*
|
|
23
|
+
* This component renders a specific event's template.
|
|
24
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-templates/Components/Group)
|
|
25
|
+
|
|
26
|
+
#### Import
|
|
27
|
+
|
|
28
|
+
```jsx
|
|
29
|
+
import {Group} from '@selfcommunity/react-templates';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
#### Component Name
|
|
33
|
+
|
|
34
|
+
The name `SCGroupTemplate` can be used when providing style overrides in the theme.
|
|
35
|
+
|
|
36
|
+
#### CSS
|
|
37
|
+
|
|
38
|
+
|Rule Name|Global class|Description|
|
|
39
|
+
|---|---|---|
|
|
40
|
+
|root|.SCGroupTemplate-root|Styles applied to the root element.|
|
|
41
|
+
|feed|.SCGroupTemplate-feed|Styles applied to the feed element.|
|
|
42
|
+
*
|
|
43
|
+
* @param inProps
|
|
44
|
+
*/
|
|
45
|
+
export default function Event(inProps) {
|
|
46
|
+
// PROPS
|
|
47
|
+
const props = useThemeProps({
|
|
48
|
+
props: inProps,
|
|
49
|
+
name: PREFIX
|
|
50
|
+
});
|
|
51
|
+
const { id = 'event', className, event, eventId, widgets, FeedObjectProps, FeedSidebarProps, EventFeedProps = {} } = props;
|
|
52
|
+
// HOOKS
|
|
53
|
+
const { scEvent, setSCEvent } = useSCFetchEvent({ id: eventId, event });
|
|
54
|
+
const handleSubscribe = (group, status) => {
|
|
55
|
+
setSCEvent(Object.assign({}, scEvent, { subscription_status: status }));
|
|
56
|
+
};
|
|
57
|
+
if (!scEvent) {
|
|
58
|
+
return React.createElement(EventSkeletonTemplate, null);
|
|
59
|
+
}
|
|
60
|
+
return (React.createElement(Root, { id: id, className: classNames(classes.root, className) },
|
|
61
|
+
React.createElement(EventHeader, { eventId: scEvent.id, GroupSubscribeButtonProps: { onSubscribe: handleSubscribe } }),
|
|
62
|
+
React.createElement(EventFeed, Object.assign({ className: classes.feed, event: scEvent, widgets: widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, EventFeedProps))));
|
|
63
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* > API documentation for the Community-JS Group Skeleton Template. Learn about the available props and the CSS API.
|
|
3
|
+
|
|
4
|
+
#### Import
|
|
5
|
+
|
|
6
|
+
```jsx
|
|
7
|
+
import {EventSkeletonTemplate} from '@selfcommunity/react-templates';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
#### Component Name
|
|
11
|
+
|
|
12
|
+
The name `SCEventTemplate-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|.SCEventTemplate-skeleton-root|Styles applied to the root element.|
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export default function EventSkeletonTemplate(): JSX.Element;
|