@selfcommunity/react-ui 0.7.0-alpha.365 → 0.7.0-alpha.366
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 +1 -1
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.d.ts +3 -6
- package/lib/cjs/components/ComposerIconButton/ComposerIconButton.js +3 -4
- package/lib/cjs/components/PrivateMessageSettingsIconButton/PrivateMessageSettingsIconButton.js +6 -9
- package/lib/cjs/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +10 -5
- package/lib/esm/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.d.ts +3 -6
- package/lib/esm/components/ComposerIconButton/ComposerIconButton.js +3 -3
- package/lib/esm/components/PrivateMessageSettingsIconButton/PrivateMessageSettingsIconButton.js +6 -9
- package/lib/esm/components/PrivateMessageThreadItem/PrivateMessageThreadItem.js +11 -6
- package/lib/umd/react-ui.js +1 -1
- package/package.json +2 -2
|
@@ -70,7 +70,7 @@ function BottomNavigation(inProps) {
|
|
|
70
70
|
react_1.default.createElement(material_1.BottomNavigationAction, { key: "home", className: classes.action, component: react_core_1.Link, to: scUserContext.user ? scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}) : '/', value: scUserContext.user ? scRoutingContext.url(react_core_1.SCRoutes.HOME_ROUTE_NAME, {}) : '/', icon: react_1.default.createElement(material_1.Icon, null, "home") }),
|
|
71
71
|
(scUserContext.user || preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value) &&
|
|
72
72
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value ? (react_1.default.createElement(material_1.BottomNavigationAction, { key: "explore", className: classes.action, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.EXPLORE_ROUTE_NAME, {}), value: scRoutingContext.url(react_core_1.SCRoutes.EXPLORE_ROUTE_NAME, {}), icon: react_1.default.createElement(material_1.Icon, null, "explore") })) : null,
|
|
73
|
-
react_1.default.createElement(material_1.BottomNavigationAction, { key: "composer", className: (0, classnames_1.default)(classes.composer, classes.action), component: ComposerIconButton_1.default }),
|
|
73
|
+
react_1.default.createElement(material_1.BottomNavigationAction, { key: "composer", className: (0, classnames_1.default)(classes.composer, classes.action), component: ComposerIconButton_1.default, disableRipple: true }),
|
|
74
74
|
scUserContext.user ? (react_1.default.createElement(material_1.BottomNavigationAction, { key: "notifications", className: classes.action, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}), value: scRoutingContext.url(react_core_1.SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}), icon: react_1.default.createElement(material_1.Badge, { badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" },
|
|
75
75
|
react_1.default.createElement(material_1.Icon, null, "notifications_active")) })) : null,
|
|
76
76
|
privateMessagingEnabled && scUserContext.user ? (react_1.default.createElement(material_1.BottomNavigationAction, { key: "messages", className: classes.action, component: react_core_1.Link, to: scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}), value: scRoutingContext.url(react_core_1.SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}), icon: react_1.default.createElement(material_1.Badge, { badgeContent: 0, color: "secondary" },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { IconButtonProps } from '@mui/material';
|
|
3
3
|
import { ComposerProps } from '../Composer';
|
|
4
4
|
export interface ComposerIconButtonProps extends IconButtonProps {
|
|
@@ -7,10 +7,6 @@ export interface ComposerIconButtonProps extends IconButtonProps {
|
|
|
7
7
|
* @default null
|
|
8
8
|
*/
|
|
9
9
|
ComposerProps?: ComposerProps;
|
|
10
|
-
/**
|
|
11
|
-
* Other props
|
|
12
|
-
*/
|
|
13
|
-
items?: any;
|
|
14
10
|
}
|
|
15
11
|
/**
|
|
16
12
|
* > API documentation for the Community-JS Composer Icon Button component. Learn about the available props and the CSS API.
|
|
@@ -34,4 +30,5 @@ export interface ComposerIconButtonProps extends IconButtonProps {
|
|
|
34
30
|
|
|
35
31
|
* @param inProps
|
|
36
32
|
*/
|
|
37
|
-
|
|
33
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<ComposerIconButtonProps, "form" | "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" | "component" | "sx" | "name" | "classes" | "value" | "type" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "action" | "size" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "ComposerProps"> & React.RefAttributes<HTMLButtonElement>>;
|
|
34
|
+
export default _default;
|
|
@@ -41,7 +41,7 @@ const Root = (0, styles_1.styled)(material_1.IconButton, {
|
|
|
41
41
|
|
|
42
42
|
* @param inProps
|
|
43
43
|
*/
|
|
44
|
-
function ComposerIconButton(inProps) {
|
|
44
|
+
exports.default = react_1.default.forwardRef(function ComposerIconButton(inProps, ref) {
|
|
45
45
|
// PROPS
|
|
46
46
|
const props = (0, system_1.useThemeProps)({
|
|
47
47
|
props: inProps,
|
|
@@ -86,8 +86,7 @@ function ComposerIconButton(inProps) {
|
|
|
86
86
|
});
|
|
87
87
|
}, []);
|
|
88
88
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
89
|
-
react_1.default.createElement(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: handleClick }),
|
|
89
|
+
react_1.default.createElement(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: handleClick, ref: ref }),
|
|
90
90
|
react_1.default.createElement(material_1.Icon, null, "add_circle_outline")),
|
|
91
91
|
react_1.default.createElement(Composer_1.default, Object.assign({ open: open, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess }, ComposerProps))));
|
|
92
|
-
}
|
|
93
|
-
exports.default = ComposerIconButton;
|
|
92
|
+
});
|
package/lib/cjs/components/PrivateMessageSettingsIconButton/PrivateMessageSettingsIconButton.js
CHANGED
|
@@ -22,19 +22,16 @@ const classes = {
|
|
|
22
22
|
};
|
|
23
23
|
const Root = (0, styles_1.styled)(material_1.IconButton, {
|
|
24
24
|
name: PREFIX,
|
|
25
|
-
slot: 'Root'
|
|
26
|
-
|
|
27
|
-
})(({ theme }) => ({}));
|
|
25
|
+
slot: 'Root'
|
|
26
|
+
})(() => ({}));
|
|
28
27
|
const SwipeableDrawerRoot = (0, styles_1.styled)(material_1.SwipeableDrawer, {
|
|
29
28
|
name: PREFIX,
|
|
30
|
-
slot: '
|
|
31
|
-
|
|
32
|
-
})(({ theme }) => ({}));
|
|
29
|
+
slot: 'DrawerRoot'
|
|
30
|
+
})(() => ({}));
|
|
33
31
|
const MenuRoot = (0, styles_1.styled)(material_1.Menu, {
|
|
34
32
|
name: PREFIX,
|
|
35
|
-
slot: '
|
|
36
|
-
|
|
37
|
-
})(({ theme }) => ({}));
|
|
33
|
+
slot: 'MenuRoot'
|
|
34
|
+
})(() => ({}));
|
|
38
35
|
/**
|
|
39
36
|
* > API documentation for the Community-JS PrivateMessageSettingsIconButton component. Learn about the available props and the CSS API.
|
|
40
37
|
|
|
@@ -10,6 +10,7 @@ const types_1 = require("@selfcommunity/types");
|
|
|
10
10
|
const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
|
|
11
11
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
12
12
|
const system_1 = require("@mui/system");
|
|
13
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
13
14
|
const useMediaQuery_1 = tslib_1.__importDefault(require("@mui/material/useMediaQuery"));
|
|
14
15
|
const PrivateMessageSettingsIconButton_1 = tslib_1.__importDefault(require("../PrivateMessageSettingsIconButton"));
|
|
15
16
|
const sizeCoverter_1 = require("../../utils/sizeCoverter");
|
|
@@ -86,6 +87,12 @@ function PrivateMessageThreadItem(inProps) {
|
|
|
86
87
|
const hasFile = message ? message.file : null;
|
|
87
88
|
const [openDialog, setOpenDialog] = (0, react_1.useState)(false);
|
|
88
89
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
90
|
+
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
91
|
+
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
92
|
+
const messageReceiver = (item, loggedUserId) => {
|
|
93
|
+
var _a;
|
|
94
|
+
return ((_a = item === null || item === void 0 ? void 0 : item.receiver) === null || _a === void 0 ? void 0 : _a.id) !== loggedUserId ? item === null || item === void 0 ? void 0 : item.receiver : item === null || item === void 0 ? void 0 : item.sender;
|
|
95
|
+
};
|
|
89
96
|
const getMouseEvents = (mouseEnter, mouseLeave) => ({
|
|
90
97
|
onMouseEnter: mouseEnter,
|
|
91
98
|
onMouseLeave: mouseLeave,
|
|
@@ -122,8 +129,7 @@ function PrivateMessageThreadItem(inProps) {
|
|
|
122
129
|
}
|
|
123
130
|
let section = null;
|
|
124
131
|
const defaultSection = (react_1.default.createElement(material_1.Box, { className: classes.other },
|
|
125
|
-
react_1.default.createElement(material_1.Button, { onClick: () => handleDownload(m.file) },
|
|
126
|
-
react_1.default.createElement(Icon_1.default, null, "download"),
|
|
132
|
+
react_1.default.createElement(material_1.Button, { onClick: () => handleDownload(m.file), startIcon: react_1.default.createElement(Icon_1.default, null, "download") },
|
|
127
133
|
react_1.default.createElement(material_1.Typography, null, m.file.filename),
|
|
128
134
|
react_1.default.createElement(material_1.Typography, null, (0, sizeCoverter_1.bytesToSize)(m.file.filesize)))));
|
|
129
135
|
if (m.file) {
|
|
@@ -147,8 +153,7 @@ function PrivateMessageThreadItem(inProps) {
|
|
|
147
153
|
case type.startsWith(types_1.SCMessageFileType.DOCUMENT):
|
|
148
154
|
section = (react_1.default.createElement(material_1.Box, { className: m.file.filename.endsWith('.pdf') ? classes.document : classes.other },
|
|
149
155
|
m.file.filename.endsWith('.pdf') && react_1.default.createElement("img", { src: m.file.thumbnail, loading: "lazy", alt: 'img' }),
|
|
150
|
-
react_1.default.createElement(material_1.Button, { onClick: () => handleDownload(m.file) },
|
|
151
|
-
react_1.default.createElement(Icon_1.default, null, "download"),
|
|
156
|
+
react_1.default.createElement(material_1.Button, { onClick: () => handleDownload(m.file), startIcon: react_1.default.createElement(Icon_1.default, null, "download") },
|
|
152
157
|
react_1.default.createElement(material_1.Typography, null, m.file.filename),
|
|
153
158
|
react_1.default.createElement(material_1.Typography, null, (0, sizeCoverter_1.bytesToSize)(m.file.filesize)))));
|
|
154
159
|
break;
|
|
@@ -168,7 +173,7 @@ function PrivateMessageThreadItem(inProps) {
|
|
|
168
173
|
*/
|
|
169
174
|
return (react_1.default.createElement(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, getMouseEvents(mouseEvents.onMouseEnter, mouseEvents.onMouseLeave), rest, { secondaryAction: (isHovering || isMobile) &&
|
|
170
175
|
showMenuIcon &&
|
|
171
|
-
message.status !== types_1.SCPrivateMessageStatusType.HIDDEN && react_1.default.createElement(PrivateMessageSettingsIconButton_1.default, { onMenuItemDeleteClick: handleMenuItemClick }) }),
|
|
176
|
+
message.status !== types_1.SCPrivateMessageStatusType.HIDDEN && (react_1.default.createElement(PrivateMessageSettingsIconButton_1.default, { onMenuItemDeleteClick: handleMenuItemClick, user: messageReceiver(message, authUserId) })) }),
|
|
172
177
|
react_1.default.createElement(react_1.default.Fragment, null,
|
|
173
178
|
hasFile && message.status !== types_1.SCPrivateMessageStatusType.HIDDEN ? (renderMessageFile(message)) : (react_1.default.createElement(material_1.Box, { className: classes.text },
|
|
174
179
|
react_1.default.createElement(material_1.Typography, { component: "span", dangerouslySetInnerHTML: { __html: message.message } }))),
|
|
@@ -68,7 +68,7 @@ export default function BottomNavigation(inProps) {
|
|
|
68
68
|
React.createElement(BottomNavigationAction, { key: "home", className: classes.action, component: Link, to: scUserContext.user ? scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}) : '/', value: scUserContext.user ? scRoutingContext.url(SCRoutes.HOME_ROUTE_NAME, {}) : '/', icon: React.createElement(Icon, null, "home") }),
|
|
69
69
|
(scUserContext.user || preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value) &&
|
|
70
70
|
preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value ? (React.createElement(BottomNavigationAction, { key: "explore", className: classes.action, component: Link, to: scRoutingContext.url(SCRoutes.EXPLORE_ROUTE_NAME, {}), value: scRoutingContext.url(SCRoutes.EXPLORE_ROUTE_NAME, {}), icon: React.createElement(Icon, null, "explore") })) : null,
|
|
71
|
-
React.createElement(BottomNavigationAction, { key: "composer", className: classNames(classes.composer, classes.action), component: ComposerIconButton }),
|
|
71
|
+
React.createElement(BottomNavigationAction, { key: "composer", className: classNames(classes.composer, classes.action), component: ComposerIconButton, disableRipple: true }),
|
|
72
72
|
scUserContext.user ? (React.createElement(BottomNavigationAction, { key: "notifications", className: classes.action, component: Link, to: scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}), value: scRoutingContext.url(SCRoutes.USER_NOTIFICATIONS_ROUTE_NAME, {}), icon: React.createElement(Badge, { badgeContent: scUserContext.user.unseen_notification_banners_counter + scUserContext.user.unseen_interactions_counter, color: "secondary" },
|
|
73
73
|
React.createElement(Icon, null, "notifications_active")) })) : null,
|
|
74
74
|
privateMessagingEnabled && scUserContext.user ? (React.createElement(BottomNavigationAction, { key: "messages", className: classes.action, component: Link, to: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}), value: scRoutingContext.url(SCRoutes.USER_PRIVATE_MESSAGES_ROUTE_NAME, {}), icon: React.createElement(Badge, { badgeContent: 0, color: "secondary" },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { IconButtonProps } from '@mui/material';
|
|
3
3
|
import { ComposerProps } from '../Composer';
|
|
4
4
|
export interface ComposerIconButtonProps extends IconButtonProps {
|
|
@@ -7,10 +7,6 @@ export interface ComposerIconButtonProps extends IconButtonProps {
|
|
|
7
7
|
* @default null
|
|
8
8
|
*/
|
|
9
9
|
ComposerProps?: ComposerProps;
|
|
10
|
-
/**
|
|
11
|
-
* Other props
|
|
12
|
-
*/
|
|
13
|
-
items?: any;
|
|
14
10
|
}
|
|
15
11
|
/**
|
|
16
12
|
* > API documentation for the Community-JS Composer Icon Button component. Learn about the available props and the CSS API.
|
|
@@ -34,4 +30,5 @@ export interface ComposerIconButtonProps extends IconButtonProps {
|
|
|
34
30
|
|
|
35
31
|
* @param inProps
|
|
36
32
|
*/
|
|
37
|
-
|
|
33
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<ComposerIconButtonProps, "form" | "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" | "component" | "sx" | "name" | "classes" | "value" | "type" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "action" | "size" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "ComposerProps"> & React.RefAttributes<HTMLButtonElement>>;
|
|
34
|
+
export default _default;
|
|
@@ -39,7 +39,7 @@ const Root = styled(IconButton, {
|
|
|
39
39
|
|
|
40
40
|
* @param inProps
|
|
41
41
|
*/
|
|
42
|
-
export default function ComposerIconButton(inProps) {
|
|
42
|
+
export default React.forwardRef(function ComposerIconButton(inProps, ref) {
|
|
43
43
|
// PROPS
|
|
44
44
|
const props = useThemeProps({
|
|
45
45
|
props: inProps,
|
|
@@ -84,7 +84,7 @@ export default function ComposerIconButton(inProps) {
|
|
|
84
84
|
});
|
|
85
85
|
}, []);
|
|
86
86
|
return (React.createElement(React.Fragment, null,
|
|
87
|
-
React.createElement(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { onClick: handleClick }),
|
|
87
|
+
React.createElement(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { onClick: handleClick, ref: ref }),
|
|
88
88
|
React.createElement(Icon, null, "add_circle_outline")),
|
|
89
89
|
React.createElement(Composer, Object.assign({ open: open, fullWidth: true, onClose: handleClose, onSuccess: handleSuccess }, ComposerProps))));
|
|
90
|
-
}
|
|
90
|
+
});
|
package/lib/esm/components/PrivateMessageSettingsIconButton/PrivateMessageSettingsIconButton.js
CHANGED
|
@@ -20,19 +20,16 @@ const classes = {
|
|
|
20
20
|
};
|
|
21
21
|
const Root = styled(IconButton, {
|
|
22
22
|
name: PREFIX,
|
|
23
|
-
slot: 'Root'
|
|
24
|
-
|
|
25
|
-
})(({ theme }) => ({}));
|
|
23
|
+
slot: 'Root'
|
|
24
|
+
})(() => ({}));
|
|
26
25
|
const SwipeableDrawerRoot = styled(SwipeableDrawer, {
|
|
27
26
|
name: PREFIX,
|
|
28
|
-
slot: '
|
|
29
|
-
|
|
30
|
-
})(({ theme }) => ({}));
|
|
27
|
+
slot: 'DrawerRoot'
|
|
28
|
+
})(() => ({}));
|
|
31
29
|
const MenuRoot = styled(Menu, {
|
|
32
30
|
name: PREFIX,
|
|
33
|
-
slot: '
|
|
34
|
-
|
|
35
|
-
})(({ theme }) => ({}));
|
|
31
|
+
slot: 'MenuRoot'
|
|
32
|
+
})(() => ({}));
|
|
36
33
|
/**
|
|
37
34
|
* > API documentation for the Community-JS PrivateMessageSettingsIconButton component. Learn about the available props and the CSS API.
|
|
38
35
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter, __rest } from "tslib";
|
|
2
|
-
import React, { useState } from 'react';
|
|
2
|
+
import React, { useContext, useState } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { ListItem, Typography, IconButton, Box, useTheme, Button } from '@mui/material';
|
|
5
5
|
import PrivateMessageThreadItemSkeleton from './Skeleton';
|
|
@@ -8,6 +8,7 @@ import { SCMessageFileType, SCPrivateMessageStatusType } from '@selfcommunity/ty
|
|
|
8
8
|
import Icon from '@mui/material/Icon';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import { useThemeProps } from '@mui/system';
|
|
11
|
+
import { SCUserContext } from '@selfcommunity/react-core';
|
|
11
12
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
12
13
|
import PrivateMessageSettingsIconButton from '../PrivateMessageSettingsIconButton';
|
|
13
14
|
import { bytesToSize } from '../../utils/sizeCoverter';
|
|
@@ -84,6 +85,12 @@ export default function PrivateMessageThreadItem(inProps) {
|
|
|
84
85
|
const hasFile = message ? message.file : null;
|
|
85
86
|
const [openDialog, setOpenDialog] = useState(false);
|
|
86
87
|
const { enqueueSnackbar } = useSnackbar();
|
|
88
|
+
const scUserContext = useContext(SCUserContext);
|
|
89
|
+
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
90
|
+
const messageReceiver = (item, loggedUserId) => {
|
|
91
|
+
var _a;
|
|
92
|
+
return ((_a = item === null || item === void 0 ? void 0 : item.receiver) === null || _a === void 0 ? void 0 : _a.id) !== loggedUserId ? item === null || item === void 0 ? void 0 : item.receiver : item === null || item === void 0 ? void 0 : item.sender;
|
|
93
|
+
};
|
|
87
94
|
const getMouseEvents = (mouseEnter, mouseLeave) => ({
|
|
88
95
|
onMouseEnter: mouseEnter,
|
|
89
96
|
onMouseLeave: mouseLeave,
|
|
@@ -120,8 +127,7 @@ export default function PrivateMessageThreadItem(inProps) {
|
|
|
120
127
|
}
|
|
121
128
|
let section = null;
|
|
122
129
|
const defaultSection = (React.createElement(Box, { className: classes.other },
|
|
123
|
-
React.createElement(Button, { onClick: () => handleDownload(m.file) },
|
|
124
|
-
React.createElement(Icon, null, "download"),
|
|
130
|
+
React.createElement(Button, { onClick: () => handleDownload(m.file), startIcon: React.createElement(Icon, null, "download") },
|
|
125
131
|
React.createElement(Typography, null, m.file.filename),
|
|
126
132
|
React.createElement(Typography, null, bytesToSize(m.file.filesize)))));
|
|
127
133
|
if (m.file) {
|
|
@@ -145,8 +151,7 @@ export default function PrivateMessageThreadItem(inProps) {
|
|
|
145
151
|
case type.startsWith(SCMessageFileType.DOCUMENT):
|
|
146
152
|
section = (React.createElement(Box, { className: m.file.filename.endsWith('.pdf') ? classes.document : classes.other },
|
|
147
153
|
m.file.filename.endsWith('.pdf') && React.createElement("img", { src: m.file.thumbnail, loading: "lazy", alt: 'img' }),
|
|
148
|
-
React.createElement(Button, { onClick: () => handleDownload(m.file) },
|
|
149
|
-
React.createElement(Icon, null, "download"),
|
|
154
|
+
React.createElement(Button, { onClick: () => handleDownload(m.file), startIcon: React.createElement(Icon, null, "download") },
|
|
150
155
|
React.createElement(Typography, null, m.file.filename),
|
|
151
156
|
React.createElement(Typography, null, bytesToSize(m.file.filesize)))));
|
|
152
157
|
break;
|
|
@@ -166,7 +171,7 @@ export default function PrivateMessageThreadItem(inProps) {
|
|
|
166
171
|
*/
|
|
167
172
|
return (React.createElement(Root, Object.assign({ className: classNames(classes.root, className) }, getMouseEvents(mouseEvents.onMouseEnter, mouseEvents.onMouseLeave), rest, { secondaryAction: (isHovering || isMobile) &&
|
|
168
173
|
showMenuIcon &&
|
|
169
|
-
message.status !== SCPrivateMessageStatusType.HIDDEN && React.createElement(PrivateMessageSettingsIconButton, { onMenuItemDeleteClick: handleMenuItemClick }) }),
|
|
174
|
+
message.status !== SCPrivateMessageStatusType.HIDDEN && (React.createElement(PrivateMessageSettingsIconButton, { onMenuItemDeleteClick: handleMenuItemClick, user: messageReceiver(message, authUserId) })) }),
|
|
170
175
|
React.createElement(React.Fragment, null,
|
|
171
176
|
hasFile && message.status !== SCPrivateMessageStatusType.HIDDEN ? (renderMessageFile(message)) : (React.createElement(Box, { className: classes.text },
|
|
172
177
|
React.createElement(Typography, { component: "span", dangerouslySetInnerHTML: { __html: message.message } }))),
|