@@ -3,6 +3,7 @@ import { useSelector } from 'react-redux';
3
3
import { RootState } from '../../redux/store' ;
4
4
import { emitEvent } from '../../helperFunctions/socket' ;
5
5
import Videomeeting from './VideoMeeting' ;
6
+ import { Send } from '@mui/icons-material' ;
6
7
7
8
const Chatroom = ( props ) : JSX . Element => {
8
9
const { userName, roomCode, messages, userJoinCollabRoom } = useSelector (
@@ -12,40 +13,43 @@ const Chatroom = (props): JSX.Element => {
12
13
const [ inputContent , setInputContent ] = useState ( '' ) ;
13
14
14
15
const wrapperStyles = {
15
- border : `2px solid #f2fbf8` ,
16
- borderRadius : '8px ' ,
17
- width : '75 %' ,
16
+ border : '1px solid #31343A' ,
17
+ borderRadius : '15px ' ,
18
+ width : '70 %' ,
18
19
height : '100%' ,
19
- display : 'column' ,
20
- padding : '20px' ,
21
- backgroundColor : '#42464C' ,
20
+ display : 'flex' ,
21
+ flexDirection : 'column' ,
22
+ alignSelf : 'center' ,
23
+ padding : '12px 20px' ,
24
+ backgroundColor : '#1B1B1B' ,
22
25
overflow : 'auto'
23
26
} ;
24
27
25
28
const inputContainerStyles = {
26
29
width : '100%' ,
27
- paddingLeft : '30px ' ,
30
+ paddingLeft : '20px ' ,
28
31
paddingTop : '10px' ,
29
32
display : 'flex' ,
30
33
justifyContent : 'center'
31
34
} ;
32
35
33
36
const inputStyles = {
34
- width : '75%' ,
35
- padding : '10px' ,
36
- border : 'none' ,
37
- borderRadius : '5px' ,
38
- backgroundColor : '#333333' ,
39
- color : 'white'
37
+ width : '72%' ,
38
+ padding : '10px 12px' ,
39
+ borderRadius : '50px' ,
40
+ backgroundColor : '#1B1B1B' ,
41
+ color : 'white' ,
42
+ border : '1px solid #31343A' ,
43
+ marginLeft : '28px'
40
44
} ;
41
45
42
46
const buttonStyles = {
43
- padding : '10px ' ,
47
+ padding : '5px 7px ' ,
44
48
marginLeft : '10px' ,
45
49
backgroundColor : '#0671E3' ,
46
50
color : 'white' ,
47
51
border : 'none' ,
48
- borderRadius : '5px ' ,
52
+ borderRadius : '50% ' ,
49
53
cursor : 'pointer'
50
54
} ;
51
55
@@ -62,10 +66,30 @@ const Chatroom = (props): JSX.Element => {
62
66
63
67
const handleMessageContainerStyle = ( message : object ) => {
64
68
if ( message [ 'type' ] === 'activity' ) {
65
- return { color : 'yellow' } ;
69
+ return {
70
+ color : '#E8E9EB' ,
71
+ fontSize : '12px' ,
72
+ alignSelf : 'center' ,
73
+ margin : '3px 0'
74
+ } ;
66
75
} else {
67
- if ( message [ 'userName' ] === userName ) return { color : '#66C4EB' } ;
68
- return { color : 'white' } ;
76
+ if ( message [ 'userName' ] === userName )
77
+ return {
78
+ alignSelf : 'end' ,
79
+ padding : '8px 15px' ,
80
+ backgroundColor : '#0671E3' ,
81
+ borderRadius : '15.5px' ,
82
+ margin : '3px 0' ,
83
+ maxWidth : '300px'
84
+ } ;
85
+ return {
86
+ color : 'white' ,
87
+ padding : '8px 15px' ,
88
+ backgroundColor : '#333333' ,
89
+ borderRadius : '15.5px' ,
90
+ margin : '3px 0' ,
91
+ maxWidth : '300px'
92
+ } ;
69
93
}
70
94
} ;
71
95
@@ -78,12 +102,25 @@ const Chatroom = (props): JSX.Element => {
78
102
</ div >
79
103
) ;
80
104
} else if ( message . type === 'chat' ) {
81
- return (
82
- < div key = { index } style = { handleMessageContainerStyle ( message ) } >
83
- { message . userName === userName ? 'You' : message . userName } :{ ' ' }
84
- { message . message }
85
- </ div >
86
- ) ;
105
+ if ( message . userName === userName ) {
106
+ return (
107
+ < div key = { index } style = { handleMessageContainerStyle ( message ) } >
108
+ { message . message }
109
+ </ div >
110
+ ) ;
111
+ } else
112
+ return (
113
+ < div key = { index } style = { { alignSelf : 'start' } } >
114
+ < div
115
+ style = { { color : '#E8E9EB' , fontSize : '12px' , margin : '3px 0' } }
116
+ >
117
+ { message . userName }
118
+ </ div >
119
+ < div style = { handleMessageContainerStyle ( message ) } >
120
+ { message . message }
121
+ </ div >
122
+ </ div >
123
+ ) ;
87
124
}
88
125
return null ;
89
126
} ) ;
@@ -129,15 +166,16 @@ const Chatroom = (props): JSX.Element => {
129
166
justifyContent : 'center' ,
130
167
display : 'flex' ,
131
168
flexDirection : 'column' ,
132
- height : '80 %' ,
169
+ height : '90 %' ,
133
170
width : '60%'
134
171
} }
135
172
>
136
173
< div
137
174
style = { {
138
175
justifyContent : 'center' ,
139
176
display : 'flex' ,
140
- height : '90%' ,
177
+ flexDirection : 'column' ,
178
+ height : '100%' ,
141
179
width : '100%'
142
180
} }
143
181
>
@@ -148,24 +186,32 @@ const Chatroom = (props): JSX.Element => {
148
186
>
149
187
{ renderMessages ( ) }
150
188
</ div >
151
- </ div >
152
- < div className = "chatroom-input" >
153
- < form
154
- id = "send-container"
155
- style = { inputContainerStyles }
156
- onSubmit = { handleSubmit }
157
- >
158
- < input
159
- type = "text"
160
- id = "message-input"
161
- onChange = { ( e ) => setInputContent ( e . target . value ) }
162
- value = { inputContent }
163
- style = { inputStyles }
164
- />
165
- < button type = "submit" id = "send-button" style = { buttonStyles } >
166
- Send
167
- </ button >
168
- </ form >
189
+ < div className = "chatroom-input" >
190
+ < form
191
+ id = "send-container"
192
+ style = { inputContainerStyles }
193
+ onSubmit = { handleSubmit }
194
+ >
195
+ < input
196
+ type = "text"
197
+ id = "message-input"
198
+ placeholder = "message"
199
+ onChange = { ( e ) => setInputContent ( e . target . value ) }
200
+ value = { inputContent }
201
+ style = { inputStyles }
202
+ />
203
+ < button type = "submit" id = "send-button" style = { buttonStyles } >
204
+ < Send
205
+ sx = { {
206
+ width : '20px' ,
207
+ height : '20px' ,
208
+ marginLeft : '2px' ,
209
+ marginTop : '2px'
210
+ } }
211
+ />
212
+ </ button >
213
+ </ form >
214
+ </ div >
169
215
</ div >
170
216
</ div >
171
217
) }
0 commit comments