@selfcommunity/react-templates 0.3.56-alpha.0 → 0.4.0-alpha.0
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/Category/Category.js +3 -5
- package/lib/cjs/components/Category/Skeleton.js +2 -4
- package/lib/cjs/components/CategoryFeed/CategoryFeed.js +7 -7
- package/lib/cjs/components/CategoryFeed/Skeleton.js +2 -5
- package/lib/cjs/components/Event/Event.d.ts +77 -0
- package/lib/cjs/components/Event/Event.js +62 -0
- package/lib/cjs/components/Event/Skeleton.d.ts +21 -0
- package/lib/cjs/components/Event/Skeleton.js +40 -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 +146 -0
- package/lib/cjs/components/EventFeed/Skeleton.d.ts +21 -0
- package/lib/cjs/components/EventFeed/Skeleton.js +39 -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/cjs/components/ExploreFeed/ExploreFeed.js +23 -4
- package/lib/cjs/components/ExploreFeed/Skeleton.js +2 -5
- package/lib/cjs/components/FeedObjectDetail/FeedObjectDetail.js +6 -15
- package/lib/cjs/components/FeedObjectDetail/Skeleton.js +2 -9
- package/lib/cjs/components/Group/Group.js +3 -5
- package/lib/cjs/components/Group/Skeleton.js +2 -4
- package/lib/cjs/components/GroupFeed/GroupFeed.js +8 -8
- package/lib/cjs/components/GroupFeed/Skeleton.js +2 -5
- package/lib/cjs/components/LoyaltyProgramDetail/LoyaltyProgramDetail.js +6 -35
- package/lib/cjs/components/LoyaltyProgramDetail/PointsList.js +4 -17
- package/lib/cjs/components/LoyaltyProgramDetail/PrizeItemSkeleton.js +2 -14
- package/lib/cjs/components/LoyaltyProgramDetail/Skeleton.js +2 -16
- package/lib/cjs/components/MainFeed/MainFeed.js +21 -4
- package/lib/cjs/components/MainFeed/Skeleton.js +2 -5
- package/lib/cjs/components/NotificationFeed/NotificationFeed.js +3 -2
- package/lib/cjs/components/NotificationFeed/Skeleton.js +2 -3
- package/lib/cjs/components/UserFeed/Skeleton.js +2 -5
- package/lib/cjs/components/UserFeed/UserFeed.js +6 -5
- package/lib/cjs/components/UserProfile/Skeleton.js +2 -4
- package/lib/cjs/components/UserProfile/UserProfile.js +13 -30
- package/lib/cjs/index.d.ts +4 -2
- package/lib/cjs/index.js +10 -4
- package/lib/esm/components/Category/Category.js +3 -5
- package/lib/esm/components/Category/Skeleton.js +2 -4
- package/lib/esm/components/CategoryFeed/CategoryFeed.js +7 -7
- package/lib/esm/components/CategoryFeed/Skeleton.js +2 -5
- package/lib/esm/components/Event/Event.d.ts +77 -0
- package/lib/esm/components/Event/Event.js +58 -0
- package/lib/esm/components/Event/Skeleton.d.ts +21 -0
- package/lib/esm/components/Event/Skeleton.js +36 -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 +142 -0
- package/lib/esm/components/EventFeed/Skeleton.d.ts +21 -0
- package/lib/esm/components/EventFeed/Skeleton.js +35 -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/esm/components/ExploreFeed/ExploreFeed.js +24 -5
- package/lib/esm/components/ExploreFeed/Skeleton.js +2 -5
- package/lib/esm/components/FeedObjectDetail/FeedObjectDetail.js +6 -15
- package/lib/esm/components/FeedObjectDetail/Skeleton.js +2 -8
- package/lib/esm/components/Group/Group.js +3 -5
- package/lib/esm/components/Group/Skeleton.js +2 -4
- package/lib/esm/components/GroupFeed/GroupFeed.js +8 -8
- package/lib/esm/components/GroupFeed/Skeleton.js +2 -5
- package/lib/esm/components/LoyaltyProgramDetail/LoyaltyProgramDetail.js +6 -35
- package/lib/esm/components/LoyaltyProgramDetail/PointsList.js +4 -17
- package/lib/esm/components/LoyaltyProgramDetail/PrizeItemSkeleton.js +2 -13
- package/lib/esm/components/LoyaltyProgramDetail/Skeleton.js +2 -16
- package/lib/esm/components/MainFeed/MainFeed.js +23 -6
- package/lib/esm/components/MainFeed/Skeleton.js +2 -5
- package/lib/esm/components/NotificationFeed/NotificationFeed.js +3 -2
- package/lib/esm/components/NotificationFeed/Skeleton.js +2 -3
- package/lib/esm/components/UserFeed/Skeleton.js +2 -5
- package/lib/esm/components/UserFeed/UserFeed.js +6 -5
- package/lib/esm/components/UserProfile/Skeleton.js +2 -4
- package/lib/esm/components/UserProfile/UserProfile.js +13 -30
- package/lib/esm/index.d.ts +4 -2
- package/lib/esm/index.js +4 -2
- package/lib/umd/341.js +2 -0
- package/lib/umd/{138.js.LICENSE.txt → 341.js.LICENSE.txt} +15 -0
- package/lib/umd/react-templates.js +1 -1
- package/package.json +6 -6
- package/lib/umd/138.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const styles_1 = require("@mui/material/styles");
|
|
6
6
|
const material_1 = require("@mui/material");
|
|
7
7
|
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
@@ -55,10 +55,8 @@ function Category(inProps) {
|
|
|
55
55
|
// Hooks
|
|
56
56
|
const { scCategory } = (0, react_core_1.useSCFetchCategory)({ id: categoryId, category });
|
|
57
57
|
if (!scCategory) {
|
|
58
|
-
return
|
|
58
|
+
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
59
59
|
}
|
|
60
|
-
return (
|
|
61
|
-
react_1.default.createElement(react_ui_1.CategoryHeader, { category: scCategory }),
|
|
62
|
-
react_1.default.createElement(CategoryFeed_1.default, Object.assign({ className: classes.feed, category: scCategory, widgets: widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, CategoryFeedProps))));
|
|
60
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.CategoryHeader, { category: scCategory }), (0, jsx_runtime_1.jsx)(CategoryFeed_1.default, Object.assign({ className: classes.feed, category: scCategory, widgets: widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, CategoryFeedProps))] })));
|
|
63
61
|
}
|
|
64
62
|
exports.default = Category;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const styles_1 = require("@mui/material/styles");
|
|
7
7
|
const Skeleton_1 = tslib_1.__importDefault(require("../CategoryFeed/Skeleton"));
|
|
@@ -35,8 +35,6 @@ const Root = (0, styles_1.styled)(material_1.Box, {
|
|
|
35
35
|
*
|
|
36
36
|
*/
|
|
37
37
|
function CategorySkeleton() {
|
|
38
|
-
return (
|
|
39
|
-
react_1.default.createElement(react_ui_1.CategoryHeaderSkeleton, null),
|
|
40
|
-
react_1.default.createElement(Skeleton_1.default, null)));
|
|
38
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.CategoryHeaderSkeleton, {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, {})] })));
|
|
41
39
|
}
|
|
42
40
|
exports.default = CategorySkeleton;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
5
6
|
const styles_1 = require("@mui/material/styles");
|
|
6
7
|
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
7
8
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
@@ -80,9 +81,8 @@ function CategoryFeed(inProps) {
|
|
|
80
81
|
const handleComposerSuccess = (feedObject) => {
|
|
81
82
|
// Not insert if the category does not match
|
|
82
83
|
if (feedObject.categories.findIndex((c) => c.id === scCategory.id) === -1) {
|
|
83
|
-
enqueueSnackbar(
|
|
84
|
-
action: (snackbarId) => (
|
|
85
|
-
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }))),
|
|
84
|
+
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
|
|
85
|
+
action: (snackbarId) => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], react_ui_1.ContributionUtils.getRouteData(feedObject)) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }) }))),
|
|
86
86
|
variant: 'success',
|
|
87
87
|
autoHideDuration: 7000
|
|
88
88
|
});
|
|
@@ -105,16 +105,16 @@ function CategoryFeed(inProps) {
|
|
|
105
105
|
return w;
|
|
106
106
|
}), [widgets, scCategory]);
|
|
107
107
|
if (!scCategory) {
|
|
108
|
-
return
|
|
108
|
+
return (0, jsx_runtime_1.jsx)(index_1.CategoryFeedSkeleton, {});
|
|
109
109
|
}
|
|
110
|
-
return (
|
|
110
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className), ref: feedRef, endpoint: Object.assign(Object.assign({}, api_services_1.Endpoints.CategoryFeed), { url: () => api_services_1.Endpoints.CategoryFeed.url({ id: scCategory.id }) }), widgets: _widgets, ItemComponent: react_ui_1.FeedObject, itemPropsGenerator: (scUser, item) => ({
|
|
111
111
|
feedObject: item[item.type],
|
|
112
112
|
feedObjectType: item.type,
|
|
113
113
|
feedObjectActivities: item.activities ? item.activities : null,
|
|
114
114
|
markRead: scUser ? !item.seen_by_id.includes(scUser.id) : null
|
|
115
115
|
}), itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
116
116
|
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
117
|
-
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent:
|
|
117
|
+
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { categories: [scCategory] }, feedType: types_1.SCFeedTypologyType.CATEGORY }), CustomAdvProps: { categoriesId: [scCategory.id] }, enabledCustomAdvPositions: [
|
|
118
118
|
types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
119
119
|
types_1.SCCustomAdvPosition.POSITION_FEED,
|
|
120
120
|
types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
6
|
const styles_1 = require("@mui/material/styles");
|
|
6
7
|
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
@@ -33,10 +34,6 @@ const Root = (0, styles_1.styled)(react_ui_1.FeedSkeleton, {
|
|
|
33
34
|
*
|
|
34
35
|
*/
|
|
35
36
|
function CategoryFeedSkeleton() {
|
|
36
|
-
return (
|
|
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 })))));
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root, sidebar: (0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.GenericSkeleton, { sx: { mb: 2 } }), (0, jsx_runtime_1.jsx)(react_ui_1.GenericSkeleton, { sx: { mb: 2 } })] }) }, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidgetSkeleton, {}), Array.from({ length: 5 }).map((e, i) => ((0, jsx_runtime_1.jsx)(react_ui_1.FeedObjectSkeleton, { template: react_ui_1.SCFeedObjectTemplateType.DETAIL }, i)))] })));
|
|
41
38
|
}
|
|
42
39
|
exports.default = CategoryFeedSkeleton;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { FeedObjectProps, FeedSidebarProps, SCFeedWidgetType, EventHeaderProps } 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
|
+
* Props to spread EventHeader component
|
|
47
|
+
* @default {}
|
|
48
|
+
*/
|
|
49
|
+
EventHeaderProps?: EventHeaderProps;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* > API documentation for the Community-JS Category Template. Learn about the available props and the CSS API.
|
|
53
|
+
*
|
|
54
|
+
*
|
|
55
|
+
* This component renders a specific event's template.
|
|
56
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-templates/Components/Group)
|
|
57
|
+
|
|
58
|
+
#### Import
|
|
59
|
+
|
|
60
|
+
```jsx
|
|
61
|
+
import {Group} from '@selfcommunity/react-templates';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Component Name
|
|
65
|
+
|
|
66
|
+
The name `SCGroupTemplate` can be used when providing style overrides in the theme.
|
|
67
|
+
|
|
68
|
+
#### CSS
|
|
69
|
+
|
|
70
|
+
|Rule Name|Global class|Description|
|
|
71
|
+
|---|---|---|
|
|
72
|
+
|root|.SCGroupTemplate-root|Styles applied to the root element.|
|
|
73
|
+
|feed|.SCGroupTemplate-feed|Styles applied to the feed element.|
|
|
74
|
+
*
|
|
75
|
+
* @param inProps
|
|
76
|
+
*/
|
|
77
|
+
export default function Event(inProps: EventProps): JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
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 = {}, EventHeaderProps = {} } = props;
|
|
55
|
+
// HOOKS
|
|
56
|
+
const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
|
|
57
|
+
if (!scEvent) {
|
|
58
|
+
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
59
|
+
}
|
|
60
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.EventHeader, Object.assign({ event: scEvent }, EventHeaderProps)), (0, jsx_runtime_1.jsx)(EventFeed_1.default, Object.assign({ className: classes.feed, event: scEvent, widgets: widgets, FeedObjectProps: FeedObjectProps, FeedSidebarProps: FeedSidebarProps }, EventFeedProps))] })));
|
|
61
|
+
}
|
|
62
|
+
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,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
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 ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root }, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.EventHeaderSkeleton, {}), (0, jsx_runtime_1.jsx)(Skeleton_1.default, {})] })));
|
|
39
|
+
}
|
|
40
|
+
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,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
8
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
9
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
10
|
+
const types_1 = require("@selfcommunity/types");
|
|
11
|
+
const system_1 = require("@mui/system");
|
|
12
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
13
|
+
const react_intl_1 = require("react-intl");
|
|
14
|
+
const notistack_1 = require("notistack");
|
|
15
|
+
const constants_1 = require("./constants");
|
|
16
|
+
const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
|
|
17
|
+
const material_1 = require("@mui/material");
|
|
18
|
+
const classes = {
|
|
19
|
+
root: `${constants_1.PREFIX}-root`
|
|
20
|
+
};
|
|
21
|
+
const Root = (0, styles_1.styled)(react_ui_1.Feed, {
|
|
22
|
+
name: constants_1.PREFIX,
|
|
23
|
+
slot: 'Root'
|
|
24
|
+
})(() => ({}));
|
|
25
|
+
// Widgets for feed
|
|
26
|
+
const WIDGETS = [
|
|
27
|
+
{
|
|
28
|
+
type: 'widget',
|
|
29
|
+
component: react_ui_1.EventLocationWidget,
|
|
30
|
+
componentProps: {},
|
|
31
|
+
column: 'right',
|
|
32
|
+
position: 0
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'widget',
|
|
36
|
+
component: react_ui_1.EventMembersWidget,
|
|
37
|
+
componentProps: {},
|
|
38
|
+
column: 'right',
|
|
39
|
+
position: 1
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: 'widget',
|
|
43
|
+
component: react_ui_1.RelatedEventsWidget,
|
|
44
|
+
componentProps: {},
|
|
45
|
+
column: 'right',
|
|
46
|
+
position: 2
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
/**
|
|
50
|
+
* > API documentation for the Community-JS Group Feed Template. Learn about the available props and the CSS API.
|
|
51
|
+
*
|
|
52
|
+
*
|
|
53
|
+
* This component renders a specific event's feed.
|
|
54
|
+
|
|
55
|
+
#### Import
|
|
56
|
+
|
|
57
|
+
```jsx
|
|
58
|
+
import {EventFeed} from '@selfcommunity/react-templates';
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### Component Name
|
|
62
|
+
|
|
63
|
+
The name `SCEventFeedTemplate` can be used when providing style overrides in the theme.
|
|
64
|
+
|
|
65
|
+
#### CSS
|
|
66
|
+
|
|
67
|
+
|Rule Name|Global class|Description|
|
|
68
|
+
|---|---|---|
|
|
69
|
+
|root|.SCEventFeedTemplate-root|Styles applied to the root element.|
|
|
70
|
+
*
|
|
71
|
+
* @param inProps
|
|
72
|
+
*/
|
|
73
|
+
function EventFeed(inProps) {
|
|
74
|
+
// PROPS
|
|
75
|
+
const props = (0, system_1.useThemeProps)({
|
|
76
|
+
props: inProps,
|
|
77
|
+
name: constants_1.PREFIX
|
|
78
|
+
});
|
|
79
|
+
const { id = 'event_feed', className, event, eventId, widgets = WIDGETS, FeedObjectProps = {}, FeedSidebarProps = null, FeedProps = {} } = props;
|
|
80
|
+
// CONTEXT
|
|
81
|
+
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
82
|
+
const scUserContext = (0, react_core_1.useSCUser)();
|
|
83
|
+
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
84
|
+
// REF
|
|
85
|
+
const feedRef = (0, react_1.useRef)();
|
|
86
|
+
// Hooks
|
|
87
|
+
const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
|
|
88
|
+
// HANDLERS
|
|
89
|
+
const handleComposerSuccess = (feedObject) => {
|
|
90
|
+
var _a;
|
|
91
|
+
enqueueSnackbar((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.success", defaultMessage: "ui.composerIconButton.composer.success" }), {
|
|
92
|
+
action: (snackbarId) => ((0, jsx_runtime_1.jsx)(react_core_1.Link, Object.assign({ to: scRoutingContext.url(react_core_1.SCRoutes[`${feedObject.type.toUpperCase()}_ROUTE_NAME`], react_ui_1.ContributionUtils.getRouteData(feedObject)) }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.composerIconButton.composer.viewContribute", defaultMessage: "ui.composerIconButton.composer.viewContribute" }) }))),
|
|
93
|
+
variant: 'success',
|
|
94
|
+
autoHideDuration: 7000
|
|
95
|
+
});
|
|
96
|
+
if (((_a = feedObject.event) === null || _a === void 0 ? void 0 : _a.id) === scEvent.id) {
|
|
97
|
+
// Hydrate feedUnit
|
|
98
|
+
const feedUnit = {
|
|
99
|
+
type: feedObject.type,
|
|
100
|
+
[feedObject.type]: feedObject,
|
|
101
|
+
seen_by_id: [],
|
|
102
|
+
has_boost: false
|
|
103
|
+
};
|
|
104
|
+
feedRef && feedRef.current && feedRef.current.addFeedData(feedUnit, true);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
// WIDGETS
|
|
108
|
+
const _widgets = (0, react_1.useMemo)(() => widgets.map((w) => {
|
|
109
|
+
if (scEvent) {
|
|
110
|
+
return Object.assign(Object.assign({}, w), { componentProps: Object.assign(Object.assign({}, w.componentProps), { eventId: scEvent.id }) });
|
|
111
|
+
}
|
|
112
|
+
return w;
|
|
113
|
+
}), [widgets, scEvent]);
|
|
114
|
+
if (!scEvent) {
|
|
115
|
+
return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
|
|
116
|
+
}
|
|
117
|
+
else if (scEvent.privacy === types_1.SCEventPrivacyType.PRIVATE &&
|
|
118
|
+
scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.SUBSCRIBED &&
|
|
119
|
+
scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.INVITED &&
|
|
120
|
+
scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.GOING &&
|
|
121
|
+
scEvent.subscription_status !== types_1.SCEventSubscriptionStatusType.NOT_GOING) {
|
|
122
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(react_ui_1.EventInfoWidget, { className: classes.root, event: scEvent }) })));
|
|
123
|
+
}
|
|
124
|
+
return ((0, jsx_runtime_1.jsx)(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) => {
|
|
125
|
+
var _a;
|
|
126
|
+
return ({
|
|
127
|
+
feedObject: item[item.type],
|
|
128
|
+
feedObjectType: item.type,
|
|
129
|
+
feedObjectActivities: item.activities ? item.activities : null,
|
|
130
|
+
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
|
|
131
|
+
});
|
|
132
|
+
}, itemIdGenerator: (item) => item[item.type].id, ItemProps: FeedObjectProps, ItemSkeleton: react_ui_1.FeedObjectSkeleton, ItemSkeletonProps: {
|
|
133
|
+
template: react_ui_1.SCFeedObjectTemplateType.PREVIEW
|
|
134
|
+
}, FeedSidebarProps: FeedSidebarProps, HeaderComponent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.EventInfoWidget, { className: classes.root, event: scEvent }), Boolean(scEvent &&
|
|
135
|
+
((!scUserContext.user && scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC) ||
|
|
136
|
+
(scUserContext.user &&
|
|
137
|
+
(scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.SUBSCRIBED ||
|
|
138
|
+
scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.INVITED ||
|
|
139
|
+
scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.GOING ||
|
|
140
|
+
scEvent.subscription_status === types_1.SCEventSubscriptionStatusType.NOT_GOING)))) && ((0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidget, { onSuccess: handleComposerSuccess, defaultValue: { event: scEvent }, label: (0, jsx_runtime_1.jsx)(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: [
|
|
141
|
+
types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR,
|
|
142
|
+
types_1.SCCustomAdvPosition.POSITION_FEED,
|
|
143
|
+
types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR
|
|
144
|
+
] }, FeedProps)));
|
|
145
|
+
}
|
|
146
|
+
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,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const react_ui_1 = require("@selfcommunity/react-ui");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const classes = {
|
|
10
|
+
root: `${constants_1.PREFIX}-skeleton-root`
|
|
11
|
+
};
|
|
12
|
+
const Root = (0, styles_1.styled)(react_ui_1.FeedSkeleton, {
|
|
13
|
+
name: constants_1.PREFIX,
|
|
14
|
+
slot: 'SkeletonRoot'
|
|
15
|
+
})(() => ({}));
|
|
16
|
+
/**
|
|
17
|
+
* > API documentation for the Community-JS Group Feed Skeleton Template. Learn about the available props and the CSS API.
|
|
18
|
+
|
|
19
|
+
#### Import
|
|
20
|
+
|
|
21
|
+
```jsx
|
|
22
|
+
import {GroupFeedSkeleton} from '@selfcommunity/react-templates';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
#### Component Name
|
|
26
|
+
|
|
27
|
+
The name `SCGroupFeedTemplate-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|.SCGroupFeedTemplate-skeleton-root|Styles applied to the root element.|
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
function EventFeedSkeleton() {
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: classes.root, sidebar: (0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.GenericSkeleton, { sx: { mb: 2 } }), (0, jsx_runtime_1.jsx)(react_ui_1.GenericSkeleton, { sx: { mb: 2 } })] }) }, { children: [(0, jsx_runtime_1.jsx)(react_ui_1.InlineComposerWidgetSkeleton, {}), Array.from({ length: 5 }).map((e, i) => ((0, jsx_runtime_1.jsx)(react_ui_1.FeedObjectSkeleton, { template: react_ui_1.SCFeedObjectTemplateType.DETAIL }, i)))] })));
|
|
38
|
+
}
|
|
39
|
+
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;
|