@selfcommunity/react-ui 0.8.0-alpha.10 → 0.8.0-alpha.12

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.
@@ -119,7 +119,7 @@ function NavigationToolbar(inProps) {
119
119
  const eventsEnabled = (0, react_1.useMemo)(() => scPreferences.preferences &&
120
120
  scPreferences.features &&
121
121
  scPreferences.features.includes(types_1.SCFeatureName.TAGGING) &&
122
- react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
122
+ react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in scPreferences.preferences &&
123
123
  scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
124
124
  const showComposer = (0, react_1.useMemo)(() => {
125
125
  return (!disableComposer &&
@@ -77,7 +77,6 @@ const messages = (0, react_intl_1.defineMessages)({
77
77
  }
78
78
  });
79
79
  function ContributionActionsMenu(props) {
80
- var _a, _b, _c;
81
80
  // PROPS
82
81
  const { className, feedObjectId, feedObject, feedObjectType = types_1.SCContributionType.POST, commentObjectId, commentObject, onFlagContribution, onEditContribution, onHideContribution, onDeleteContribution, onRestoreContribution, onSuspendNotificationContribution, onSuspendNotificationEvent, PopperProps = {} } = props, rest = tslib_1.__rest(props, ["className", "feedObjectId", "feedObject", "feedObjectType", "commentObjectId", "commentObject", "onFlagContribution", "onEditContribution", "onHideContribution", "onDeleteContribution", "onRestoreContribution", "onSuspendNotificationContribution", "onSuspendNotificationEvent", "PopperProps"]);
83
82
  // INTL
@@ -624,9 +623,9 @@ function ContributionActionsMenu(props) {
624
623
  return name;
625
624
  }
626
625
  /**
627
- * action
628
- * @param sectionId
629
- */
626
+ * action
627
+ * @param sectionId
628
+ */
630
629
  function handleOpenSection(sectionId) {
631
630
  if (sectionId) {
632
631
  if (sectionId === openSection) {
@@ -705,7 +704,8 @@ function ContributionActionsMenu(props) {
705
704
  scUserContext.user.id !== contributionObj.author.id &&
706
705
  contributionObj &&
707
706
  contributionObj.type !== types_1.SCContributionType.COMMENT &&
708
- Boolean(contributionObj.event));
707
+ Boolean(contributionObj.event) &&
708
+ Boolean(contributionObj.event.active));
709
709
  }
710
710
  /**
711
711
  * Renders section general
@@ -728,7 +728,7 @@ function ContributionActionsMenu(props) {
728
728
  , Object.assign({
729
729
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
730
730
  // @ts-ignore
731
- disabled: contributionObj && ((_a = contributionObj === null || contributionObj === void 0 ? void 0 : contributionObj.medias) === null || _a === void 0 ? void 0 : _a.length) && !((_c = (_b = contributionObj.medias[0].embed) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.active), ref: (ref) => {
731
+ ref: (ref) => {
732
732
  popperRef.current = ref;
733
733
  }, "aria-haspopup": "true", onClick: handleOpen, className: classes.button, size: "small" }, { children: contributionObj && (contributionObj.collapsed || contributionObj.deleted) ? ((0, jsx_runtime_1.jsxs)("span", Object.assign({ className: classes.visibilityIcons }, { children: [contributionObj.collapsed ? (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "visibility_off" }) : (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "delete" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "expand_more" })] }))) : ((0, jsx_runtime_1.jsx)(Icon_1.default, { children: "more_vert" })) })), isMobile ? ((0, jsx_runtime_1.jsx)(material_1.SwipeableDrawer, Object.assign({ open: open, onClose: handleClose, onOpen: handleOpen, anchor: "bottom", disableSwipeToOpen: true }, { children: renderContent() }))) : ((0, jsx_runtime_1.jsx)(PopperRoot, Object.assign({ open: open, anchorEl: popperRef.current, role: undefined, transition: true, className: classes.popperRoot }, PopperProps, { placement: "bottom-end" }, { children: ({ TransitionProps, placement }) => ((0, jsx_runtime_1.jsx)(material_1.Grow, Object.assign({}, TransitionProps, { style: { transformOrigin: placement === 'bottom' ? 'center top' : 'center bottom' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Paper, Object.assign({ variant: 'outlined', className: classes.paper }, { children: (0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, Object.assign({ onClickAway: handleClose }, { children: renderContent() })) })) }))) }))), openConfirmDialog && ((0, jsx_runtime_1.jsx)(ConfirmDialog_1.default, Object.assign({ open: openConfirmDialog }, (currentAction === ContributionsActionsMenu_1.DELETE_CONTRIBUTION
734
734
  ? {
@@ -117,7 +117,7 @@ export default function NavigationToolbar(inProps) {
117
117
  const eventsEnabled = useMemo(() => scPreferences.preferences &&
118
118
  scPreferences.features &&
119
119
  scPreferences.features.includes(SCFeatureName.TAGGING) &&
120
- SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
120
+ SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in scPreferences.preferences &&
121
121
  scPreferences.preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [scPreferences.preferences, scPreferences.features]);
122
122
  const showComposer = useMemo(() => {
123
123
  return (!disableComposer &&
@@ -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
- * action
626
- * @param sectionId
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
- disabled: contributionObj && ((_a = contributionObj === null || contributionObj === void 0 ? void 0 : contributionObj.medias) === null || _a === void 0 ? void 0 : _a.length) && !((_c = (_b = contributionObj.medias[0].embed) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.active), ref: (ref) => {
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
  ? {