File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import SendIcon from '@assets/default/send-message.svg';
1111
1212import { ChatBoxContainer , Textarea , SendButton } from './styles' ;
1313
14- const ChatBox : React . FC = ( ) => {
14+ const ChatBox : React . FC < { disabled ?: boolean } > = ( { disabled = false } ) => {
1515 const [ newMessage , setNewMessage ] = useState ( '' ) ;
1616 const textareaRef = useRef < HTMLTextAreaElement | null > ( null ) ;
1717 const socket = useSocket ( ) ;
@@ -22,9 +22,9 @@ const ChatBox: React.FC = () => {
2222 const isOtherUserValid = ! ! ( otherUser && otherUser . id ) ;
2323
2424 useEffect ( ( ) => {
25- if ( textareaRef . current && ! isOtherUserValid ) {
25+ if ( textareaRef . current && ( ! isOtherUserValid || disabled ) ) {
2626 textareaRef . current . disabled = true ;
27- textareaRef . current . placeholder = '메시지를 보낼 수 없습니다 .' ;
27+ textareaRef . current . placeholder = '메시지를 보낼 수 없는 채팅방입니다 .' ;
2828 }
2929 } , [ ] ) ;
3030
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ const MatchingRoom: React.FC = () => {
105105 ) }
106106 < div ref = { chatWindowRef } />
107107 </ MessagesContainer >
108- < ChatBox />
108+ < ChatBox disabled = { true } />
109109 </ OODDFrame >
110110 ) ;
111111} ;
You can’t perform that action at this time.
0 commit comments