@selfcommunity/react-ui 0.8.0-alpha.8 → 0.8.0-embeds.16
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 +8 -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.js +10 -3
- package/lib/cjs/components/EventInfoWidget/EventInfoWidget.js +24 -1
- package/lib/cjs/components/MyEventsWidget/MyEventsWidget.js +6 -2
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +12 -3
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -2
- package/lib/cjs/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +7 -2
- package/lib/cjs/shared/ContributionActionsMenu/index.js +6 -6
- package/lib/cjs/shared/Media/Link/DisplayComponent.js +2 -2
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +11 -2
- package/lib/esm/components/Composer/Composer.js +8 -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.js +10 -3
- package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +25 -2
- package/lib/esm/components/MyEventsWidget/MyEventsWidget.js +7 -3
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +12 -3
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -2
- package/lib/esm/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +8 -3
- package/lib/esm/shared/ContributionActionsMenu/index.js +6 -6
- package/lib/esm/shared/Media/Link/DisplayComponent.js +2 -2
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
|
@@ -6,7 +6,7 @@ import List from '@mui/material/List';
|
|
|
6
6
|
import { Button, CardContent, ListItem, Typography } from '@mui/material';
|
|
7
7
|
import { GroupService } from '@selfcommunity/api-services';
|
|
8
8
|
import { CacheStrategies, isInteger, Logger } from '@selfcommunity/utils';
|
|
9
|
-
import { SCCache, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
9
|
+
import { SCCache, SCPreferences, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
10
10
|
import { actionWidgetTypes, dataWidgetReducer, stateWidgetInitializer } from '../../utils/widget';
|
|
11
11
|
import { SCFeatureName, SCGroupPrivacyType, SCGroupSubscriptionStatusType } from '@selfcommunity/types';
|
|
12
12
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
@@ -71,8 +71,13 @@ export default function UserSubscribedGroupsWidget(inProps) {
|
|
|
71
71
|
// CONTEXT
|
|
72
72
|
const scUserContext = useSCUser();
|
|
73
73
|
const isMe = useMemo(() => scUserContext.user && userId === scUserContext.user.id, [scUserContext.user, userId]);
|
|
74
|
-
const { features } = useSCPreferences();
|
|
75
|
-
const groupsEnabled = useMemo(() =>
|
|
74
|
+
const { preferences, features } = useSCPreferences();
|
|
75
|
+
const groupsEnabled = useMemo(() => preferences &&
|
|
76
|
+
features &&
|
|
77
|
+
features.includes(SCFeatureName.TAGGING) &&
|
|
78
|
+
features.includes(SCFeatureName.GROUPING) &&
|
|
79
|
+
SCPreferences.CONFIGURATIONS_GROUPS_ENABLED in preferences &&
|
|
80
|
+
preferences[SCPreferences.CONFIGURATIONS_GROUPS_ENABLED].value, [preferences, features]);
|
|
76
81
|
// STATE
|
|
77
82
|
const [state, dispatch] = useReducer(dataWidgetReducer, {
|
|
78
83
|
isLoadingNext: false,
|
|
@@ -75,7 +75,6 @@ const messages = defineMessages({
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
export default function ContributionActionsMenu(props) {
|
|
78
|
-
var _a, _b, _c;
|
|
79
78
|
// PROPS
|
|
80
79
|
const { className, feedObjectId, feedObject, feedObjectType = SCContributionType.POST, commentObjectId, commentObject, onFlagContribution, onEditContribution, onHideContribution, onDeleteContribution, onRestoreContribution, onSuspendNotificationContribution, onSuspendNotificationEvent, PopperProps = {} } = props, rest = __rest(props, ["className", "feedObjectId", "feedObject", "feedObjectType", "commentObjectId", "commentObject", "onFlagContribution", "onEditContribution", "onHideContribution", "onDeleteContribution", "onRestoreContribution", "onSuspendNotificationContribution", "onSuspendNotificationEvent", "PopperProps"]);
|
|
81
80
|
// INTL
|
|
@@ -622,9 +621,9 @@ export default function ContributionActionsMenu(props) {
|
|
|
622
621
|
return name;
|
|
623
622
|
}
|
|
624
623
|
/**
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
624
|
+
* action
|
|
625
|
+
* @param sectionId
|
|
626
|
+
*/
|
|
628
627
|
function handleOpenSection(sectionId) {
|
|
629
628
|
if (sectionId) {
|
|
630
629
|
if (sectionId === openSection) {
|
|
@@ -703,7 +702,8 @@ export default function ContributionActionsMenu(props) {
|
|
|
703
702
|
scUserContext.user.id !== contributionObj.author.id &&
|
|
704
703
|
contributionObj &&
|
|
705
704
|
contributionObj.type !== SCContributionType.COMMENT &&
|
|
706
|
-
Boolean(contributionObj.event)
|
|
705
|
+
Boolean(contributionObj.event) &&
|
|
706
|
+
Boolean(contributionObj.event.active));
|
|
707
707
|
}
|
|
708
708
|
/**
|
|
709
709
|
* Renders section general
|
|
@@ -726,7 +726,7 @@ export default function ContributionActionsMenu(props) {
|
|
|
726
726
|
, Object.assign({
|
|
727
727
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
728
728
|
// @ts-ignore
|
|
729
|
-
|
|
729
|
+
ref: (ref) => {
|
|
730
730
|
popperRef.current = ref;
|
|
731
731
|
}, "aria-haspopup": "true", onClick: handleOpen, className: classes.button, size: "small" }, { children: contributionObj && (contributionObj.collapsed || contributionObj.deleted) ? (_jsxs("span", Object.assign({ className: classes.visibilityIcons }, { children: [contributionObj.collapsed ? _jsx(Icon, { children: "visibility_off" }) : _jsx(Icon, { children: "delete" }), _jsx(Icon, { children: "expand_more" })] }))) : (_jsx(Icon, { children: "more_vert" })) })), isMobile ? (_jsx(SwipeableDrawer, Object.assign({ open: open, onClose: handleClose, onOpen: handleOpen, anchor: "bottom", disableSwipeToOpen: true }, { children: renderContent() }))) : (_jsx(PopperRoot, Object.assign({ open: open, anchorEl: popperRef.current, role: undefined, transition: true, className: classes.popperRoot }, PopperProps, { placement: "bottom-end" }, { children: ({ TransitionProps, placement }) => (_jsx(Grow, Object.assign({}, TransitionProps, { style: { transformOrigin: placement === 'bottom' ? 'center top' : 'center bottom' } }, { children: _jsx(Paper, Object.assign({ variant: 'outlined', className: classes.paper }, { children: _jsx(ClickAwayListener, Object.assign({ onClickAway: handleClose }, { children: renderContent() })) })) }))) }))), openConfirmDialog && (_jsx(ConfirmDialog, Object.assign({ open: openConfirmDialog }, (currentAction === DELETE_CONTRIBUTION
|
|
732
732
|
? {
|
|
@@ -51,7 +51,7 @@ export default (props) => {
|
|
|
51
51
|
return renderHtml(media, key);
|
|
52
52
|
}
|
|
53
53
|
const domain = new URL(media.embed.metadata.url).hostname.replace('www.', '');
|
|
54
|
-
return (_jsxs(Box, Object.assign({ className: classes.displayLink }, { children: [media.embed.metadata.images && media.embed.metadata.images.length > 0 && (_jsx(_Fragment, { children: fullWidth ? (_jsx(Box, { className: classNames(classes.thumbnailFullWidth, classes.image), style: { background: `url(${media.image})`, paddingBottom: `${100 / media.image_width / media.image_height}%` } })) : (_jsx(Box, { className: classNames(classes.thumbnail, classes.image), style: { background: `url(${media.image})` } })) })), _jsxs(Box, Object.assign({ className: classes.snippet }, { children: [_jsx("b", Object.assign({ className: classes.snippetTitle }, { children: media.embed.metadata.title })), _jsx("br", {}), _jsx("p", Object.assign({ className: classes.snippetDescription }, { children: media.embed.metadata.description })), _jsx("a", Object.assign({ href: media.embed.metadata.url, target: '_blank', onClick: () => handleLinkClick(media) }, { children: domain }))] })), _jsx("div", { style: { clear: 'both' } })] })
|
|
54
|
+
return (_jsxs(Box, Object.assign({ className: classes.displayLink }, { children: [media.embed.metadata.images && media.embed.metadata.images.length > 0 && (_jsx(_Fragment, { children: fullWidth ? (_jsx(Box, { className: classNames(classes.thumbnailFullWidth, classes.image), style: { background: `url(${media.image})`, paddingBottom: `${100 / media.image_width / media.image_height}%` } })) : (_jsx(Box, { className: classNames(classes.thumbnail, classes.image), style: { background: `url(${media.image})` } })) })), _jsxs(Box, Object.assign({ className: classes.snippet }, { children: [_jsx("b", Object.assign({ className: classes.snippetTitle }, { children: media.embed.metadata.title })), _jsx("br", {}), _jsx("p", Object.assign({ className: classes.snippetDescription }, { children: media.embed.metadata.description })), _jsx("a", Object.assign({ href: media.embed.metadata.url, target: '_blank', onClick: () => handleLinkClick(media) }, { children: domain }))] })), _jsx("div", { style: { clear: 'both' } })] })));
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
57
57
|
* Render html embed
|
|
@@ -59,7 +59,7 @@ export default (props) => {
|
|
|
59
59
|
* @param key
|
|
60
60
|
*/
|
|
61
61
|
const renderHtml = (media, key) => {
|
|
62
|
-
return (_jsxs(Box, Object.assign({ className: classes.displayHtmlWrap }, { children: [_jsx("div", { dangerouslySetInnerHTML: { __html: media.embed.metadata.html }, className: classes.displayHtml }), _jsx("div", Object.assign({ className: classes.displayHtmlPlaceholder, style: { paddingTop: `${(100 * media.embed.metadata.height) / media.embed.metadata.width}%`, maxHeight: media.embed.metadata.height } }, { children: _jsx(CircularProgress, { size: 20, className: classes.displayHtmlLoading }) }))] })
|
|
62
|
+
return (_jsxs(Box, Object.assign({ className: classes.displayHtmlWrap }, { children: [_jsx("div", { dangerouslySetInnerHTML: { __html: media.embed.metadata.html }, className: classes.displayHtml }), _jsx("div", Object.assign({ className: classes.displayHtmlPlaceholder, style: { paddingTop: `${(100 * media.embed.metadata.height) / media.embed.metadata.width}%`, maxHeight: media.embed.metadata.height } }, { children: _jsx(CircularProgress, { size: 20, className: classes.displayHtmlLoading }) }))] })));
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
65
|
* Renders component
|