@@ -4,7 +4,8 @@ import { RootState } from '../../redux/store';
4
4
import { emitEvent } from '../../helperFunctions/socket' ;
5
5
6
6
const Chatroom = ( props ) : JSX . Element => {
7
- const collaborationRoom = useSelector ( ( store : RootState ) => store . roomSlice ) ;
7
+ const nickName = useSelector ( ( store : RootState ) => store . roomSlice . userName ) ;
8
+ const roomCode = useSelector ( ( store : RootState ) => store . roomSlice . roomCode ) ;
8
9
9
10
const newMessage = useSelector (
10
11
( store : RootState ) => store . roomSlice . newMessage
@@ -14,9 +15,6 @@ const Chatroom = (props): JSX.Element => {
14
15
( store : RootState ) => store . roomSlice . userChange
15
16
) ;
16
17
17
- const nickName = collaborationRoom . userName ;
18
- const roomCode = collaborationRoom . roomCode ;
19
-
20
18
const wrapperStyles = {
21
19
border : `2px solid #f2fbf8` ,
22
20
borderRadius : '8px' ,
@@ -93,8 +91,8 @@ const Chatroom = (props): JSX.Element => {
93
91
const messageElement = document . createElement ( 'div' ) ;
94
92
messageElement . innerText =
95
93
userChange . status === 'JOIN'
96
- ? `${ userChange . nickName } joined the chatroom `
97
- : `${ userChange . nickName } left the chatroom ` ;
94
+ ? `${ userChange . nickName } joined the chat room `
95
+ : `${ userChange . nickName } left the chat room ` ;
98
96
messageElement . style . color = 'yellow' ;
99
97
messageContainer . append ( messageElement ) ;
100
98
} , [ userChange ] ) ;
@@ -106,10 +104,10 @@ const Chatroom = (props): JSX.Element => {
106
104
>
107
105
< div className = "roomInfo" style = { { paddingLeft : '70px' } } >
108
106
< p > Current room: { roomCode } </ p >
109
- < p > Your Nickname : { nickName } </ p >
107
+ < p > Your nickname : { nickName } </ p >
110
108
</ div >
111
109
< div style = { { justifyContent : 'center' , display : 'flex' , height : '80%' } } >
112
- < div id = "message-container" style = { { ... wrapperStyles } } > </ div >
110
+ < div id = "message-container" style = { wrapperStyles } > </ div >
113
111
</ div >
114
112
< form
115
113
id = "send-container"
0 commit comments