-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/120' of https://github.com/catchroom/FE_CatchRoom…
… into feature/#180
- Loading branch information
Showing
4 changed files
with
93 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,64 @@ | ||
// 'use client'; | ||
// import React, { useState } from 'react'; | ||
// import ProductInfo from '@/components/chat/chatRoom/productInfo'; | ||
// import Send from '@/components/chat/chatRoom/send'; | ||
// import Date from '@/components/chat/chatRoom/date'; | ||
// import Header from '@/components/common/header'; | ||
// import MessageList from '@/components/chat/chatRoom/messageList'; | ||
// import WebSocketConnection from '@/components/chat/chatRoom/WebSocketConnection/WebSocketConnection'; | ||
// import { MessageProps } from '@/types/chat/chatRoom/types'; | ||
// // eslint-disable-next-line | ||
// import { loadedChatMessage, loadedChatInfo } from '@/api/chat/api'; | ||
'use client'; | ||
import React, { useState } from 'react'; | ||
import ProductInfo from '@/components/chat/chatRoom/productInfo'; | ||
import Send from '@/components/chat/chatRoom/send'; | ||
import Date from '@/components/chat/chatRoom/date'; | ||
import Header from '@/components/common/header'; | ||
import MessageList from '@/components/chat/chatRoom/messageList'; | ||
import WebSocketConnection from '@/components/chat/chatRoom/WebSocketConnection/WebSocketConnection'; | ||
import { MessageProps } from '@/types/chat/chatRoom/types'; | ||
import { loadedChatMessage } from '@/api/chat/api'; | ||
|
||
// // eslint-disable-next-line | ||
// const ROOMID = '02d6b08d-60f8-4c21-b5b2-0ba7af752e29'; | ||
const ROOMID = '02d6b08d-60f8-4c21-b5b2-0ba7af752e29'; | ||
|
||
// const Page = () => { | ||
// const [message, setMessage] = useState<MessageProps[]>([]); | ||
const Page = () => { | ||
const [message, setMessage] = useState<MessageProps[]>([]); | ||
|
||
// // // 채팅방 내부 정보 불러오기 | ||
// // const ChatInfo = async () => { | ||
// // try { | ||
// // const result = await loadedChatInfo(ROOMID); | ||
// // console.log(result); | ||
// // } catch (error) { | ||
// // console.error('failed:', error); | ||
// // } | ||
// // }; | ||
// // ChatInfo(); | ||
// // 채팅방 내부 정보 불러오기 | ||
// const ChatInfo = async () => { | ||
// try { | ||
// const result = await loadedChatInfo(ROOMID); | ||
// console.log(result); | ||
// } catch (error) { | ||
// console.error('failed:', error); | ||
// } | ||
// }; | ||
// ChatInfo(); | ||
|
||
// // //채팅 내용 불러오기 | ||
// // const chatMessage = async () => { | ||
// // try { | ||
// // const result = await loadedChatMessage(ROOMID); | ||
// // console.log(result); | ||
// // } catch (error) { | ||
// // console.error('failed:', error); | ||
// // } | ||
// // }; | ||
// // chatMessage(); | ||
//채팅 내용 불러오기 | ||
const chatMessage = async () => { | ||
try { | ||
const result = await loadedChatMessage(ROOMID); | ||
console.log(result); | ||
} catch (error) { | ||
console.error('failed:', error); | ||
} | ||
}; | ||
chatMessage(); | ||
|
||
// const onMessageReceived = (newMessage: MessageProps) => { | ||
// setMessage((prev) => [...prev, newMessage]); | ||
// }; | ||
const onMessageReceived = (newMessage: MessageProps) => { | ||
setMessage((prev) => [...prev, newMessage]); | ||
}; | ||
|
||
// // eslint-disable-next-line | ||
// // const { sendMessage } = WebSocketConnection({ onMessageReceived }); | ||
const { sendMessage } = WebSocketConnection({ onMessageReceived }); | ||
|
||
// const handleSendMessage = (messageText: string) => { | ||
// sendMessage(messageText); | ||
// }; | ||
const handleSendMessage = (messageText: string) => { | ||
sendMessage(messageText); | ||
}; | ||
|
||
// return ( | ||
// <> | ||
// <Header title="닉네임" showBackButton /> | ||
// <div className="flex flex-col "> | ||
// <ProductInfo /> | ||
// <div className="bg-gray-100 overflow-auto flex flex-col px-5 h-screen"> | ||
// <Date /> | ||
// <MessageList messages={message} /> | ||
// </div> | ||
// <Send onSendMessage={handleSendMessage} /> | ||
// </div> | ||
// </> | ||
// ); | ||
// }; | ||
return ( | ||
<> | ||
<Header title="닉네임" showBackButton /> | ||
<div className="flex flex-col "> | ||
<ProductInfo /> | ||
<div className="bg-gray-100 overflow-auto flex flex-col px-5 h-screen"> | ||
<Date /> | ||
<MessageList messages={message} /> | ||
</div> | ||
<Send onSendMessage={handleSendMessage} /> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
// export default Page; | ||
export default Page; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters