Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
messenger
Commits
b21d2576
Commit
b21d2576
authored
Jan 18, 2021
by
Choi Ga Young
Browse files
chat수정
parent
e2bdbc19
Changes
3
Hide whitespace changes
Inline
Side-by-side
client/src/Components/Chat.js
View file @
b21d2576
...
@@ -34,7 +34,7 @@ function Chat(props) {
...
@@ -34,7 +34,7 @@ function Chat(props) {
<
div
className
=
"
chat
"
id
=
"
chat
"
style
=
{{
border
:
"
2px solid
"
,
height
:
"
300%
"
,
margin
:
"
1%
"
,
borderColor
:
"
#BDBDBD
"
}}
>
<
div
className
=
"
chat
"
id
=
"
chat
"
style
=
{{
border
:
"
2px solid
"
,
height
:
"
300%
"
,
margin
:
"
1%
"
,
borderColor
:
"
#BDBDBD
"
}}
>
<
h2
>
현재
{
props
.
roomName
}
입니다
.
<
/h2
>
<
h2
>
현재
{
props
.
roomName
}
입니다
.
<
/h2
>
{
chat
.
map
((
value
,
index
)
=>
{
{
chat
.
map
((
value
,
index
)
=>
{
if
(
Boolean
(
value
))
{
if
(
!
(
value
==
''
))
{
// console.log(`value=${value}=`)
// console.log(`value=${value}=`)
return
<
Row
key
=
{
index
}
className
=
'
ml-3
'
>
return
<
Row
key
=
{
index
}
className
=
'
ml-3
'
>
{
props
.
roomName
}
에서
{
defaultname
}
님이
보낸
메세지
:
{
value
}
{
props
.
roomName
}
에서
{
defaultname
}
님이
보낸
메세지
:
{
value
}
...
...
client/src/Components/Menu.js
View file @
b21d2576
import
React
,
{
useState
,
useEffect
}
from
'
react
'
import
React
from
'
react
'
import
{
Navbar
,
Nav
,
Button
}
from
'
react-bootstrap
'
;
import
{
Navbar
,
Nav
,
Button
}
from
'
react-bootstrap
'
;
import
{
Link
}
from
'
react-router-dom
'
;
import
{
handleLogout
}
from
'
../utils/auth
'
;
import
{
handleLogout
}
from
'
../utils/auth
'
;
import
axios
from
'
axios
'
function
Menu
()
{
function
Menu
()
{
...
@@ -16,7 +14,6 @@ function Menu() {
...
@@ -16,7 +14,6 @@ function Menu() {
<>
<>
<
div
className
=
'
ml-1 mr-2
'
style
=
{{
color
:
'
white
'
}}
>
{
name
}
님
환영합니다
<
/div
>
<
div
className
=
'
ml-1 mr-2
'
style
=
{{
color
:
'
white
'
}}
>
{
name
}
님
환영합니다
<
/div
>
<
Nav
className
=
"
mr-auto
"
>
<
Nav
className
=
"
mr-auto
"
>
{
/* <Nav.Link href="/home">Home</Nav.Link> */
}
<
Nav
.
Link
href
=
"
/profile
"
>
Profile
<
/Nav.Link
>
<
Nav
.
Link
href
=
"
/profile
"
>
Profile
<
/Nav.Link
>
<
/Nav
>
<
/Nav
>
<
Button
className
=
"
ml-auto
"
onClick
=
{()
=>
handleLogout
()}
variant
=
"
light
"
className
=
"
ml-3
"
>
Logout
<
/Button
>
<
Button
className
=
"
ml-auto
"
onClick
=
{()
=>
handleLogout
()}
variant
=
"
light
"
className
=
"
ml-3
"
>
Logout
<
/Button
>
...
...
client/src/Pages/HomePage.js
View file @
b21d2576
...
@@ -33,7 +33,7 @@ function Home() {
...
@@ -33,7 +33,7 @@ function Home() {
const
handleChato
=
()
=>
setChat
(
true
);
const
handleChato
=
()
=>
setChat
(
true
);
const
handleChatc
=
()
=>
setChat
(
false
);
const
handleChatc
=
()
=>
setChat
(
false
);
//SOCKET 관련 시작
//SOCKET 관련 시작
function
enterChatroom
(
rName
)
{
//방 입장하기
function
enterChatroom
(
rName
)
{
//방 입장하기
...
@@ -46,10 +46,13 @@ function Home() {
...
@@ -46,10 +46,13 @@ function Home() {
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
socket
.
emit
(
"
chat
"
,
{
if
(
!
(
singleChat
==
''
))
{
roomName
:
roomCode
,
socket
.
emit
(
"
chat
"
,
{
msg
:
singleChat
roomName
:
roomCode
,
})
msg
:
singleChat
})
setSingleChat
([
''
])
}
},
[
singleChat
])
},
[
singleChat
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment