Commit ff15706b authored by Choi Ga Young's avatar Choi Ga Young
Browse files

불필요한거 삭제중

parent 0bece6ad
......@@ -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' >
......
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) {
......
......@@ -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)
}
}
......
......@@ -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} setRecievedMsg={setRecievedMsg} setSingleUser={setSingleUser} setSingleImg={setSingleImg} 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} setSingleUser={setSingleUser} setSingleImg={setSingleImg} setSingleTime={setSingleTime} setRecievedMsg={setRecievedMsg} 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">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment