File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed
src/modules/OpenChannel/components/OpenChannelInput Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -7,22 +7,33 @@ export type MessageInputWrapperProps = {
77 value ?: string ;
88} ;
99
10- const MessageInputWrapper = ( props : MessageInputWrapperProps , ref : React . RefObject < HTMLInputElement > ) : JSX . Element => {
10+ const MessageInputWrapper = ( props : MessageInputWrapperProps , ref : React . RefObject < HTMLInputElement > ) : React . ReactNode => {
1111 const {
1212 currentOpenChannel,
1313 disabled,
1414 handleSendMessage,
1515 handleFileUpload,
16+ amIMuted,
1617 } = useOpenChannelContext ( ) ;
1718
1819 const channel = currentOpenChannel ;
19- if ( ! channel ) {
20- return ;
21- }
2220
2321 const { stringSet } = useContext ( LocalizationContext ) ;
2422 const { value } = props ;
2523
24+ function getPlaceHolderString ( ) {
25+ if ( amIMuted ) {
26+ return stringSet . MESSAGE_INPUT__PLACE_HOLDER__MUTED ;
27+ }
28+ if ( disabled ) {
29+ return stringSet . MESSAGE_INPUT__PLACE_HOLDER__DISABLED ;
30+ }
31+ return '' ;
32+ }
33+
34+ if ( ! channel ) {
35+ return null ;
36+ }
2637 return (
2738 < div className = "sendbird-openchannel-footer" >
2839 < MessageInput
@@ -32,11 +43,7 @@ const MessageInputWrapper = (props: MessageInputWrapperProps, ref: React.RefObje
3243 isVoiceMessageEnabled = { false }
3344 onSendMessage = { handleSendMessage }
3445 onFileUpload = { handleFileUpload }
35- placeholder = { (
36- disabled
37- && stringSet . MESSAGE_INPUT__PLACE_HOLDER__DISABLED
38- // add disabled because of muted state
39- ) }
46+ placeholder = { getPlaceHolderString ( ) }
4047 />
4148 </ div >
4249 ) ;
You can’t perform that action at this time.
0 commit comments