@selfcommunity/react-ui 0.8.0-alpha.3 → 0.8.0-alpha.31
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 +11 -2
- package/lib/cjs/components/Composer/Composer.js +10 -2
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +12 -3
- package/lib/cjs/components/CreateEventButton/CreateEventButton.js +5 -1
- package/lib/cjs/components/CreateEventWidget/CreateEventWidget.js +5 -1
- package/lib/cjs/components/EventForm/EventForm.d.ts +1 -1
- package/lib/cjs/components/EventForm/EventForm.js +72 -54
- package/lib/cjs/components/EventForm/constants.d.ts +4 -0
- package/lib/cjs/components/EventForm/constants.js +5 -1
- package/lib/cjs/components/EventForm/types.d.ts +1 -2
- package/lib/cjs/components/EventForm/utils.d.ts +4 -0
- package/lib/cjs/components/EventForm/utils.js +28 -0
- package/lib/cjs/components/EventInfoWidget/EventInfoWidget.js +24 -1
- package/lib/cjs/components/Events/Events.js +17 -7
- package/lib/cjs/components/Events/LocationEventsFilter.d.ts +14 -0
- package/lib/cjs/components/Events/LocationEventsFilter.js +45 -0
- package/lib/cjs/components/Events/PastEventsFilter.js +1 -2
- package/lib/cjs/components/Feed/Feed.js +12 -3
- package/lib/cjs/components/GroupActionsMenu/index.d.ts +57 -0
- package/lib/cjs/components/GroupActionsMenu/index.js +157 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +6 -0
- package/lib/cjs/components/GroupHeader/GroupHeader.js +8 -4
- package/lib/cjs/components/Groups/Groups.js +26 -0
- package/lib/cjs/components/MyEventsWidget/MyEventsWidget.js +6 -2
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +35 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +68 -0
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +8 -27
- package/lib/cjs/components/NavigationMenuIconButton/index.d.ts +2 -1
- package/lib/cjs/components/NavigationMenuIconButton/index.js +3 -1
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +14 -5
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -2
- package/lib/cjs/components/Notification/Event/Event.js +4 -0
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +10 -1
- package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +69 -26
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +8 -4
- package/lib/cjs/components/OnBoardingWidget/Steps/Invite/Invite.js +56 -12
- package/lib/cjs/components/PlatformWidget/constants.d.ts +0 -4
- package/lib/cjs/components/PlatformWidget/constants.js +1 -5
- package/lib/cjs/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +7 -2
- package/lib/cjs/constants/GroupActionsMenu.d.ts +5 -0
- package/lib/cjs/constants/GroupActionsMenu.js +8 -0
- package/lib/cjs/constants/PubSub.d.ts +16 -1
- package/lib/cjs/constants/PubSub.js +11 -1
- package/lib/cjs/index.d.ts +4 -2
- package/lib/cjs/index.js +12 -5
- package/lib/cjs/shared/ContributionActionsMenu/index.js +6 -6
- package/lib/cjs/shared/InfiniteScroll/index.js +3 -3
- package/lib/cjs/shared/Media/Link/DisplayComponent.js +21 -5
- package/lib/cjs/utils/formatRelativeTime.js +2 -2
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +11 -2
- package/lib/esm/components/Composer/Composer.js +10 -2
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +13 -4
- package/lib/esm/components/CreateEventButton/CreateEventButton.js +5 -1
- package/lib/esm/components/CreateEventWidget/CreateEventWidget.js +5 -1
- package/lib/esm/components/EventForm/EventForm.d.ts +1 -1
- package/lib/esm/components/EventForm/EventForm.js +74 -56
- package/lib/esm/components/EventForm/constants.d.ts +4 -0
- package/lib/esm/components/EventForm/constants.js +4 -0
- package/lib/esm/components/EventForm/types.d.ts +1 -2
- package/lib/esm/components/EventForm/utils.d.ts +4 -0
- package/lib/esm/components/EventForm/utils.js +21 -0
- package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +25 -2
- package/lib/esm/components/Events/Events.js +18 -8
- package/lib/esm/components/Events/LocationEventsFilter.d.ts +14 -0
- package/lib/esm/components/Events/LocationEventsFilter.js +41 -0
- package/lib/esm/components/Events/PastEventsFilter.js +1 -2
- package/lib/esm/components/Feed/Feed.js +14 -5
- package/lib/esm/components/GroupActionsMenu/index.d.ts +57 -0
- package/lib/esm/components/GroupActionsMenu/index.js +154 -0
- package/lib/esm/components/GroupHeader/GroupHeader.d.ts +6 -0
- package/lib/esm/components/GroupHeader/GroupHeader.js +9 -5
- package/lib/esm/components/Groups/Groups.js +27 -1
- package/lib/esm/components/MyEventsWidget/MyEventsWidget.js +7 -3
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.d.ts +35 -0
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +65 -0
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.d.ts +9 -20
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +11 -30
- package/lib/esm/components/NavigationMenuIconButton/index.d.ts +2 -1
- package/lib/esm/components/NavigationMenuIconButton/index.js +2 -1
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.d.ts +5 -0
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +14 -5
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -2
- package/lib/esm/components/Notification/Event/Event.js +4 -0
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +10 -1
- package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +71 -28
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +9 -5
- package/lib/esm/components/OnBoardingWidget/Steps/Invite/Invite.js +59 -14
- package/lib/esm/components/PlatformWidget/constants.d.ts +0 -4
- package/lib/esm/components/PlatformWidget/constants.js +0 -4
- package/lib/esm/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +8 -3
- package/lib/esm/constants/GroupActionsMenu.d.ts +5 -0
- package/lib/esm/constants/GroupActionsMenu.js +5 -0
- package/lib/esm/constants/PubSub.d.ts +16 -1
- package/lib/esm/constants/PubSub.js +10 -0
- package/lib/esm/index.d.ts +4 -2
- package/lib/esm/index.js +5 -3
- package/lib/esm/shared/ContributionActionsMenu/index.js +6 -6
- package/lib/esm/shared/InfiniteScroll/index.js +3 -3
- package/lib/esm/shared/Media/Link/DisplayComponent.js +21 -5
- package/lib/esm/utils/formatRelativeTime.js +2 -2
- package/lib/umd/148.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
- package/lib/umd/99.js +0 -2
- /package/lib/umd/{99.js.LICENSE.txt → 148.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
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 react_intl_1 = require("react-intl");
|
|
7
|
+
const system_1 = require("@mui/system");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const styles_1 = require("@mui/material/styles");
|
|
10
|
+
const types_1 = require("@selfcommunity/types");
|
|
11
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
12
|
+
const classes = {
|
|
13
|
+
root: `${constants_1.PREFIX}-root`
|
|
14
|
+
};
|
|
15
|
+
const Root = (0, styles_1.styled)(material_1.FormControl, {
|
|
16
|
+
name: constants_1.PREFIX,
|
|
17
|
+
slot: 'Root'
|
|
18
|
+
})(() => ({}));
|
|
19
|
+
const locationOptions = [
|
|
20
|
+
{
|
|
21
|
+
value: types_1.SCEventLocationFilterType.ANY,
|
|
22
|
+
label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.location.select.any", defaultMessage: "ui.events.location.select.any" })
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: types_1.SCEventLocationFilterType.PERSON,
|
|
26
|
+
label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventInfoDetails.location.inPerson", defaultMessage: "ui.eventInfoDetails.location.inPerson" })
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: types_1.SCEventLocationFilterType.ONLINE,
|
|
30
|
+
label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventInfoDetails.location.virtual", defaultMessage: "ui.eventInfoDetails.location.virtual" })
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
function LocationEventsFilter(inProps) {
|
|
34
|
+
// PROPS
|
|
35
|
+
const props = (0, system_1.useThemeProps)({
|
|
36
|
+
props: inProps,
|
|
37
|
+
name: constants_1.PREFIX
|
|
38
|
+
});
|
|
39
|
+
const { className, value, disabled = false, autoHide = false, handleOnChange } = props;
|
|
40
|
+
if (autoHide) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className), fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.filterByLocation", defaultMessage: "ui.events.filterByLocation" }) }), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ disabled: disabled, size: 'small', label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.events.location", defaultMessage: "ui.events.location" }), value: value, onChange: handleOnChange, renderValue: (selected) => locationOptions.find((option) => option.value === selected).label }, { children: locationOptions.map((option) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ value: option.value }, { children: [(0, jsx_runtime_1.jsx)(material_1.Radio, { checked: value === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })));
|
|
44
|
+
}
|
|
45
|
+
exports.default = LocationEventsFilter;
|
|
@@ -7,7 +7,6 @@ const react_intl_1 = require("react-intl");
|
|
|
7
7
|
const system_1 = require("@mui/system");
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
9
|
const Events_1 = require("./Events");
|
|
10
|
-
const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
|
|
11
10
|
function PastEventsFilter(inProps) {
|
|
12
11
|
// PROPS
|
|
13
12
|
const props = (0, system_1.useThemeProps)({
|
|
@@ -16,7 +15,7 @@ function PastEventsFilter(inProps) {
|
|
|
16
15
|
});
|
|
17
16
|
const { autoHide = false, showPastEvents, handleClick, handleDeleteClick } = props, rest = tslib_1.__rest(props, ["autoHide", "showPastEvents", "handleClick", "handleDeleteClick"]);
|
|
18
17
|
if (autoHide) {
|
|
19
|
-
return
|
|
18
|
+
return null;
|
|
20
19
|
}
|
|
21
20
|
return ((0, jsx_runtime_1.jsx)(Events_1.EventsChipRoot
|
|
22
21
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
@@ -26,11 +26,18 @@ const Skeleton_2 = tslib_1.__importDefault(require("./Skeleton"));
|
|
|
26
26
|
const use_deep_compare_effect_1 = require("use-deep-compare-effect");
|
|
27
27
|
const StickyBox_1 = tslib_1.__importDefault(require("../../shared/StickyBox"));
|
|
28
28
|
const constants_1 = require("./constants");
|
|
29
|
+
const messages = (0, react_intl_1.defineMessages)({
|
|
30
|
+
refresh: {
|
|
31
|
+
id: 'ui.feed.refreshRelease',
|
|
32
|
+
defaultMessage: 'ui.feed.refreshRelease'
|
|
33
|
+
}
|
|
34
|
+
});
|
|
29
35
|
const classes = {
|
|
30
36
|
root: `${constants_1.PREFIX}-root`,
|
|
31
37
|
left: `${constants_1.PREFIX}-left`,
|
|
32
38
|
leftItems: `${constants_1.PREFIX}-left-items`,
|
|
33
39
|
start: `${constants_1.PREFIX}-start`,
|
|
40
|
+
headerItem: `${constants_1.PREFIX}-header-item`,
|
|
34
41
|
end: `${constants_1.PREFIX}-end`,
|
|
35
42
|
endMessage: `${constants_1.PREFIX}-end-message`,
|
|
36
43
|
right: `${constants_1.PREFIX}-right`,
|
|
@@ -78,7 +85,9 @@ const Feed = (inProps, ref) => {
|
|
|
78
85
|
props: inProps,
|
|
79
86
|
name: constants_1.PREFIX
|
|
80
87
|
});
|
|
81
|
-
|
|
88
|
+
// HOOKS
|
|
89
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
90
|
+
const { id = 'feed', className, endpoint, endpointQueryParams = { limit: Pagination_1.DEFAULT_PAGINATION_LIMIT, offset: Pagination_1.DEFAULT_PAGINATION_OFFSET }, endMessage = (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.feed.noOtherFeedObject", defaultMessage: "ui.feed.noOtherFeedObject" }), refreshMessage = (0, jsx_runtime_1.jsx)(material_1.Typography, { dangerouslySetInnerHTML: { __html: `${intl.formatMessage(messages.refresh)}` } }), HeaderComponent, FooterComponent = Footer_1.default, FooterComponentProps = {}, widgets = [], ItemComponent, itemPropsGenerator, itemIdGenerator, ItemProps = {}, ItemSkeleton, ItemSkeletonProps = {}, onNextData, onPreviousData, FeedSidebarProps = {}, CustomAdvProps = {}, enabledCustomAdvPositions = [types_1.SCCustomAdvPosition.POSITION_FEED_SIDEBAR, types_1.SCCustomAdvPosition.POSITION_FEED], requireAuthentication = false, cacheStrategy = utils_1.CacheStrategies.NETWORK_ONLY, prefetchedData, scrollableTargetId, VirtualizedScrollerProps = {}, disablePaginationLinks = false, hidePaginationLinks = true, paginationLinksPageQueryParam = Pagination_1.DEFAULT_PAGINATION_QUERY_PARAM_NAME, PaginationLinkProps = {}, hideAdvs = false, emptyFeedPlaceholder } = props;
|
|
82
91
|
// CONTEXT
|
|
83
92
|
const scPreferences = (0, react_1.useContext)(react_core_1.SCPreferencesContext);
|
|
84
93
|
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
@@ -285,7 +294,7 @@ const Feed = (inProps, ref) => {
|
|
|
285
294
|
const renderHeaderComponent = () => {
|
|
286
295
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.start }, { children: !feedDataObject.previous && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [virtualScrollerMountState.current && HeaderComponent, headData.map((item) => {
|
|
287
296
|
const _itemId = `item_${itemIdGenerator(item)}`;
|
|
288
|
-
return ((0, jsx_runtime_1.jsx)(ItemComponent, Object.assign({ id: _itemId }, itemPropsGenerator(scUserContext.user, item), ItemProps, { sx: { width: '100%' } }), _itemId));
|
|
297
|
+
return ((0, jsx_runtime_1.jsx)(ItemComponent, Object.assign({ className: classes.headerItem, id: _itemId }, itemPropsGenerator(scUserContext.user, item), ItemProps, { sx: { width: '100%' } }), _itemId));
|
|
289
298
|
})] })) })));
|
|
290
299
|
};
|
|
291
300
|
/**
|
|
@@ -411,6 +420,6 @@ const Feed = (inProps, ref) => {
|
|
|
411
420
|
if (feedDataObject.isLoadingNext && !feedDataLeft.length) {
|
|
412
421
|
return ((0, jsx_runtime_1.jsx)(Skeleton_2.default, { children: [...Array(3)].map((v, i) => ((0, jsx_runtime_1.jsx)(ItemSkeleton, Object.assign({}, ItemSkeletonProps), i))) }));
|
|
413
422
|
}
|
|
414
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ container: true, spacing: 2, id: id, className: (0, classnames_1.default)(classes.root, className) }, { children: [advEnabled && !hideAdvs && enabledCustomAdvPositions.includes(types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR) ? ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(CustomAdv_1.default, Object.assign({ position: types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR }, CustomAdvProps)) }))) : null, (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 7 }, { children: (0, jsx_runtime_1.jsxs)(InfiniteScroll_1.default, Object.assign({ ref: containerRef, className: classes.left, dataLength: feedDataLeft.length, next: getNextPage, previous: getPreviousPage, hasMoreNext: Boolean(feedDataObject.next), hasMorePrevious: Boolean(feedDataObject.previous), header: PreviousPageLink, footer: NextPageLink, loaderNext: (0, jsx_runtime_1.jsx)(ItemSkeleton, Object.assign({}, ItemSkeletonProps)), loaderPrevious: (0, jsx_runtime_1.jsx)(ItemSkeleton, Object.assign({}, ItemSkeletonProps)), scrollThreshold: '90%', endMessage: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.end }, { children: [(0, jsx_runtime_1.jsx)(Widget_1.default, Object.assign({ className: classes.endMessage }, { children: (0, jsx_runtime_1.jsx)(material_1.CardContent, { children: endMessage }) })), FooterComponent ? (0, jsx_runtime_1.jsx)(FooterComponent, Object.assign({}, FooterComponentProps)) : null] })), refreshFunction: refresh, pullDownToRefresh: true, pullDownToRefreshThreshold: 1000, pullDownToRefreshContent: null, releaseToRefreshContent: (0, jsx_runtime_1.jsx)(
|
|
423
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ container: true, spacing: 2, id: id, className: (0, classnames_1.default)(classes.root, className) }, { children: [advEnabled && !hideAdvs && enabledCustomAdvPositions.includes(types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR) ? ((0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(CustomAdv_1.default, Object.assign({ position: types_1.SCCustomAdvPosition.POSITION_BELOW_TOPBAR }, CustomAdvProps)) }))) : null, (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 7 }, { children: (0, jsx_runtime_1.jsxs)(InfiniteScroll_1.default, Object.assign({ ref: containerRef, className: classes.left, dataLength: feedDataLeft.length, next: getNextPage, previous: getPreviousPage, hasMoreNext: Boolean(feedDataObject.next), hasMorePrevious: Boolean(feedDataObject.previous), header: PreviousPageLink, footer: NextPageLink, loaderNext: (0, jsx_runtime_1.jsx)(ItemSkeleton, Object.assign({}, ItemSkeletonProps)), loaderPrevious: (0, jsx_runtime_1.jsx)(ItemSkeleton, Object.assign({}, ItemSkeletonProps)), scrollThreshold: '90%', endMessage: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.end }, { children: [(0, jsx_runtime_1.jsx)(Widget_1.default, Object.assign({ className: classes.endMessage }, { children: (0, jsx_runtime_1.jsx)(material_1.CardContent, { children: endMessage }) })), FooterComponent ? (0, jsx_runtime_1.jsx)(FooterComponent, Object.assign({}, FooterComponentProps)) : null] })), refreshFunction: refresh, pullDownToRefresh: true, pullDownToRefreshThreshold: 1000, pullDownToRefreshContent: null, releaseToRefreshContent: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ color: "secondary", variant: "contained", className: classes.refresh }, { children: refreshMessage })), style: { overflow: 'visible' } }, (scrollableTargetId && { scrollableTarget: scrollableTargetId }), { children: [renderHeaderComponent(), feedDataObject.count === 0 && emptyFeedPlaceholder && emptyFeedPlaceholder, (0, jsx_runtime_1.jsx)(VirtualizedScroller_1.default, Object.assign({ className: classes.leftItems, items: feedDataLeft, itemComponent: InnerItem, onMount: onScrollerMount, onScrollerStateChange: onScrollerStateChange, getItemId: getScrollItemId, preserveScrollPosition: true, preserveScrollPositionOnPrependItems: true, cacheScrollStateKey: react_core_1.SCCache.getVirtualizedScrollStateCacheKey(id), cacheScrollerPositionKey: react_core_1.SCCache.getFeedSPCacheKey(id), cacheStrategy: cacheStrategy }, (scrollableTargetId && { getScrollableContainer: () => document.getElementById(scrollableTargetId) }), VirtualizedScrollerProps))] })) })), feedDataRight.length > 0 && !hideAdvs && ((0, jsx_runtime_1.jsx)(material_1.Hidden, Object.assign({ smDown: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, Object.assign({ item: true, xs: 12, md: 5 }, { children: (0, jsx_runtime_1.jsx)(StickyBox_1.default, Object.assign({ className: classes.right }, FeedSidebarProps, { children: (0, jsx_runtime_1.jsx)(react_1.default.Suspense, Object.assign({ fallback: (0, jsx_runtime_1.jsx)(Skeleton_1.GenericSkeleton, {}) }, { children: feedDataRight.map((d, i) => ((0, jsx_runtime_1.jsx)(d.component, Object.assign({}, d.componentProps), i))) })) })) })) })))] })));
|
|
415
424
|
};
|
|
416
425
|
exports.default = (0, react_1.forwardRef)(Feed);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { IconButtonProps } from '@mui/material';
|
|
2
|
+
import { SCGroupType } from '@selfcommunity/types';
|
|
3
|
+
export interface GroupActionsMenuProps extends IconButtonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Overrides or extends the styles applied to the component.
|
|
6
|
+
* @default null
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The group
|
|
11
|
+
*/
|
|
12
|
+
group: SCGroupType;
|
|
13
|
+
/**
|
|
14
|
+
* The group id
|
|
15
|
+
*/
|
|
16
|
+
groupId?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Handles callback on delete confirm
|
|
19
|
+
*/
|
|
20
|
+
onDeleteConfirm?: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Handles on edit success
|
|
23
|
+
*/
|
|
24
|
+
onEditSuccess?: (data: SCGroupType) => any;
|
|
25
|
+
/**
|
|
26
|
+
* Any other properties
|
|
27
|
+
*/
|
|
28
|
+
[p: string]: any;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* > API documentation for the Community-JS GroupActionsMenu component. Learn about the available props and the CSS API.
|
|
32
|
+
|
|
33
|
+
#### Import
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
import {GroupActionsMenu} from '@selfcommunity/react-ui';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Component Name
|
|
40
|
+
|
|
41
|
+
The name `SCGroupActionsMenu` can be used when providing style overrides in the theme.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
#### CSS
|
|
45
|
+
|
|
46
|
+
|Rule Name|Global class|Description|
|
|
47
|
+
|---|---|---|
|
|
48
|
+
|root|.SCGroupActionsMenu-root|Styles applied to the root element.|
|
|
49
|
+
|drawerRoot|.SCGroupActionsMenu-drawer-root|Styles applied to the drawer root element.|
|
|
50
|
+
|menuRoot|.SCGroupActionsMenu-menu-root|Styles applied to the menu root element.|
|
|
51
|
+
|paper|.SCGroupActionsMenu-paper|Styles applied to the paper element.|
|
|
52
|
+
|item|.SCGroupActionsMenu-item|Styles applied to the item element.|
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
* @param inProps
|
|
56
|
+
*/
|
|
57
|
+
export default function GroupActionsMenu(inProps: GroupActionsMenuProps): JSX.Element;
|
|
@@ -0,0 +1,157 @@
|
|
|
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 material_1 = require("@mui/material");
|
|
8
|
+
const react_intl_1 = require("react-intl");
|
|
9
|
+
const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
|
|
10
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
11
|
+
const system_1 = require("@mui/system");
|
|
12
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
13
|
+
const ConfirmDialog_1 = tslib_1.__importDefault(require("../../shared/ConfirmDialog/ConfirmDialog"));
|
|
14
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
15
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
16
|
+
const notistack_1 = require("notistack");
|
|
17
|
+
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
18
|
+
const PubSub_1 = require("../../constants/PubSub");
|
|
19
|
+
const GroupForm_1 = tslib_1.__importDefault(require("../../components/GroupForm"));
|
|
20
|
+
const GroupActionsMenu_1 = require("../../constants/GroupActionsMenu");
|
|
21
|
+
const PREFIX = 'SCGroupActionsMenu';
|
|
22
|
+
const classes = {
|
|
23
|
+
root: `${PREFIX}-root`,
|
|
24
|
+
drawerRoot: `${PREFIX}-drawer-root`,
|
|
25
|
+
menuRoot: `${PREFIX}-menu-root`,
|
|
26
|
+
paper: `${PREFIX}-paper`,
|
|
27
|
+
item: `${PREFIX}-item`
|
|
28
|
+
};
|
|
29
|
+
const Root = (0, styles_1.styled)(material_1.IconButton, {
|
|
30
|
+
name: PREFIX,
|
|
31
|
+
slot: 'Root'
|
|
32
|
+
})(() => ({}));
|
|
33
|
+
const SwipeableDrawerRoot = (0, styles_1.styled)(material_1.SwipeableDrawer, {
|
|
34
|
+
name: PREFIX,
|
|
35
|
+
slot: 'DrawerRoot'
|
|
36
|
+
})(() => ({}));
|
|
37
|
+
const MenuRoot = (0, styles_1.styled)(material_1.Menu, {
|
|
38
|
+
name: PREFIX,
|
|
39
|
+
slot: 'MenuRoot'
|
|
40
|
+
})(() => ({}));
|
|
41
|
+
/**
|
|
42
|
+
* > API documentation for the Community-JS GroupActionsMenu component. Learn about the available props and the CSS API.
|
|
43
|
+
|
|
44
|
+
#### Import
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
import {GroupActionsMenu} from '@selfcommunity/react-ui';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Component Name
|
|
51
|
+
|
|
52
|
+
The name `SCGroupActionsMenu` can be used when providing style overrides in the theme.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
#### CSS
|
|
56
|
+
|
|
57
|
+
|Rule Name|Global class|Description|
|
|
58
|
+
|---|---|---|
|
|
59
|
+
|root|.SCGroupActionsMenu-root|Styles applied to the root element.|
|
|
60
|
+
|drawerRoot|.SCGroupActionsMenu-drawer-root|Styles applied to the drawer root element.|
|
|
61
|
+
|menuRoot|.SCGroupActionsMenu-menu-root|Styles applied to the menu root element.|
|
|
62
|
+
|paper|.SCGroupActionsMenu-paper|Styles applied to the paper element.|
|
|
63
|
+
|item|.SCGroupActionsMenu-item|Styles applied to the item element.|
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
* @param inProps
|
|
67
|
+
*/
|
|
68
|
+
function GroupActionsMenu(inProps) {
|
|
69
|
+
var _a;
|
|
70
|
+
// PROPS
|
|
71
|
+
const props = (0, system_1.useThemeProps)({
|
|
72
|
+
props: inProps,
|
|
73
|
+
name: PREFIX
|
|
74
|
+
});
|
|
75
|
+
const { className, group, groupId, onDeleteConfirm, onEditSuccess } = props, rest = tslib_1.__rest(props, ["className", "group", "groupId", "onDeleteConfirm", "onEditSuccess"]);
|
|
76
|
+
// STATE
|
|
77
|
+
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
78
|
+
const [openConfirmDialog, setOpenConfirmDialog] = (0, react_1.useState)(false);
|
|
79
|
+
const [openEdit, setOpenEdit] = (0, react_1.useState)(false);
|
|
80
|
+
// HOOKS
|
|
81
|
+
const theme = (0, material_1.useTheme)();
|
|
82
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
83
|
+
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
84
|
+
const scUserContext = (0, react_core_1.useSCUser)();
|
|
85
|
+
const { scGroup, setSCGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
|
|
86
|
+
const isGroupAdmin = (0, react_1.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]);
|
|
87
|
+
// HANDLERS
|
|
88
|
+
const handleOpen = (group) => {
|
|
89
|
+
setAnchorEl(group.currentTarget);
|
|
90
|
+
};
|
|
91
|
+
const handleClose = () => {
|
|
92
|
+
setAnchorEl(null);
|
|
93
|
+
};
|
|
94
|
+
const handleEditClick = () => {
|
|
95
|
+
setOpenEdit((o) => !o);
|
|
96
|
+
};
|
|
97
|
+
const handleCloseDialog = () => {
|
|
98
|
+
setOpenConfirmDialog(false);
|
|
99
|
+
setAnchorEl(null);
|
|
100
|
+
};
|
|
101
|
+
const handleEditSuccess = (data) => {
|
|
102
|
+
setSCGroup(data);
|
|
103
|
+
onEditSuccess && onEditSuccess(data);
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Handles thread deletion
|
|
107
|
+
*/
|
|
108
|
+
function handleDeleteThread() {
|
|
109
|
+
api_services_1.GroupService.deleteGroup(scGroup.id)
|
|
110
|
+
.then(() => {
|
|
111
|
+
onDeleteConfirm();
|
|
112
|
+
handleCloseDialog();
|
|
113
|
+
pubsub_js_1.default.publish(`${PubSub_1.SCTopicType.GROUP}.${PubSub_1.SCGroupEventType.DELETE}`, scGroup.id);
|
|
114
|
+
})
|
|
115
|
+
.catch((error) => {
|
|
116
|
+
setOpenConfirmDialog(false);
|
|
117
|
+
console.log(error);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Handles actions
|
|
122
|
+
*/
|
|
123
|
+
function handleAction(action) {
|
|
124
|
+
if (action === GroupActionsMenu_1.GET_GROUP_LINK) {
|
|
125
|
+
(0, utils_1.copyTextToClipboard)(`${location.protocol}//${location.host}${scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, scGroup)}`).then(() => {
|
|
126
|
+
(0, notistack_1.enqueueSnackbar)((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.common.permanentLinkCopied", defaultMessage: "ui.common.permanentLinkCopied" }), {
|
|
127
|
+
variant: 'success',
|
|
128
|
+
autoHideDuration: 3000
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
handleClose();
|
|
132
|
+
}
|
|
133
|
+
else if (action === GroupActionsMenu_1.DELETE_GROUP) {
|
|
134
|
+
setOpenConfirmDialog(true);
|
|
135
|
+
handleClose();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
*/
|
|
141
|
+
const renderList = () => {
|
|
142
|
+
return [
|
|
143
|
+
(0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: () => handleAction(GroupActionsMenu_1.GET_GROUP_LINK) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "link" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupActionsMenu.item.link", defaultMessage: "ui.groupActionsMenu.item.link" })] }), "link"),
|
|
144
|
+
isGroupAdmin &&
|
|
145
|
+
scGroup.active && [
|
|
146
|
+
(0, jsx_runtime_1.jsx)(material_1.Divider, {}, "divider"),
|
|
147
|
+
isMobile && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: handleEditClick }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "edit" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupActionsMenu.item.edit", defaultMessage: "ui.groupActionsMenu.item.edit" })] }), "edit")),
|
|
148
|
+
(0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: () => handleAction(GroupActionsMenu_1.DELETE_GROUP) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "delete" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupActionsMenu.item.delete", defaultMessage: "ui.groupActionsMenu.item.delete" })] }), "delete")
|
|
149
|
+
]
|
|
150
|
+
];
|
|
151
|
+
};
|
|
152
|
+
if (!scGroup) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "more_vert" }) })), isMobile ? ((0, jsx_runtime_1.jsx)(SwipeableDrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "bottom", open: Boolean(anchorEl), onClose: handleClose, onOpen: handleOpen, PaperProps: { className: classes.paper }, disableSwipeToOpen: true }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: renderList() }) }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ className: classes.menuRoot, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, PaperProps: { className: classes.paper } }, { children: renderList() }))), openConfirmDialog && ((0, jsx_runtime_1.jsx)(ConfirmDialog_1.default, { open: openConfirmDialog, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupActionsMenu.dialog.msg", defaultMessage: "ui.groupActionsMenu.dialog.msg" }), btnConfirm: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupActionsMenu.dialog.confirm", defaultMessage: "ui.groupActionsMenu.dialog.confirm" }), onConfirm: handleDeleteThread, onClose: handleCloseDialog })), openEdit && (0, jsx_runtime_1.jsx)(GroupForm_1.default, { onClose: handleEditClick, group: scGroup, onSuccess: handleEditSuccess })] }));
|
|
156
|
+
}
|
|
157
|
+
exports.default = GroupActionsMenu;
|
|
@@ -3,6 +3,7 @@ import { ChangeGroupCoverProps } from '../ChangeGroupCover';
|
|
|
3
3
|
import { ChangeGroupPictureProps } from '../ChangeGroupPicture';
|
|
4
4
|
import { GroupMembersButtonProps } from '../GroupMembersButton';
|
|
5
5
|
import { GroupSubscribeButtonProps } from '../GroupSubscribeButton';
|
|
6
|
+
import { GroupActionsMenuProps } from '../GroupActionsMenu';
|
|
6
7
|
export interface GroupHeaderProps {
|
|
7
8
|
/**
|
|
8
9
|
* Id of group object
|
|
@@ -44,6 +45,11 @@ export interface GroupHeaderProps {
|
|
|
44
45
|
* @default {}
|
|
45
46
|
*/
|
|
46
47
|
GroupMembersButtonProps?: GroupMembersButtonProps;
|
|
48
|
+
/**
|
|
49
|
+
* Props to spread event actions menu
|
|
50
|
+
* @default {}
|
|
51
|
+
*/
|
|
52
|
+
GroupActionsProps?: Omit<GroupActionsMenuProps, 'group'>;
|
|
47
53
|
/**
|
|
48
54
|
* Any other properties
|
|
49
55
|
*/
|
|
@@ -21,6 +21,7 @@ const GroupSubscribeButton_1 = tslib_1.__importDefault(require("../GroupSubscrib
|
|
|
21
21
|
const GroupInviteButton_1 = tslib_1.__importDefault(require("../GroupInviteButton"));
|
|
22
22
|
const PubSub_1 = require("../../constants/PubSub");
|
|
23
23
|
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
24
|
+
const GroupActionsMenu_1 = tslib_1.__importDefault(require("../GroupActionsMenu"));
|
|
24
25
|
const classes = {
|
|
25
26
|
root: `${constants_1.PREFIX}-root`,
|
|
26
27
|
cover: `${constants_1.PREFIX}-cover`,
|
|
@@ -32,7 +33,8 @@ const classes = {
|
|
|
32
33
|
visibility: `${constants_1.PREFIX}-visibility`,
|
|
33
34
|
visibilityItem: `${constants_1.PREFIX}-visibility-item`,
|
|
34
35
|
members: `${constants_1.PREFIX}-members`,
|
|
35
|
-
membersCounter: `${constants_1.PREFIX}-members-counter
|
|
36
|
+
membersCounter: `${constants_1.PREFIX}-members-counter`,
|
|
37
|
+
multiActions: `${constants_1.PREFIX}-multi-actions`
|
|
36
38
|
};
|
|
37
39
|
const Root = (0, styles_1.styled)(material_1.Box, {
|
|
38
40
|
name: constants_1.PREFIX,
|
|
@@ -76,7 +78,7 @@ function GroupHeader(inProps) {
|
|
|
76
78
|
props: inProps,
|
|
77
79
|
name: constants_1.PREFIX
|
|
78
80
|
});
|
|
79
|
-
const { id = null, className = null, group, groupId = null, ChangePictureProps = {}, ChangeCoverProps = {}, GroupSubscribeButtonProps = {}, GroupMembersButtonProps = {} } = props, rest = tslib_1.__rest(props, ["id", "className", "group", "groupId", "ChangePictureProps", "ChangeCoverProps", "GroupSubscribeButtonProps", "GroupMembersButtonProps"]);
|
|
81
|
+
const { id = null, className = null, group, groupId = null, ChangePictureProps = {}, ChangeCoverProps = {}, GroupSubscribeButtonProps = {}, GroupMembersButtonProps = {}, GroupActionsProps } = props, rest = tslib_1.__rest(props, ["id", "className", "group", "groupId", "ChangePictureProps", "ChangeCoverProps", "GroupSubscribeButtonProps", "GroupMembersButtonProps", "GroupActionsProps"]);
|
|
80
82
|
// PREFERENCES
|
|
81
83
|
const scPreferences = (0, react_core_1.useSCPreferences)();
|
|
82
84
|
const visibilityEnabled = (0, react_1.useMemo)(() => scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_GROUPS_VISIBILITY_ENABLED].value, [scPreferences.preferences]);
|
|
@@ -85,6 +87,8 @@ function GroupHeader(inProps) {
|
|
|
85
87
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
86
88
|
// HOOKS
|
|
87
89
|
const { scGroup, setSCGroup } = (0, react_core_1.useSCFetchGroup)({ id: groupId, group });
|
|
90
|
+
const theme = (0, material_1.useTheme)();
|
|
91
|
+
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
88
92
|
// REFS
|
|
89
93
|
const updatesSubscription = (0, react_1.useRef)(null);
|
|
90
94
|
// CONST
|
|
@@ -147,8 +151,8 @@ function GroupHeader(inProps) {
|
|
|
147
151
|
const _backgroundCover = Object.assign({}, (scGroup.emotional_image
|
|
148
152
|
? { background: `url('${scGroup.emotional_image}') center / cover` }
|
|
149
153
|
: { background: `url('${scPreferences.preferences[react_core_1.SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
|
|
150
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.avatar }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { children: (0, jsx_runtime_1.jsx)("img", { alt: "group", src: scGroup.image_big ? scGroup.image_big : '' }) }) })), isGroupAdmin && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ChangeGroupPicture_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeAvatar, className: classes.changePicture }, ChangePictureProps)), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.changeCover }, { children: (0, jsx_runtime_1.jsx)(ChangeGroupCover_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeCover }, ChangeCoverProps)) }))] }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.info }, { children: [isGroupAdmin && (0, jsx_runtime_1.jsx)(EditGroupButton_1.default, { group: scGroup, groupId: scGroup.id, onEditSuccess: (data) => setSCGroup(data) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scGroup.name })), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [privateEnabled && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.public", defaultMessage: "ui.groupHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.private", defaultMessage: "ui.groupHeader.visibility.private" })] }))) })), visibilityEnabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [privateEnabled && (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), scGroup.visible ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.visible", defaultMessage: "ui.groupHeader.visibility.visible" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility_off" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.hidden", defaultMessage: "ui.groupHeader.visibility.hidden" })] })))] }))] }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: ((scGroup && scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC) ||
|
|
154
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.avatar }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, { children: (0, jsx_runtime_1.jsx)("img", { alt: "group", src: scGroup.image_big ? scGroup.image_big : '' }) }) })), isGroupAdmin && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ChangeGroupPicture_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeAvatar, className: classes.changePicture }, ChangePictureProps)), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.changeCover }, { children: (0, jsx_runtime_1.jsx)(ChangeGroupCover_1.default, Object.assign({ groupId: scGroup.id, onChange: handleChangeCover }, ChangeCoverProps)) }))] }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.info }, { children: [isGroupAdmin && !isMobile && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EditGroupButton_1.default, { group: scGroup, groupId: scGroup.id, onEditSuccess: (data) => setSCGroup(data) }), (0, jsx_runtime_1.jsx)(GroupActionsMenu_1.default, Object.assign({ group: scGroup, onEditSuccess: (data) => setSCGroup(data) }, GroupActionsProps))] }))), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scGroup.name })), privateEnabled && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [privateEnabled && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.public", defaultMessage: "ui.groupHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.private", defaultMessage: "ui.groupHeader.visibility.private" })] }))) })), visibilityEnabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [privateEnabled && (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), scGroup.visible ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.visible", defaultMessage: "ui.groupHeader.visibility.visible" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "visibility_off" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.visibility.hidden", defaultMessage: "ui.groupHeader.visibility.hidden" })] })))] }))] }))), (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: ((scGroup && scGroup.privacy === types_1.SCGroupPrivacyType.PUBLIC) ||
|
|
151
155
|
scGroup.subscription_status === types_1.SCGroupSubscriptionStatusType.SUBSCRIBED ||
|
|
152
|
-
isGroupAdmin) && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.members }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.membersCounter, component: "div" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.members", defaultMessage: "ui.groupHeader.members", values: { total: scGroup.subscribers_counter } }) })), (0, jsx_runtime_1.jsx)(GroupMembersButton_1.default, Object.assign({ groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id, group: scGroup, autoHide: !isGroupAdmin }, GroupMembersButtonProps), scGroup.subscribers_counter)] }))) }), isGroupAdmin ? ((0, jsx_runtime_1.jsx)(GroupInviteButton_1.default, { group: scGroup, groupId: scGroup.id })) : ((0, jsx_runtime_1.jsx)(GroupSubscribeButton_1.default, Object.assign({ group: scGroup, onSubscribe: handleSubscribe }, GroupSubscribeButtonProps)))] }))] })));
|
|
156
|
+
isGroupAdmin) && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.members }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.membersCounter, component: "div" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.groupHeader.members", defaultMessage: "ui.groupHeader.members", values: { total: scGroup.subscribers_counter } }) })), (0, jsx_runtime_1.jsx)(GroupMembersButton_1.default, Object.assign({ groupId: scGroup === null || scGroup === void 0 ? void 0 : scGroup.id, group: scGroup, autoHide: !isGroupAdmin }, GroupMembersButtonProps), scGroup.subscribers_counter)] }))) }), isGroupAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(GroupInviteButton_1.default, { group: scGroup, groupId: scGroup.id }), isMobile && (0, jsx_runtime_1.jsx)(GroupActionsMenu_1.default, Object.assign({ group: scGroup, onEditSuccess: (data) => setSCGroup(data) }, GroupActionsProps))] })) : ((0, jsx_runtime_1.jsx)(GroupSubscribeButton_1.default, Object.assign({ group: scGroup, onSubscribe: handleSubscribe }, GroupSubscribeButtonProps)))] }))] })));
|
|
153
157
|
}
|
|
154
158
|
exports.default = GroupHeader;
|
|
@@ -18,6 +18,8 @@ const constants_1 = require("./constants");
|
|
|
18
18
|
const Group_1 = tslib_1.__importStar(require("../Group"));
|
|
19
19
|
const Pagination_1 = require("../../constants/Pagination");
|
|
20
20
|
const InfiniteScroll_1 = tslib_1.__importDefault(require("../../shared/InfiniteScroll"));
|
|
21
|
+
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
22
|
+
const PubSub_1 = require("../../constants/PubSub");
|
|
21
23
|
const classes = {
|
|
22
24
|
root: `${constants_1.PREFIX}-root`,
|
|
23
25
|
filters: `${constants_1.PREFIX}-filter`,
|
|
@@ -85,6 +87,8 @@ function Groups(inProps) {
|
|
|
85
87
|
scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value, [scPreferencesContext.preferences]);
|
|
86
88
|
// CONST
|
|
87
89
|
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
90
|
+
// REFS
|
|
91
|
+
const updatesSubscription = (0, react_1.useRef)(null);
|
|
88
92
|
// HANDLERS
|
|
89
93
|
const handleScrollUp = () => {
|
|
90
94
|
window.scrollTo({ left: 0, top: 0, behavior: 'smooth' });
|
|
@@ -121,6 +125,28 @@ function Groups(inProps) {
|
|
|
121
125
|
fetchGroups();
|
|
122
126
|
}
|
|
123
127
|
}, [contentAvailability, authUserId, search]);
|
|
128
|
+
/**
|
|
129
|
+
* Subscriber for pubsub callback
|
|
130
|
+
*/
|
|
131
|
+
const onDeleteGroupHandler = (0, react_1.useCallback)((_msg, deleted) => {
|
|
132
|
+
setGroups((prev) => {
|
|
133
|
+
if (prev.some((e) => e.id === deleted)) {
|
|
134
|
+
return prev.filter((e) => e.id !== deleted);
|
|
135
|
+
}
|
|
136
|
+
return prev;
|
|
137
|
+
});
|
|
138
|
+
}, [groups]);
|
|
139
|
+
/**
|
|
140
|
+
* On mount, subscribe to receive event updates (only delete)
|
|
141
|
+
*/
|
|
142
|
+
(0, react_1.useEffect)(() => {
|
|
143
|
+
if (groups) {
|
|
144
|
+
updatesSubscription.current = pubsub_js_1.default.subscribe(`${PubSub_1.SCTopicType.GROUP}.${PubSub_1.SCGroupEventType.DELETE}`, onDeleteGroupHandler);
|
|
145
|
+
}
|
|
146
|
+
return () => {
|
|
147
|
+
updatesSubscription.current && pubsub_js_1.default.unsubscribe(updatesSubscription.current);
|
|
148
|
+
};
|
|
149
|
+
}, [groups]);
|
|
124
150
|
const handleNext = (0, react_1.useMemo)(() => () => {
|
|
125
151
|
if (!next) {
|
|
126
152
|
return;
|
|
@@ -66,8 +66,12 @@ function MyEventsWidget(inProps) {
|
|
|
66
66
|
// CONTEXT
|
|
67
67
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
68
68
|
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
69
|
-
const { features } = (0, react_core_1.useSCPreferences)();
|
|
70
|
-
const eventsEnabled = (0, react_1.useMemo)(() =>
|
|
69
|
+
const { preferences, features } = (0, react_core_1.useSCPreferences)();
|
|
70
|
+
const eventsEnabled = (0, react_1.useMemo)(() => preferences &&
|
|
71
|
+
features &&
|
|
72
|
+
features.includes(types_1.SCFeatureName.TAGGING) &&
|
|
73
|
+
react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
|
|
74
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
|
|
71
75
|
// REFS
|
|
72
76
|
const updatesSubscription = (0, react_1.useRef)(null);
|
|
73
77
|
/**
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawerProps } from '@mui/material';
|
|
3
|
+
export interface NavigationMenuDrawerProps extends DrawerProps {
|
|
4
|
+
/**
|
|
5
|
+
* Custom Drawer header content
|
|
6
|
+
* @default null
|
|
7
|
+
*/
|
|
8
|
+
drawerHeaderContent?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Hide drawer header
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
showDrawerHeader?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Custom Drawer content
|
|
16
|
+
* @default null
|
|
17
|
+
*/
|
|
18
|
+
drawerContent?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Props to spread to ScrollContainer component
|
|
21
|
+
* This lib use 'react-custom-scrollbars' component to perform scrollbars
|
|
22
|
+
* For more info: https://github.com/malte-wessel/react-custom-scrollbars/blob/master/docs/API.md
|
|
23
|
+
* @default {}
|
|
24
|
+
*/
|
|
25
|
+
ScrollContainerProps?: Record<string, any>;
|
|
26
|
+
/**
|
|
27
|
+
* Override onClose
|
|
28
|
+
*/
|
|
29
|
+
handleOnClose?: () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Any other properties
|
|
32
|
+
*/
|
|
33
|
+
[p: string]: any;
|
|
34
|
+
}
|
|
35
|
+
export default function NavigationMenuDrawer(inProps: NavigationMenuDrawerProps): JSX.Element;
|
|
@@ -0,0 +1,68 @@
|
|
|
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 material_1 = require("@mui/material");
|
|
8
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
9
|
+
const system_1 = require("@mui/system");
|
|
10
|
+
const ScrollContainer_1 = tslib_1.__importDefault(require("../../shared/ScrollContainer"));
|
|
11
|
+
const DefaultDrawerContent_1 = tslib_1.__importDefault(require("./DefaultDrawerContent"));
|
|
12
|
+
const DefaultHeaderContent_1 = tslib_1.__importDefault(require("./DefaultHeaderContent"));
|
|
13
|
+
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
14
|
+
const PubSub_1 = require("../../constants/PubSub");
|
|
15
|
+
const PREFIX = 'SCNavigationMenuDrawer';
|
|
16
|
+
const classes = {
|
|
17
|
+
root: `${PREFIX}-root`,
|
|
18
|
+
logo: `${PREFIX}-logo`,
|
|
19
|
+
drawerRoot: `${PREFIX}-drawer-root`,
|
|
20
|
+
drawerHeader: `${PREFIX}-drawer-header`,
|
|
21
|
+
drawerHeaderAction: `${PREFIX}-drawer-header-action`,
|
|
22
|
+
drawerContent: `${PREFIX}-drawer-content`
|
|
23
|
+
};
|
|
24
|
+
const Root = (0, styles_1.styled)(material_1.Drawer, {
|
|
25
|
+
name: PREFIX,
|
|
26
|
+
slot: 'Root',
|
|
27
|
+
overridesResolver: (props, styles) => styles.root
|
|
28
|
+
})(({ theme }) => ({}));
|
|
29
|
+
function NavigationMenuDrawer(inProps) {
|
|
30
|
+
// PROPS
|
|
31
|
+
const props = (0, system_1.useThemeProps)({
|
|
32
|
+
props: inProps,
|
|
33
|
+
name: PREFIX
|
|
34
|
+
});
|
|
35
|
+
const { className = null, open, drawerHeaderContent = (0, jsx_runtime_1.jsx)(DefaultHeaderContent_1.default, {}), drawerContent = (0, jsx_runtime_1.jsx)(DefaultDrawerContent_1.default, {}), ScrollContainerProps = {}, handleOnClose, showDrawerHeader = true } = props, rest = tslib_1.__rest(props, ["className", "open", "drawerHeaderContent", "drawerContent", "ScrollContainerProps", "handleOnClose", "showDrawerHeader"]);
|
|
36
|
+
// REFS
|
|
37
|
+
const refreshSubscription = (0, react_1.useRef)(null);
|
|
38
|
+
const [isDrawerOpen, setIsDrawerOpen] = (0, react_1.useState)(open);
|
|
39
|
+
// HANDLERS
|
|
40
|
+
const onClose = (0, react_1.useCallback)(() => {
|
|
41
|
+
if (handleOnClose) {
|
|
42
|
+
handleOnClose();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
setIsDrawerOpen(false);
|
|
46
|
+
}
|
|
47
|
+
}, [open]);
|
|
48
|
+
// Subscriber for pubsub callback
|
|
49
|
+
const subscriber = (0, react_1.useCallback)((msg, data) => {
|
|
50
|
+
if (msg === `${PubSub_1.SCTopicType.LAYOUT}.${PubSub_1.SCLayoutEventType.TOGGLE_DRAWER}`) {
|
|
51
|
+
setIsDrawerOpen(!isDrawerOpen);
|
|
52
|
+
}
|
|
53
|
+
else if (msg === `${PubSub_1.SCTopicType.LAYOUT}.${PubSub_1.SCLayoutEventType.SET_DRAWER}`) {
|
|
54
|
+
setIsDrawerOpen(data.open);
|
|
55
|
+
}
|
|
56
|
+
}, [isDrawerOpen]);
|
|
57
|
+
/**
|
|
58
|
+
* When a ws notification arrives, update data
|
|
59
|
+
*/
|
|
60
|
+
(0, react_1.useEffect)(() => {
|
|
61
|
+
refreshSubscription.current = pubsub_js_1.default.subscribe(`${PubSub_1.SCTopicType.LAYOUT}.${PubSub_1.SCLayoutEventType.DRAWER}`, subscriber);
|
|
62
|
+
return () => {
|
|
63
|
+
pubsub_js_1.default.unsubscribe(refreshSubscription.current);
|
|
64
|
+
};
|
|
65
|
+
}, [subscriber]);
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ anchor: "left", className: (0, classnames_1.default)(classes.root, className), open: isDrawerOpen, onClose: onClose }, rest, { children: [showDrawerHeader && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, Object.assign({}, ScrollContainerProps, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) }))] })));
|
|
67
|
+
}
|
|
68
|
+
exports.default = NavigationMenuDrawer;
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { IconButtonProps } from '@mui/material';
|
|
2
|
+
import { NavigationMenuDrawerProps } from './NavigationMenuDrawer';
|
|
3
3
|
export interface NavigationMenuIconButtonProps extends IconButtonProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @default
|
|
5
|
+
* Prop to show/hide the default drawer component
|
|
6
|
+
* @default true
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
showDrawer?: boolean;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Callback triggered on menu click
|
|
11
11
|
* @default null
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
onMenuIconClick?: () => void;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @default null
|
|
17
|
-
*/
|
|
18
|
-
drawerContent?: React.ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Props to spread to ScrollContainer component
|
|
21
|
-
* This lib use 'react-custom-scrollbars' component to perform scrollbars
|
|
22
|
-
* For more info: https://github.com/malte-wessel/react-custom-scrollbars/blob/master/docs/API.md
|
|
15
|
+
* Props to spread to default drawer root
|
|
23
16
|
* @default {}
|
|
24
17
|
*/
|
|
25
|
-
|
|
18
|
+
DrawerProps?: NavigationMenuDrawerProps;
|
|
26
19
|
}
|
|
27
20
|
/**
|
|
28
21
|
* > API documentation for the Community-JS Navigation Menu Icon Button component. Learn about the available props and the CSS API.
|
|
@@ -43,10 +36,6 @@ export interface NavigationMenuIconButtonProps extends IconButtonProps {
|
|
|
43
36
|
|Rule Name|Global class|Description|
|
|
44
37
|
|---|---|---|
|
|
45
38
|
|root|.SCNavigationMenuIconButton-root|Styles applied to the root element.|
|
|
46
|
-
|drawerRoot|.SCNavigationMenuIconButton-drawer-root|Styles applied to the drawer root element.|
|
|
47
|
-
|drawerHeader|.SCNavigationMenuIconButton-drawer-header|Styles applied to the drawer header.|
|
|
48
|
-
|drawerHeaderAction|.SCNavigationMenuIconButton-drawer-header-action|Styles applied to the drawer header action element.|
|
|
49
|
-
|drawerContent|.SCNavigationMenuIconButton-drawer-content|Styles applied to the drawer content.|
|
|
50
39
|
|
|
51
40
|
* @param inProps
|
|
52
41
|
*/
|