11/** @jsx jsx */
22import { jsx } from '@emotion/core' ;
3+ import PropTypes from 'prop-types' ;
34
45import { CometChat } from "@cometchat-pro/chat" ;
56
@@ -14,18 +15,20 @@ import {
1415 actionStyle
1516} from "./style" ;
1617
18+ import Translator from "../../resources/localization/translator" ;
19+ import { theme } from "../../resources/theme" ;
1720import unban from "./resources/block.png" ;
1821
1922const memberview = ( props ) => {
2023
2124 const roles = { }
22- roles [ CometChat . GROUP_MEMBER_SCOPE . ADMIN ] = "Administrator" ;
23- roles [ CometChat . GROUP_MEMBER_SCOPE . MODERATOR ] = "Moderator" ;
24- roles [ CometChat . GROUP_MEMBER_SCOPE . PARTICIPANT ] = "Participant" ;
25+ roles [ CometChat . GROUP_MEMBER_SCOPE . ADMIN ] = Translator . translate ( "ADMINISTRATOR" , props . lang ) ;
26+ roles [ CometChat . GROUP_MEMBER_SCOPE . MODERATOR ] = Translator . translate ( "MODERATOR" , props . lang ) ;
27+ roles [ CometChat . GROUP_MEMBER_SCOPE . PARTICIPANT ] = Translator . translate ( "PARTICIPANT" , props . lang ) ;
2528
2629 let name = props . member . name ;
2730 let scope = roles [ props . member . scope ] ;
28- let unBan = ( < img src = { unban } alt = "Unban" onClick = { ( ) => { props . actionGenerated ( "unban" , props . member ) } } /> ) ;
31+ let unBan = ( < img src = { unban } alt = { Translator . translate ( "UNBAN" , props . lang ) } onClick = { ( ) => { props . actionGenerated ( "unban" , props . member ) } } /> ) ;
2932
3033 //if the loggedin user is moderator, don't allow unban of banned moderators or administrators
3134 if ( props . item . scope === CometChat . GROUP_MEMBER_SCOPE . MODERATOR
@@ -57,25 +60,19 @@ const memberview = (props) => {
5760 } else {
5861 nameContainer . removeAttribute ( "title" ) ;
5962 }
60- }
63+ }
6164
6265 return (
6366 < tr css = { tableRowStyle ( props ) } >
6467 < td
6568 onMouseEnter = { event => toggleTooltip ( event , true ) }
6669 onMouseLeave = { event => toggleTooltip ( event , false ) } >
6770 < div css = { avatarStyle ( ) } className = "avatar" >
68- < Avatar
69- image = { props . member . avatar }
70- cornerRadius = "18px"
71- borderColor = { props . theme . borderColor . primary }
72- borderWidth = "1px" />
71+ < Avatar image = { props . member . avatar } borderColor = { props . theme . borderColor . primary } />
7372 < StatusIndicator
7473 widgetsettings = { props . widgetsettings }
7574 status = { props . member . status }
76- cornerRadius = "50%"
77- borderColor = { props . theme . borderColor . primary }
78- borderWidth = "1px" />
75+ borderColor = { props . theme . borderColor . primary } />
7976 </ div >
8077 < div css = { nameStyle ( ) } className = "name" > { name } </ div >
8178 </ td >
@@ -85,4 +82,15 @@ const memberview = (props) => {
8582 ) ;
8683}
8784
85+ // Specifies the default values for props:
86+ memberview . defaultProps = {
87+ lang : Translator . getDefaultLanguage ( ) ,
88+ theme : theme
89+ } ;
90+
91+ memberview . propTypes = {
92+ lang : PropTypes . string ,
93+ theme : PropTypes . object
94+ }
95+
8896export default memberview ;
0 commit comments