@@ -8,17 +8,50 @@ import {
88} from 'timeago.js' ;
99
1010import classNames from 'classnames' ;
11- import MdBlock from 'react-icons/lib/md/block' ;
11+
12+ import { MdVideoCall , MdVolumeOff , MdVolumeUp } from 'react-icons/lib/md' ;
1213
1314export class ChatItem extends Component {
1415
16+ constructor ( p ) {
17+ super ( p ) ;
18+ this . state = {
19+ onHoverTool : false ,
20+ } ;
21+
22+ this . handleOnMouseEnter = this . handleOnMouseEnter . bind ( this ) ;
23+ this . handleOnMouseLeave = this . handleOnMouseLeave . bind ( this ) ;
24+ this . handleOnClick = this . handleOnClick . bind ( this ) ;
25+ }
26+
27+ handleOnMouseEnter ( ) {
28+ this . setState ( {
29+ onHoverTool : true ,
30+ } ) ;
31+ }
32+
33+ handleOnMouseLeave ( ) {
34+ this . setState ( {
35+ onHoverTool : false ,
36+ } ) ;
37+ }
38+
39+ handleOnClick ( e ) {
40+ e . preventDefault ( ) ;
41+
42+ if ( this . state . onHoverTool === true )
43+ return ;
44+
45+ this . props . onClick ( ) ;
46+ }
47+
1548 render ( ) {
1649 const statusColorType = this . props . statusColorType ;
1750
1851 return (
1952 < div
2053 className = { classNames ( 'rce-container-citem' , this . props . className ) }
21- onClick = { this . props . onClick }
54+ onClick = { this . handleOnClick }
2255 onContextMenu = { this . props . onContextMenu } >
2356 < div className = "rce-citem" >
2457 < div className = { classNames (
@@ -71,6 +104,38 @@ export class ChatItem extends Component {
71104 < div className = "rce-citem-body--bottom-title" >
72105 { this . props . subtitle }
73106 </ div >
107+ < div className = "rce-citem-body--bottom-tools" onMouseEnter = { this . handleOnMouseEnter } onMouseLeave = { this . handleOnMouseLeave } >
108+ {
109+ this . props . showMute &&
110+ < div className = "rce-citem-body--bottom-tools-item"
111+ onClick = { this . props . onClickMute } >
112+ {
113+ this . props . muted === true &&
114+ < MdVolumeOff />
115+ }
116+ {
117+ this . props . muted === false &&
118+ < MdVolumeUp />
119+ }
120+ </ div >
121+ }
122+ {
123+ this . props . showVideoCall &&
124+ < div className = "rce-citem-body--bottom-tools-item"
125+ onClick = { this . props . onClickVideoCall } >
126+ < MdVideoCall />
127+ </ div >
128+ }
129+ </ div >
130+ < div className = "rce-citem-body--bottom-tools-item-hidden-hover" >
131+ {
132+ this . props . showMute &&
133+ this . props . muted &&
134+ < div className = "rce-citem-body--bottom-tools-item" >
135+ < MdVolumeOff />
136+ </ div >
137+ }
138+ </ div >
74139 < div className = "rce-citem-body--bottom-status" >
75140 {
76141 this . props . unread > 0 &&
@@ -101,6 +166,8 @@ ChatItem.defaultProps = {
101166 dateString : null ,
102167 lazyLoadingImage : undefined ,
103168 onAvatarError : ( ) => void ( 0 ) ,
169+ showMute : null ,
170+ showVideoCall : null ,
104171}
105172
106173export default ChatItem ;
0 commit comments