@@ -13,13 +13,45 @@ import { MdVideoCall, MdVolumeOff, MdVolumeUp } from 'react-icons/lib/md';
1313
1414export class ChatItem extends Component {
1515
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+
1648 render ( ) {
1749 const statusColorType = this . props . statusColorType ;
1850
1951 return (
2052 < div
2153 className = { classNames ( 'rce-container-citem' , this . props . className ) }
22- onClick = { this . props . onClick }
54+ onClick = { this . handleOnClick }
2355 onContextMenu = { this . props . onContextMenu } >
2456 < div className = "rce-citem" >
2557 < div className = { classNames (
@@ -72,9 +104,9 @@ export class ChatItem extends Component {
72104 < div className = "rce-citem-body--bottom-title" >
73105 { this . props . subtitle }
74106 </ div >
75- < div className = "rce-citem-body--bottom-tools" >
107+ < div className = "rce-citem-body--bottom-tools" onMouseEnter = { this . handleOnMouseEnter } onMouseLeave = { this . handleOnMouseLeave } >
76108 {
77- this . props . onClickMute instanceof Function &&
109+ this . props . showMute &&
78110 < div className = "rce-citem-body--bottom-tools-item"
79111 onClick = { this . props . onClickMute } >
80112 {
@@ -88,7 +120,7 @@ export class ChatItem extends Component {
88120 </ div >
89121 }
90122 {
91- this . props . onClickVideoCall instanceof Function &&
123+ this . props . showVideoCall &&
92124 < div className = "rce-citem-body--bottom-tools-item"
93125 onClick = { this . props . onClickVideoCall } >
94126 < MdVideoCall />
@@ -97,7 +129,7 @@ export class ChatItem extends Component {
97129 </ div >
98130 < div className = "rce-citem-body--bottom-tools-item-hidden-hover" >
99131 {
100- this . props . onClickMute instanceof Function &&
132+ this . props . showMute &&
101133 this . props . muted &&
102134 < div className = "rce-citem-body--bottom-tools-item" >
103135 < MdVolumeOff />
@@ -134,6 +166,8 @@ ChatItem.defaultProps = {
134166 dateString : null ,
135167 lazyLoadingImage : undefined ,
136168 onAvatarError : ( ) => void ( 0 ) ,
169+ showMute : null ,
170+ showVideoCall : null ,
137171}
138172
139173export default ChatItem ;
0 commit comments