@selfcommunity/react-ui 0.7.9-alpha.1 → 0.7.9-alpha.2
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/ChangeGroupCover/ChangeGroupCover.d.ts +55 -0
- package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.js +117 -0
- package/lib/cjs/components/ChangeGroupCover/constants.d.ts +1 -0
- package/lib/cjs/components/ChangeGroupCover/constants.js +4 -0
- package/lib/cjs/components/ChangeGroupCover/index.d.ts +3 -0
- package/lib/cjs/components/ChangeGroupCover/index.js +5 -0
- package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.d.ts +57 -0
- package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.js +117 -0
- package/lib/cjs/components/ChangeGroupPicture/constants.d.ts +1 -0
- package/lib/cjs/components/ChangeGroupPicture/constants.js +4 -0
- package/lib/cjs/components/ChangeGroupPicture/index.d.ts +3 -0
- package/lib/cjs/components/ChangeGroupPicture/index.js +5 -0
- package/lib/cjs/components/CreateGroup/CreateGroup.d.ts +48 -0
- package/lib/cjs/components/CreateGroup/CreateGroup.js +187 -0
- package/lib/cjs/components/CreateGroup/constants.d.ts +1 -0
- package/lib/cjs/components/CreateGroup/constants.js +4 -0
- package/lib/cjs/components/CreateGroup/index.d.ts +3 -0
- package/lib/cjs/components/CreateGroup/index.js +5 -0
- package/lib/cjs/components/CreateGroupButton/CreateGroupButton.d.ts +38 -0
- package/lib/cjs/components/CreateGroupButton/CreateGroupButton.js +73 -0
- package/lib/cjs/components/CreateGroupButton/index.d.ts +3 -0
- package/lib/cjs/components/CreateGroupButton/index.js +5 -0
- package/lib/cjs/components/Group/Group.d.ts +67 -0
- package/lib/cjs/components/Group/Group.js +96 -0
- package/lib/cjs/components/Group/Skeleton.d.ts +22 -0
- package/lib/cjs/components/Group/Skeleton.js +42 -0
- package/lib/cjs/components/Group/constants.d.ts +1 -0
- package/lib/cjs/components/Group/constants.js +4 -0
- package/lib/cjs/components/Group/index.d.ts +4 -0
- package/lib/cjs/components/Group/index.js +8 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +83 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.js +137 -0
- package/lib/cjs/components/GroupHeader/Skeleton.d.ts +27 -0
- package/lib/cjs/components/GroupHeader/Skeleton.js +56 -0
- package/lib/cjs/components/GroupHeader/constants.d.ts +1 -0
- package/lib/cjs/components/GroupHeader/constants.js +4 -0
- package/lib/cjs/components/GroupHeader/index.d.ts +4 -0
- package/lib/cjs/components/GroupHeader/index.js +8 -0
- package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.d.ts +52 -0
- package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.js +100 -0
- package/lib/cjs/components/GroupInfoWidget/Skeleton.d.ts +21 -0
- package/lib/cjs/components/GroupInfoWidget/Skeleton.js +38 -0
- package/lib/cjs/components/GroupInfoWidget/constants.d.ts +1 -0
- package/lib/cjs/components/GroupInfoWidget/constants.js +4 -0
- package/lib/cjs/components/GroupInfoWidget/index.d.ts +4 -0
- package/lib/cjs/components/GroupInfoWidget/index.js +8 -0
- package/lib/cjs/components/GroupInviteButton/GroupInviteButton.d.ts +57 -0
- package/lib/cjs/components/GroupInviteButton/GroupInviteButton.js +259 -0
- package/lib/cjs/components/GroupInviteButton/index.d.ts +3 -0
- package/lib/cjs/components/GroupInviteButton/index.js +5 -0
- package/lib/cjs/components/GroupMembersButton/GroupMembersButton.d.ts +46 -0
- package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +135 -0
- package/lib/cjs/components/GroupMembersButton/index.d.ts +3 -0
- package/lib/cjs/components/GroupMembersButton/index.js +5 -0
- package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.d.ts +79 -0
- package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.js +194 -0
- package/lib/cjs/components/GroupMembersWidget/Skeleton.d.ts +22 -0
- package/lib/cjs/components/GroupMembersWidget/Skeleton.js +38 -0
- package/lib/cjs/components/GroupMembersWidget/constants.d.ts +1 -0
- package/lib/cjs/components/GroupMembersWidget/constants.js +4 -0
- package/lib/cjs/components/GroupMembersWidget/index.d.ts +4 -0
- package/lib/cjs/components/GroupMembersWidget/index.js +8 -0
- package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +79 -0
- package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +194 -0
- package/lib/cjs/components/GroupRequestsWidget/Skeleton.d.ts +22 -0
- package/lib/cjs/components/GroupRequestsWidget/Skeleton.js +38 -0
- package/lib/cjs/components/GroupRequestsWidget/constants.d.ts +1 -0
- package/lib/cjs/components/GroupRequestsWidget/constants.js +4 -0
- package/lib/cjs/components/GroupRequestsWidget/index.d.ts +4 -0
- package/lib/cjs/components/GroupRequestsWidget/index.js +8 -0
- package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +51 -0
- package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +117 -0
- package/lib/cjs/components/GroupSubscribeButton/index.d.ts +3 -0
- package/lib/cjs/components/GroupSubscribeButton/index.js +5 -0
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.d.ts +4 -0
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.js +2 -3
- package/lib/cjs/components/User/User.d.ts +12 -0
- package/lib/cjs/components/User/User.js +5 -3
- package/lib/cjs/constants/Group.d.ts +2 -0
- package/lib/cjs/constants/Group.js +5 -0
- package/lib/cjs/index.d.ts +13 -1
- package/lib/cjs/index.js +30 -2
- package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.d.ts +55 -0
- package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.js +114 -0
- package/lib/esm/components/ChangeGroupCover/constants.d.ts +1 -0
- package/lib/esm/components/ChangeGroupCover/constants.js +1 -0
- package/lib/esm/components/ChangeGroupCover/index.d.ts +3 -0
- package/lib/esm/components/ChangeGroupCover/index.js +2 -0
- package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.d.ts +57 -0
- package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.js +114 -0
- package/lib/esm/components/ChangeGroupPicture/constants.d.ts +1 -0
- package/lib/esm/components/ChangeGroupPicture/constants.js +1 -0
- package/lib/esm/components/ChangeGroupPicture/index.d.ts +3 -0
- package/lib/esm/components/ChangeGroupPicture/index.js +2 -0
- package/lib/esm/components/CreateGroup/CreateGroup.d.ts +48 -0
- package/lib/esm/components/CreateGroup/CreateGroup.js +184 -0
- package/lib/esm/components/CreateGroup/constants.d.ts +1 -0
- package/lib/esm/components/CreateGroup/constants.js +1 -0
- package/lib/esm/components/CreateGroup/index.d.ts +3 -0
- package/lib/esm/components/CreateGroup/index.js +2 -0
- package/lib/esm/components/CreateGroupButton/CreateGroupButton.d.ts +38 -0
- package/lib/esm/components/CreateGroupButton/CreateGroupButton.js +70 -0
- package/lib/esm/components/CreateGroupButton/index.d.ts +3 -0
- package/lib/esm/components/CreateGroupButton/index.js +2 -0
- package/lib/esm/components/Group/Group.d.ts +67 -0
- package/lib/esm/components/Group/Group.js +93 -0
- package/lib/esm/components/Group/Skeleton.d.ts +22 -0
- package/lib/esm/components/Group/Skeleton.js +38 -0
- package/lib/esm/components/Group/constants.d.ts +1 -0
- package/lib/esm/components/Group/constants.js +1 -0
- package/lib/esm/components/Group/index.d.ts +4 -0
- package/lib/esm/components/Group/index.js +4 -0
- package/lib/esm/components/GroupHeader/GroupHeader.d.ts +83 -0
- package/lib/esm/components/GroupHeader/GroupHeader.js +134 -0
- package/lib/esm/components/GroupHeader/Skeleton.d.ts +27 -0
- package/lib/esm/components/GroupHeader/Skeleton.js +53 -0
- package/lib/esm/components/GroupHeader/constants.d.ts +1 -0
- package/lib/esm/components/GroupHeader/constants.js +1 -0
- package/lib/esm/components/GroupHeader/index.d.ts +4 -0
- package/lib/esm/components/GroupHeader/index.js +4 -0
- package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.d.ts +52 -0
- package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.js +97 -0
- package/lib/esm/components/GroupInfoWidget/Skeleton.d.ts +21 -0
- package/lib/esm/components/GroupInfoWidget/Skeleton.js +34 -0
- package/lib/esm/components/GroupInfoWidget/constants.d.ts +1 -0
- package/lib/esm/components/GroupInfoWidget/constants.js +1 -0
- package/lib/esm/components/GroupInfoWidget/index.d.ts +4 -0
- package/lib/esm/components/GroupInfoWidget/index.js +4 -0
- package/lib/esm/components/GroupInviteButton/GroupInviteButton.d.ts +57 -0
- package/lib/esm/components/GroupInviteButton/GroupInviteButton.js +256 -0
- package/lib/esm/components/GroupInviteButton/index.d.ts +3 -0
- package/lib/esm/components/GroupInviteButton/index.js +2 -0
- package/lib/esm/components/GroupMembersButton/GroupMembersButton.d.ts +46 -0
- package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +132 -0
- package/lib/esm/components/GroupMembersButton/index.d.ts +3 -0
- package/lib/esm/components/GroupMembersButton/index.js +2 -0
- package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.d.ts +79 -0
- package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.js +191 -0
- package/lib/esm/components/GroupMembersWidget/Skeleton.d.ts +22 -0
- package/lib/esm/components/GroupMembersWidget/Skeleton.js +34 -0
- package/lib/esm/components/GroupMembersWidget/constants.d.ts +1 -0
- package/lib/esm/components/GroupMembersWidget/constants.js +1 -0
- package/lib/esm/components/GroupMembersWidget/index.d.ts +4 -0
- package/lib/esm/components/GroupMembersWidget/index.js +4 -0
- package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +79 -0
- package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +191 -0
- package/lib/esm/components/GroupRequestsWidget/Skeleton.d.ts +22 -0
- package/lib/esm/components/GroupRequestsWidget/Skeleton.js +34 -0
- package/lib/esm/components/GroupRequestsWidget/constants.d.ts +1 -0
- package/lib/esm/components/GroupRequestsWidget/constants.js +1 -0
- package/lib/esm/components/GroupRequestsWidget/index.d.ts +4 -0
- package/lib/esm/components/GroupRequestsWidget/index.js +4 -0
- package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +51 -0
- package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +114 -0
- package/lib/esm/components/GroupSubscribeButton/index.d.ts +3 -0
- package/lib/esm/components/GroupSubscribeButton/index.js +2 -0
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.d.ts +4 -0
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.js +3 -4
- package/lib/esm/components/User/User.d.ts +12 -0
- package/lib/esm/components/User/User.js +5 -3
- package/lib/esm/constants/Group.d.ts +2 -0
- package/lib/esm/constants/Group.js +2 -0
- package/lib/esm/index.d.ts +13 -1
- package/lib/esm/index.js +13 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React, { useEffect, useMemo, useReducer, useState } from 'react';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import List from '@mui/material/List';
|
|
5
|
+
import { Button, CardContent, ListItem, Typography, useMediaQuery, useTheme } from '@mui/material';
|
|
6
|
+
import Widget from '../Widget';
|
|
7
|
+
import { http, Endpoints, GroupService } from '@selfcommunity/api-services';
|
|
8
|
+
import { CacheStrategies, isInteger, Logger } from '@selfcommunity/utils';
|
|
9
|
+
import { SCCache, SCPreferences, useSCFetchGroup, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
10
|
+
import { actionWidgetTypes, dataWidgetReducer, stateWidgetInitializer } from '../../utils/widget';
|
|
11
|
+
import Skeleton from './Skeleton';
|
|
12
|
+
import { FormattedMessage } from 'react-intl';
|
|
13
|
+
import classNames from 'classnames';
|
|
14
|
+
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
15
|
+
import BaseDialog from '../../shared/BaseDialog';
|
|
16
|
+
import InfiniteScroll from '../../shared/InfiniteScroll';
|
|
17
|
+
import { useThemeProps } from '@mui/system';
|
|
18
|
+
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
19
|
+
import { PREFIX } from './constants';
|
|
20
|
+
import User, { UserSkeleton } from '../User';
|
|
21
|
+
const classes = {
|
|
22
|
+
root: `${PREFIX}-root`,
|
|
23
|
+
title: `${PREFIX}-title`,
|
|
24
|
+
noResults: `${PREFIX}-no-results`,
|
|
25
|
+
showMore: `${PREFIX}-show-more`,
|
|
26
|
+
dialogRoot: `${PREFIX}-dialog-root`,
|
|
27
|
+
endMessage: `${PREFIX}-end-message`
|
|
28
|
+
};
|
|
29
|
+
const Root = styled(Widget, {
|
|
30
|
+
name: PREFIX,
|
|
31
|
+
slot: 'Root'
|
|
32
|
+
})(() => ({}));
|
|
33
|
+
const DialogRoot = styled(BaseDialog, {
|
|
34
|
+
name: PREFIX,
|
|
35
|
+
slot: 'DialogRoot'
|
|
36
|
+
})(() => ({}));
|
|
37
|
+
/**
|
|
38
|
+
* > API documentation for the Community-JS Group Members Widget component. Learn about the available props and the CSS API.
|
|
39
|
+
*
|
|
40
|
+
*
|
|
41
|
+
* This component renders the list of the follows of the given group.
|
|
42
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/GroupMembers)
|
|
43
|
+
|
|
44
|
+
#### Import
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
import {GroupMembersWidget} from '@selfcommunity/react-ui';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Component Name
|
|
51
|
+
|
|
52
|
+
The name `SCGroupMembersWidget` can be used when providing style overrides in the theme.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
#### CSS
|
|
56
|
+
|
|
57
|
+
|Rule Name|Global class|Description|
|
|
58
|
+
|---|---|---|
|
|
59
|
+
|root|.SCGroupMembersWidget-root|Styles applied to the root element.|
|
|
60
|
+
|title|.SCGroupMembersWidget-title|Styles applied to the title element.|
|
|
61
|
+
|noResults|.SCGroupMembersWidget-no-results|Styles applied to no results section.|
|
|
62
|
+
|showMore|.SCGroupMembersWidget-show-more|Styles applied to show more button element.|
|
|
63
|
+
|dialogRoot|.SCGroupMembersWidget-dialog-root|Styles applied to the dialog root element.|
|
|
64
|
+
|endMessage|.SCGroupMembersWidget-end-message|Styles applied to the end message element.|
|
|
65
|
+
|
|
66
|
+
* @param inProps
|
|
67
|
+
*/
|
|
68
|
+
export default function GroupMembersWidget(inProps) {
|
|
69
|
+
// PROPS
|
|
70
|
+
const props = useThemeProps({
|
|
71
|
+
props: inProps,
|
|
72
|
+
name: PREFIX
|
|
73
|
+
});
|
|
74
|
+
const { groupId, group, autoHide = false, limit = 5, className, cacheStrategy = CacheStrategies.NETWORK_ONLY, onHeightChange, onStateChange, UserProps = {}, DialogProps = {} } = props, rest = __rest(props, ["groupId", "group", "autoHide", "limit", "className", "cacheStrategy", "onHeightChange", "onStateChange", "UserProps", "DialogProps"]);
|
|
75
|
+
// STATE
|
|
76
|
+
const [state, dispatch] = useReducer(dataWidgetReducer, {
|
|
77
|
+
isLoadingNext: false,
|
|
78
|
+
next: null,
|
|
79
|
+
cacheKey: SCCache.getWidgetStateCacheKey(SCCache.GROUP_MEMBERS_TOOLS_STATE_CACHE_PREFIX_KEY, isInteger(groupId) ? groupId : group.id),
|
|
80
|
+
cacheStrategy,
|
|
81
|
+
visibleItems: limit
|
|
82
|
+
}, stateWidgetInitializer);
|
|
83
|
+
const [openDialog, setOpenDialog] = useState(false);
|
|
84
|
+
// CONTEXT
|
|
85
|
+
const scUserContext = useSCUser();
|
|
86
|
+
const scPreferencesContext = useSCPreferences();
|
|
87
|
+
const { scGroup } = useSCFetchGroup({ id: groupId, group });
|
|
88
|
+
// MEMO
|
|
89
|
+
const contentAvailability = useMemo(() => SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY in scPreferencesContext.preferences &&
|
|
90
|
+
scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value, [scPreferencesContext.preferences]);
|
|
91
|
+
// HOOKS
|
|
92
|
+
const theme = useTheme();
|
|
93
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
94
|
+
/**
|
|
95
|
+
* Initialize component
|
|
96
|
+
* Fetch data only if the component is not initialized and it is not loading data
|
|
97
|
+
*/
|
|
98
|
+
const _initComponent = useMemo(() => () => {
|
|
99
|
+
if (!state.initialized && !state.isLoadingNext) {
|
|
100
|
+
dispatch({ type: actionWidgetTypes.LOADING_NEXT });
|
|
101
|
+
GroupService.getGroupMembers(scGroup.id, { limit })
|
|
102
|
+
.then((payload) => {
|
|
103
|
+
dispatch({ type: actionWidgetTypes.LOAD_NEXT_SUCCESS, payload: Object.assign(Object.assign({}, payload), { initialized: true }) });
|
|
104
|
+
})
|
|
105
|
+
.catch((error) => {
|
|
106
|
+
dispatch({ type: actionWidgetTypes.LOAD_NEXT_FAILURE, payload: { errorLoadNext: error } });
|
|
107
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, [state.isLoadingNext, state.initialized, scGroup, limit, dispatch]);
|
|
111
|
+
// EFFECTS
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
var _a;
|
|
114
|
+
let _t;
|
|
115
|
+
if ((contentAvailability || (!contentAvailability && ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id))) && scGroup && scUserContext.user !== undefined) {
|
|
116
|
+
_t = setTimeout(_initComponent);
|
|
117
|
+
return () => {
|
|
118
|
+
_t && clearTimeout(_t);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}, [scUserContext.user, contentAvailability, scGroup]);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (openDialog && state.next && state.results.length === limit && state.initialized) {
|
|
124
|
+
dispatch({ type: actionWidgetTypes.LOADING_NEXT });
|
|
125
|
+
GroupService.getGroupMembers(scGroup.id, { offset: limit, limit: 10 })
|
|
126
|
+
.then((payload) => {
|
|
127
|
+
dispatch({ type: actionWidgetTypes.LOAD_NEXT_SUCCESS, payload: payload });
|
|
128
|
+
})
|
|
129
|
+
.catch((error) => {
|
|
130
|
+
dispatch({ type: actionWidgetTypes.LOAD_NEXT_FAILURE, payload: { errorLoadNext: error } });
|
|
131
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}, [openDialog, state.next, state.results.length, state.initialized, limit]);
|
|
135
|
+
/**
|
|
136
|
+
* Virtual feed update
|
|
137
|
+
*/
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
onHeightChange && onHeightChange();
|
|
140
|
+
}, [state.results]);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (!scGroup || (!contentAvailability && !scUserContext.user)) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
else if (cacheStrategy === CacheStrategies.NETWORK_ONLY) {
|
|
146
|
+
onStateChange && onStateChange({ cacheStrategy: CacheStrategies.CACHE_FIRST });
|
|
147
|
+
}
|
|
148
|
+
}, [scUserContext.user, scGroup, contentAvailability]);
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
if (!scGroup || !scUserContext.user || !state.initialized) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
}, []);
|
|
154
|
+
// HANDLERS
|
|
155
|
+
const handleNext = useMemo(() => () => {
|
|
156
|
+
dispatch({ type: actionWidgetTypes.LOADING_NEXT });
|
|
157
|
+
http
|
|
158
|
+
.request({
|
|
159
|
+
url: state.next,
|
|
160
|
+
method: Endpoints.GetGroupSubscribers.method
|
|
161
|
+
})
|
|
162
|
+
.then((res) => {
|
|
163
|
+
dispatch({ type: actionWidgetTypes.LOAD_NEXT_SUCCESS, payload: res.data });
|
|
164
|
+
});
|
|
165
|
+
}, [dispatch, state.next, state.isLoadingNext, state.initialized]);
|
|
166
|
+
const handleToggleDialogOpen = () => {
|
|
167
|
+
setOpenDialog((prev) => !prev);
|
|
168
|
+
};
|
|
169
|
+
// RENDER
|
|
170
|
+
if ((autoHide && !state.count && state.initialized) || (!contentAvailability && !scUserContext.user) || !scGroup) {
|
|
171
|
+
return React.createElement(HiddenPlaceholder, null);
|
|
172
|
+
}
|
|
173
|
+
if (!state.initialized) {
|
|
174
|
+
return React.createElement(Skeleton, null);
|
|
175
|
+
}
|
|
176
|
+
const content = (React.createElement(CardContent, null,
|
|
177
|
+
React.createElement(Typography, { className: classes.title, variant: "h5" },
|
|
178
|
+
React.createElement(FormattedMessage, { id: "ui.groupMembersWidget.title", defaultMessage: "ui.groupMembersWidget.title" })),
|
|
179
|
+
!state.count ? (React.createElement(Typography, { className: classes.noResults, variant: "body2" },
|
|
180
|
+
React.createElement(FormattedMessage, { id: "ui.groupMembersWidget.subtitle.noResults", defaultMessage: "" }))) : (React.createElement(React.Fragment, null,
|
|
181
|
+
React.createElement(List, null, state.results.slice(0, state.visibleItems).map((user) => (React.createElement(ListItem, { key: user.id },
|
|
182
|
+
React.createElement(User, { elevation: 0, actions: React.createElement(React.Fragment, null), user: user, userId: user.id, buttonProps: { onClick: () => console.log(user) } }))))),
|
|
183
|
+
state.count > state.visibleItems && (React.createElement(Button, { className: classes.showMore, onClick: handleToggleDialogOpen },
|
|
184
|
+
React.createElement(FormattedMessage, { id: "ui.groupMembersWidget.button.showMore", defaultMessage: "ui.groupMembersWidget.button.showMore" }))))),
|
|
185
|
+
openDialog && (React.createElement(DialogRoot, Object.assign({ className: classes.dialogRoot, title: React.createElement(FormattedMessage, { defaultMessage: "ui.groupMembersWidget.dialogTitle", id: "ui.groupMembersWidget.dialogTitle", values: { total: scGroup.subscribers_counter } }), onClose: handleToggleDialogOpen, open: openDialog }, DialogProps),
|
|
186
|
+
React.createElement(InfiniteScroll, { dataLength: state.results.length, next: handleNext, hasMoreNext: Boolean(state.next), loaderNext: React.createElement(UserSkeleton, Object.assign({ elevation: 0 }, UserProps)), height: isMobile ? '100%' : 400, endMessage: React.createElement(Typography, { className: classes.endMessage },
|
|
187
|
+
React.createElement(FormattedMessage, { id: "ui.groupMembersWidget.noMoreResults", defaultMessage: "ui.groupMembersWidget.noMoreResults" })) },
|
|
188
|
+
React.createElement(List, null, state.results.map((user) => (React.createElement(ListItem, { key: user.id },
|
|
189
|
+
React.createElement(User, { elevation: 0, actions: React.createElement(React.Fragment, null), user: user, userId: user.id, buttonProps: { onClick: () => console.log(user) } }))))))))));
|
|
190
|
+
return (React.createElement(Root, Object.assign({ className: classNames(classes.root, className) }, rest), content));
|
|
191
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { WidgetProps } from '../Widget';
|
|
2
|
+
/**
|
|
3
|
+
* > API documentation for the Community-JS Group Members Widget Skeleton component. Learn about the available props and the CSS API.
|
|
4
|
+
|
|
5
|
+
#### Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import {GroupMembersWidgetSkeleton} from '@selfcommunity/react-ui';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
#### Component Name
|
|
12
|
+
|
|
13
|
+
The name `SCGroupMembersWidget-skeleton-root` can be used when providing style overrides in the theme.
|
|
14
|
+
|
|
15
|
+
#### CSS
|
|
16
|
+
|
|
17
|
+
|Rule Name|Global class|Description|
|
|
18
|
+
|---|---|---|
|
|
19
|
+
|root|.SCGroupMembersWidget-skeleton-root|Styles applied to the root element.|
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export default function GroupMembersWidgetSkeleton(props: WidgetProps): JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CategoryTrendingPeopleWidgetSkeleton } from '../CategoryTrendingUsersWidget';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { PREFIX } from './constants';
|
|
5
|
+
const classes = {
|
|
6
|
+
root: `${PREFIX}-skeleton-root`
|
|
7
|
+
};
|
|
8
|
+
const Root = styled(CategoryTrendingPeopleWidgetSkeleton, {
|
|
9
|
+
name: PREFIX,
|
|
10
|
+
slot: 'SkeletonRoot'
|
|
11
|
+
})(() => ({}));
|
|
12
|
+
/**
|
|
13
|
+
* > API documentation for the Community-JS Group Members Widget Skeleton component. Learn about the available props and the CSS API.
|
|
14
|
+
|
|
15
|
+
#### Import
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
import {GroupMembersWidgetSkeleton} from '@selfcommunity/react-ui';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
#### Component Name
|
|
22
|
+
|
|
23
|
+
The name `SCGroupMembersWidget-skeleton-root` can be used when providing style overrides in the theme.
|
|
24
|
+
|
|
25
|
+
#### CSS
|
|
26
|
+
|
|
27
|
+
|Rule Name|Global class|Description|
|
|
28
|
+
|---|---|---|
|
|
29
|
+
|root|.SCGroupMembersWidget-skeleton-root|Styles applied to the root element.|
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export default function GroupMembersWidgetSkeleton(props) {
|
|
33
|
+
return React.createElement(Root, Object.assign({ className: classes.root }, props));
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCGroupMembersWidget";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PREFIX = 'SCGroupMembersWidget';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { WidgetProps } from '../Widget';
|
|
2
|
+
import { SCGroupType } from '@selfcommunity/types';
|
|
3
|
+
import { CacheStrategies } from '@selfcommunity/utils';
|
|
4
|
+
import { BaseDialogProps } from '../../shared/BaseDialog';
|
|
5
|
+
import { VirtualScrollerItemProps } from '../../types/virtualScroller';
|
|
6
|
+
import { UserProps } from '../User';
|
|
7
|
+
export interface GroupRequestsWidgetProps extends VirtualScrollerItemProps, WidgetProps {
|
|
8
|
+
/**
|
|
9
|
+
* Group Object
|
|
10
|
+
* @default null
|
|
11
|
+
*/
|
|
12
|
+
group?: SCGroupType;
|
|
13
|
+
/**
|
|
14
|
+
* Id of the group
|
|
15
|
+
* @default null
|
|
16
|
+
*/
|
|
17
|
+
groupId?: number | string;
|
|
18
|
+
/**
|
|
19
|
+
* Hides this component
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
autoHide?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Limit the number of users to show
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
limit?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Caching strategies
|
|
30
|
+
* @default CacheStrategies.CACHE_FIRST
|
|
31
|
+
*/
|
|
32
|
+
cacheStrategy?: CacheStrategies;
|
|
33
|
+
/**
|
|
34
|
+
* Props to spread to single user object
|
|
35
|
+
* @default empty object
|
|
36
|
+
*/
|
|
37
|
+
UserProps?: UserProps;
|
|
38
|
+
/**
|
|
39
|
+
* Props to spread to followers users dialog
|
|
40
|
+
* @default {}
|
|
41
|
+
*/
|
|
42
|
+
DialogProps?: BaseDialogProps;
|
|
43
|
+
/**
|
|
44
|
+
* Other props
|
|
45
|
+
*/
|
|
46
|
+
[p: string]: any;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* > API documentation for the Community-JS Group Requests Widget component. Learn about the available props and the CSS API.
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* This component renders the list of the follows of the given group.
|
|
53
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/GroupRequests)
|
|
54
|
+
|
|
55
|
+
#### Import
|
|
56
|
+
|
|
57
|
+
```jsx
|
|
58
|
+
import {GroupRequestsWidget} from '@selfcommunity/react-ui';
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### Component Name
|
|
62
|
+
|
|
63
|
+
The name `SCGroupRequestsWidget` can be used when providing style overrides in the theme.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
#### CSS
|
|
67
|
+
|
|
68
|
+
|Rule Name|Global class|Description|
|
|
69
|
+
|---|---|---|
|
|
70
|
+
|root|.SCGroupRequestsWidget-root|Styles applied to the root element.|
|
|
71
|
+
|title|.SCGroupRequestsWidget-title|Styles applied to the title element.|
|
|
72
|
+
|noResults|.SCGroupRequestsWidget-no-results|Styles applied to no results section.|
|
|
73
|
+
|showMore|.SCGroupRequestsWidget-show-more|Styles applied to show more button element.|
|
|
74
|
+
|dialogRoot|.SCGroupRequestsWidget-dialog-root|Styles applied to the dialog root element.|
|
|
75
|
+
|endMessage|.SCGroupRequestsWidget-end-message|Styles applied to the end message element.|
|
|
76
|
+
|
|
77
|
+
* @param inProps
|
|
78
|
+
*/
|
|
79
|
+
export default function GroupRequestsWidget(inProps: GroupRequestsWidgetProps): JSX.Element;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React, { useEffect, useMemo, useReducer, useState } from 'react';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import List from '@mui/material/List';
|
|
5
|
+
import { Button, CardContent, ListItem, Typography, useMediaQuery, useTheme } from '@mui/material';
|
|
6
|
+
import Widget from '../Widget';
|
|
7
|
+
import { http, Endpoints, GroupService } from '@selfcommunity/api-services';
|
|
8
|
+
import { CacheStrategies, isInteger, Logger } from '@selfcommunity/utils';
|
|
9
|
+
import { SCCache, SCPreferences, useSCFetchGroup, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
10
|
+
import { actionWidgetTypes, dataWidgetReducer, stateWidgetInitializer } from '../../utils/widget';
|
|
11
|
+
import Skeleton from './Skeleton';
|
|
12
|
+
import { FormattedMessage } from 'react-intl';
|
|
13
|
+
import classNames from 'classnames';
|
|
14
|
+
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
15
|
+
import BaseDialog from '../../shared/BaseDialog';
|
|
16
|
+
import InfiniteScroll from '../../shared/InfiniteScroll';
|
|
17
|
+
import { useThemeProps } from '@mui/system';
|
|
18
|
+
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
19
|
+
import { PREFIX } from './constants';
|
|
20
|
+
import User, { UserSkeleton } from '../User';
|
|
21
|
+
const classes = {
|
|
22
|
+
root: `${PREFIX}-root`,
|
|
23
|
+
title: `${PREFIX}-title`,
|
|
24
|
+
noResults: `${PREFIX}-no-results`,
|
|
25
|
+
showMore: `${PREFIX}-show-more`,
|
|
26
|
+
dialogRoot: `${PREFIX}-dialog-root`,
|
|
27
|
+
endMessage: `${PREFIX}-end-message`
|
|
28
|
+
};
|
|
29
|
+
const Root = styled(Widget, {
|
|
30
|
+
name: PREFIX,
|
|
31
|
+
slot: 'Root'
|
|
32
|
+
})(() => ({}));
|
|
33
|
+
const DialogRoot = styled(BaseDialog, {
|
|
34
|
+
name: PREFIX,
|
|
35
|
+
slot: 'DialogRoot'
|
|
36
|
+
})(() => ({}));
|
|
37
|
+
/**
|
|
38
|
+
* > API documentation for the Community-JS Group Requests Widget component. Learn about the available props and the CSS API.
|
|
39
|
+
*
|
|
40
|
+
*
|
|
41
|
+
* This component renders the list of the follows of the given group.
|
|
42
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/GroupRequests)
|
|
43
|
+
|
|
44
|
+
#### Import
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
import {GroupRequestsWidget} from '@selfcommunity/react-ui';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Component Name
|
|
51
|
+
|
|
52
|
+
The name `SCGroupRequestsWidget` can be used when providing style overrides in the theme.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
#### CSS
|
|
56
|
+
|
|
57
|
+
|Rule Name|Global class|Description|
|
|
58
|
+
|---|---|---|
|
|
59
|
+
|root|.SCGroupRequestsWidget-root|Styles applied to the root element.|
|
|
60
|
+
|title|.SCGroupRequestsWidget-title|Styles applied to the title element.|
|
|
61
|
+
|noResults|.SCGroupRequestsWidget-no-results|Styles applied to no results section.|
|
|
62
|
+
|showMore|.SCGroupRequestsWidget-show-more|Styles applied to show more button element.|
|
|
63
|
+
|dialogRoot|.SCGroupRequestsWidget-dialog-root|Styles applied to the dialog root element.|
|
|
64
|
+
|endMessage|.SCGroupRequestsWidget-end-message|Styles applied to the end message element.|
|
|
65
|
+
|
|
66
|
+
* @param inProps
|
|
67
|
+
*/
|
|
68
|
+
export default function GroupRequestsWidget(inProps) {
|
|
69
|
+
// PROPS
|
|
70
|
+
const props = useThemeProps({
|
|
71
|
+
props: inProps,
|
|
72
|
+
name: PREFIX
|
|
73
|
+
});
|
|
74
|
+
const { groupId, group, autoHide = false, limit = 5, className, cacheStrategy = CacheStrategies.NETWORK_ONLY, onHeightChange, onStateChange, UserProps = {}, DialogProps = {} } = props, rest = __rest(props, ["groupId", "group", "autoHide", "limit", "className", "cacheStrategy", "onHeightChange", "onStateChange", "UserProps", "DialogProps"]);
|
|
75
|
+
// STATE
|
|
76
|
+
const [state, dispatch] = useReducer(dataWidgetReducer, {
|
|
77
|
+
isLoadingNext: false,
|
|
78
|
+
next: null,
|
|
79
|
+
cacheKey: SCCache.getWidgetStateCacheKey(SCCache.GROUP_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY, isInteger(groupId) ? groupId : group.id),
|
|
80
|
+
cacheStrategy,
|
|
81
|
+
visibleItems: limit
|
|
82
|
+
}, stateWidgetInitializer);
|
|
83
|
+
const [openDialog, setOpenDialog] = useState(false);
|
|
84
|
+
// CONTEXT
|
|
85
|
+
const scUserContext = useSCUser();
|
|
86
|
+
const scPreferencesContext = useSCPreferences();
|
|
87
|
+
const { scGroup } = useSCFetchGroup({ id: groupId, group });
|
|
88
|
+
// MEMO
|
|
89
|
+
const contentAvailability = useMemo(() => SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY in scPreferencesContext.preferences &&
|
|
90
|
+
scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value, [scPreferencesContext.preferences]);
|
|
91
|
+
// HOOKS
|
|
92
|
+
const theme = useTheme();
|
|
93
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
94
|
+
/**
|
|
95
|
+
* Initialize component
|
|
96
|
+
* Fetch data only if the component is not initialized and it is not loading data
|
|
97
|
+
*/
|
|
98
|
+
const _initComponent = useMemo(() => () => {
|
|
99
|
+
if (!state.initialized && !state.isLoadingNext) {
|
|
100
|
+
dispatch({ type: actionWidgetTypes.LOADING_NEXT });
|
|
101
|
+
GroupService.getGroupWaitingApprovalSubscribers(scGroup.id, { limit })
|
|
102
|
+
.then((payload) => {
|
|
103
|
+
dispatch({ type: actionWidgetTypes.LOAD_NEXT_SUCCESS, payload: Object.assign(Object.assign({}, payload), { initialized: true }) });
|
|
104
|
+
})
|
|
105
|
+
.catch((error) => {
|
|
106
|
+
dispatch({ type: actionWidgetTypes.LOAD_NEXT_FAILURE, payload: { errorLoadNext: error } });
|
|
107
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, [state.isLoadingNext, state.initialized, scGroup, limit, dispatch]);
|
|
111
|
+
// EFFECTS
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
var _a;
|
|
114
|
+
let _t;
|
|
115
|
+
if ((contentAvailability || (!contentAvailability && ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id))) && scGroup && scUserContext.user !== undefined) {
|
|
116
|
+
_t = setTimeout(_initComponent);
|
|
117
|
+
return () => {
|
|
118
|
+
_t && clearTimeout(_t);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}, [scUserContext.user, contentAvailability, scGroup]);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (openDialog && state.next && state.results.length === limit && state.initialized) {
|
|
124
|
+
dispatch({ type: actionWidgetTypes.LOADING_NEXT });
|
|
125
|
+
GroupService.getGroupWaitingApprovalSubscribers(scGroup.id, { offset: limit, limit: 10 })
|
|
126
|
+
.then((payload) => {
|
|
127
|
+
dispatch({ type: actionWidgetTypes.LOAD_NEXT_SUCCESS, payload: payload });
|
|
128
|
+
})
|
|
129
|
+
.catch((error) => {
|
|
130
|
+
dispatch({ type: actionWidgetTypes.LOAD_NEXT_FAILURE, payload: { errorLoadNext: error } });
|
|
131
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}, [openDialog, state.next, state.results.length, state.initialized, limit]);
|
|
135
|
+
/**
|
|
136
|
+
* Virtual feed update
|
|
137
|
+
*/
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
onHeightChange && onHeightChange();
|
|
140
|
+
}, [state.results]);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (!scGroup || (!contentAvailability && !scUserContext.user)) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
else if (cacheStrategy === CacheStrategies.NETWORK_ONLY) {
|
|
146
|
+
onStateChange && onStateChange({ cacheStrategy: CacheStrategies.CACHE_FIRST });
|
|
147
|
+
}
|
|
148
|
+
}, [scUserContext.user, scGroup, contentAvailability]);
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
if (!scGroup || !scUserContext.user || !state.initialized) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
}, []);
|
|
154
|
+
// HANDLERS
|
|
155
|
+
const handleNext = useMemo(() => () => {
|
|
156
|
+
dispatch({ type: actionWidgetTypes.LOADING_NEXT });
|
|
157
|
+
http
|
|
158
|
+
.request({
|
|
159
|
+
url: state.next,
|
|
160
|
+
method: Endpoints.GetGroupWaitingApprovalSubscribers.method
|
|
161
|
+
})
|
|
162
|
+
.then((res) => {
|
|
163
|
+
dispatch({ type: actionWidgetTypes.LOAD_NEXT_SUCCESS, payload: res.data });
|
|
164
|
+
});
|
|
165
|
+
}, [dispatch, state.next, state.isLoadingNext, state.initialized]);
|
|
166
|
+
const handleToggleDialogOpen = () => {
|
|
167
|
+
setOpenDialog((prev) => !prev);
|
|
168
|
+
};
|
|
169
|
+
// RENDER
|
|
170
|
+
if ((autoHide && !state.count && state.initialized) || (!contentAvailability && !scUserContext.user) || !scGroup) {
|
|
171
|
+
return React.createElement(HiddenPlaceholder, null);
|
|
172
|
+
}
|
|
173
|
+
if (!state.initialized) {
|
|
174
|
+
return React.createElement(Skeleton, null);
|
|
175
|
+
}
|
|
176
|
+
const content = (React.createElement(CardContent, null,
|
|
177
|
+
React.createElement(Typography, { className: classes.title, variant: "h5" },
|
|
178
|
+
React.createElement(FormattedMessage, { id: "ui.groupRequestsWidget.title", defaultMessage: "ui.groupRequestsWidget.title" })),
|
|
179
|
+
!state.count ? (React.createElement(Typography, { className: classes.noResults, variant: "body2" },
|
|
180
|
+
React.createElement(FormattedMessage, { id: "ui.groupRequestsWidget.subtitle.noResults", defaultMessage: "" }))) : (React.createElement(React.Fragment, null,
|
|
181
|
+
React.createElement(List, null, state.results.slice(0, state.visibleItems).map((user) => (React.createElement(ListItem, { key: user.id },
|
|
182
|
+
React.createElement(User, { elevation: 0, actions: React.createElement(React.Fragment, null), user: user, userId: user.id, buttonProps: { onClick: () => console.log(user) } }))))),
|
|
183
|
+
state.count > state.visibleItems && (React.createElement(Button, { className: classes.showMore, onClick: handleToggleDialogOpen },
|
|
184
|
+
React.createElement(FormattedMessage, { id: "ui.groupRequestsWidget.button.showMore", defaultMessage: "ui.groupRequestsWidget.button.showMore" }))))),
|
|
185
|
+
openDialog && (React.createElement(DialogRoot, Object.assign({ className: classes.dialogRoot, title: React.createElement(FormattedMessage, { defaultMessage: "ui.groupRequestsWidget.dialogTitle", id: "ui.groupRequestsWidget.dialogTitle", values: { total: scGroup.subscribers_counter } }), onClose: handleToggleDialogOpen, open: openDialog }, DialogProps),
|
|
186
|
+
React.createElement(InfiniteScroll, { dataLength: state.results.length, next: handleNext, hasMoreNext: Boolean(state.next), loaderNext: React.createElement(UserSkeleton, Object.assign({ elevation: 0 }, UserProps)), height: isMobile ? '100%' : 400, endMessage: React.createElement(Typography, { className: classes.endMessage },
|
|
187
|
+
React.createElement(FormattedMessage, { id: "ui.groupRequestsWidget.noMoreResults", defaultMessage: "ui.groupRequestsWidget.noMoreResults" })) },
|
|
188
|
+
React.createElement(List, null, state.results.map((user) => (React.createElement(ListItem, { key: user.id },
|
|
189
|
+
React.createElement(User, { elevation: 0, actions: React.createElement(React.Fragment, null), user: user, userId: user.id, buttonProps: { onClick: () => console.log(user) } }))))))))));
|
|
190
|
+
return (React.createElement(Root, Object.assign({ className: classNames(classes.root, className) }, rest), content));
|
|
191
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { WidgetProps } from '../Widget';
|
|
2
|
+
/**
|
|
3
|
+
* > API documentation for the Community-JS Group Requests Widget Skeleton component. Learn about the available props and the CSS API.
|
|
4
|
+
|
|
5
|
+
#### Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import {GroupRequestsWidgetSkeleton} from '@selfcommunity/react-ui';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
#### Component Name
|
|
12
|
+
|
|
13
|
+
The name `SCGroupRequestsWidget-skeleton-root` can be used when providing style overrides in the theme.
|
|
14
|
+
|
|
15
|
+
#### CSS
|
|
16
|
+
|
|
17
|
+
|Rule Name|Global class|Description|
|
|
18
|
+
|---|---|---|
|
|
19
|
+
|root|.SCGroupRequestsWidget-skeleton-root|Styles applied to the root element.|
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export default function GroupRequestsWidgetSkeleton(props: WidgetProps): JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CategoryTrendingPeopleWidgetSkeleton } from '../CategoryTrendingUsersWidget';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { PREFIX } from './constants';
|
|
5
|
+
const classes = {
|
|
6
|
+
root: `${PREFIX}-skeleton-root`
|
|
7
|
+
};
|
|
8
|
+
const Root = styled(CategoryTrendingPeopleWidgetSkeleton, {
|
|
9
|
+
name: PREFIX,
|
|
10
|
+
slot: 'SkeletonRoot'
|
|
11
|
+
})(() => ({}));
|
|
12
|
+
/**
|
|
13
|
+
* > API documentation for the Community-JS Group Requests Widget Skeleton component. Learn about the available props and the CSS API.
|
|
14
|
+
|
|
15
|
+
#### Import
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
import {GroupRequestsWidgetSkeleton} from '@selfcommunity/react-ui';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
#### Component Name
|
|
22
|
+
|
|
23
|
+
The name `SCGroupRequestsWidget-skeleton-root` can be used when providing style overrides in the theme.
|
|
24
|
+
|
|
25
|
+
#### CSS
|
|
26
|
+
|
|
27
|
+
|Rule Name|Global class|Description|
|
|
28
|
+
|---|---|---|
|
|
29
|
+
|root|.SCGroupRequestsWidget-skeleton-root|Styles applied to the root element.|
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export default function GroupRequestsWidgetSkeleton(props) {
|
|
33
|
+
return React.createElement(Root, Object.assign({ className: classes.root }, props));
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCGroupRequestsWidget";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PREFIX = 'SCGroupRequestsWidget';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { SCGroupType } from '@selfcommunity/types';
|
|
2
|
+
export interface GroupSubscribeButtonProps {
|
|
3
|
+
/**
|
|
4
|
+
* Overrides or extends the styles applied to the component.
|
|
5
|
+
* @default null
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Group Object
|
|
10
|
+
* @default null
|
|
11
|
+
*/
|
|
12
|
+
group?: SCGroupType;
|
|
13
|
+
/**
|
|
14
|
+
* Id of the group
|
|
15
|
+
* @default null
|
|
16
|
+
*/
|
|
17
|
+
groupId?: number;
|
|
18
|
+
/**
|
|
19
|
+
* onJoin callback
|
|
20
|
+
* @param user
|
|
21
|
+
* @param joined
|
|
22
|
+
*/
|
|
23
|
+
onJoin?: (group: SCGroupType, member: boolean) => any;
|
|
24
|
+
/**
|
|
25
|
+
* Others properties
|
|
26
|
+
*/
|
|
27
|
+
[p: string]: any;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* > API documentation for the Community-JS Group Subscribe Button component. Learn about the available props and the CSS API.
|
|
31
|
+
|
|
32
|
+
#### Import
|
|
33
|
+
|
|
34
|
+
```jsx
|
|
35
|
+
import {GroupSubscribeButton} from '@selfcommunity/react-ui';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### Component Name
|
|
39
|
+
|
|
40
|
+
The name `SCGroupSubscribeButton` can be used when providing style overrides in the theme.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
#### CSS
|
|
44
|
+
|
|
45
|
+
|Rule Name|Global class|Description|
|
|
46
|
+
|---|---|---|
|
|
47
|
+
|root|.SCGroupSubscribeButton-root|Styles applied to the root element.|
|
|
48
|
+
|
|
49
|
+
* @param inProps
|
|
50
|
+
*/
|
|
51
|
+
export default function GroupSubscribeButton(inProps: GroupSubscribeButtonProps): JSX.Element;
|