|
|
@ -1,4 +1,5 @@
|
|
|
|
import React from 'react';
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import { isEmpty } from 'lodash';
|
|
|
|
import { isEmpty } from 'lodash';
|
|
|
|
import { ContextMenu, ContextMenuTrigger, MenuItem } from 'react-contextmenu';
|
|
|
|
import { ContextMenu, ContextMenuTrigger, MenuItem } from 'react-contextmenu';
|
|
|
@ -12,9 +13,6 @@ import { TypingAnimation } from './conversation/TypingAnimation';
|
|
|
|
|
|
|
|
|
|
|
|
import { Colors, LocalizerType } from '../types/Util';
|
|
|
|
import { Colors, LocalizerType } from '../types/Util';
|
|
|
|
|
|
|
|
|
|
|
|
import { SessionDropdown } from './session/SessionDropdown';
|
|
|
|
|
|
|
|
import { SessionDropDownItemType } from './session/SessionDropdownItem';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export type PropsData = {
|
|
|
|
export type PropsData = {
|
|
|
|
id: string;
|
|
|
|
id: string;
|
|
|
|
phoneNumber: string;
|
|
|
|
phoneNumber: string;
|
|
|
@ -191,78 +189,36 @@ export class ConversationListItem extends React.PureComponent<Props> {
|
|
|
|
const blockTitle = isBlocked ? i18n('unblockUser') : i18n('blockUser');
|
|
|
|
const blockTitle = isBlocked ? i18n('unblockUser') : i18n('blockUser');
|
|
|
|
const blockHandler = isBlocked ? onUnblockContact : onBlockContact;
|
|
|
|
const blockHandler = isBlocked ? onUnblockContact : onBlockContact;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const items = [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
content: blockTitle,
|
|
|
|
|
|
|
|
display: true,//!isPublic && !isMe,
|
|
|
|
|
|
|
|
onClick: blockHandler
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
content: i18n('changeNickname'),
|
|
|
|
|
|
|
|
display: true,//!isPublic && !isMe,
|
|
|
|
|
|
|
|
onClick: onChangeNickname,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
content: i18n('clearNickname'),
|
|
|
|
|
|
|
|
display: true,//!isPublic && !isMe && hasNickname,
|
|
|
|
|
|
|
|
onClick: onClearNickname,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
content: i18n('copyPublicKey'),
|
|
|
|
|
|
|
|
display: true,//!isPublic,
|
|
|
|
|
|
|
|
onClick: onCopyPublicKey,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
content: i18n('deleteMessages'),
|
|
|
|
|
|
|
|
onClick: onDeleteMessages,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
content: i18n('deleteContact'),
|
|
|
|
|
|
|
|
display: true,//!isMe && isClosable && !isPublic,
|
|
|
|
|
|
|
|
onClick: onDeleteContact,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
content: i18n('deletePublicChannel'),
|
|
|
|
|
|
|
|
display: true,//!isMe && isClosable && !isPublic,
|
|
|
|
|
|
|
|
type: SessionDropDownItemType.Default,
|
|
|
|
|
|
|
|
onClick: onDeleteContact,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<SessionDropdown items={items}/>
|
|
|
|
<ContextMenu id={triggerId}>
|
|
|
|
|
|
|
|
{!isPublic && !isMe ? (
|
|
|
|
|
|
|
|
<MenuItem onClick={blockHandler}>{blockTitle}</MenuItem>
|
|
|
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
{!isPublic && !isMe ? (
|
|
|
|
|
|
|
|
<MenuItem onClick={onChangeNickname}>
|
|
|
|
|
|
|
|
{i18n('changeNickname')}
|
|
|
|
|
|
|
|
</MenuItem>
|
|
|
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
{!isPublic && !isMe && hasNickname ? (
|
|
|
|
|
|
|
|
<MenuItem onClick={onClearNickname}>{i18n('clearNickname')}</MenuItem>
|
|
|
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
{!isPublic ? (
|
|
|
|
|
|
|
|
<MenuItem onClick={onCopyPublicKey}>{i18n('copyPublicKey')}</MenuItem>
|
|
|
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
<MenuItem onClick={onDeleteMessages}>{i18n('deleteMessages')}</MenuItem>
|
|
|
|
|
|
|
|
{!isMe && isClosable ? (
|
|
|
|
|
|
|
|
!isPublic ? (
|
|
|
|
|
|
|
|
<MenuItem onClick={onDeleteContact}>
|
|
|
|
|
|
|
|
{i18n('deleteContact')}
|
|
|
|
|
|
|
|
</MenuItem>
|
|
|
|
|
|
|
|
) : (
|
|
|
|
|
|
|
|
<MenuItem onClick={onDeleteContact}>
|
|
|
|
|
|
|
|
{i18n('deletePublicChannel')}
|
|
|
|
|
|
|
|
</MenuItem>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
</ContextMenu>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
// <ContextMenu id={triggerId}>
|
|
|
|
|
|
|
|
// {!isPublic && !isMe ? (
|
|
|
|
|
|
|
|
// <MenuItem onClick={blockHandler}>{blockTitle}</MenuItem>
|
|
|
|
|
|
|
|
// ) : null}
|
|
|
|
|
|
|
|
// {!isPublic && !isMe ? (
|
|
|
|
|
|
|
|
// <MenuItem onClick={onChangeNickname}>
|
|
|
|
|
|
|
|
// {i18n('changeNickname')}
|
|
|
|
|
|
|
|
// </MenuItem>
|
|
|
|
|
|
|
|
// ) : null}
|
|
|
|
|
|
|
|
// {!isPublic && !isMe && hasNickname ? (
|
|
|
|
|
|
|
|
// <MenuItem onClick={onClearNickname}>{i18n('clearNickname')}</MenuItem>
|
|
|
|
|
|
|
|
// ) : null}
|
|
|
|
|
|
|
|
// {!isPublic ? (
|
|
|
|
|
|
|
|
// <MenuItem onClick={onCopyPublicKey}>{i18n('copyPublicKey')}</MenuItem>
|
|
|
|
|
|
|
|
// ) : null}
|
|
|
|
|
|
|
|
// <MenuItem onClick={onDeleteMessages}>{i18n('deleteMessages')}</MenuItem>
|
|
|
|
|
|
|
|
// {!isMe && isClosable ? (
|
|
|
|
|
|
|
|
// !isPublic ? (
|
|
|
|
|
|
|
|
// <MenuItem onClick={onDeleteContact}>
|
|
|
|
|
|
|
|
// {i18n('deleteContact')}
|
|
|
|
|
|
|
|
// </MenuItem>
|
|
|
|
|
|
|
|
// ) : (
|
|
|
|
|
|
|
|
// <MenuItem onClick={onDeleteContact}>
|
|
|
|
|
|
|
|
// {i18n('deletePublicChannel')}
|
|
|
|
|
|
|
|
// </MenuItem>
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
// ) : null}
|
|
|
|
|
|
|
|
// </ContextMenu>
|
|
|
|
|
|
|
|
//);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public renderMessage() {
|
|
|
|
public renderMessage() {
|
|
|
|