@selfcommunity/react-ui 0.7.9-alpha.8 → 0.7.9-alpha.80
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/AccountRecover/AccountRecover.js +6 -1
- package/lib/cjs/components/BottomNavigation/BottomNavigation.js +4 -3
- package/lib/cjs/components/CategoryHeader/Skeleton.js +3 -2
- package/lib/cjs/components/ChangeGroupCover/ChangeGroupCover.js +6 -6
- package/lib/cjs/components/ChangeGroupPicture/ChangeGroupPicture.js +19 -16
- package/lib/cjs/components/Composer/Attributes/Attributes.js +3 -3
- package/lib/cjs/components/Composer/Composer.js +3 -3
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +1 -1
- package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +9 -19
- package/lib/cjs/components/Editor/Editor.js +2 -0
- package/lib/cjs/components/Editor/nodes/ImageNode.js +6 -0
- package/lib/cjs/components/Editor/plugins/ImagePlugin.js +4 -0
- package/lib/cjs/components/Editor/plugins/ToolbarPlugin.js +17 -3
- package/lib/cjs/components/FeedObject/Actions/Share/Share.js +18 -16
- package/lib/cjs/components/FeedObject/Contributors/Contributors.js +1 -1
- package/lib/cjs/components/FeedObject/FeedObject.d.ts +1 -0
- package/lib/cjs/components/FeedObject/FeedObject.js +27 -8
- package/lib/cjs/components/FeedObject/Poll/Poll.js +20 -20
- package/lib/cjs/components/FeedUpdatesWidget/FeedUpdatesWidget.js +1 -1
- package/lib/cjs/components/Footer/Footer.js +1 -1
- package/lib/cjs/components/Group/Group.d.ts +8 -0
- package/lib/cjs/components/Group/Group.js +17 -5
- package/lib/cjs/components/GroupAutocomplete/GroupAutocomplete.js +1 -1
- package/lib/cjs/components/GroupForm/GroupForm.js +64 -13
- package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +6 -5
- package/lib/cjs/components/GroupHeader/GroupHeader.js +53 -11
- package/lib/cjs/components/GroupInfoWidget/GroupInfoWidget.js +63 -9
- package/lib/cjs/components/GroupInviteButton/GroupInviteButton.js +31 -9
- package/lib/cjs/components/GroupInvitedWidget/GroupInvitedWidget.d.ts +74 -0
- package/lib/cjs/components/GroupInvitedWidget/GroupInvitedWidget.js +221 -0
- package/lib/cjs/components/GroupInvitedWidget/Skeleton.d.ts +22 -0
- package/lib/cjs/components/GroupInvitedWidget/Skeleton.js +38 -0
- package/lib/cjs/components/GroupInvitedWidget/constants.d.ts +1 -0
- package/lib/cjs/components/GroupInvitedWidget/constants.js +4 -0
- package/lib/cjs/components/GroupInvitedWidget/index.d.ts +4 -0
- package/lib/cjs/components/GroupInvitedWidget/index.js +8 -0
- package/lib/cjs/components/GroupMembersButton/GroupMembersButton.d.ts +5 -0
- package/lib/cjs/components/GroupMembersButton/GroupMembersButton.js +8 -3
- package/lib/cjs/components/GroupMembersWidget/GroupMembersWidget.js +25 -4
- package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +11 -5
- package/lib/cjs/components/GroupRequestsWidget/GroupRequestsWidget.js +18 -7
- package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +48 -0
- package/lib/cjs/components/GroupSettingsIconButton/GroupSettingsIconButton.js +151 -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 +8 -3
- package/lib/cjs/components/GroupSubscribeButton/GroupSubscribeButton.js +30 -11
- package/lib/cjs/components/Groups/Groups.d.ts +15 -8
- package/lib/cjs/components/Groups/Groups.js +86 -32
- package/lib/cjs/components/Groups/Skeleton.d.ts +4 -0
- package/lib/cjs/components/Groups/Skeleton.js +2 -2
- package/lib/cjs/components/InlineComposerWidget/InlineComposerWidget.js +7 -0
- package/lib/cjs/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +4 -4
- package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +9 -2
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -0
- package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +9 -1
- package/lib/cjs/components/Notification/Group/Group.d.ts +15 -0
- package/lib/cjs/components/Notification/Group/Group.js +78 -0
- package/lib/cjs/components/Notification/Group/index.d.ts +3 -0
- package/lib/cjs/components/Notification/Group/index.js +5 -0
- package/lib/cjs/components/Notification/Notification.js +31 -1
- package/lib/cjs/components/Notification/PrivateMessage/PrivateMessage.js +16 -5
- package/lib/cjs/components/PrivateMessageComponent/PrivateMessageComponent.d.ts +7 -1
- package/lib/cjs/components/PrivateMessageComponent/PrivateMessageComponent.js +16 -8
- package/lib/cjs/components/PrivateMessageSettingsIconButton/PrivateMessageSettingsIconButton.js +1 -1
- package/lib/cjs/components/PrivateMessageSnippetItem/PrivateMessageSnippetItem.js +11 -6
- package/lib/cjs/components/PrivateMessageSnippets/PrivateMessageSnippets.d.ts +9 -4
- package/lib/cjs/components/PrivateMessageSnippets/PrivateMessageSnippets.js +24 -6
- package/lib/cjs/components/PrivateMessageThread/PrivateMessageThread.d.ts +6 -1
- package/lib/cjs/components/PrivateMessageThread/PrivateMessageThread.js +46 -20
- package/lib/cjs/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +6 -0
- package/lib/cjs/components/SearchAutocomplete/SearchAutocomplete.js +22 -5
- package/lib/cjs/components/SnippetNotifications/SnippetNotifications.js +7 -0
- package/lib/cjs/components/ToastNotifications/ToastNotifications.js +7 -0
- package/lib/cjs/components/User/User.d.ts +6 -1
- package/lib/cjs/components/User/User.js +5 -4
- package/lib/cjs/components/UserSubscribedGroupsWidget/Skeleton.d.ts +21 -0
- package/lib/cjs/components/UserSubscribedGroupsWidget/Skeleton.js +46 -0
- package/lib/cjs/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.d.ts +68 -0
- package/lib/cjs/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +183 -0
- package/lib/cjs/components/UserSubscribedGroupsWidget/constants.d.ts +1 -0
- package/lib/cjs/components/UserSubscribedGroupsWidget/constants.js +4 -0
- package/lib/cjs/components/UserSubscribedGroupsWidget/index.d.ts +4 -0
- package/lib/cjs/components/UserSubscribedGroupsWidget/index.js +8 -0
- package/lib/cjs/components/VoteAudienceButton/VoteAudienceButton.js +1 -1
- package/lib/cjs/constants/PubSub.d.ts +28 -0
- package/lib/cjs/constants/PubSub.js +22 -0
- package/lib/cjs/index.d.ts +6 -3
- package/lib/cjs/index.js +13 -4
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/esm/components/AccountRecover/AccountRecover.js +6 -1
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +5 -4
- package/lib/esm/components/CategoryHeader/Skeleton.js +3 -2
- package/lib/esm/components/ChangeGroupCover/ChangeGroupCover.js +6 -6
- package/lib/esm/components/ChangeGroupPicture/ChangeGroupPicture.js +19 -16
- package/lib/esm/components/Composer/Attributes/Attributes.js +3 -3
- package/lib/esm/components/Composer/Composer.js +3 -3
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.d.ts +1 -1
- package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +9 -19
- package/lib/esm/components/Editor/Editor.js +2 -0
- package/lib/esm/components/Editor/nodes/ImageNode.js +6 -0
- package/lib/esm/components/Editor/plugins/ImagePlugin.js +4 -0
- package/lib/esm/components/Editor/plugins/ToolbarPlugin.js +19 -5
- package/lib/esm/components/FeedObject/Actions/Share/Share.js +19 -17
- package/lib/esm/components/FeedObject/Contributors/Contributors.js +1 -1
- package/lib/esm/components/FeedObject/FeedObject.d.ts +1 -0
- package/lib/esm/components/FeedObject/FeedObject.js +28 -9
- package/lib/esm/components/FeedObject/Poll/Poll.js +20 -20
- package/lib/esm/components/FeedUpdatesWidget/FeedUpdatesWidget.js +1 -1
- package/lib/esm/components/Footer/Footer.js +2 -2
- package/lib/esm/components/Group/Group.d.ts +8 -0
- package/lib/esm/components/Group/Group.js +21 -9
- package/lib/esm/components/GroupAutocomplete/GroupAutocomplete.js +1 -1
- package/lib/esm/components/GroupForm/GroupForm.js +64 -13
- package/lib/esm/components/GroupHeader/GroupHeader.d.ts +6 -5
- package/lib/esm/components/GroupHeader/GroupHeader.js +55 -13
- package/lib/esm/components/GroupInfoWidget/GroupInfoWidget.js +63 -9
- package/lib/esm/components/GroupInviteButton/GroupInviteButton.js +31 -9
- package/lib/esm/components/GroupInvitedWidget/GroupInvitedWidget.d.ts +74 -0
- package/lib/esm/components/GroupInvitedWidget/GroupInvitedWidget.js +218 -0
- package/lib/esm/components/GroupInvitedWidget/Skeleton.d.ts +22 -0
- package/lib/esm/components/GroupInvitedWidget/Skeleton.js +34 -0
- package/lib/esm/components/GroupInvitedWidget/constants.d.ts +1 -0
- package/lib/esm/components/GroupInvitedWidget/constants.js +1 -0
- package/lib/esm/components/GroupInvitedWidget/index.d.ts +4 -0
- package/lib/esm/components/GroupInvitedWidget/index.js +4 -0
- package/lib/esm/components/GroupMembersButton/GroupMembersButton.d.ts +5 -0
- package/lib/esm/components/GroupMembersButton/GroupMembersButton.js +9 -4
- package/lib/esm/components/GroupMembersWidget/GroupMembersWidget.js +26 -5
- package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.d.ts +11 -5
- package/lib/esm/components/GroupRequestsWidget/GroupRequestsWidget.js +18 -7
- package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.d.ts +48 -0
- package/lib/esm/components/GroupSettingsIconButton/GroupSettingsIconButton.js +148 -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 +8 -3
- package/lib/esm/components/GroupSubscribeButton/GroupSubscribeButton.js +30 -11
- package/lib/esm/components/Groups/Groups.d.ts +15 -8
- package/lib/esm/components/Groups/Groups.js +91 -37
- package/lib/esm/components/Groups/Skeleton.d.ts +4 -0
- package/lib/esm/components/Groups/Skeleton.js +2 -2
- package/lib/esm/components/InlineComposerWidget/InlineComposerWidget.js +9 -2
- package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +4 -4
- package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +10 -3
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.d.ts +1 -0
- package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -3
- package/lib/esm/components/Notification/Group/Group.d.ts +15 -0
- package/lib/esm/components/Notification/Group/Group.js +75 -0
- package/lib/esm/components/Notification/Group/index.d.ts +3 -0
- package/lib/esm/components/Notification/Group/index.js +2 -0
- package/lib/esm/components/Notification/Notification.js +31 -1
- package/lib/esm/components/Notification/PrivateMessage/PrivateMessage.js +16 -5
- package/lib/esm/components/PrivateMessageComponent/PrivateMessageComponent.d.ts +7 -1
- package/lib/esm/components/PrivateMessageComponent/PrivateMessageComponent.js +17 -9
- package/lib/esm/components/PrivateMessageSettingsIconButton/PrivateMessageSettingsIconButton.js +1 -1
- package/lib/esm/components/PrivateMessageSnippetItem/PrivateMessageSnippetItem.js +11 -6
- package/lib/esm/components/PrivateMessageSnippets/PrivateMessageSnippets.d.ts +9 -4
- package/lib/esm/components/PrivateMessageSnippets/PrivateMessageSnippets.js +26 -8
- package/lib/esm/components/PrivateMessageThread/PrivateMessageThread.d.ts +6 -1
- package/lib/esm/components/PrivateMessageThread/PrivateMessageThread.js +48 -22
- package/lib/esm/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +7 -1
- package/lib/esm/components/SearchAutocomplete/SearchAutocomplete.js +22 -5
- package/lib/esm/components/SnippetNotifications/SnippetNotifications.js +7 -0
- package/lib/esm/components/ToastNotifications/ToastNotifications.js +7 -0
- package/lib/esm/components/User/User.d.ts +6 -1
- package/lib/esm/components/User/User.js +5 -4
- package/lib/esm/components/UserSubscribedGroupsWidget/Skeleton.d.ts +21 -0
- package/lib/esm/components/UserSubscribedGroupsWidget/Skeleton.js +42 -0
- package/lib/esm/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.d.ts +68 -0
- package/lib/esm/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +180 -0
- package/lib/esm/components/UserSubscribedGroupsWidget/constants.d.ts +1 -0
- package/lib/esm/components/UserSubscribedGroupsWidget/constants.js +1 -0
- package/lib/esm/components/UserSubscribedGroupsWidget/index.d.ts +4 -0
- package/lib/esm/components/UserSubscribedGroupsWidget/index.js +4 -0
- package/lib/esm/components/VoteAudienceButton/VoteAudienceButton.js +1 -1
- package/lib/esm/constants/PubSub.d.ts +28 -0
- package/lib/esm/constants/PubSub.js +19 -0
- package/lib/esm/index.d.ts +6 -3
- package/lib/esm/index.js +6 -3
- package/lib/esm/types/index.d.ts +2 -1
- package/lib/umd/311.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +9 -9
- package/lib/umd/871.js +0 -2
- /package/lib/umd/{871.js.LICENSE.txt → 311.js.LICENSE.txt} +0 -0
|
@@ -10,7 +10,7 @@ export declare enum AudienceTypes {
|
|
|
10
10
|
AUDIENCE_GROUP = "group"
|
|
11
11
|
}
|
|
12
12
|
export interface AudienceLayerProps extends Omit<BoxProps, 'defaultValue'>, ComposerLayerProps {
|
|
13
|
-
defaultValue: SCTagType[] | SCGroupType;
|
|
13
|
+
defaultValue: SCTagType[] | SCGroupType | any;
|
|
14
14
|
TextFieldProps?: TextFieldProps;
|
|
15
15
|
}
|
|
16
16
|
declare const AudienceLayer: React.ForwardRefExoticComponent<Pick<AudienceLayerProps, "p" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "component" | "sx" | "classes" | "onClose" | "TextFieldProps" | "onSave"> & React.RefAttributes<unknown>>;
|
|
@@ -43,7 +43,7 @@ const AudienceLayer = React.forwardRef((props, ref) => {
|
|
|
43
43
|
// @ts-ignore
|
|
44
44
|
defaultValue === null || defaultValue.length === 0
|
|
45
45
|
? AudienceTypes.AUDIENCE_ALL
|
|
46
|
-
:
|
|
46
|
+
: defaultValue && Object.prototype.hasOwnProperty.call(defaultValue, 'managed_by')
|
|
47
47
|
? AudienceTypes.AUDIENCE_GROUP
|
|
48
48
|
: AudienceTypes.AUDIENCE_TAG);
|
|
49
49
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -52,15 +52,15 @@ const AudienceLayer = React.forwardRef((props, ref) => {
|
|
|
52
52
|
// HOOKS
|
|
53
53
|
const { scAddressingTags } = useSCFetchAddressingTagList({ fetch: autocompleteOpen });
|
|
54
54
|
// HANDLERS
|
|
55
|
-
const handleSave = useCallback(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
() => (typeof defaultValue === 'object' ? onSave(value) : onSave((value === null || value === void 0 ? void 0 : value.length) && (value === null || value === void 0 ? void 0 : value.length) > 0 ? value : null)), [value, onSave]);
|
|
55
|
+
const handleSave = useCallback(() => {
|
|
56
|
+
audience === AudienceTypes.AUDIENCE_GROUP ? onSave(value) : onSave((value === null || value === void 0 ? void 0 : value.length) && (value === null || value === void 0 ? void 0 : value.length) > 0 ? value : null);
|
|
57
|
+
}, [value, onSave, audience]);
|
|
59
58
|
const handleChange = useCallback((event, tags) => setValue(tags), []);
|
|
60
59
|
const handleGroupChange = useCallback((group) => setValue(group), []);
|
|
61
60
|
const handleChangeAudience = useCallback((event, data) => setAudience(data), []);
|
|
62
61
|
const handleAutocompleteOpen = useCallback(() => setAutocompleteOpen(true), []);
|
|
63
62
|
const handleAutocompleteClose = useCallback(() => setAutocompleteOpen(false), []);
|
|
63
|
+
console.log(defaultValue);
|
|
64
64
|
return (React.createElement(Root, Object.assign({ ref: ref, className: classNames(className, classes.root) }, rest),
|
|
65
65
|
React.createElement(DialogTitle, { className: classes.title },
|
|
66
66
|
React.createElement(IconButton, { onClick: onClose },
|
|
@@ -72,20 +72,10 @@ const AudienceLayer = React.forwardRef((props, ref) => {
|
|
|
72
72
|
React.createElement(DialogContent, { className: classes.content },
|
|
73
73
|
React.createElement(Tabs, { value: audience, onChange: handleChangeAudience, "aria-label": "audience type" },
|
|
74
74
|
React.createElement(Tab, { value: AudienceTypes.AUDIENCE_ALL, icon: React.createElement(Icon, null, "public"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all", defaultMessage: "ui.composer.layer.audience.all" }) }),
|
|
75
|
-
React.createElement(Tab
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
, {
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
80
|
-
// @ts-ignore
|
|
81
|
-
disabled: defaultValue && defaultValue.length !== 0, value: AudienceTypes.AUDIENCE_GROUP, icon: React.createElement(Icon, null, "groups"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.group", defaultMessage: "ui.composer.layer.audience.group" }) }),
|
|
82
|
-
React.createElement(Tab
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
, {
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
87
|
-
// @ts-ignore
|
|
88
|
-
disabled: typeof defaultValue === 'object', value: AudienceTypes.AUDIENCE_TAG, icon: React.createElement(Icon, null, "label"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tag", defaultMessage: "ui.composer.layer.audience.tag" }) })),
|
|
75
|
+
React.createElement(Tab, { disabled: (Boolean(value === null || value === void 0 ? void 0 : value.length) && !Object.prototype.hasOwnProperty.call(value, 'managed_by')) ||
|
|
76
|
+
(value !== undefined && Boolean(!(value === null || value === void 0 ? void 0 : value.length)) && audience !== AudienceTypes.AUDIENCE_ALL) ||
|
|
77
|
+
(Boolean((value === null || value === void 0 ? void 0 : value.length) === 0) && audience === AudienceTypes.AUDIENCE_ALL && Boolean((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.length) !== 0)), value: AudienceTypes.AUDIENCE_GROUP, icon: React.createElement(Icon, null, "groups"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.group", defaultMessage: "ui.composer.layer.audience.group" }) }),
|
|
78
|
+
React.createElement(Tab, { disabled: value && Object.prototype.hasOwnProperty.call(value, 'managed_by'), value: AudienceTypes.AUDIENCE_TAG, icon: React.createElement(Icon, null, "label"), label: React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.tag", defaultMessage: "ui.composer.layer.audience.tag" }) })),
|
|
89
79
|
React.createElement(Typography, { className: classes.message },
|
|
90
80
|
audience === AudienceTypes.AUDIENCE_ALL && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.all.message", defaultMessage: "ui.composer.audience.layer.all.message" })),
|
|
91
81
|
audience === AudienceTypes.AUDIENCE_GROUP && (React.createElement(FormattedMessage, { id: "ui.composer.layer.audience.group.message", defaultMessage: "ui.composer.audience.layer.group.message" })),
|
|
@@ -101,6 +101,8 @@ function convertImageElement(domNode) {
|
|
|
101
101
|
}
|
|
102
102
|
return null;
|
|
103
103
|
}
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
105
|
+
// @ts-ignore
|
|
104
106
|
export class ImageNode extends DecoratorNode {
|
|
105
107
|
constructor(src, altText, maxWidth, key) {
|
|
106
108
|
super(key);
|
|
@@ -166,8 +168,12 @@ export class ImageNode extends DecoratorNode {
|
|
|
166
168
|
}
|
|
167
169
|
exportJSON() {
|
|
168
170
|
return {
|
|
171
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
172
|
+
// @ts-ignore
|
|
169
173
|
altText: this.getAltText(),
|
|
170
174
|
maxWidth: this.__maxWidth,
|
|
175
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
176
|
+
// @ts-ignore
|
|
171
177
|
src: this.getSrc(),
|
|
172
178
|
type: 'image',
|
|
173
179
|
version: 1
|
|
@@ -76,6 +76,8 @@ const Root = styled(Image, {
|
|
|
76
76
|
export default function ImagePlugin() {
|
|
77
77
|
const [editor] = useLexicalComposerContext();
|
|
78
78
|
useEffect(() => {
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
80
|
+
// @ts-ignore
|
|
79
81
|
if (!editor.hasNodes([ImageNode])) {
|
|
80
82
|
return;
|
|
81
83
|
}
|
|
@@ -92,6 +94,8 @@ export default function ImagePlugin() {
|
|
|
92
94
|
return true;
|
|
93
95
|
}, COMMAND_PRIORITY_EDITOR);
|
|
94
96
|
}, [editor]);
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
98
|
+
// @ts-ignore
|
|
95
99
|
if (!editor.hasNodes([ImageNode])) {
|
|
96
100
|
return null;
|
|
97
101
|
}
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import { $createParagraphNode, $getSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, COMMAND_PRIORITY_CRITICAL,
|
|
8
|
+
import { $createParagraphNode, $getSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, COMMAND_PRIORITY_CRITICAL, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
|
|
9
9
|
import { $isLinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link';
|
|
10
10
|
import { $isListNode, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, ListNode, REMOVE_LIST_COMMAND } from '@lexical/list';
|
|
11
11
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
12
12
|
import { $isDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode';
|
|
13
13
|
import { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode } from '@lexical/rich-text';
|
|
14
14
|
import { $setBlocksType } from '@lexical/selection';
|
|
15
|
-
import { $isTableNode } from '@lexical/table';
|
|
15
|
+
import { $isTableNode, $isTableSelection } from '@lexical/table';
|
|
16
16
|
import { $findMatchingParent, $getNearestBlockElementAncestorOrThrow, $getNearestNodeOfType, mergeRegister } from '@lexical/utils';
|
|
17
17
|
import * as React from 'react';
|
|
18
18
|
import { useCallback, useEffect, useState } from 'react';
|
|
@@ -47,7 +47,7 @@ function BlockFormatIconButton({ className = '', editor, blockType, disabled = f
|
|
|
47
47
|
const formatParagraph = () => {
|
|
48
48
|
editor.update(() => {
|
|
49
49
|
const selection = $getSelection();
|
|
50
|
-
if ($isRangeSelection(selection) ||
|
|
50
|
+
if ($isRangeSelection(selection) || $isTableSelection(selection)) {
|
|
51
51
|
$setBlocksType(selection, () => $createParagraphNode());
|
|
52
52
|
}
|
|
53
53
|
});
|
|
@@ -56,7 +56,7 @@ function BlockFormatIconButton({ className = '', editor, blockType, disabled = f
|
|
|
56
56
|
if (blockType !== headingSize) {
|
|
57
57
|
editor.update(() => {
|
|
58
58
|
const selection = $getSelection();
|
|
59
|
-
if ($isRangeSelection(selection) ||
|
|
59
|
+
if ($isRangeSelection(selection) || $isTableSelection(selection)) {
|
|
60
60
|
$setBlocksType(selection, () => $createHeadingNode(headingSize));
|
|
61
61
|
}
|
|
62
62
|
});
|
|
@@ -82,7 +82,7 @@ function BlockFormatIconButton({ className = '', editor, blockType, disabled = f
|
|
|
82
82
|
if (blockType !== 'quote') {
|
|
83
83
|
editor.update(() => {
|
|
84
84
|
const selection = $getSelection();
|
|
85
|
-
if ($isRangeSelection(selection) ||
|
|
85
|
+
if ($isRangeSelection(selection) || $isTableSelection(selection)) {
|
|
86
86
|
$setBlocksType(selection, () => $createQuoteNode());
|
|
87
87
|
}
|
|
88
88
|
});
|
|
@@ -166,6 +166,8 @@ export default function ToolbarPlugin(inProps) {
|
|
|
166
166
|
const elementDOM = activeEditor.getElementByKey(elementKey);
|
|
167
167
|
// Update text format
|
|
168
168
|
setFormats(FORMATS.filter((f) => selection.hasFormat(f)));
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
170
|
+
// @ts-ignore
|
|
169
171
|
setAlignment(ALIGNMENTS.find((a) => element.getFormatType() === a) || ALIGNMENTS[0]);
|
|
170
172
|
// Update links
|
|
171
173
|
const node = getSelectedNode(selection);
|
|
@@ -191,6 +193,8 @@ export default function ToolbarPlugin(inProps) {
|
|
|
191
193
|
setBlockType(type);
|
|
192
194
|
}
|
|
193
195
|
else {
|
|
196
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
197
|
+
// @ts-ignore
|
|
194
198
|
const type = $isHeadingNode(element) ? element.getTag() : element.getType();
|
|
195
199
|
if (type in blockTypeToBlockIcon) {
|
|
196
200
|
setBlockType(type);
|
|
@@ -233,12 +237,22 @@ export default function ToolbarPlugin(inProps) {
|
|
|
233
237
|
node = node.splitText(anchor.offset)[1] || node;
|
|
234
238
|
}
|
|
235
239
|
if (idx === nodes.length - 1) {
|
|
240
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
241
|
+
// @ts-ignore
|
|
236
242
|
node = node.splitText(focus.offset)[0] || node;
|
|
237
243
|
}
|
|
244
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
245
|
+
// @ts-ignore
|
|
238
246
|
if (node.__style !== '') {
|
|
247
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
248
|
+
// @ts-ignore
|
|
239
249
|
node.setStyle('');
|
|
240
250
|
}
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
252
|
+
// @ts-ignore
|
|
241
253
|
if (node.__format !== 0) {
|
|
254
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
255
|
+
// @ts-ignore
|
|
242
256
|
node.setFormat(0);
|
|
243
257
|
$getNearestBlockElementAncestorOrThrow(node).setFormat('');
|
|
244
258
|
}
|
|
@@ -13,7 +13,7 @@ import { SCOPE_SC_UI } from '../../../../constants/Errors';
|
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import { useSnackbar } from 'notistack';
|
|
15
15
|
import Skeleton from '@mui/material/Skeleton';
|
|
16
|
-
import { SCContributionType } from '@selfcommunity/types';
|
|
16
|
+
import { SCContributionType, SCGroupPrivacyType } from '@selfcommunity/types';
|
|
17
17
|
import { Endpoints, http } from '@selfcommunity/api-services';
|
|
18
18
|
import { copyTextToClipboard, Logger } from '@selfcommunity/utils';
|
|
19
19
|
import { SCPreferences, SCPreferencesContext, UserUtils, useSCContext, useSCFetchFeedObject, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
@@ -68,6 +68,7 @@ export default function Share(props) {
|
|
|
68
68
|
const { enqueueSnackbar } = useSnackbar();
|
|
69
69
|
const domain = typeof location !== 'undefined' && location.origin ? location.origin : '';
|
|
70
70
|
const url = domain + scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj));
|
|
71
|
+
const isGroupPublic = useMemo(() => feedObject.group && feedObject.group.privacy === SCGroupPrivacyType.PUBLIC, [feedObject.group]);
|
|
71
72
|
// INTL
|
|
72
73
|
const intl = useIntl();
|
|
73
74
|
// HANDLERS
|
|
@@ -186,22 +187,23 @@ export default function Share(props) {
|
|
|
186
187
|
}
|
|
187
188
|
function renderShareMenuItems() {
|
|
188
189
|
return (React.createElement(Box, null,
|
|
189
|
-
|
|
190
|
-
React.createElement(
|
|
191
|
-
React.createElement(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
React.createElement(
|
|
195
|
-
React.createElement(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
React.createElement(
|
|
199
|
-
React.createElement(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
React.createElement(
|
|
203
|
-
React.createElement(
|
|
204
|
-
|
|
190
|
+
(!feedObject.group || isGroupPublic) && (React.createElement(React.Fragment, null,
|
|
191
|
+
React.createElement(MenuItem, { onClick: () => share(false) },
|
|
192
|
+
React.createElement(ListItemIcon, null,
|
|
193
|
+
React.createElement(Icon, { fontSize: "small" }, "redo")),
|
|
194
|
+
React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.shareNow", defaultMessage: "ui.feedObject.share.shareNow" }) })),
|
|
195
|
+
facebookShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(FACEBOOK_SHARE + url, 'facebook-share-dialog', 'width=626,height=436') },
|
|
196
|
+
React.createElement(ListItemIcon, null,
|
|
197
|
+
React.createElement(Icon, { fontSize: "small" }, "facebook")),
|
|
198
|
+
React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.facebook", defaultMessage: "ui.feedObject.share.facebook" }) }))),
|
|
199
|
+
twitterShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(TWITTER_SHARE + url, 'twitter-share-dialog', 'width=626,height=436') },
|
|
200
|
+
React.createElement(ListItemIcon, null,
|
|
201
|
+
React.createElement(Icon, { fontSize: "small" }, "twitter")),
|
|
202
|
+
React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.twitter", defaultMessage: "ui.feedObject.share.twitter" }) }))),
|
|
203
|
+
linkedinShareEnabled && (React.createElement(MenuItem, { onClick: () => window.open(LINKEDIN_SHARE + url, 'linkedin-share-dialog', 'width=626,height=436') },
|
|
204
|
+
React.createElement(ListItemIcon, null,
|
|
205
|
+
React.createElement(Icon, { fontSize: "small" }, "linkedin")),
|
|
206
|
+
React.createElement(ListItemText, { primary: React.createElement(FormattedMessage, { id: "ui.feedObject.share.linkedin", defaultMessage: "ui.feedObject.share.linkedin" }) }))))),
|
|
205
207
|
React.createElement(MenuItem, null,
|
|
206
208
|
React.createElement(ListItemIcon, null,
|
|
207
209
|
React.createElement(Icon, { fontSize: "small" }, "link")),
|
|
@@ -58,5 +58,5 @@ export default function ContributorsFeedObject(props) {
|
|
|
58
58
|
openContributorsDialog && (React.createElement(BaseDialog, { title: React.createElement(FormattedMessage, { defaultMessage: "ui.feedObject.contributors.title", id: "ui.feedObject.contributors.title", values: { total: contributorsObject.total } }), onClose: () => setOpenContributorsDialog(false), open: openContributorsDialog }, contributorsObject.isLoadingNext ? (React.createElement(CentralProgress, { size: 50 })) : (React.createElement(InfiniteScroll, { dataLength: contributorsObject.contributors.length, next: contributorsObject.getNextPage(), hasMoreNext: Boolean(contributorsObject.next), loaderNext: React.createElement(CentralProgress, { size: 30 }), height: 400, endMessage: React.createElement(Typography, { variant: "body2", align: "center", fontWeight: "bold" },
|
|
59
59
|
React.createElement(FormattedMessage, { id: "ui.feedObject.contributors.noOtherContributors", defaultMessage: "ui.feedObject.contributors.noOtherContributors" })) },
|
|
60
60
|
React.createElement(List, null, contributorsObject.contributors.map((c, i) => (React.createElement(ListItem, { key: i },
|
|
61
|
-
React.createElement(User, { elevation: 0, user: c, key: c.id, sx: { m: 0 } }))))))))))) : null)))));
|
|
61
|
+
React.createElement(User, { elevation: 0, user: c, key: c.id, sx: { m: 0 }, onClick: () => setOpenContributorsDialog(false) }))))))))))) : null)))));
|
|
62
62
|
}
|
|
@@ -188,6 +188,7 @@ export interface FeedObjectProps extends CardProps, VirtualScrollerItemProps {
|
|
|
188
188
|
|deleted|.SCFeedObject-deleted|Styles applied to the feed obj when is deleted (visible only for admin and moderator).|
|
|
189
189
|
|header|.SCFeedObject-header|Styles applied to the header of the card.|
|
|
190
190
|
|category|.SCFeedObject-category|Styles applied to the category element.|
|
|
191
|
+
|group|.SCFeedObject-group|Styles applied to the group element.|
|
|
191
192
|
|avatar|.SCFeedObject-avatar|Styles applied to the avatar element.|
|
|
192
193
|
|username|.SCFeedObject-username|Styles applied to the username element.|
|
|
193
194
|
|activityAt|.SCFeedObject-activity-at|Styles applied to the activity at section.|
|
|
@@ -2,7 +2,7 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import CardContent from '@mui/material/CardContent';
|
|
5
|
-
import { Avatar, Box, Button, CardActions, CardHeader, Collapse, Stack, Tooltip, Typography } from '@mui/material';
|
|
5
|
+
import { Avatar, Box, Button, CardActions, CardHeader, Chip, Collapse, Stack, Tooltip, Typography } from '@mui/material';
|
|
6
6
|
import FeedObjectSkeleton from './Skeleton';
|
|
7
7
|
import DateTimeAgo from '../../shared/DateTimeAgo';
|
|
8
8
|
import Bullet from '../../shared/Bullet';
|
|
@@ -40,6 +40,10 @@ const messages = defineMessages({
|
|
|
40
40
|
visibleToAll: {
|
|
41
41
|
id: 'ui.feedObject.visibleToAll',
|
|
42
42
|
defaultMessage: 'ui.feedObject.visibleToAll'
|
|
43
|
+
},
|
|
44
|
+
visibleToGroup: {
|
|
45
|
+
id: 'ui.feedObject.visibleToGroup',
|
|
46
|
+
defaultMessage: 'ui.feedObject.visibleToGroup'
|
|
43
47
|
}
|
|
44
48
|
});
|
|
45
49
|
const classes = {
|
|
@@ -47,6 +51,7 @@ const classes = {
|
|
|
47
51
|
deleted: `${PREFIX}-deleted`,
|
|
48
52
|
header: `${PREFIX}-header`,
|
|
49
53
|
category: `${PREFIX}-category`,
|
|
54
|
+
group: `${PREFIX}-group`,
|
|
50
55
|
avatar: `${PREFIX}-avatar`,
|
|
51
56
|
username: `${PREFIX}-username`,
|
|
52
57
|
activityAt: `${PREFIX}-activity-at`,
|
|
@@ -100,6 +105,7 @@ const Root = styled(Widget, {
|
|
|
100
105
|
|deleted|.SCFeedObject-deleted|Styles applied to the feed obj when is deleted (visible only for admin and moderator).|
|
|
101
106
|
|header|.SCFeedObject-header|Styles applied to the header of the card.|
|
|
102
107
|
|category|.SCFeedObject-category|Styles applied to the category element.|
|
|
108
|
+
|group|.SCFeedObject-group|Styles applied to the group element.|
|
|
103
109
|
|avatar|.SCFeedObject-avatar|Styles applied to the avatar element.|
|
|
104
110
|
|username|.SCFeedObject-username|Styles applied to the username element.|
|
|
105
111
|
|activityAt|.SCFeedObject-activity-at|Styles applied to the activity at section.|
|
|
@@ -167,7 +173,7 @@ export default function FeedObject(inProps) {
|
|
|
167
173
|
}, [onStateChange, onHeightChange]);
|
|
168
174
|
/**
|
|
169
175
|
* Update state object
|
|
170
|
-
* @param
|
|
176
|
+
* @param newObj
|
|
171
177
|
*/
|
|
172
178
|
const updateObject = (newObj) => {
|
|
173
179
|
setObj(newObj);
|
|
@@ -196,8 +202,10 @@ export default function FeedObject(inProps) {
|
|
|
196
202
|
/**
|
|
197
203
|
* Handle change/update poll: votes
|
|
198
204
|
*/
|
|
199
|
-
const handleChangePoll = useCallback((
|
|
200
|
-
|
|
205
|
+
const handleChangePoll = useCallback((pollChoices) => {
|
|
206
|
+
if ('poll' in obj) {
|
|
207
|
+
updateObject(Object.assign({}, obj, { poll: Object.assign(Object.assign({}, obj.poll), { choices: pollChoices }) }));
|
|
208
|
+
}
|
|
201
209
|
}, [obj]);
|
|
202
210
|
/**
|
|
203
211
|
* Handle change poll visibility
|
|
@@ -424,8 +432,13 @@ export default function FeedObject(inProps) {
|
|
|
424
432
|
template === SCFeedObjectTemplateType.DETAIL ||
|
|
425
433
|
template === SCFeedObjectTemplateType.SEARCH) {
|
|
426
434
|
objElement = (React.createElement(React.Fragment, null, obj ? (React.createElement(Box, { className: classNames({ [classes.deleted]: obj && obj.deleted }) },
|
|
427
|
-
obj.categories.length > 0 && (React.createElement("div", { className: classes.category },
|
|
428
|
-
React.createElement(
|
|
435
|
+
obj.categories.length > 0 && (React.createElement("div", { className: classes.category },
|
|
436
|
+
React.createElement(React.Fragment, null, obj.group && (React.createElement("div", { className: classes.group },
|
|
437
|
+
React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true })))),
|
|
438
|
+
obj.categories.map((c) => (React.createElement(Link, { to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c), key: c.id },
|
|
439
|
+
React.createElement(Typography, { variant: "overline" }, c.name)))))),
|
|
440
|
+
obj.group && !obj.categories.length && (React.createElement("div", { className: classes.group },
|
|
441
|
+
React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), label: obj.group.name, component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }))),
|
|
429
442
|
React.createElement(CardHeader, { className: classes.header, avatar: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null }),
|
|
430
443
|
React.createElement(UserAvatar, { hide: !obj.author.community_badge },
|
|
431
444
|
React.createElement(Avatar, { "aria-label": "recipe", src: obj.author.avatar, className: classes.avatar }, obj.author.username))), title: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }), obj.author.username), subheader: React.createElement(React.Fragment, null,
|
|
@@ -437,7 +450,8 @@ export default function FeedObject(inProps) {
|
|
|
437
450
|
React.createElement(Icon, null, "add_location_alt"), (_a = obj.location) === null || _a === void 0 ? void 0 :
|
|
438
451
|
_a.location))),
|
|
439
452
|
React.createElement(Bullet, null),
|
|
440
|
-
React.createElement(Box, { className: classes.tag }, obj.addressing.length > 0 ? (React.createElement(Tags, { tags: obj.addressing, TagChipProps: { disposable: false, clickable: false } })) : (React.createElement(Tooltip, { title: `${intl.formatMessage(messages.
|
|
453
|
+
React.createElement(Box, { className: classes.tag }, obj.addressing.length > 0 ? (React.createElement(Tags, { tags: obj.addressing, TagChipProps: { disposable: false, clickable: false } })) : obj.group ? (React.createElement(Tooltip, { title: `${intl.formatMessage(messages.visibleToGroup, { group: obj.group.name })}` },
|
|
454
|
+
React.createElement(Icon, { color: "disabled", fontSize: "small" }, "groups"))) : (React.createElement(Tooltip, { title: `${intl.formatMessage(messages.visibleToAll)}` },
|
|
441
455
|
React.createElement(Icon, { color: "disabled", fontSize: "small" }, "public"))))), action: renderHeaderAction() }),
|
|
442
456
|
React.createElement(CardContent, { classes: { root: classes.content } },
|
|
443
457
|
React.createElement(Box, { className: classes.titleSection }, 'title' in obj && (React.createElement(React.Fragment, null, template === SCFeedObjectTemplateType.DETAIL ? (React.createElement(Typography, { variant: "body1", gutterBottom: true, className: classes.title }, obj.title)) : (React.createElement(Link, { to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)) },
|
|
@@ -466,8 +480,13 @@ export default function FeedObject(inProps) {
|
|
|
466
480
|
}
|
|
467
481
|
else if (template === SCFeedObjectTemplateType.SHARE) {
|
|
468
482
|
objElement = (React.createElement(React.Fragment, null, obj ? (React.createElement(React.Fragment, null,
|
|
469
|
-
obj.categories.length > 0 && (React.createElement("div", { className: classes.category },
|
|
470
|
-
React.createElement(
|
|
483
|
+
obj.categories.length > 0 && (React.createElement("div", { className: classes.category },
|
|
484
|
+
React.createElement(React.Fragment, null, obj.group && (React.createElement("div", { className: classes.group },
|
|
485
|
+
React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true })))),
|
|
486
|
+
obj.categories.map((c) => (React.createElement(Link, { to: scRoutingContext.url(SCRoutes.CATEGORY_ROUTE_NAME, c), key: c.id },
|
|
487
|
+
React.createElement(Typography, { variant: "overline" }, c.name)))))),
|
|
488
|
+
obj.group && !obj.categories.length && (React.createElement("div", { className: classes.group },
|
|
489
|
+
React.createElement(Chip, { color: "secondary", size: "small", key: obj.group.id, icon: React.createElement(Icon, null, "groups"), label: obj.group.name, component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, obj.group), clickable: true }))),
|
|
471
490
|
React.createElement(CardHeader, { classes: { root: classes.header }, avatar: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }),
|
|
472
491
|
React.createElement(UserAvatar, { hide: !obj.author.community_badge },
|
|
473
492
|
React.createElement(Avatar, { "aria-label": "recipe", src: obj.author.avatar, className: classes.avatar }, obj.author.username))), title: React.createElement(Link, Object.assign({}, (!obj.author.deleted && { to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, obj.author) }), { onClick: obj.author.deleted ? () => setOpenAlert(true) : null, className: classes.username }), obj.author.username), subheader: React.createElement(Link, { to: scRoutingContext.url(getContributionRouteName(obj), getRouteData(obj)), className: classes.activityAt },
|
|
@@ -67,36 +67,36 @@ export default function PollObject(props) {
|
|
|
67
67
|
* Handles choice upvote
|
|
68
68
|
*/
|
|
69
69
|
const handleVote = (id) => {
|
|
70
|
+
const prevChoices = [...choices];
|
|
71
|
+
let updatedChoices;
|
|
70
72
|
if (multipleChoices) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}));
|
|
76
|
-
});
|
|
73
|
+
updatedChoices = prevChoices.map((choice) => Object.assign({}, choice, {
|
|
74
|
+
voted: choice.id === id ? true : choice.voted,
|
|
75
|
+
vote_count: choice.id === id ? choice.vote_count + 1 : choice.vote_count
|
|
76
|
+
}));
|
|
77
77
|
setVotes((prevVotes) => prevVotes + 1);
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
setVotes(newVotes);
|
|
86
|
-
return updatedChoices;
|
|
87
|
-
});
|
|
80
|
+
updatedChoices = prevChoices.map((choice) => Object.assign({}, choice, {
|
|
81
|
+
voted: choice.id === id,
|
|
82
|
+
vote_count: choice.id === id ? choice.vote_count + 1 : choice.vote_count > 0 && choice.voted ? choice.vote_count - 1 : choice.vote_count
|
|
83
|
+
}));
|
|
84
|
+
setVotes(updatedChoices.reduce((totalVotes, choice) => totalVotes + choice.vote_count, 0));
|
|
88
85
|
}
|
|
86
|
+
setChoices(updatedChoices);
|
|
87
|
+
onChange(updatedChoices);
|
|
89
88
|
};
|
|
90
89
|
/**
|
|
91
90
|
* Handles choice unvote
|
|
92
91
|
*/
|
|
93
92
|
const handleUnVote = (id) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
const prevChoices = [...choices];
|
|
94
|
+
const updatedChoices = prevChoices.map((choice) => Object.assign({}, choice, {
|
|
95
|
+
voted: choice.id === id ? false : choice.voted,
|
|
96
|
+
vote_count: choice.id === id && choice.vote_count > 0 ? choice.vote_count - 1 : choice.vote_count
|
|
97
|
+
}));
|
|
98
|
+
setChoices(updatedChoices);
|
|
99
|
+
onChange(updatedChoices);
|
|
100
100
|
setVotes((prevVotes) => prevVotes - 1);
|
|
101
101
|
};
|
|
102
102
|
/**
|
|
@@ -55,7 +55,7 @@ export default function FeedUpdatesWidget(inProps) {
|
|
|
55
55
|
const [updates, setUpdates] = useState(false);
|
|
56
56
|
// REFS
|
|
57
57
|
const updatesSubscription = useRef(null);
|
|
58
|
-
//
|
|
58
|
+
// Subscriber for pubsub callback
|
|
59
59
|
const subscriber = (msg, data) => {
|
|
60
60
|
if (subscriptionChannelUpdatesCallback(msg, data)) {
|
|
61
61
|
setUpdates(true);
|
|
@@ -5,7 +5,7 @@ import { styled } from '@mui/material/styles';
|
|
|
5
5
|
import { Box, Button, Typography } from '@mui/material';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { CustomMenuService } from '@selfcommunity/api-services';
|
|
8
|
-
import { Logger } from '@selfcommunity/utils';
|
|
8
|
+
import { Logger, sortByAttr } from '@selfcommunity/utils';
|
|
9
9
|
import { Link, SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
|
|
10
10
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
11
11
|
import FooterSkeleton from './Skeleton';
|
|
@@ -94,7 +94,7 @@ export default function Footer(inProps) {
|
|
|
94
94
|
}
|
|
95
95
|
return (React.createElement(Root, Object.assign({}, rest, { className: classNames(classes.root, className) }),
|
|
96
96
|
startActions,
|
|
97
|
-
React.createElement(Box, { className: classes.itemList }, _menu.items.map((item, index) => (React.createElement(Button, { component: Link, key: item.id, className: classes.item, to: item.url, variant: "text" }, item.label)))),
|
|
97
|
+
React.createElement(Box, { className: classes.itemList }, sortByAttr(_menu.items, 'order').map((item, index) => (React.createElement(Button, { component: Link, key: item.id, className: classes.item, to: item.url, variant: "text" }, item.label)))),
|
|
98
98
|
endActions,
|
|
99
99
|
React.createElement(Typography, { textAlign: "center", className: classes.copyright, variant: "body2", dangerouslySetInnerHTML: { __html: copyright } })));
|
|
100
100
|
}
|
|
@@ -27,6 +27,11 @@ export interface GroupProps extends WidgetProps {
|
|
|
27
27
|
* @default false
|
|
28
28
|
*/
|
|
29
29
|
hideActions?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Prop to redirect the user to the group page
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
actionRedirect?: boolean;
|
|
30
35
|
/**
|
|
31
36
|
* Props to spread to the button
|
|
32
37
|
* @default {}
|
|
@@ -61,6 +66,9 @@ export interface GroupProps extends WidgetProps {
|
|
|
61
66
|
|---|---|---|
|
|
62
67
|
|root|.SCGroup-root|Styles applied to the root element.|
|
|
63
68
|
|avatar|.SCGroup-avatar|Styles applied to the avatar element.|
|
|
69
|
+
|actions|.SCGroup-actions|Styles applied to the actions section.|
|
|
70
|
+
|icon|.SCGroup-icon|Styles applied to the group privacy icon element.|
|
|
71
|
+
|
|
64
72
|
|
|
65
73
|
*
|
|
66
74
|
* @param inProps
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import React, { useState } from 'react';
|
|
2
|
+
import React, { useMemo, useState } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
|
-
import { Avatar, Icon, Stack } from '@mui/material';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { Avatar, Button, Icon, Stack } from '@mui/material';
|
|
5
|
+
import { SCGroupPrivacyType, SCGroupSubscriptionStatusType } from '@selfcommunity/types';
|
|
6
|
+
import { Link, SCRoutes, useSCFetchGroup, useSCRouting, useSCUser } from '@selfcommunity/react-core';
|
|
7
|
+
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|
7
8
|
import classNames from 'classnames';
|
|
8
9
|
import { useThemeProps } from '@mui/system';
|
|
9
10
|
import BaseItemButton from '../../shared/BaseItemButton';
|
|
@@ -20,7 +21,8 @@ const messages = defineMessages({
|
|
|
20
21
|
const classes = {
|
|
21
22
|
root: `${PREFIX}-root`,
|
|
22
23
|
avatar: `${PREFIX}-avatar`,
|
|
23
|
-
actions: `${PREFIX}-actions
|
|
24
|
+
actions: `${PREFIX}-actions`,
|
|
25
|
+
icon: `${PREFIX}-icon`
|
|
24
26
|
};
|
|
25
27
|
const Root = styled(BaseItemButton, {
|
|
26
28
|
name: PREFIX,
|
|
@@ -51,21 +53,28 @@ const Root = styled(BaseItemButton, {
|
|
|
51
53
|
|---|---|---|
|
|
52
54
|
|root|.SCGroup-root|Styles applied to the root element.|
|
|
53
55
|
|avatar|.SCGroup-avatar|Styles applied to the avatar element.|
|
|
56
|
+
|actions|.SCGroup-actions|Styles applied to the actions section.|
|
|
57
|
+
|icon|.SCGroup-icon|Styles applied to the group privacy icon element.|
|
|
58
|
+
|
|
54
59
|
|
|
55
60
|
*
|
|
56
61
|
* @param inProps
|
|
57
62
|
*/
|
|
58
63
|
export default function Group(inProps) {
|
|
64
|
+
var _a;
|
|
59
65
|
// PROPS
|
|
60
66
|
const props = useThemeProps({
|
|
61
67
|
props: inProps,
|
|
62
68
|
name: PREFIX
|
|
63
69
|
});
|
|
64
|
-
const { groupId = null, group = null, className = null, elevation, hideActions = false,
|
|
70
|
+
const { groupId = null, group = null, className = null, elevation, hideActions = false, actionRedirect = false, groupSubscribeButtonProps = {} } = props, rest = __rest(props, ["groupId", "group", "className", "elevation", "hideActions", "actionRedirect", "groupSubscribeButtonProps"]);
|
|
65
71
|
// STATE
|
|
66
72
|
const { scGroup } = useSCFetchGroup({ id: groupId, group });
|
|
67
73
|
// CONTEXT
|
|
68
74
|
const scRoutingContext = useSCRouting();
|
|
75
|
+
const scUserContext = useSCUser();
|
|
76
|
+
// CONST
|
|
77
|
+
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]);
|
|
69
78
|
const [openAlert, setOpenAlert] = useState(false);
|
|
70
79
|
// INTL
|
|
71
80
|
const intl = useIntl();
|
|
@@ -75,8 +84,8 @@ export default function Group(inProps) {
|
|
|
75
84
|
*/
|
|
76
85
|
function renderAuthenticatedActions() {
|
|
77
86
|
return (React.createElement(Stack, { className: classes.actions, direction: "row", alignItems: "center", justifyContent: "center", spacing: 2 },
|
|
78
|
-
React.createElement(Icon, null,
|
|
79
|
-
React.createElement(GroupSubscribeButton, Object.assign({ group: group, groupId: groupId }, groupSubscribeButtonProps))));
|
|
87
|
+
isGroupAdmin && React.createElement(Icon, null, "face"),
|
|
88
|
+
actionRedirect ? (React.createElement(Button, { size: "small", variant: "outlined", component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, scGroup) }, scGroup.subscription_status === SCGroupSubscriptionStatusType.SUBSCRIBED ? (React.createElement(FormattedMessage, { defaultMessage: "ui.group.status.enter", id: "ui.group.status.enter" })) : (React.createElement(FormattedMessage, { defaultMessage: "ui.group.status.discover", id: "ui.group.status.discover" })))) : (React.createElement(GroupSubscribeButton, Object.assign({ group: group, groupId: groupId }, groupSubscribeButtonProps)))));
|
|
80
89
|
}
|
|
81
90
|
/**
|
|
82
91
|
* Renders group object
|
|
@@ -88,6 +97,9 @@ export default function Group(inProps) {
|
|
|
88
97
|
* Renders root object
|
|
89
98
|
*/
|
|
90
99
|
return (React.createElement(React.Fragment, null,
|
|
91
|
-
React.createElement(Root, Object.assign({ elevation: elevation }, rest, { className: classNames(classes.root, className), ButtonBaseProps: { component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, scGroup) }, image: React.createElement(Avatar, { alt: scGroup.name, src: scGroup.image_medium, className: classes.avatar }), primary:
|
|
100
|
+
React.createElement(Root, Object.assign({ elevation: elevation }, rest, { className: classNames(classes.root, className), ButtonBaseProps: { component: Link, to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, scGroup) }, image: React.createElement(Avatar, { alt: scGroup.name, src: scGroup.image_medium, className: classes.avatar }), primary: React.createElement(React.Fragment, null,
|
|
101
|
+
scGroup.name,
|
|
102
|
+
" ",
|
|
103
|
+
React.createElement(Icon, { className: classes.icon }, (group === null || group === void 0 ? void 0 : group.privacy) === SCGroupPrivacyType.PRIVATE ? 'private' : 'public')), secondary: `${intl.formatMessage(messages.groupMembers, { total: scGroup.subscribers_counter })}`, actions: hideActions ? null : renderAuthenticatedActions() })),
|
|
92
104
|
openAlert && React.createElement(UserDeletedSnackBar, { open: openAlert, handleClose: () => setOpenAlert(false) })));
|
|
93
105
|
}
|
|
@@ -78,7 +78,7 @@ const GroupAutocomplete = (inProps) => {
|
|
|
78
78
|
setValue(value);
|
|
79
79
|
};
|
|
80
80
|
// Render
|
|
81
|
-
return (React.createElement(Root, Object.assign({
|
|
81
|
+
return (React.createElement(Root, Object.assign({ className: classes.root, open: open, onOpen: handleOpen, onClose: handleClose, options: groups || [], getOptionLabel: (option) => option.name || '', value: value, selectOnFocus: true, clearOnBlur: true, blurOnSelect: true, handleHomeEndKeys: true, clearIcon: null, disabled: disabled || isLoading, noOptionsText: React.createElement(FormattedMessage, { id: "ui.groupAutocomplete.empty", defaultMessage: "ui.groupAutocomplete.empty" }), onChange: handleChange, isOptionEqualToValue: (option, value) => value.id === option.id,
|
|
82
82
|
// renderTags={(value, getTagProps) => {
|
|
83
83
|
// return value.map((option: any, index) => (
|
|
84
84
|
// <Chip key={option.id} id={option.id} label={option.name} color={option.color} {...getTagProps({index})} />
|