From fd91a41aa9dcfe3657170679258f731d6f818e10 Mon Sep 17 00:00:00 2001 From: rukadeveloper Date: Sat, 2 Aug 2025 05:16:24 -0700 Subject: [PATCH 1/2] delete chat --- .../chat/ChatRequestModal.module.scss | 197 ------------- src/components/chat/ChatRequestModal.tsx | 120 -------- src/components/chat/ChatRoom.module.scss | 200 ------------- src/components/chat/ChatRoom.tsx | 118 -------- src/hooks/useChat.ts | 272 ------------------ src/hooks/useWebSocket.ts | 183 ------------ 6 files changed, 1090 deletions(-) delete mode 100644 src/components/chat/ChatRequestModal.module.scss delete mode 100644 src/components/chat/ChatRequestModal.tsx delete mode 100644 src/components/chat/ChatRoom.module.scss delete mode 100644 src/components/chat/ChatRoom.tsx delete mode 100644 src/hooks/useChat.ts delete mode 100644 src/hooks/useWebSocket.ts diff --git a/src/components/chat/ChatRequestModal.module.scss b/src/components/chat/ChatRequestModal.module.scss deleted file mode 100644 index 975517e..0000000 --- a/src/components/chat/ChatRequestModal.module.scss +++ /dev/null @@ -1,197 +0,0 @@ -.overlay { - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: rgba(0, 0, 0, 0.5); - display: flex; - align-items: center; - justify-content: center; - z-index: 1000; -} - -.modal { - background: white; - border-radius: 12px; - width: 90%; - max-width: 400px; - max-height: 80vh; - overflow: hidden; - box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); -} - -.header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 20px 20px 0 20px; - border-bottom: 1px solid #e9ecef; - - h3 { - margin: 0; - font-size: 18px; - font-weight: 600; - color: #333; - } - - .closeButton { - background: none; - border: none; - font-size: 24px; - color: #999; - cursor: pointer; - padding: 0; - width: 30px; - height: 30px; - display: flex; - align-items: center; - justify-content: center; - border-radius: 50%; - - &:hover { - background-color: #f8f9fa; - color: #666; - } - } -} - -.content { - padding: 20px; - - .receiverInfo { - margin-bottom: 16px; - padding: 12px; - background-color: #f8f9fa; - border-radius: 8px; - border-left: 4px solid #2773e6; - - span { - font-size: 14px; - color: #666; - font-weight: 500; - } - } - - .receiverInput { - margin-bottom: 16px; - - label { - display: block; - font-size: 14px; - font-weight: 600; - color: #333; - margin-bottom: 8px; - } - - input { - width: 100%; - padding: 12px; - border: 1px solid #e9ecef; - border-radius: 8px; - font-size: 14px; - margin-bottom: 12px; - outline: none; - transition: border-color 0.2s ease; - - &::placeholder { - color: #999; - } - - &:focus { - border-color: #2773e6; - } - } - } - - .messageInput { - label { - display: block; - font-size: 14px; - font-weight: 600; - color: #333; - margin-bottom: 8px; - } - - textarea { - width: 100%; - padding: 12px; - border: 1px solid #e9ecef; - border-radius: 8px; - font-size: 14px; - font-family: inherit; - resize: vertical; - min-height: 100px; - outline: none; - transition: border-color 0.2s ease; - - &::placeholder { - color: #999; - } - - &:focus { - border-color: #2773e6; - } - } - } -} - -.footer { - display: flex; - gap: 12px; - padding: 0 20px 20px 20px; - - button { - flex: 1; - padding: 12px; - border: none; - border-radius: 8px; - font-size: 14px; - font-weight: 600; - cursor: pointer; - transition: all 0.2s ease; - - &:disabled { - opacity: 0.6; - cursor: not-allowed; - } - } - - .cancelButton { - background-color: #f8f9fa; - color: #666; - - &:hover:not(:disabled) { - background-color: #e9ecef; - } - } - - .sendButton { - background-color: #2773e6; - color: white; - - &:hover:not(:disabled) { - background-color: #1e5bb8; - } - } -} - -// 반응형 디자인 -@media (max-width: 768px) { - .modal { - width: 95%; - margin: 20px; - } - - .header { - padding: 16px 16px 0 16px; - } - - .content { - padding: 16px; - } - - .footer { - padding: 0 16px 16px 16px; - } -} diff --git a/src/components/chat/ChatRequestModal.tsx b/src/components/chat/ChatRequestModal.tsx deleted file mode 100644 index 5ea7360..0000000 --- a/src/components/chat/ChatRequestModal.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import { useState } from "react"; -import styles from "./ChatRequestModal.module.scss"; - -interface ChatRequestModalProps { - isOpen: boolean; - onClose: () => void; - onSendRequest: (receiverId: number, message: string) => Promise; - receiverId?: number; - receiverName?: string; -} - -const ChatRequestModal = ({ - isOpen, - onClose, - onSendRequest, - receiverId, - receiverName, -}: ChatRequestModalProps) => { - const [message, setMessage] = useState(""); - const [isLoading, setIsLoading] = useState(false); - const [inputReceiverId, setInputReceiverId] = useState(""); - const [inputReceiverName, setInputReceiverName] = useState(""); - - const handleSendRequest = async () => { - const targetReceiverId = receiverId || parseInt(inputReceiverId); - if (!message.trim() || !targetReceiverId) return; - - try { - setIsLoading(true); - await onSendRequest(targetReceiverId, message); - setMessage(""); - setInputReceiverId(""); - setInputReceiverName(""); - onClose(); - } catch (error) { - console.error("채팅 요청 전송 실패:", error); - } finally { - setIsLoading(false); - } - }; - - const handleKeyPress = (e: React.KeyboardEvent) => { - if (e.key === "Enter" && !e.shiftKey) { - e.preventDefault(); - handleSendRequest(); - } - }; - - if (!isOpen) return null; - - return ( -
-
e.stopPropagation()}> -
-

채팅 요청

- -
- -
- {receiverName ? ( -
- 받는 사람: {receiverName} -
- ) : ( -
- - setInputReceiverId(e.target.value)} - /> - - setInputReceiverName(e.target.value)} - /> -
- )} - -
- -