@selfcommunity/react-ui 0.7.11-alpha.1 → 0.7.12-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,6 +71,9 @@ function Share(props) {
71
71
  const domain = typeof location !== 'undefined' && location.origin ? location.origin : '';
72
72
  const url = domain + scRoutingContext.url((0, contribution_1.getContributionRouteName)(obj), (0, contribution_1.getRouteData)(obj));
73
73
  const isGroupPublic = (0, react_1.useMemo)(() => feedObject.group && feedObject.group.privacy === types_1.SCGroupPrivacyType.PUBLIC, [feedObject.group]);
74
+ const showShareAction = (0, react_1.useMemo)(() => {
75
+ return !scPreferencesContext.preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value || react_core_1.UserUtils.isStaff(scUserContext.user);
76
+ }, [scPreferencesContext, scUserContext.user]);
74
77
  // INTL
75
78
  const intl = (0, react_intl_1.useIntl)();
76
79
  // HANDLERS
@@ -190,10 +193,10 @@ function Share(props) {
190
193
  function renderShareMenuItems() {
191
194
  return (react_1.default.createElement(material_1.Box, null,
192
195
  (!feedObject.group || isGroupPublic) && (react_1.default.createElement(react_1.default.Fragment, null,
193
- react_1.default.createElement(MenuItem_1.default, { onClick: () => share(false) },
196
+ showShareAction && (react_1.default.createElement(MenuItem_1.default, { onClick: () => share(false) },
194
197
  react_1.default.createElement(ListItemIcon_1.default, null,
195
198
  react_1.default.createElement(Icon_1.default, { fontSize: "small" }, "redo")),
196
- react_1.default.createElement(material_1.ListItemText, { primary: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.shareNow", defaultMessage: "ui.feedObject.share.shareNow" }) })),
199
+ react_1.default.createElement(material_1.ListItemText, { primary: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.feedObject.share.shareNow", defaultMessage: "ui.feedObject.share.shareNow" }) }))),
197
200
  facebookShareEnabled && (react_1.default.createElement(MenuItem_1.default, { onClick: () => window.open(SocialShare_1.FACEBOOK_SHARE + url, 'facebook-share-dialog', 'width=626,height=436') },
198
201
  react_1.default.createElement(ListItemIcon_1.default, null,
199
202
  react_1.default.createElement(Icon_1.default, { fontSize: "small" }, "facebook")),
@@ -1,5 +1,5 @@
1
1
  /**
2
- * > API documentation for the Community-JS Platform Skeleton component. Learn about the available props and the CSS API.
2
+ * > API documentation for the Community-JS Group Info Widget Skeleton component. Learn about the available props and the CSS API.
3
3
 
4
4
  #### Import
5
5
 
@@ -13,7 +13,7 @@ const Root = (0, styles_1.styled)(Skeleton_1.GenericSkeleton, {
13
13
  slot: 'SkeletonRoot'
14
14
  })(() => ({}));
15
15
  /**
16
- * > API documentation for the Community-JS Platform Skeleton component. Learn about the available props and the CSS API.
16
+ * > API documentation for the Community-JS Group Info Widget Skeleton component. Learn about the available props and the CSS API.
17
17
 
18
18
  #### Import
19
19
 
@@ -103,8 +103,7 @@ function NavigationToolbar(inProps) {
103
103
  const privateMessagingEnabled = (0, react_1.useMemo)(() => scPreferences.features.includes(types_1.SCFeatureName.PRIVATE_MESSAGING), [scPreferences.features]);
104
104
  const groupsEnabled = (0, react_1.useMemo)(() => scPreferences.features.includes(types_1.SCFeatureName.GROUPING) && scPreferences.features.includes(types_1.SCFeatureName.TAGGING), [scPreferences.features]);
105
105
  const showComposer = (0, react_1.useMemo)(() => {
106
- return (scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value &&
107
- !disableComposer &&
106
+ return (!disableComposer &&
108
107
  (!scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value || react_core_1.UserUtils.isStaff(scUserContext.user)));
109
108
  }, [scPreferences, disableComposer, scUserContext.user]);
110
109
  // STATE
@@ -69,6 +69,9 @@ export default function Share(props) {
69
69
  const domain = typeof location !== 'undefined' && location.origin ? location.origin : '';
70
70
  const url = domain + scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj));
71
71
  const isGroupPublic = useMemo(() => feedObject.group && feedObject.group.privacy === SCGroupPrivacyType.PUBLIC, [feedObject.group]);
72
+ const showShareAction = useMemo(() => {
73
+ return !scPreferencesContext.preferences[SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value || UserUtils.isStaff(scUserContext.user);
74
+ }, [scPreferencesContext, scUserContext.user]);
72
75
  // INTL
73
76
  const intl = useIntl();
74
77
  // HANDLERS
@@ -188,10 +191,10 @@ export default function Share(props) {
188
191
  function renderShareMenuItems() {
189
192
  return (React.createElement(Box, null,
190
193
  (!feedObject.group || isGroupPublic) && (React.createElement(React.Fragment, null,
191
- React.createElement(MenuItem, { onClick: () => share(false) },
194
+ showShareAction && (React.createElement(MenuItem, { onClick: () => share(false) },
192
195
  React.createElement(ListItemIcon, null,
193
196
  React.createElement(Icon, { fontSize: "small" }, "redo")),
194
- React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.shareNow", defaultMessage: "ui.feedObject.share.shareNow" }) })),
197
+ React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.shareNow", defaultMessage: "ui.feedObject.share.shareNow" }) }))),
195
198
  facebookShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(FACEBOOK_SHARE + url, 'facebook-share-dialog', 'width=626,height=436') },
196
199
  React.createElement(ListItemIcon, null,
197
200
  React.createElement(Icon, { fontSize: "small" }, "facebook")),
@@ -1,5 +1,5 @@
1
1
  /**
2
- * > API documentation for the Community-JS Platform Skeleton component. Learn about the available props and the CSS API.
2
+ * > API documentation for the Community-JS Group Info Widget Skeleton component. Learn about the available props and the CSS API.
3
3
 
4
4
  #### Import
5
5
 
@@ -10,7 +10,7 @@ const Root = styled(GenericSkeleton, {
10
10
  slot: 'SkeletonRoot'
11
11
  })(() => ({}));
12
12
  /**
13
- * > API documentation for the Community-JS Platform Skeleton component. Learn about the available props and the CSS API.
13
+ * > API documentation for the Community-JS Group Info Widget Skeleton component. Learn about the available props and the CSS API.
14
14
 
15
15
  #### Import
16
16
 
@@ -101,8 +101,7 @@ export default function NavigationToolbar(inProps) {
101
101
  const privateMessagingEnabled = useMemo(() => scPreferences.features.includes(SCFeatureName.PRIVATE_MESSAGING), [scPreferences.features]);
102
102
  const groupsEnabled = useMemo(() => scPreferences.features.includes(SCFeatureName.GROUPING) && scPreferences.features.includes(SCFeatureName.TAGGING), [scPreferences.features]);
103
103
  const showComposer = useMemo(() => {
104
- return (scPreferences.preferences[SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value &&
105
- !disableComposer &&
104
+ return (!disableComposer &&
106
105
  (!scPreferences.preferences[SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value || UserUtils.isStaff(scUserContext.user)));
107
106
  }, [scPreferences, disableComposer, scUserContext.user]);
108
107
  // STATE