|
|
@ -1,7 +1,7 @@
|
|
|
|
import React from 'react';
|
|
|
|
import React from 'react';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
import { isEmpty } from 'lodash';
|
|
|
|
import { isEmpty } from 'lodash';
|
|
|
|
import { MenuProvider } from 'react-contexify';
|
|
|
|
import { contextMenu } from 'react-contexify';
|
|
|
|
|
|
|
|
|
|
|
|
import { Avatar } from './Avatar';
|
|
|
|
import { Avatar } from './Avatar';
|
|
|
|
import { MessageBody } from './conversation/MessageBody';
|
|
|
|
import { MessageBody } from './conversation/MessageBody';
|
|
|
@ -19,6 +19,7 @@ import {
|
|
|
|
ConversationListItemContextMenu,
|
|
|
|
ConversationListItemContextMenu,
|
|
|
|
PropsContextConversationItem,
|
|
|
|
PropsContextConversationItem,
|
|
|
|
} from './session/menu/ConversationListItemContextMenu';
|
|
|
|
} from './session/menu/ConversationListItemContextMenu';
|
|
|
|
|
|
|
|
import { createPortal } from 'react-dom';
|
|
|
|
|
|
|
|
|
|
|
|
export type PropsData = {
|
|
|
|
export type PropsData = {
|
|
|
|
id: string;
|
|
|
|
id: string;
|
|
|
@ -70,6 +71,10 @@ type PropsHousekeeping = {
|
|
|
|
|
|
|
|
|
|
|
|
type Props = PropsData & PropsHousekeeping;
|
|
|
|
type Props = PropsData & PropsHousekeeping;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Portal = ({ children }: { children: any }) => {
|
|
|
|
|
|
|
|
return createPortal(children, document.querySelector('.inbox.index') as Element);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class ConversationListItem extends React.PureComponent<Props> {
|
|
|
|
class ConversationListItem extends React.PureComponent<Props> {
|
|
|
|
public constructor(props: Props) {
|
|
|
|
public constructor(props: Props) {
|
|
|
|
super(props);
|
|
|
|
super(props);
|
|
|
@ -103,7 +108,6 @@ class ConversationListItem extends React.PureComponent<Props> {
|
|
|
|
|
|
|
|
|
|
|
|
public renderHeader() {
|
|
|
|
public renderHeader() {
|
|
|
|
const { unreadCount, mentionedUs, i18n, isMe, lastUpdated } = this.props;
|
|
|
|
const { unreadCount, mentionedUs, i18n, isMe, lastUpdated } = this.props;
|
|
|
|
const {} = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let atSymbol = null;
|
|
|
|
let atSymbol = null;
|
|
|
|
let unreadCountDiv = null;
|
|
|
|
let unreadCountDiv = null;
|
|
|
@ -221,7 +225,6 @@ class ConversationListItem extends React.PureComponent<Props> {
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div key={key}>
|
|
|
|
<div key={key}>
|
|
|
|
<MenuProvider id={triggerId}>
|
|
|
|
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
role="button"
|
|
|
|
role="button"
|
|
|
|
onClick={() => {
|
|
|
|
onClick={() => {
|
|
|
@ -229,6 +232,12 @@ class ConversationListItem extends React.PureComponent<Props> {
|
|
|
|
onClick(id);
|
|
|
|
onClick(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
|
|
|
|
onContextMenu={(e: any) => {
|
|
|
|
|
|
|
|
contextMenu.show({
|
|
|
|
|
|
|
|
id: triggerId,
|
|
|
|
|
|
|
|
event: e,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}}
|
|
|
|
style={style}
|
|
|
|
style={style}
|
|
|
|
className={classNames(
|
|
|
|
className={classNames(
|
|
|
|
'module-conversation-list-item',
|
|
|
|
'module-conversation-list-item',
|
|
|
@ -248,8 +257,9 @@ class ConversationListItem extends React.PureComponent<Props> {
|
|
|
|
{this.renderMessage()}
|
|
|
|
{this.renderMessage()}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</MenuProvider>
|
|
|
|
<Portal>
|
|
|
|
<ConversationListItemContextMenu {...this.getMenuProps(triggerId)} />
|
|
|
|
<ConversationListItemContextMenu {...this.getMenuProps(triggerId)} />
|
|
|
|
|
|
|
|
</Portal>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|