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
ff15706b
Commit
ff15706b
authored
Jan 25, 2021
by
Choi Ga Young
Browse files
불필요한거 삭제중
parent
0bece6ad
Changes
4
Show whitespace changes
Inline
Side-by-side
client/src/Components/Chat.js
View file @
ff15706b
...
...
@@ -153,12 +153,7 @@ function Chat(props) {
getPreviousChat
()
},
[
props
.
roomCode
])
useEffect
(()
=>
{
getRoomName
(
props
.
roomCode
)
console
.
log
(
'
겟 룸네임
'
,
chat
)
},
[
props
.
roomCode
])
const
time
=
new
Date
().
toLocaleTimeString
()
//const time = new Date().toLocaleTimeString()
return
(
<>
<
Container
id
=
"
chat
"
style
=
{{
overflow
:
'
auto
'
,
padding
:
'
20px
'
,
border
:
"
2px solid
"
,
height
:
"
500px
"
,
margin
:
"
1%
"
,
borderColor
:
"
#BDBDBD
"
,
background
:
''
}}
>
...
...
@@ -182,7 +177,7 @@ function Chat(props) {
:
null
}
<
p
>
{
props
.
newUser
}
님이
입장하셨습니다
.
<
/p
>
{
chat
.
map
((
value
,
index
)
=>
{
if
(
!
(
value
==
''
))
{
if
(
!
(
value
==
=
''
))
{
if
(
!
(
sender
[
index
]
===
user
.
nickname
))
{
return
(
//상대편 메시지
<
Row
key
=
{
index
}
className
=
'
m-1
'
>
...
...
client/src/Components/ClosedList.js
View file @
ff15706b
import
React
,
{
useState
,
useEffect
}
from
'
react
'
import
{
Badge
,
Button
,
ListGroup
}
from
'
react-bootstrap
'
;
import
{
Badge
,
ListGroup
}
from
'
react-bootstrap
'
;
import
axios
from
'
axios
'
function
ClosedList
(
props
)
{
...
...
client/src/Components/RoomMake.js
View file @
ff15706b
...
...
@@ -11,18 +11,12 @@ const INIT_ROOM = {
function
RoomMake
(
props
)
{
const
[
room
,
setRoom
]
=
useState
(
INIT_ROOM
);
const
[
disabled
,
setDisabled
]
=
useState
(
true
);
const
[
error
,
setError
]
=
useState
(
''
);
useEffect
(()
=>
{
const
isRoom
=
Object
.
values
(
room
).
every
(
el
=>
Boolean
(
el
))
isRoom
?
setDisabled
(
false
)
:
setDisabled
(
true
)
},
[
room
])
const
member
=
sessionStorage
.
getItem
(
'
userId
'
);
function
handleChange
(
event
)
{
const
{
name
,
value
}
=
event
.
target
setRoom
({
...
room
,
[
name
]:
value
,
member
})
setRoom
({
...
room
,
[
name
]:
value
,
member
})
// console.log(room)
}
...
...
@@ -36,7 +30,7 @@ function RoomMake(props) {
props
.
handleCloseModal
()
props
.
handleChato
()
setRoom
(
INIT_ROOM
)
}
catch
(
error
)
{
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
}
}
...
...
client/src/Pages/HomePage.js
View file @
ff15706b
...
...
@@ -60,7 +60,6 @@ function Home() {
console
.
log
(
`joinRoom :
${
rCode
}
입장`
)
//여기서 채팅 불러와서 넘겨주던가 해야할거 같은데
}
const
[
roomName
,
setRoomName
]
=
useState
(
''
)
function
closeChatRoom
(
rCode
)
{
socket
.
emit
(
'
closeRoom
'
,
rCode
)
...
...
@@ -103,7 +102,7 @@ function Home() {
}
useEffect
(()
=>
{
if
(
!
(
singleChat
==
""
)){
if
(
!
(
singleChat
==
""
))
{
socket
.
emit
(
"
chat
"
,
{
roomInfo
:
roomCode
,
sendInfo
:
{
...
...
@@ -149,10 +148,10 @@ function Home() {
<
Col
className
=
"
list
"
md
=
{
5
}
>
<
Tabs
defaultActiveKey
=
"
closed
"
id
=
"
uncontrolled-tab-example
"
>
<
Tab
eventKey
=
"
closed
"
title
=
"
내 채팅
"
onClick
=
{
handleChato
}
>
<
ClosedList
enterChatRoom
=
{
enterChatRoom
}
setRoomCode
=
{
setRoomCode
}
setRoomName
=
{
setRoomName
}
roomCode
=
{
roomCode
}
closeChatRoom
=
{
closeChatRoom
}
/
>
<
ClosedList
enterChatRoom
=
{
enterChatRoom
}
setRoomCode
=
{
setRoomCode
}
setRoomName
=
{
setRoomName
}
roomCode
=
{
roomCode
}
closeChatRoom
=
{
closeChatRoom
}
/
>
<
/Tab
>
<
Tab
eventKey
=
"
open
"
title
=
"
공개방
"
onClick
=
{
handleChatc
}
>
<
OpenList
enterChatRoom
=
{
enterChatRoom
}
openListroom
=
{
openListroom
}
setRoomCode
=
{
setRoomCode
}
setRoomName
=
{
setRoomName
}
roomCode
=
{
roomCode
}
closeChatRoom
=
{
closeChatRoom
}
/
>
<
OpenList
enterChatRoom
=
{
enterChatRoom
}
openListroom
=
{
openListroom
}
setRoomCode
=
{
setRoomCode
}
setRoomName
=
{
setRoomName
}
roomCode
=
{
roomCode
}
closeChatRoom
=
{
closeChatRoom
}
/
>
<
/Tab
>
<
/Tabs
>
<
/Col
>
...
...
@@ -166,7 +165,7 @@ function Home() {
<
/div
>
}
{
chat
?
<
Chat
handleChatc
=
{
handleChatc
}
sendMsg
=
{
sendMsg
}
singleChat
=
{
singleChat
}
singleUser
=
{
singleUser
}
singleImg
=
{
singleImg
}
recievedMsg
=
{
recievedMsg
}
recievedUser
=
{
recievedUser
}
recievedImg
=
{
recievedImg
}
setSingleChat
=
{
setSingleChat
}
set
RecievedMsg
=
{
setRecievedMsg
}
setSingle
User
=
{
setSingle
User
}
setSingle
Img
=
{
setSingle
Im
g
}
roomCode
=
{
roomCode
}
roomName
=
{
roomName
}
closeChatRoom
=
{
closeChatRoom
}
exitRoom
=
{
exitRoom
}
/
>
<
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
}
set
SingleUser
=
{
setSingleUser
}
setSingle
Img
=
{
setSingle
Img
}
setSingle
Time
=
{
setSingle
Time
}
setRecievedMsg
=
{
setRecievedMs
g
}
roomCode
=
{
roomCode
}
roomName
=
{
roomName
}
closeChatRoom
=
{
closeChatRoom
}
exitRoom
=
{
exitRoom
}
/
>
:
null
}
{
open
?
<
div
className
=
"
vh-90 flex-column align-items-center justify-content-center mt-2
"
variant
=
"
dark
"
>
...
...
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