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
d1f36994
Commit
d1f36994
authored
Jan 27, 2021
by
우지원
Browse files
오픈
parent
db0836db
Changes
2
Hide whitespace changes
Inline
Side-by-side
client/src/Components/Chat.js
View file @
d1f36994
...
@@ -66,7 +66,6 @@ function Chat(props) {
...
@@ -66,7 +66,6 @@ function Chat(props) {
props
.
setLeaveInfo
([...
props
.
leaveInfo
,
{
roomName
:
props
.
roomCode
,
leaveTime
:
realTime
}])
props
.
setLeaveInfo
([...
props
.
leaveInfo
,
{
roomName
:
props
.
roomCode
,
leaveTime
:
realTime
}])
console
.
log
(
'
나간시간
'
,
realTime
,
usualTime
)
console
.
log
(
'
나간시간
'
,
realTime
,
usualTime
)
setChat
([
''
])
setChat
([
''
])
props
.
handleChatc
()
props
.
handleChatc
()
props
.
setLeaveInfo
([...
props
.
leaveInfo
,
{
roomName
:
props
.
roomCode
,
leaveTime
:
realTime
}])
props
.
setLeaveInfo
([...
props
.
leaveInfo
,
{
roomName
:
props
.
roomCode
,
leaveTime
:
realTime
}])
}
}
...
@@ -188,7 +187,7 @@ function Chat(props) {
...
@@ -188,7 +187,7 @@ function Chat(props) {
<
Form
.
Group
style
=
{{
display
:
"
flex
"
,
flexDirection
:
"
row
"
,
justifyContent
:
"
space-evenly
"
}}
>
<
Form
.
Group
style
=
{{
display
:
"
flex
"
,
flexDirection
:
"
row
"
,
justifyContent
:
"
space-evenly
"
}}
>
<
Form
.
Control
name
=
'
chat
'
type
=
"
text
"
value
=
{
inner
}
onChange
=
{
handleChange
}
style
=
{{
width
:
"
80%
"
,
height
:
"
90%
"
,
borderColor
:
"
#FFFFFF
"
}}
/
>
<
Form
.
Control
name
=
'
chat
'
type
=
"
text
"
value
=
{
inner
}
onChange
=
{
handleChange
}
style
=
{{
width
:
"
80%
"
,
height
:
"
90%
"
,
borderColor
:
"
#FFFFFF
"
}}
/
>
<
Button
type
=
"
submit
"
disabled
=
{
disabled
}
style
=
{{
justifyContent
:
"
center
"
,
width
:
"
10%
"
,
height
:
"
90%
"
,
borderRadius
:
"
20px
"
,
backgroundColor
:
"
#C1C1C1
"
,
borderColor
:
"
#FFFFFF
"
}}
>
<
Button
type
=
"
submit
"
disabled
=
{
disabled
}
style
=
{{
justifyContent
:
"
center
"
,
width
:
"
10%
"
,
height
:
"
90%
"
,
borderRadius
:
"
20px
"
,
backgroundColor
:
"
#C1C1C1
"
,
borderColor
:
"
#FFFFFF
"
}}
>
<
FiSend
size
=
"
16px
"
color
=
"
FAFAFA
"
/>
<
FiSend
size
=
"
16px
"
color
=
"
#
FAFAFA
"
/>
<
/Button
>
<
/Button
>
<
/Form.Group
>
<
/Form.Group
>
<
/Form
>
<
/Form
>
...
...
client/src/Pages/HomePage.js
View file @
d1f36994
...
@@ -67,7 +67,9 @@ function Home() {
...
@@ -67,7 +67,9 @@ function Home() {
async
function
enterChatRoom
(
rCode
)
{
//방 입장하기
async
function
enterChatRoom
(
rCode
)
{
//방 입장하기
socket
.
emit
(
'
joinRoom
'
,
rCode
)
socket
.
emit
(
'
joinRoom
'
,
rCode
)
socket
.
emit
(
'
newUser
'
,
{
rmIf
:
rCode
,
userInfo
:
userName
})
socket
.
emit
(
'
newUser
'
,
{
rmIf
:
rCode
,
userInfo
:
userName
})
setShow
(
true
)
console
.
log
(
`joinRoom :
${
rCode
}
입장`
)
console
.
log
(
`joinRoom :
${
rCode
}
입장`
)
console
.
log
(
'
show:
'
,
show
)
//여기서 채팅 불러와서 넘겨주던가 해야할거 같은데
//여기서 채팅 불러와서 넘겨주던가 해야할거 같은데
}
}
...
@@ -80,6 +82,7 @@ function Home() {
...
@@ -80,6 +82,7 @@ function Home() {
await
axios
.
put
(
'
/room/deleteMem
'
,
{
userId
:
userId
,
roomId
:
roomId
})
await
axios
.
put
(
'
/room/deleteMem
'
,
{
userId
:
userId
,
roomId
:
roomId
})
console
.
log
(
`
${
roomId
}
방
${
userId
}
탈퇴`
)
console
.
log
(
`
${
roomId
}
방
${
userId
}
탈퇴`
)
setRoomCode
(
""
)
setRoomCode
(
""
)
const
response
=
await
axios
.
get
(
'
/users/check
'
,
{
params
:
{
'
_id
'
:
userId
}
})
}
}
async
function
getClosedList
()
{
async
function
getClosedList
()
{
...
@@ -99,8 +102,8 @@ function Home() {
...
@@ -99,8 +102,8 @@ function Home() {
console
.
log
(
roomId
)
console
.
log
(
roomId
)
const
roomInf
=
await
axios
.
get
(
'
/room/changeMem
'
,
{
params
:
{
'
roomId
'
:
roomId
}
})
const
roomInf
=
await
axios
.
get
(
'
/room/changeMem
'
,
{
params
:
{
'
roomId
'
:
roomId
}
})
setRoom
(
roomInf
.
data
[
0
])
setRoom
(
roomInf
.
data
[
0
])
setOpen
(
true
)
setShow
(
false
)
setShow
(
false
)
setOpen
(
true
)
}
}
async
function
attendListRoom
()
{
async
function
attendListRoom
()
{
...
@@ -190,34 +193,29 @@ function Home() {
...
@@ -190,34 +193,29 @@ function Home() {
</Navbar> */
}
</Navbar> */
}
<
/Col
>
<
/Col
>
<
Col
style
=
{{
padding
:
"
5px
"
,
marginLeft
:
"
15px
"
}}
>
<
Col
style
=
{{
padding
:
"
5px
"
,
marginLeft
:
"
15px
"
}}
>
<>
{
show
?
<>
{(
show
||
chat
)
?
{
chat
?
<
Chat
handleChatc
=
{
handleChatc
}
leaveInfo
=
{
leaveInfo
}
setLeaveInfo
=
{
setLeaveInfo
}
sendMsg
=
{
sendMsg
}
singleChat
=
{
singleChat
}
singleUser
=
{
singleUser
}
singleImg
=
{
singleImg
}
singleTime
=
{
singleTime
}
recievedMsg
=
{
recievedMsg
}
recievedUser
=
{
recievedUser
}
recievedImg
=
{
recievedImg
}
recievedTime
=
{
recievedTime
}
setSingleChat
=
{
setSingleChat
}
setSingleUser
=
{
setSingleUser
}
setSingleImg
=
{
setSingleImg
}
setSingleTime
=
{
setSingleTime
}
setRecievedMsg
=
{
setRecievedMsg
}
roomCode
=
{
roomCode
}
roomName
=
{
roomName
}
closeChatRoom
=
{
closeChatRoom
}
exitRoom
=
{
exitRoom
}
/
>
null
:
<
div
style
=
{{
position
:
"
fixed
"
,
bottom
:
"
20px
"
,
right
:
"
30px
"
}}
>
:
<
div
style
=
{{
position
:
"
fixed
"
,
bottom
:
"
20px
"
,
right
:
"
30px
"
}}
>
<
Button
style
=
{{
borderColor
:
"
#9174ad
"
,
backgroundColor
:
"
#9174ad
"
,
color
:
'
white
'
}}
onClick
=
{
handleShowModal
}
size
=
"
lg
"
block
>
생성
<
/Button
>
<
Button
style
=
{{
borderColor
:
"
#9174ad
"
,
backgroundColor
:
"
#9174ad
"
,
color
:
'
white
'
}}
onClick
=
{
handleShowModal
}
size
=
"
lg
"
block
>
생성
<
/Button
>
<
Button
style
=
{{
borderColor
:
"
#9174ad
"
,
backgroundColor
:
"
#9174ad
"
,
color
:
'
white
'
}}
onClick
=
{
handleShowEnter
}
size
=
"
lg
"
block
>
참가
<
/Button
>
<
Button
style
=
{{
borderColor
:
"
#9174ad
"
,
backgroundColor
:
"
#9174ad
"
,
color
:
'
white
'
}}
onClick
=
{
handleShowEnter
}
size
=
"
lg
"
block
>
참가
<
/Button
>
<
/div
>
<
/div>} </
>
}
:
<>
{
open
?
<
div
className
=
"
vh-90 flex-column align-items-center justify-content-center mt-2
"
variant
=
"
dark
"
>
{
chat
?
<
div
className
=
"
d-flex justify-content-center
"
>
<
Chat
handleChatc
=
{
handleChatc
}
leaveInfo
=
{
leaveInfo
}
setLeaveInfo
=
{
setLeaveInfo
}
sendMsg
=
{
sendMsg
}
singleChat
=
{
singleChat
}
singleUser
=
{
singleUser
}
singleImg
=
{
singleImg
}
singleTime
=
{
singleTime
}
recievedMsg
=
{
recievedMsg
}
recievedUser
=
{
recievedUser
}
recievedImg
=
{
recievedImg
}
recievedTime
=
{
recievedTime
}
setSingleChat
=
{
setSingleChat
}
setSingleUser
=
{
setSingleUser
}
setSingleImg
=
{
setSingleImg
}
setSingleTime
=
{
setSingleTime
}
setRecievedMsg
=
{
setRecievedMsg
}
roomCode
=
{
roomCode
}
roomName
=
{
roomName
}
closeChatRoom
=
{
closeChatRoom
}
exitRoom
=
{
exitRoom
}
/
>
<
div
className
=
"
mt-5 p-5 shadow w-75
"
>
:
null
}
<
h2
className
=
"
d-flex justify-content-center mb-3
"
>
현재
{
room
.
roomName
}
방
입니다
.
<
/h2
>
{
open
?
<
h5
>
▷
관심분야
:
{
room
.
interest
}
<
/h5
>
<
div
className
=
"
vh-90 flex-column align-items-center justify-content-center mt-2
"
variant
=
"
dark
"
>
<
h5
>
▷
참여인원
:
{
room
.
member
.
length
}
<
/h5
>
<
div
className
=
"
d-flex justify-content-center
"
>
<
h5
className
=
"
mb-3
"
>
▷
방코드
(
방코드를
통해서도
참여할
수
있습니다
.)
:
{
room
.
roomId
}
<
/h5
>
<
div
className
=
"
mt-5 p-5 shadow w-75
"
>
<
Row
className
=
'
justify-content-center
'
>
<
h2
className
=
"
d-flex justify-content-center mb-3
"
>
현재
{
room
.
roomName
}
방
입니다
.
<
/h2
>
<
Button
variant
=
"
outline
"
style
=
{{
border
:
"
3px solid
"
,
borderColor
:
"
#b49dc9
"
}}
size
=
"
sm
"
className
=
"
mr-4
"
onClick
=
{
enterButton
}
>
뒤로가기
<
/Button
>
<
h5
>
▷
관심분야
:
{
room
.
interest
}
<
/h5
>
<
Button
variant
=
"
outline
"
style
=
{{
border
:
"
3px solid
"
,
borderColor
:
"
#b49dc9
"
}}
size
=
"
sm
"
className
=
"
ml-4
"
type
=
'
submit
'
onClick
=
{
attendListRoom
}
>
참가
<
/Button
>
<
h5
>
▷
참여인원
:
{
room
.
member
.
length
}
<
/h5
>
<
/Row
>
<
h5
className
=
"
mb-3
"
>
▷
방코드
(
방코드를
통해서도
참여할
수
있습니다
.)
:
{
room
.
roomId
}
<
/h5
>
<
Row
className
=
'
justify-content-center
'
>
<
Button
variant
=
"
outline
"
style
=
{{
border
:
"
3px solid
"
,
borderColor
:
"
#b49dc9
"
}}
size
=
"
sm
"
className
=
"
mr-4
"
onClick
=
{
enterButton
}
>
뒤로가기
<
/Button
>
<
Button
variant
=
"
outline
"
style
=
{{
border
:
"
3px solid
"
,
borderColor
:
"
#b49dc9
"
}}
size
=
"
sm
"
className
=
"
ml-4
"
type
=
'
submit
'
onClick
=
{
attendListRoom
}
>
참가
<
/Button
>
<
/Row
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
:
null
}
<
/div> : <div style={{ position: "fixed", bottom: "20px", right: "30px" }}
>
<
/
>
<
Button
style
=
{{
borderColor
:
"
#9174ad
"
,
backgroundColor
:
"
#9174ad
"
,
color
:
'
white
'
}}
onClick
=
{
handleShowModal
}
size
=
"
lg
"
block
>
생성
<
/Button
>
<
Button
style
=
{{
borderColor
:
"
#9174ad
"
,
backgroundColor
:
"
#9174ad
"
,
color
:
'
white
'
}}
onClick
=
{
handleShowEnter
}
size
=
"
lg
"
block
>
참가
<
/Button
>
<
/div>} </
>
}
<
/Col
>
<
/Col
>
<
/Row
>
<
/Row
>
<
RoomMake
showModal
=
{
showModal
}
handleCloseModal
=
{
handleCloseModal
}
/
>
<
RoomMake
showModal
=
{
showModal
}
handleCloseModal
=
{
handleCloseModal
}
/
>
...
@@ -229,8 +227,8 @@ function Home() {
...
@@ -229,8 +227,8 @@ function Home() {
const
Sdiv
=
styled
.
div
`
const
Sdiv
=
styled
.
div
`
@media screen and (max-width: 768px) {
@media screen and (max-width: 768px) {
display:
${({
chat
})
=>
{
display:
${({
chat
})
=>
{
return
chat
===
false
?
'
block
'
:
'
none
'
return
chat
===
false
?
'
block
'
:
'
none
'
}}
}}
}
}
`
`
...
...
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