File tree Expand file tree Collapse file tree 6 files changed +27
-8
lines changed Expand file tree Collapse file tree 6 files changed +27
-8
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ header {
117
117
word-break : break-all;
118
118
text-align : left;
119
119
padding-left : 3rem ;
120
- padding-right : 1 rem ;
120
+ padding-right : 3 rem ;
121
121
padding-top : 6rem ;
122
122
padding-bottom : 4rem ;
123
123
}
@@ -132,7 +132,16 @@ header {
132
132
color : var (--prime-blue );
133
133
}
134
134
135
+ .message-content {
136
+ border : 1px solid var (--prime-blue );
137
+ border-left : unset;
138
+ border-bottom : unset;
139
+ border-radius : 5% ;
140
+ margin : 2rem auto;
141
+ }
142
+
135
143
.message-username {
144
+ font-size : 0.77rem ;
136
145
}
137
146
138
147
.message-text ::before {
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ const Messages: React.FC<MessageProps> = ({
40
40
< div className = "scroll-wrapper" >
41
41
< div ref = { scrollRef } className = "messages-container" >
42
42
{ messages . map ( ( message : any , idx : number ) => (
43
- < div key = { message . _id } >
43
+ < div className = "message-content" key = { message . _id } >
44
44
< p className = "message-username" > { message . author . username } </ p >
45
45
< p className = "message-text" > { message . text } </ p >
46
46
</ div >
Original file line number Diff line number Diff line change @@ -39,13 +39,13 @@ const SessionUtils: React.FC<any> = ({}) => {
39
39
< div className = "session-utils-box" >
40
40
< button onClick = { destroySession } > END SESSION</ button >
41
41
{ spacer ( ) }
42
- < button onClick = { getAllRooms } > FETCH ROOMS</ button >
42
+ { /* <button onClick={getAllRooms}>FETCH ROOMS</button>
43
43
{spacer()}
44
44
<button onClick={getOwnUser}>FETCH ME</button>
45
45
{spacer()}
46
46
<button onClick={getRecentMsgs}>FETCH MESSAGES</button>
47
47
{spacer()}
48
- < button onClick = { deleteAllMessages } > DELETE MESSAGES</ button >
48
+ <button onClick={deleteAllMessages}>DELETE MESSAGES</button> */ }
49
49
</ div >
50
50
) ;
51
51
} ;
Original file line number Diff line number Diff line change 1
1
import { useEffect , useState } from "react" ;
2
2
import { io , Socket } from "socket.io-client" ;
3
- import { API } from "../api/api" ;
4
- import { useRoomContext } from "./context" ;
3
+
4
+ const currentProto = window . location . protocol ;
5
+ const protoByEnv = currentProto === "http:" ? `http://localhost:3001` : `` ;
6
+ console . log ( protoByEnv ) ;
5
7
6
8
export type SocketProp = null | Socket < any , any > ;
7
9
8
10
export const useChatSocket = ( ) => {
9
11
const [ socket , setSocket ] = useState < SocketProp > ( null ) ;
10
12
useEffect ( ( ) => {
11
13
// Init client-specific socket connection
12
- const socket = io ( ) ;
14
+ const socket = io ( protoByEnv ) ;
13
15
///////////////////////////////
14
16
setSocket ( socket ) ;
15
17
///////////////////////////////
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ io.on("connection", (socket) => {
30
30
if ( ! msg ) return ;
31
31
32
32
try {
33
- socket . broadcast . emit ( "chat message" , msg ) ;
33
+ socket . emit ( "chat message" , msg ) ;
34
34
} catch ( err ) {
35
35
console . error ( err ) ;
36
36
}
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ cd client
6
+ yarn dev &
7
+ cd ../server
8
+ npm run debug
You can’t perform that action at this time.
0 commit comments