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
Hide whitespace changes
Inline
Side-by-side
client/src/Components/Chat.js
View file @
ff15706b
...
@@ -153,12 +153,7 @@ function Chat(props) {
...
@@ -153,12 +153,7 @@ function Chat(props) {
getPreviousChat
()
getPreviousChat
()
},
[
props
.
roomCode
])
},
[
props
.
roomCode
])
useEffect
(()
=>
{
//const time = new Date().toLocaleTimeString()
getRoomName
(
props
.
roomCode
)
console
.
log
(
'
겟 룸네임
'
,
chat
)
},
[
props
.
roomCode
])
const
time
=
new
Date
().
toLocaleTimeString
()
return
(
return
(
<>
<>
<
Container
id
=
"
chat
"
style
=
{{
overflow
:
'
auto
'
,
padding
:
'
20px
'
,
border
:
"
2px solid
"
,
height
:
"
500px
"
,
margin
:
"
1%
"
,
borderColor
:
"
#BDBDBD
"
,
background
:
''
}}
>
<
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) {
...
@@ -182,7 +177,7 @@ function Chat(props) {
:
null
}
:
null
}
<
p
>
{
props
.
newUser
}
님이
입장하셨습니다
.
<
/p
>
<
p
>
{
props
.
newUser
}
님이
입장하셨습니다
.
<
/p
>
{
chat
.
map
((
value
,
index
)
=>
{
{
chat
.
map
((
value
,
index
)
=>
{
if
(
!
(
value
==
''
))
{
if
(
!
(
value
==
=
''
))
{
if
(
!
(
sender
[
index
]
===
user
.
nickname
))
{
if
(
!
(
sender
[
index
]
===
user
.
nickname
))
{
return
(
//상대편 메시지
return
(
//상대편 메시지
<
Row
key
=
{
index
}
className
=
'
m-1
'
>
<
Row
key
=
{
index
}
className
=
'
m-1
'
>
...
...
client/src/Components/ClosedList.js
View file @
ff15706b
import
React
,
{
useState
,
useEffect
}
from
'
react
'
import
React
,
{
useState
,
useEffect
}
from
'
react
'
import
{
Badge
,
Button
,
ListGroup
}
from
'
react-bootstrap
'
;
import
{
Badge
,
ListGroup
}
from
'
react-bootstrap
'
;
import
axios
from
'
axios
'
import
axios
from
'
axios
'
function
ClosedList
(
props
)
{
function
ClosedList
(
props
)
{
...
...
client/src/Components/RoomMake.js
View file @
ff15706b
...
@@ -11,18 +11,12 @@ const INIT_ROOM = {
...
@@ -11,18 +11,12 @@ const INIT_ROOM = {
function
RoomMake
(
props
)
{
function
RoomMake
(
props
)
{
const
[
room
,
setRoom
]
=
useState
(
INIT_ROOM
);
const
[
room
,
setRoom
]
=
useState
(
INIT_ROOM
);
const
[
disabled
,
setDisabled
]
=
useState
(
true
);
const
[
error
,
setError
]
=
useState
(
''
);
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
'
);
const
member
=
sessionStorage
.
getItem
(
'
userId
'
);
function
handleChange
(
event
)
{
function
handleChange
(
event
)
{
const
{
name
,
value
}
=
event
.
target
const
{
name
,
value
}
=
event
.
target
setRoom
({
...
room
,
[
name
]:
value
,
member
})
setRoom
({
...
room
,
[
name
]:
value
,
member
})
// console.log(room)
// console.log(room)
}
}
...
@@ -36,7 +30,7 @@ function RoomMake(props) {
...
@@ -36,7 +30,7 @@ function RoomMake(props) {
props
.
handleCloseModal
()
props
.
handleCloseModal
()
props
.
handleChato
()
props
.
handleChato
()
setRoom
(
INIT_ROOM
)
setRoom
(
INIT_ROOM
)
}
catch
(
error
)
{
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
catchErrors
(
error
,
setError
)
}
}
}
}
...
...
client/src/Pages/HomePage.js
View file @
ff15706b
...
@@ -60,7 +60,6 @@ function Home() {
...
@@ -60,7 +60,6 @@ function Home() {
console
.
log
(
`joinRoom :
${
rCode
}
입장`
)
console
.
log
(
`joinRoom :
${
rCode
}
입장`
)
//여기서 채팅 불러와서 넘겨주던가 해야할거 같은데
//여기서 채팅 불러와서 넘겨주던가 해야할거 같은데
}
}
const
[
roomName
,
setRoomName
]
=
useState
(
''
)
function
closeChatRoom
(
rCode
)
{
function
closeChatRoom
(
rCode
)
{
socket
.
emit
(
'
closeRoom
'
,
rCode
)
socket
.
emit
(
'
closeRoom
'
,
rCode
)
...
@@ -103,7 +102,7 @@ function Home() {
...
@@ -103,7 +102,7 @@ function Home() {
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
(
singleChat
==
""
)){
if
(
!
(
singleChat
==
""
))
{
socket
.
emit
(
"
chat
"
,
{
socket
.
emit
(
"
chat
"
,
{
roomInfo
:
roomCode
,
roomInfo
:
roomCode
,
sendInfo
:
{
sendInfo
:
{
...
@@ -149,10 +148,10 @@ function Home() {
...
@@ -149,10 +148,10 @@ function Home() {
<
Col
className
=
"
list
"
md
=
{
5
}
>
<
Col
className
=
"
list
"
md
=
{
5
}
>
<
Tabs
defaultActiveKey
=
"
closed
"
id
=
"
uncontrolled-tab-example
"
>
<
Tabs
defaultActiveKey
=
"
closed
"
id
=
"
uncontrolled-tab-example
"
>
<
Tab
eventKey
=
"
closed
"
title
=
"
내 채팅
"
onClick
=
{
handleChato
}
>
<
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
>
<
Tab
eventKey
=
"
open
"
title
=
"
공개방
"
onClick
=
{
handleChatc
}
>
<
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
>
<
/Tab
>
<
/Tabs
>
<
/Tabs
>
<
/Col
>
<
/Col
>
...
@@ -166,9 +165,9 @@ function Home() {
...
@@ -166,9 +165,9 @@ function Home() {
<
/div
>
<
/div
>
}
}
{
chat
?
{
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
}
:
null
}
{
open
?
{
open
?
<
div
className
=
"
vh-90 flex-column align-items-center justify-content-center mt-2
"
variant
=
"
dark
"
>
<
div
className
=
"
vh-90 flex-column align-items-center justify-content-center mt-2
"
variant
=
"
dark
"
>
<
div
className
=
"
d-flex justify-content-center
"
>
<
div
className
=
"
d-flex justify-content-center
"
>
<
div
className
=
"
mt-5 p-5 shadow w-75
"
>
<
div
className
=
"
mt-5 p-5 shadow w-75
"
>
...
...
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