Skip to content

Commit

Permalink
Merge pull request #119 from capstone-maru/dev
Browse files Browse the repository at this point in the history
release: v1.0.0
  • Loading branch information
cjeongmin authored May 30, 2024
2 parents 32696e6 + 62fb54d commit 3d38eda
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maru",
"version": "0.11.2",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
1 change: 0 additions & 1 deletion src/app/globals.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:[email protected]&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:[email protected]&display=swap');
@import url('https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.min.css');

Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/error-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 28 additions & 0 deletions src/app/pages/setting-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Set<string>>((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 = (
Expand Down
29 changes: 24 additions & 5 deletions src/components/FloatingChatting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -140,6 +141,8 @@ interface Message {
}

function FloatingChattingBox() {
const { createToast } = useToast();

const [isChatRoomOpen, setIsChatRoomOpen] = useState<boolean>(false);
const [chatRooms, setChatRooms] = useState<ChatRoom[]>([]);
const [message, setMessage] = useState<Message>();
Expand Down Expand Up @@ -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);
Expand All @@ -183,8 +191,19 @@ function FloatingChattingBox() {
}
});
};

stomp.onWebSocketError = () => {
createToast({
message: '연결에 실패했습니다. 다시 시도합니다.',
option: {
duration: 3000,
},
});
};

stomp.activate();
} catch (error) {
console.error('채팅 생성 중 오류가 발생했습니다:', error);
console.error('채팅 생성 중 오류가 발생했습니다:', error);
}
};

Expand All @@ -197,7 +216,7 @@ function FloatingChattingBox() {
stompClient.deactivate();
}
};
}, [auth?.accessToken, userId]);
}, [auth?.accessToken]);

useEffect(() => {
if (data !== undefined) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/components/card/OptionSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 21 additions & 2 deletions src/components/chat/ChattingRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -187,6 +188,8 @@ export function ChattingRoom({
lastTime: string;
onRoomClick: React.Dispatch<React.SetStateAction<boolean>>;
}) {
const { createToast } = useToast();

const [messages, setMessages] = useState<Content[]>([]);
const [inputMessage, setInputMessage] = useState('');
const [stompClient, setStompClient] = useState<Client | null>(null);
Expand Down Expand Up @@ -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());
Expand All @@ -249,6 +257,17 @@ export function ChattingRoom({
}
});
};

stomp.onWebSocketError = () => {
createToast({
message: '연결에 실패했습니다. 다시 시도합니다.',
option: {
duration: 3000,
},
});
};

stomp.activate();
} catch (error) {
console.error('채팅 룸 생성 중 오류가 발생했습니다:', error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/chat/MobileChattingBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3d38eda

Please sign in to comment.