@selfcommunity/react-ui 0.7.9-alpha.1 → 0.7.9-alpha.11
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/BottomNavigation/BottomNavigation.js +3 -1
- package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.d.ts +55 -0
- package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.js +140 -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 +135 -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/Composer/Attributes/Attributes.d.ts +1 -1
- package/lib/cjs/components/Composer/Attributes/Attributes.js +7 -0
- package/lib/cjs/components/Composer/Composer.d.ts +2 -1
- package/lib/cjs/components/Composer/Composer.js +39 -12
- package/lib/cjs/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +7 -3
- package/lib/cjs/components/Composer/Content/ContentPost/ContentPost.js +4 -3
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +7 -1
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +46 -12
- package/lib/cjs/components/CreateGroupButton/CreateGroupButton.d.ts +38 -0
- package/lib/cjs/components/CreateGroupButton/CreateGroupButton.js +72 -0
- package/lib/cjs/components/CreateGroupButton/index.d.ts +3 -0
- package/lib/cjs/components/CreateGroupButton/index.js +5 -0
- package/lib/cjs/components/CustomAdv/CustomAdv.d.ts +4 -0
- package/lib/cjs/components/EditGroupButton/EditGroupButton.d.ts +43 -0
- package/lib/cjs/components/EditGroupButton/EditGroupButton.js +61 -0
- package/lib/cjs/components/EditGroupButton/index.d.ts +3 -0
- package/lib/cjs/components/EditGroupButton/index.js +5 -0
- package/lib/cjs/components/Group/Group.d.ts +68 -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/GroupAutocomplete/GroupAutocomplete.d.ts +49 -0
- package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.js +101 -0
- package/lib/cjs/components/GroupAutocomplete/index.d.ts +3 -0
- package/lib/cjs/components/GroupAutocomplete/index.js +5 -0
- package/lib/cjs/components/GroupForm/GroupForm.d.ts +70 -0
- package/lib/cjs/components/GroupForm/GroupForm.js +239 -0
- package/lib/cjs/components/GroupForm/constants.d.ts +1 -0
- package/lib/cjs/components/GroupForm/constants.js +4 -0
- package/lib/cjs/components/GroupForm/index.d.ts +3 -0
- package/lib/cjs/components/GroupForm/index.js +5 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +84 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.js +147 -0
- package/lib/cjs/components/GroupHeader/Skeleton.d.ts +25 -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 +262 -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 +51 -0
- package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +136 -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 +205 -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 +74 -0
- package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +204 -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/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +56 -0
- package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.js +137 -0
- package/lib/cjs/components/GroupSettingsIconButton/index.d.ts +3 -0
- package/lib/cjs/components/GroupSettingsIconButton/index.js +5 -0
- package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +56 -0
- package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +132 -0
- package/lib/cjs/components/GroupSubscribeButton/index.d.ts +3 -0
- package/lib/cjs/components/GroupSubscribeButton/index.js +5 -0
- package/lib/cjs/components/Groups/Groups.d.ts +61 -0
- package/lib/cjs/components/Groups/Groups.js +133 -0
- package/lib/cjs/components/Groups/Skeleton.d.ts +34 -0
- package/lib/cjs/components/Groups/Skeleton.js +45 -0
- package/lib/cjs/components/Groups/constants.d.ts +1 -0
- package/lib/cjs/components/Groups/constants.js +4 -0
- package/lib/cjs/components/Groups/index.d.ts +4 -0
- package/lib/cjs/components/Groups/index.js +8 -0
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.d.ts +6 -1
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.js +2 -3
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +5 -1
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.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 +17 -1
- package/lib/cjs/index.js +40 -2
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +3 -1
- package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.d.ts +55 -0
- package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.js +137 -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 +132 -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/Composer/Attributes/Attributes.d.ts +1 -1
- package/lib/esm/components/Composer/Attributes/Attributes.js +7 -0
- package/lib/esm/components/Composer/Composer.d.ts +2 -1
- package/lib/esm/components/Composer/Composer.js +39 -12
- package/lib/esm/components/Composer/Content/ContentDiscussion/ContentDiscussion.js +7 -3
- package/lib/esm/components/Composer/Content/ContentPost/ContentPost.js +4 -3
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +7 -1
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +45 -12
- package/lib/esm/components/CreateGroupButton/CreateGroupButton.d.ts +38 -0
- package/lib/esm/components/CreateGroupButton/CreateGroupButton.js +69 -0
- package/lib/esm/components/CreateGroupButton/index.d.ts +3 -0
- package/lib/esm/components/CreateGroupButton/index.js +2 -0
- package/lib/esm/components/CustomAdv/CustomAdv.d.ts +4 -0
- package/lib/esm/components/EditGroupButton/EditGroupButton.d.ts +43 -0
- package/lib/esm/components/EditGroupButton/EditGroupButton.js +58 -0
- package/lib/esm/components/EditGroupButton/index.d.ts +3 -0
- package/lib/esm/components/EditGroupButton/index.js +2 -0
- package/lib/esm/components/Group/Group.d.ts +68 -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/GroupAutocomplete/GroupAutocomplete.d.ts +49 -0
- package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.js +99 -0
- package/lib/esm/components/GroupAutocomplete/index.d.ts +3 -0
- package/lib/esm/components/GroupAutocomplete/index.js +2 -0
- package/lib/esm/components/GroupForm/GroupForm.d.ts +70 -0
- package/lib/esm/components/GroupForm/GroupForm.js +236 -0
- package/lib/esm/components/GroupForm/constants.d.ts +1 -0
- package/lib/esm/components/GroupForm/constants.js +1 -0
- package/lib/esm/components/GroupForm/index.d.ts +3 -0
- package/lib/esm/components/GroupForm/index.js +2 -0
- package/lib/esm/components/GroupHeader/GroupHeader.d.ts +84 -0
- package/lib/esm/components/GroupHeader/GroupHeader.js +144 -0
- package/lib/esm/components/GroupHeader/Skeleton.d.ts +25 -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 +259 -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 +51 -0
- package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +133 -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 +202 -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 +74 -0
- package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +201 -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/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +56 -0
- package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.js +134 -0
- package/lib/esm/components/GroupSettingsIconButton/index.d.ts +3 -0
- package/lib/esm/components/GroupSettingsIconButton/index.js +2 -0
- package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.d.ts +56 -0
- package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +129 -0
- package/lib/esm/components/GroupSubscribeButton/index.d.ts +3 -0
- package/lib/esm/components/GroupSubscribeButton/index.js +2 -0
- package/lib/esm/components/Groups/Groups.d.ts +61 -0
- package/lib/esm/components/Groups/Groups.js +130 -0
- package/lib/esm/components/Groups/Skeleton.d.ts +34 -0
- package/lib/esm/components/Groups/Skeleton.js +42 -0
- package/lib/esm/components/Groups/constants.d.ts +1 -0
- package/lib/esm/components/Groups/constants.js +1 -0
- package/lib/esm/components/Groups/index.d.ts +4 -0
- package/lib/esm/components/Groups/index.js +4 -0
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.d.ts +6 -1
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.js +3 -4
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +5 -1
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +4 -0
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +2 -3
- 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 +17 -1
- package/lib/esm/index.js +19 -3
- package/lib/umd/react-ui.js +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { CardContent, Icon, Typography } from '@mui/material';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import Widget from '../Widget';
|
|
7
|
+
import { useThemeProps } from '@mui/system';
|
|
8
|
+
import { PREFIX } from './constants';
|
|
9
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
10
|
+
import { SCGroupPrivacyType } from '@selfcommunity/types';
|
|
11
|
+
import { useSCFetchGroup } from '@selfcommunity/react-core';
|
|
12
|
+
const classes = {
|
|
13
|
+
root: `${PREFIX}-root`,
|
|
14
|
+
title: `${PREFIX}-title`,
|
|
15
|
+
description: `${PREFIX}-description`,
|
|
16
|
+
privacy: `${PREFIX}-privacy`,
|
|
17
|
+
privacyTitle: `${PREFIX}-privacy-title`,
|
|
18
|
+
visibility: `${PREFIX}-visibility`,
|
|
19
|
+
visibilityTitle: `${PREFIX}-visibility-title`,
|
|
20
|
+
date: `${PREFIX}-date`
|
|
21
|
+
};
|
|
22
|
+
const Root = styled(Widget, {
|
|
23
|
+
name: PREFIX,
|
|
24
|
+
slot: 'Root'
|
|
25
|
+
})(() => ({}));
|
|
26
|
+
/**
|
|
27
|
+
* > API documentation for the Community-JS Group Info Widget component. Learn about the available props and the CSS API.
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
* This component renders a widget containing the group info.
|
|
31
|
+
* Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/GroupInfoWidget)
|
|
32
|
+
|
|
33
|
+
#### Import
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
import {GroupInfoWidget} from '@selfcommunity/react-ui';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Component Name
|
|
40
|
+
|
|
41
|
+
The name `SCGroupInfoWidget` can be used when providing style overrides in the theme.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
#### CSS
|
|
45
|
+
|
|
46
|
+
|Rule Name|Global class|Description|
|
|
47
|
+
|---|---|---|
|
|
48
|
+
|root|.SCGroupInfoWidget-root|Styles applied to the root element.|
|
|
49
|
+
|title|.SCGroupInfoWidget-title|Styles applied to the title element.|
|
|
50
|
+
|
|
51
|
+
*
|
|
52
|
+
* @param inProps
|
|
53
|
+
*/
|
|
54
|
+
export default function GroupInfoWidget(inProps) {
|
|
55
|
+
// PROPS
|
|
56
|
+
const props = useThemeProps({
|
|
57
|
+
props: inProps,
|
|
58
|
+
name: PREFIX
|
|
59
|
+
});
|
|
60
|
+
const { className, group, groupId, onHeightChange, onStateChange } = props, rest = __rest(props, ["className", "group", "groupId", "onHeightChange", "onStateChange"]);
|
|
61
|
+
// HOOKS
|
|
62
|
+
const { scGroup } = useSCFetchGroup({ id: groupId, group });
|
|
63
|
+
// INTL
|
|
64
|
+
const intl = useIntl();
|
|
65
|
+
/**
|
|
66
|
+
* Renders root object
|
|
67
|
+
*/
|
|
68
|
+
return (React.createElement(Root, Object.assign({ className: classNames(classes.root, className) }, rest),
|
|
69
|
+
React.createElement(CardContent, null,
|
|
70
|
+
React.createElement(Typography, { variant: "h4", className: classes.title },
|
|
71
|
+
React.createElement(FormattedMessage, { id: "ui.groupInfoWidget.title", defaultMessage: "ui.groupInfoWidget.title" })),
|
|
72
|
+
React.createElement(Typography, { variant: "body1", className: classes.description }, scGroup.description),
|
|
73
|
+
React.createElement(Typography, { component: "div", className: classes.privacy }, scGroup.privacy === SCGroupPrivacyType.PUBLIC ? (React.createElement(React.Fragment, null,
|
|
74
|
+
React.createElement(Typography, { className: classes.privacyTitle },
|
|
75
|
+
React.createElement(Icon, null, "public"),
|
|
76
|
+
React.createElement(FormattedMessage, { id: "ui.groupForm.privacy.public", defaultMessage: "ui.groupForm.privacy.public" })),
|
|
77
|
+
React.createElement(Typography, { variant: "body2" },
|
|
78
|
+
React.createElement(FormattedMessage, { id: "ui.groupForm.privacy.public.info", defaultMessage: "ui.groupForm.privacy.public.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } })))) : (React.createElement(React.Fragment, null,
|
|
79
|
+
React.createElement(Typography, { className: classes.privacyTitle },
|
|
80
|
+
React.createElement(Icon, null, "private"),
|
|
81
|
+
React.createElement(FormattedMessage, { id: "ui.groupForm.privacy.private", defaultMessage: "ui.groupForm.privacy.private" })),
|
|
82
|
+
React.createElement(Typography, { variant: "body2" },
|
|
83
|
+
React.createElement(FormattedMessage, { id: "ui.groupForm.privacy.private.info", defaultMessage: "ui.groupForm.private.public.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } }))))),
|
|
84
|
+
scGroup.privacy === SCGroupPrivacyType.PRIVATE && (React.createElement(Typography, { component: "div", className: classes.visibility }, scGroup.visible ? (React.createElement(React.Fragment, null,
|
|
85
|
+
React.createElement(Typography, { className: classes.visibilityTitle },
|
|
86
|
+
React.createElement(Icon, null, "visibility"),
|
|
87
|
+
React.createElement(FormattedMessage, { id: "ui.groupForm.visibility.visible", defaultMessage: "ui.groupForm.visibility.visible" })),
|
|
88
|
+
React.createElement(Typography, { variant: "body2" },
|
|
89
|
+
React.createElement(FormattedMessage, { id: "ui.groupForm.visibility.visible.info", defaultMessage: "ui.groupForm.visibility.visible.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } })))) : (React.createElement(React.Fragment, null,
|
|
90
|
+
React.createElement(Typography, { className: classes.visibilityTitle },
|
|
91
|
+
React.createElement(Icon, null, "visibility_off"),
|
|
92
|
+
React.createElement(FormattedMessage, { id: "ui.groupForm.visibility.hidden", defaultMessage: "ui.groupForm.visibility.hidden" })),
|
|
93
|
+
React.createElement(Typography, { variant: "body2" },
|
|
94
|
+
React.createElement(FormattedMessage, { id: "ui.groupForm.visibility.hidden.info", defaultMessage: "ui.groupForm.visibility.hidden.info", values: { b: (chunks) => React.createElement("strong", null, chunks) } })))))),
|
|
95
|
+
React.createElement(Typography, { variant: "body2", className: classes.date },
|
|
96
|
+
React.createElement(FormattedMessage, { id: "ui.groupInfoWidget.date", defaultMessage: "ui.groupInfoWidget.date", values: { date: intl.formatDate(scGroup.created_at, { day: 'numeric', year: 'numeric', month: 'long' }) } })))));
|
|
97
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* > API documentation for the Community-JS Platform Skeleton component. Learn about the available props and the CSS API.
|
|
3
|
+
|
|
4
|
+
#### Import
|
|
5
|
+
|
|
6
|
+
```jsx
|
|
7
|
+
import {PlatformWidgetSkeleton} from '@selfcommunity/react-ui';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
#### Component Name
|
|
11
|
+
|
|
12
|
+
The name `SCPlatformWidget-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|.SCPlatformWidget-skeleton-root|Styles applied to the root element.|
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export default function PlatformWidgetSkeleton(): JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GenericSkeleton } from '../Skeleton';
|
|
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(GenericSkeleton, {
|
|
9
|
+
name: PREFIX,
|
|
10
|
+
slot: 'SkeletonRoot'
|
|
11
|
+
})(() => ({}));
|
|
12
|
+
/**
|
|
13
|
+
* > API documentation for the Community-JS Platform Skeleton component. Learn about the available props and the CSS API.
|
|
14
|
+
|
|
15
|
+
#### Import
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
import {PlatformWidgetSkeleton} from '@selfcommunity/react-ui';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
#### Component Name
|
|
22
|
+
|
|
23
|
+
The name `SCPlatformWidget-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|.SCPlatformWidget-skeleton-root|Styles applied to the root element.|
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export default function PlatformWidgetSkeleton() {
|
|
33
|
+
return React.createElement(Root, { className: classes.root });
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX = "SCGroupInfoWidget";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PREFIX = 'SCGroupInfoWidget';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ButtonProps } from '@mui/material/Button/Button';
|
|
2
|
+
import { SCGroupType } from '@selfcommunity/types';
|
|
3
|
+
export interface GroupInviteButtonProps extends ButtonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Overrides or extends the styles applied to the component.
|
|
6
|
+
* @default null
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Group Object
|
|
11
|
+
* @default null
|
|
12
|
+
*/
|
|
13
|
+
group?: SCGroupType;
|
|
14
|
+
/**
|
|
15
|
+
* Id of the group
|
|
16
|
+
* @default null
|
|
17
|
+
*/
|
|
18
|
+
groupId?: number | string;
|
|
19
|
+
/**
|
|
20
|
+
* Functions to handle invitations sending in group creation mode
|
|
21
|
+
* @default null
|
|
22
|
+
*/
|
|
23
|
+
handleInvitations?: (data: any) => any;
|
|
24
|
+
/**
|
|
25
|
+
* Any other properties
|
|
26
|
+
*/
|
|
27
|
+
[p: string]: any;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
*> API documentation for the Community-JS Group Invite Button component. Learn about the available props and the CSS API.
|
|
31
|
+
*
|
|
32
|
+
#### Import
|
|
33
|
+
```jsx
|
|
34
|
+
import {SCGroupInviteButton} from '@selfcommunity/react-ui';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### Component Name
|
|
38
|
+
The name `SCGroupInviteButton` can be used when providing style overrides in the theme.
|
|
39
|
+
|
|
40
|
+
#### CSS
|
|
41
|
+
|
|
42
|
+
|Rule Name|Global class|Description|
|
|
43
|
+
|---|---|---|
|
|
44
|
+
|root|.SCGroupInviteButton-root|Styles applied to the root element.|
|
|
45
|
+
|dialogRoot|.SCGroupInviteButton-dialog-root|Styles applied to the dialog root.|
|
|
46
|
+
|dialogTitle|.SCGroupInviteButton-dialog-title|Styles applied to the dialog title element.|
|
|
47
|
+
|dialogContent|.SCGroupInviteButton-dialog-content|Styles applied to the dialog content.|
|
|
48
|
+
|autocomplete|.SCGroupInviteButton-autocomplete|Styles applied to the autocomplete element.|
|
|
49
|
+
|icon|.SCGroupInviteButton-icon|Styles applied to the autocomplete icon element.|
|
|
50
|
+
|input|.SCGroupInviteButton-input|Styles applied to the autocomplete input element.|
|
|
51
|
+
|clear|.SCGroupInviteButton-clear|Styles applied to the autocomplete clear icon element.|
|
|
52
|
+
|invitedBox|.SCGroupInviteButton-invited-box|Styles applied to the invited users box.|
|
|
53
|
+
|suggested|.SCGroupInviteButton-suggested|Styles applied to the suggested users box.|
|
|
54
|
+
|
|
55
|
+
* @param inProps
|
|
56
|
+
*/
|
|
57
|
+
export default function GroupInviteButton(inProps: GroupInviteButtonProps): JSX.Element;
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { useThemeProps } from '@mui/system';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { Avatar, Box, Button, Chip, Icon, IconButton, InputAdornment, TextField, Typography } from '@mui/material';
|
|
6
|
+
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
7
|
+
import { SCUserContext, useSCFetchGroup } from '@selfcommunity/react-core';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import BaseDialog from '../../shared/BaseDialog';
|
|
10
|
+
import { LoadingButton } from '@mui/lab';
|
|
11
|
+
import { GroupService } from '@selfcommunity/api-services';
|
|
12
|
+
import Autocomplete from '@mui/material/Autocomplete';
|
|
13
|
+
import User from '../User';
|
|
14
|
+
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
15
|
+
import { Logger } from '@selfcommunity/utils';
|
|
16
|
+
const messages = defineMessages({
|
|
17
|
+
placeholder: {
|
|
18
|
+
id: 'ui.groupInviteButton.searchBar.placeholder',
|
|
19
|
+
defaultMessage: 'ui.groupInviteButton.searchBar.placeholder'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const PREFIX = 'SCGroupInviteButton';
|
|
23
|
+
const classes = {
|
|
24
|
+
root: `${PREFIX}-root`,
|
|
25
|
+
dialogRoot: `${PREFIX}-dialog-root`,
|
|
26
|
+
dialogTitle: `${PREFIX}-dialog-title`,
|
|
27
|
+
dialogContent: `${PREFIX}-dialog-content`,
|
|
28
|
+
autocomplete: `${PREFIX}-autocomplete`,
|
|
29
|
+
icon: `${PREFIX}-icon`,
|
|
30
|
+
input: `${PREFIX}-input`,
|
|
31
|
+
clear: `${PREFIX}-clear`,
|
|
32
|
+
invitedBox: `${PREFIX}-invited-box`,
|
|
33
|
+
suggested: `${PREFIX}-suggested`
|
|
34
|
+
};
|
|
35
|
+
const Root = styled(Button, {
|
|
36
|
+
name: PREFIX,
|
|
37
|
+
slot: 'Root',
|
|
38
|
+
overridesResolver: (props, styles) => styles.root
|
|
39
|
+
})(({ theme }) => ({}));
|
|
40
|
+
const DialogRoot = styled(BaseDialog, {
|
|
41
|
+
name: PREFIX,
|
|
42
|
+
slot: 'Root',
|
|
43
|
+
overridesResolver: (props, styles) => styles.dialogRoot
|
|
44
|
+
})(({ theme }) => ({}));
|
|
45
|
+
/**
|
|
46
|
+
*> API documentation for the Community-JS Group Invite Button component. Learn about the available props and the CSS API.
|
|
47
|
+
*
|
|
48
|
+
#### Import
|
|
49
|
+
```jsx
|
|
50
|
+
import {SCGroupInviteButton} from '@selfcommunity/react-ui';
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Component Name
|
|
54
|
+
The name `SCGroupInviteButton` can be used when providing style overrides in the theme.
|
|
55
|
+
|
|
56
|
+
#### CSS
|
|
57
|
+
|
|
58
|
+
|Rule Name|Global class|Description|
|
|
59
|
+
|---|---|---|
|
|
60
|
+
|root|.SCGroupInviteButton-root|Styles applied to the root element.|
|
|
61
|
+
|dialogRoot|.SCGroupInviteButton-dialog-root|Styles applied to the dialog root.|
|
|
62
|
+
|dialogTitle|.SCGroupInviteButton-dialog-title|Styles applied to the dialog title element.|
|
|
63
|
+
|dialogContent|.SCGroupInviteButton-dialog-content|Styles applied to the dialog content.|
|
|
64
|
+
|autocomplete|.SCGroupInviteButton-autocomplete|Styles applied to the autocomplete element.|
|
|
65
|
+
|icon|.SCGroupInviteButton-icon|Styles applied to the autocomplete icon element.|
|
|
66
|
+
|input|.SCGroupInviteButton-input|Styles applied to the autocomplete input element.|
|
|
67
|
+
|clear|.SCGroupInviteButton-clear|Styles applied to the autocomplete clear icon element.|
|
|
68
|
+
|invitedBox|.SCGroupInviteButton-invited-box|Styles applied to the invited users box.|
|
|
69
|
+
|suggested|.SCGroupInviteButton-suggested|Styles applied to the suggested users box.|
|
|
70
|
+
|
|
71
|
+
* @param inProps
|
|
72
|
+
*/
|
|
73
|
+
export default function GroupInviteButton(inProps) {
|
|
74
|
+
var _a;
|
|
75
|
+
//PROPS
|
|
76
|
+
const props = useThemeProps({
|
|
77
|
+
props: inProps,
|
|
78
|
+
name: PREFIX
|
|
79
|
+
});
|
|
80
|
+
const { className, group, groupId, handleInvitations = null } = props, rest = __rest(props, ["className", "group", "groupId", "handleInvitations"]);
|
|
81
|
+
// CONTEXT
|
|
82
|
+
const scUserContext = useContext(SCUserContext);
|
|
83
|
+
// STATE
|
|
84
|
+
const [open, setOpen] = useState(false);
|
|
85
|
+
const [isSending, setIsSending] = useState(false);
|
|
86
|
+
const [value, setValue] = useState('');
|
|
87
|
+
const [suggested, setSuggested] = useState([]);
|
|
88
|
+
const [list, setList] = useState([]);
|
|
89
|
+
const [loading, setLoading] = useState(false);
|
|
90
|
+
const [invited, setInvited] = useState([]);
|
|
91
|
+
function convertToInvitedUsersObject(data) {
|
|
92
|
+
const invited_users = {};
|
|
93
|
+
data.forEach((user, index) => {
|
|
94
|
+
invited_users[`invited_users[${index}]`] = user.id;
|
|
95
|
+
});
|
|
96
|
+
return invited_users;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Memoized users invited ids
|
|
100
|
+
*/
|
|
101
|
+
const ids = useMemo(() => {
|
|
102
|
+
if (invited) {
|
|
103
|
+
return invited.map((u) => {
|
|
104
|
+
return parseInt(u.id, 10);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return [invited];
|
|
108
|
+
}, [invited]);
|
|
109
|
+
// HOOKS
|
|
110
|
+
const { scGroup } = useSCFetchGroup({ id: groupId, group });
|
|
111
|
+
const isGroupAdmin = useMemo(() => { var _a; return scUserContext.user && ((_a = scGroup === null || scGroup === void 0 ? void 0 : scGroup.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scGroup === null || scGroup === void 0 ? void 0 : scGroup.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
|
|
112
|
+
// INTL
|
|
113
|
+
const intl = useIntl();
|
|
114
|
+
function fetchResults() {
|
|
115
|
+
setLoading(true);
|
|
116
|
+
GroupService.getGroupSuggestedUsers(scGroup === null || scGroup === void 0 ? void 0 : scGroup.id, value)
|
|
117
|
+
.then((data) => {
|
|
118
|
+
setLoading(false);
|
|
119
|
+
setSuggested(data.results);
|
|
120
|
+
})
|
|
121
|
+
.catch((error) => {
|
|
122
|
+
setLoading(false);
|
|
123
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function fetchGeneralResults() {
|
|
127
|
+
setLoading(true);
|
|
128
|
+
GroupService.getGroupsSuggestedUsers(value)
|
|
129
|
+
.then((data) => {
|
|
130
|
+
setLoading(false);
|
|
131
|
+
setSuggested(data.results);
|
|
132
|
+
})
|
|
133
|
+
.catch((error) => {
|
|
134
|
+
setLoading(false);
|
|
135
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (scGroup === null || scGroup === void 0 ? void 0 : scGroup.id) {
|
|
140
|
+
GroupService.getGroupSuggestedUsers(scGroup === null || scGroup === void 0 ? void 0 : scGroup.id, value).then((data) => {
|
|
141
|
+
setLoading(false);
|
|
142
|
+
setList(data.results);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
GroupService.getGroupsSuggestedUsers(value).then((data) => {
|
|
147
|
+
setLoading(false);
|
|
148
|
+
setList(data.results);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}, [scGroup === null || scGroup === void 0 ? void 0 : scGroup.id]);
|
|
152
|
+
/**
|
|
153
|
+
* If a value is entered in new message field, it fetches user suggested
|
|
154
|
+
*/
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
if (value && !handleInvitations) {
|
|
157
|
+
fetchResults();
|
|
158
|
+
}
|
|
159
|
+
fetchGeneralResults();
|
|
160
|
+
}, [value, handleInvitations]);
|
|
161
|
+
/**
|
|
162
|
+
* Handles dialog close
|
|
163
|
+
*/
|
|
164
|
+
const handleClose = () => {
|
|
165
|
+
setOpen((p) => !p);
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Handles invitation sending
|
|
169
|
+
*/
|
|
170
|
+
const handleSendInvitations = () => {
|
|
171
|
+
if (handleInvitations) {
|
|
172
|
+
handleInvitations(convertToInvitedUsersObject(invited));
|
|
173
|
+
setOpen(false);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
const data = { users: ids };
|
|
177
|
+
setIsSending(true);
|
|
178
|
+
GroupService.inviteOrAcceptGroupRequest(scGroup.id, data)
|
|
179
|
+
.then(() => {
|
|
180
|
+
setIsSending(false);
|
|
181
|
+
setOpen(false);
|
|
182
|
+
setInvited([]);
|
|
183
|
+
})
|
|
184
|
+
.catch((error) => {
|
|
185
|
+
setOpen(false);
|
|
186
|
+
setLoading(false);
|
|
187
|
+
Logger.error(SCOPE_SC_UI, error);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
// Autocomplete Handlers
|
|
192
|
+
const handleInputChange = (event, value, reason) => {
|
|
193
|
+
switch (reason) {
|
|
194
|
+
case 'input':
|
|
195
|
+
setValue(value);
|
|
196
|
+
!value && setSuggested([]);
|
|
197
|
+
break;
|
|
198
|
+
case 'reset':
|
|
199
|
+
setValue(value);
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
const handleChange = (event, value, reason, details) => {
|
|
204
|
+
event.preventDefault();
|
|
205
|
+
event.stopPropagation();
|
|
206
|
+
switch (reason) {
|
|
207
|
+
case 'selectOption':
|
|
208
|
+
setInvited(value);
|
|
209
|
+
setList((prev) => prev.filter((u) => u.id !== details.option.id));
|
|
210
|
+
break;
|
|
211
|
+
case 'removeOption':
|
|
212
|
+
setInvited(value);
|
|
213
|
+
setList((prev) => [...prev, details.option]);
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
return false;
|
|
217
|
+
};
|
|
218
|
+
const handleUserInvite = (user) => {
|
|
219
|
+
setInvited((prev) => [...prev, user]);
|
|
220
|
+
setList((prev) => prev.filter((u) => u.id !== user.id));
|
|
221
|
+
};
|
|
222
|
+
const handleDelete = (option) => {
|
|
223
|
+
setInvited(invited.filter((v) => v !== option));
|
|
224
|
+
setList((prev) => [...prev, option]);
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* If in group edit mode and logged-in user is not also the group manager, the component is hidden.
|
|
228
|
+
// */
|
|
229
|
+
if (group && !isGroupAdmin) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Renders root object
|
|
234
|
+
*/
|
|
235
|
+
return (React.createElement(React.Fragment, null,
|
|
236
|
+
React.createElement(Root, Object.assign({ className: classNames(classes.root, className), onClick: handleClose, variant: scGroup ? 'contained' : 'outlined', color: scGroup ? 'secondary' : 'inherit', startIcon: React.createElement(Icon, { fontSize: "small" }, "add") }, rest),
|
|
237
|
+
React.createElement(FormattedMessage, { id: "ui.groupInviteButton", defaultMessage: "ui.groupInviteButton" })),
|
|
238
|
+
open && (React.createElement(DialogRoot, { DialogContentProps: { dividers: false }, open: true, className: classes.dialogRoot, title: React.createElement(React.Fragment, null,
|
|
239
|
+
React.createElement(IconButton, { onClick: handleClose },
|
|
240
|
+
React.createElement(Icon, { fontSize: "medium" }, "arrow_back")),
|
|
241
|
+
React.createElement(Typography, { className: classes.dialogTitle },
|
|
242
|
+
React.createElement(FormattedMessage, { id: "ui.groupInviteButton.dialog.title", defaultMessage: "ui.groupInviteButton.dialog.title" })),
|
|
243
|
+
React.createElement(LoadingButton, { size: "small", color: "secondary", variant: "contained", onClick: handleSendInvitations, loading: isSending, disabled: !invited.length },
|
|
244
|
+
React.createElement(FormattedMessage, { id: "ui.groupInviteButton.dialog.button.end", defaultMessage: "ui.groupInviteButton.dialog.button.end" }))) },
|
|
245
|
+
React.createElement(Box, { className: classes.dialogContent },
|
|
246
|
+
React.createElement(Autocomplete, { className: classes.autocomplete, loading: loading, size: "small", multiple: true, freeSolo: true, disableClearable: true, options: suggested, onChange: handleChange, onInputChange: handleInputChange, inputValue: value, value: invited, getOptionLabel: (option) => (option ? option.username : '...'), isOptionEqualToValue: (option, value) => (option ? value.id === option.id : false), renderTags: () => null, renderOption: (props, option) => (React.createElement(Box, Object.assign({ component: "li" }, props),
|
|
247
|
+
React.createElement(Avatar, { alt: option.username, src: option.avatar }),
|
|
248
|
+
React.createElement(Typography, { ml: 1 }, option.username))), renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { variant: "outlined", placeholder: `${intl.formatMessage(messages.placeholder)}`, InputProps: Object.assign(Object.assign({}, params.InputProps), { className: classes.input, startAdornment: (React.createElement(React.Fragment, null,
|
|
249
|
+
React.createElement(InputAdornment, { position: "start" },
|
|
250
|
+
React.createElement(Icon, { className: classes.icon }, "search")),
|
|
251
|
+
params.InputProps.startAdornment)) }) }))) }),
|
|
252
|
+
React.createElement(Box, { className: classes.invitedBox }, invited.map((option, index) => (React.createElement(Chip, { key: index, avatar: React.createElement(Avatar, { alt: option.username, src: option.avatar }), label: option.username, onDelete: () => {
|
|
253
|
+
handleDelete(option);
|
|
254
|
+
}, style: { marginRight: 8 } })))),
|
|
255
|
+
React.createElement(Box, { className: classes.suggested },
|
|
256
|
+
list.length !== 0 && (React.createElement(Typography, { variant: "h4", fontWeight: "bold" },
|
|
257
|
+
React.createElement(FormattedMessage, { id: "ui.groupInviteButton.dialog.content.list", defaultMessage: "ui.groupInviteButton.dialog.content.list" }))),
|
|
258
|
+
list.slice(0, 5).map((user, index) => (React.createElement(User, { elevation: 0, actions: React.createElement(React.Fragment, null), user: user, userId: user.id, key: index, buttonProps: { onClick: () => handleUserInvite(user) } })))))))));
|
|
259
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BaseDialogProps } from '../../shared/BaseDialog';
|
|
2
|
+
import { SCGroupType } from '@selfcommunity/types';
|
|
3
|
+
import { ButtonProps } from '@mui/material/Button/Button';
|
|
4
|
+
export interface GroupMembersButtonProps extends Pick<ButtonProps, Exclude<keyof ButtonProps, 'onClick' | 'disabled'>> {
|
|
5
|
+
/**
|
|
6
|
+
* Group Object
|
|
7
|
+
* @default null
|
|
8
|
+
*/
|
|
9
|
+
group?: SCGroupType;
|
|
10
|
+
/**
|
|
11
|
+
* Id of the group
|
|
12
|
+
* @default null
|
|
13
|
+
*/
|
|
14
|
+
groupId?: number | string;
|
|
15
|
+
/**
|
|
16
|
+
* Props to spread to followedBy dialog
|
|
17
|
+
* @default {}
|
|
18
|
+
*/
|
|
19
|
+
DialogProps?: BaseDialogProps;
|
|
20
|
+
/**
|
|
21
|
+
* Hides this component
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
autoHide?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Any other properties
|
|
27
|
+
*/
|
|
28
|
+
[p: string]: any;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
*> API documentation for the Community-JS Group Members Button component. Learn about the available props and the CSS API.
|
|
32
|
+
*
|
|
33
|
+
#### Import
|
|
34
|
+
```jsx
|
|
35
|
+
import {GroupMembersButton} from '@selfcommunity/react-ui';
|
|
36
|
+
```
|
|
37
|
+
#### Component Name
|
|
38
|
+
|
|
39
|
+
The name `SCGroupMembersButton` can be used when providing style overrides in the theme.
|
|
40
|
+
|
|
41
|
+
* #### CSS
|
|
42
|
+
*
|
|
43
|
+
|Rule Name|Global class|Description|
|
|
44
|
+
|---|---|---|
|
|
45
|
+
|root|.SCGroupMembersButton-root|Styles applied to the root element.|
|
|
46
|
+
|dialogRoot|.SCGroupMembersButton-dialog-root|Styles applied to the root element.|
|
|
47
|
+
|endMessage|.SCCategoriesFollowedWidget-end-message|Styles applied to the end message element.|
|
|
48
|
+
|
|
49
|
+
* @param inProps
|
|
50
|
+
*/
|
|
51
|
+
export default function GroupMembersButton(inProps: GroupMembersButtonProps): JSX.Element;
|