diff --git a/package.json b/package.json index 31bbdaa..68629f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "maru", - "version": "0.11.2", + "version": "1.0.0", "private": true, "scripts": { "dev": "next dev", diff --git a/src/app/globals.scss b/src/app/globals.scss index d428443..70f917b 100644 --- a/src/app/globals.scss +++ b/src/app/globals.scss @@ -1,4 +1,3 @@ -@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400..800&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100..900&display=swap'); @import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css'); diff --git a/src/app/pages/error-page.tsx b/src/app/pages/error-page.tsx index b8fb74d..b506c88 100644 --- a/src/app/pages/error-page.tsx +++ b/src/app/pages/error-page.tsx @@ -29,7 +29,7 @@ const styles = { title: styled.p` color: var(--Main-1, #e15637); - font-family: 'Baloo 2'; + font-family: 'Pretendard'; font-size: 1.875rem; font-style: normal; font-weight: 700; diff --git a/src/app/pages/setting-page.tsx b/src/app/pages/setting-page.tsx index 3725d83..ece93a2 100644 --- a/src/app/pages/setting-page.tsx +++ b/src/app/pages/setting-page.tsx @@ -320,6 +320,34 @@ export function SettingPage({ cardId }: { cardId: number }) { history.back(); }; + useEffect(() => { + if (card.data == null) return; + + const { smoking, mateAge, roomSharingOption, options } = + card.data.data.myFeatures; + + const temp = JSON.parse(options) as string[]; + + setFeatures({ + smoking, + mateAge, + roomSharingOption, + options: + temp == null + ? new Set() + : temp.reduce>((prev, curr) => { + try { + if (Array.isArray(JSON.parse(curr))) { + setBudget(curr.slice(1, -1)); + } + } catch { + prev.add(curr); + } + return prev; + }, new Set()), + }); + }, [card.data]); + useEffect(() => { const originalPush = router.push.bind(router); const newPush = ( diff --git a/src/components/FloatingChatting.tsx b/src/components/FloatingChatting.tsx index 71b292d..2dffc3a 100644 --- a/src/components/FloatingChatting.tsx +++ b/src/components/FloatingChatting.tsx @@ -13,6 +13,7 @@ import { ChattingRoom } from './chat/ChattingRoom'; import { useAuthValue, useUserData } from '@/features/auth'; import { chatOpenState, type GetChatRoomDTO } from '@/features/chat'; import { useIsMobile } from '@/shared/mobile'; +import { useToast } from '@/features/toast'; const styles = { chattingButton: styled.div` @@ -74,7 +75,7 @@ const styles = { background: var(--background, #f7f6f9); `, title: styled.span` - font-family: 'Baloo 2'; + font-family: 'Pretendard'; font-size: 1.575rem; font-style: normal; font-weight: 700; @@ -140,6 +141,8 @@ interface Message { } function FloatingChattingBox() { + const { createToast } = useToast(); + const [isChatRoomOpen, setIsChatRoomOpen] = useState(false); const [chatRooms, setChatRooms] = useState([]); const [message, setMessage] = useState(); @@ -170,10 +173,15 @@ function FloatingChattingBox() { heartbeatOutgoing: 4000, }); setStompClient(stomp); - stomp.activate(); stomp.onConnect = () => { - console.log('WebSocket 연결이 열렸습니다.'); + createToast({ + message: '채팅 연결에 성공했습니다.', + option: { + duration: 3000, + }, + }); + stomp.subscribe(`/roomList/${userId}`, frame => { try { const newMessage: Message = JSON.parse(frame.body); @@ -183,8 +191,19 @@ function FloatingChattingBox() { } }); }; + + stomp.onWebSocketError = () => { + createToast({ + message: '연결에 실패했습니다. 다시 시도합니다.', + option: { + duration: 3000, + }, + }); + }; + + stomp.activate(); } catch (error) { - console.error('채팅 룸 생성 중 오류가 발생했습니다:', error); + console.error('채팅 방 생성 중 오류가 발생했습니다:', error); } }; @@ -197,7 +216,7 @@ function FloatingChattingBox() { stompClient.deactivate(); } }; - }, [auth?.accessToken, userId]); + }, [auth?.accessToken]); useEffect(() => { if (data !== undefined) { diff --git a/src/components/NavigationBar.tsx b/src/components/NavigationBar.tsx index 9e49679..3823be7 100644 --- a/src/components/NavigationBar.tsx +++ b/src/components/NavigationBar.tsx @@ -99,7 +99,7 @@ const styles = { `, title: styled.h1` color: var(--Main-1, #e15637); - font-family: 'Baloo 2'; + font-family: 'Pretendard'; font-size: 1.875rem; font-style: normal; font-weight: 700; diff --git a/src/components/card/OptionSection.tsx b/src/components/card/OptionSection.tsx index ad0c2f7..136a929 100644 --- a/src/components/card/OptionSection.tsx +++ b/src/components/card/OptionSection.tsx @@ -125,7 +125,7 @@ const styles = { `, value: styled.div` display: flex; - width: 6.8rem; + width: 7rem; padding: 0.5rem 1.5rem; justify-content: center; align-items: center; diff --git a/src/components/chat/ChattingRoom.tsx b/src/components/chat/ChattingRoom.tsx index aaf8664..e7d0678 100644 --- a/src/components/chat/ChattingRoom.tsx +++ b/src/components/chat/ChattingRoom.tsx @@ -10,6 +10,7 @@ import { SenderMessage } from './SenderMessage'; import { useAuthValue } from '@/features/auth'; import { useEnterChatRoom, useExitChatRoom } from '@/features/chat'; +import { useToast } from '@/features/toast'; const styles = { container: styled.div` @@ -187,6 +188,8 @@ export function ChattingRoom({ lastTime: string; onRoomClick: React.Dispatch>; }) { + const { createToast } = useToast(); + const [messages, setMessages] = useState([]); const [inputMessage, setInputMessage] = useState(''); const [stompClient, setStompClient] = useState(null); @@ -234,10 +237,15 @@ export function ChattingRoom({ heartbeatOutgoing: 4000, }); setStompClient(stomp); - stomp.activate(); stomp.onConnect = () => { - console.log('WebSocket 연결이 열렸습니다.'); + createToast({ + message: `[${roomName}] 방 연결에 성공했습니다.`, + option: { + duration: 3000, + }, + }); + stomp.subscribe(`/room/${roomId}`, frame => { try { setTime(new Date().toISOString()); @@ -249,6 +257,17 @@ export function ChattingRoom({ } }); }; + + stomp.onWebSocketError = () => { + createToast({ + message: '연결에 실패했습니다. 다시 시도합니다.', + option: { + duration: 3000, + }, + }); + }; + + stomp.activate(); } catch (error) { console.error('채팅 룸 생성 중 오류가 발생했습니다:', error); } diff --git a/src/components/chat/MobileChattingBox.tsx b/src/components/chat/MobileChattingBox.tsx index afc158c..b752b03 100644 --- a/src/components/chat/MobileChattingBox.tsx +++ b/src/components/chat/MobileChattingBox.tsx @@ -36,7 +36,7 @@ const styles = { background: var(--background, #f7f6f9); `, title: styled.span` - font-family: 'Baloo 2'; + font-family: 'Pretendard'; font-size: 1.575rem; font-style: normal; font-weight: 700;