Skip to content

Commit 2e93bba

Browse files
authored
fix: Change OpenChannelInput muted state notice text (#592)
### Description Of Changes * Notice disabled message input because of muted state [UIKIT-4055](https://sendbird.atlassian.net/browse/UIKIT-4055)
1 parent 89bd694 commit 2e93bba

File tree

1 file changed

+16
-9
lines changed
  • src/modules/OpenChannel/components/OpenChannelInput

1 file changed

+16
-9
lines changed

src/modules/OpenChannel/components/OpenChannelInput/index.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff 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
);

0 commit comments

Comments
 (0)