From a6b0eef2dc4a1598d0aa4da4b12d6d345eee639a Mon Sep 17 00:00:00 2001
From: collie-jun <167491677+collie-jun@users.noreply.github.com>
Date: Mon, 30 Sep 2024 21:20:01 +0900
Subject: [PATCH 1/5] =?UTF-8?q?Feat:=20=EC=B1=84=ED=8C=85=20=EB=A6=AC?=
=?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20footer=20?=
=?UTF-8?q?=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/pages/chatPage/chatListPage.jsx | 56 +++++++++++--------
.../src/pages/schedulePage/schedulePage.jsx | 2 +-
2 files changed, 35 insertions(+), 23 deletions(-)
diff --git a/travelday-fe/src/pages/chatPage/chatListPage.jsx b/travelday-fe/src/pages/chatPage/chatListPage.jsx
index 5f6bd60..960cde7 100644
--- a/travelday-fe/src/pages/chatPage/chatListPage.jsx
+++ b/travelday-fe/src/pages/chatPage/chatListPage.jsx
@@ -4,10 +4,12 @@ import BottomNav from '../../components/shared/bottomNav.js';
import Header from '../../components/shared/header.js';
import { useNavigate } from 'react-router-dom';
import axiosInstance from '../../utils/axiosInstance';
+import Footer from '../../components/footer/footer.js';
const ChatListPage = () => {
const [chatRooms, setChatRooms] = useState([]);
const [searchTerm, setSearchTerm] = useState('');
+ const [isLoading, setIsLoading] = useState(true); // 로딩 상태 추가
const navigate = useNavigate();
useEffect(() => {
@@ -42,7 +44,7 @@ const ChatListPage = () => {
// 3. 채팅방 목록에 마지막 메시지 추가
const formattedChatRooms = rooms.map((room) => {
- const lastMessageData = lastMessages.find(msg => msg.travelRoomId === room.id);
+ const lastMessageData = lastMessages.find(msg => msg.travelRoomId === room.id);
return {
id: room.id,
@@ -59,10 +61,10 @@ const ChatListPage = () => {
}
} catch (error) {
console.error('채팅방 불러오기 중 오류 발생:', error);
+ } finally {
+ setIsLoading(false); // 로딩 완료
}
};
-
-
const handleChatRoomClick = (roomId) => {
navigate(`/chat/${roomId}`);
@@ -115,25 +117,28 @@ const ChatListPage = () => {
- {filteredChatRooms.length > 0 ? (
- filteredChatRooms.map((room) => (
- handleChatRoomClick(room.id)}>
-
- {room.name}
- {room.participants}
-
-
- {truncateMessage(room.lastMessage, 20)}
-
- {room.timestamp && {formatTime(new Date(room.timestamp))}}
-
-
- ))
+ {isLoading ? ( // 로딩 중일 때 Loading 표시
+ Loading...
) : (
- 채팅방이 없습니다.
+ filteredChatRooms.length > 0 ? (
+ filteredChatRooms.map((room) => (
+ handleChatRoomClick(room.id)}>
+
+ {room.name}
+ {room.participants}
+
+
+ {truncateMessage(room.lastMessage, 20)}
+ {room.timestamp && {formatTime(new Date(room.timestamp))}}
+
+
+ ))
+ ) : (
+ 채팅방이 없습니다.
+ )
)}
-
+
@@ -181,7 +186,6 @@ const PageTitle = styled.h1`
margin-top: 50px;
`;
-
const SearchContainer = styled.div`
padding: 10px;
background-color: #ffffff;
@@ -283,7 +287,15 @@ const NoChatRooms = styled.div`
font-size: 16px;
`;
+const LoadingMessage = styled.div`
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 100px;
+ color: #999;
+ font-size: 16px;
+`;
+
const BottomPadding = styled.div`
height: 80px;
-
-`
\ No newline at end of file
+`
diff --git a/travelday-fe/src/pages/schedulePage/schedulePage.jsx b/travelday-fe/src/pages/schedulePage/schedulePage.jsx
index 7a18401..a2a5af9 100644
--- a/travelday-fe/src/pages/schedulePage/schedulePage.jsx
+++ b/travelday-fe/src/pages/schedulePage/schedulePage.jsx
@@ -6,7 +6,7 @@ import ScheduleList from '../../components/schedulePage/scheduleList';
import { useNavigate } from 'react-router-dom';
import Footer from '../../components/footer/footer.js';
import axiosInstance from '../../utils/axiosInstance.js';
-import backgroundVideo from '../../images/schedule/null.mp4'; // 비디오 파일의 경로를 import로 수정
+import backgroundVideo from '../../images/schedule/null.mp4';
const SchedulePage = () => {
const [schedules, setSchedules] = useState([]);
From 0fc2696afb1b9a6a660272a811c761297938c820 Mon Sep 17 00:00:00 2001
From: collie-jun <167491677+collie-jun@users.noreply.github.com>
Date: Thu, 3 Oct 2024 15:25:52 +0900
Subject: [PATCH 2/5] Fix: chatlist css
---
travelday-fe/src/pages/chatPage/chatListPage.jsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/travelday-fe/src/pages/chatPage/chatListPage.jsx b/travelday-fe/src/pages/chatPage/chatListPage.jsx
index 960cde7..6fa79fd 100644
--- a/travelday-fe/src/pages/chatPage/chatListPage.jsx
+++ b/travelday-fe/src/pages/chatPage/chatListPage.jsx
@@ -217,6 +217,7 @@ const ChatList = styled.div`
flex-direction: column;
align-items: center;
padding: 15px;
+ min-height: 300px;
&::-webkit-scrollbar {
display: none;
From cdfd833db3e617794ace6c510206b10ff5fed261 Mon Sep 17 00:00:00 2001
From: collie-jun <167491677+collie-jun@users.noreply.github.com>
Date: Thu, 3 Oct 2024 15:49:49 +0900
Subject: [PATCH 3/5] =?UTF-8?q?Fix:=20=EB=94=94=ED=85=8C=EC=9D=BC=20?=
=?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=92=A4=EB=A1=9C=EA=B0=80?=
=?UTF-8?q?=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
travelday-fe/src/pages/chatPage/chatPage.jsx | 6 ++++--
travelday-fe/src/pages/mainPage/mainDetailPage.jsx | 5 +++--
travelday-fe/src/pages/resultPage/flightDetailPage.jsx | 5 ++++-
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/travelday-fe/src/pages/chatPage/chatPage.jsx b/travelday-fe/src/pages/chatPage/chatPage.jsx
index d5d4946..66ef975 100644
--- a/travelday-fe/src/pages/chatPage/chatPage.jsx
+++ b/travelday-fe/src/pages/chatPage/chatPage.jsx
@@ -107,6 +107,8 @@ const ChatPage = ({roomId,isSimple}) => {
});
if (response.status === 200) {
+ console.log('유저 정보 받아왔다!',response);
+ console.log('포챠코 아이디:',userId);
const fetchedNickname = response.data.data.nickname;
const fetchedUserId = response.data.data.userId; // userId도 함께 저장
setNickname(fetchedNickname); // 닉네임 설정
@@ -132,8 +134,8 @@ const ChatPage = ({roomId,isSimple}) => {
let retryCount = 0;
const connectStompClient = () => {
// console.log('STOMP 클라이언트 연결 시도 중...');
- const socket = new SockJS('https://dev.thetravelday.co.kr/ws');
- // const socket = new SockJS('http://localhost:8080/ws');
+ // const socket = new SockJS('https://dev.thetravelday.co.kr/ws');
+ const socket = new SockJS('http://localhost:8080/ws');
console.log('소켓 접속 성공');
const stompClient = Stomp.over(socket);
diff --git a/travelday-fe/src/pages/mainPage/mainDetailPage.jsx b/travelday-fe/src/pages/mainPage/mainDetailPage.jsx
index 7561e53..a128f97 100644
--- a/travelday-fe/src/pages/mainPage/mainDetailPage.jsx
+++ b/travelday-fe/src/pages/mainPage/mainDetailPage.jsx
@@ -1,6 +1,5 @@
import React, { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
-import axios from 'axios';
import styled from 'styled-components';
import { useTranslation } from 'react-i18next';
import Header from '../../components/shared/header.js';
@@ -11,6 +10,7 @@ import PriceIcon from '../../images/filter/price.png';
import ScheduleIcon from '../../images/footer/schedule.png';
import PplIcon from '../../images/main/detail/ppl.png';
import axiosInstance from "../../utils/axiosInstance";
+import { useNavigate } from 'react-router-dom';
const airportNames = {
PQC: '푸꾸옥 국제공항',
@@ -146,6 +146,7 @@ const MainDetailPage = () => {
const { id } = useParams();
const { t } = useTranslation();
const [flight, setFlight] = useState(null);
+ const navigate = useNavigate();
useEffect(() => {
axiosInstance.get(`/api/flights/lowestPrice/list`)
@@ -177,7 +178,7 @@ const MainDetailPage = () => {
return (
-
+ navigate(-1)} />
{image ? : {t('imageNotFound')}
}
diff --git a/travelday-fe/src/pages/resultPage/flightDetailPage.jsx b/travelday-fe/src/pages/resultPage/flightDetailPage.jsx
index 0f6fd9b..72037ea 100644
--- a/travelday-fe/src/pages/resultPage/flightDetailPage.jsx
+++ b/travelday-fe/src/pages/resultPage/flightDetailPage.jsx
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
import Header from '../../components/shared/header.js';
import BottomNav from '../../components/shared/bottomNav.js';
import { images } from '../../data/mainPage.js';
+import { useNavigate } from 'react-router-dom';
import TakeoffIcon from '../../images/filter/takeoff.png';
import PriceIcon from '../../images/filter/price.png';
import ScheduleIcon from '../../images/footer/schedule.png';
@@ -147,6 +148,7 @@ const FlightDetailPage = () => {
const { id } = useParams();
const { t } = useTranslation();
const [flight, setFlight] = useState(null);
+ const navigate = useNavigate();
useEffect(() => {
axiosInstance.get(`/api/flights/lowestPrice/list`)
@@ -194,9 +196,10 @@ const FlightDetailPage = () => {
const priceInKRW = convertToKRW(parseFloat(price.grandTotal), price.currency);
+
return (
-
+ navigate(-1)} />
From d6ffbe1d3f6b730932036d74f36ec17ec1a0cceb Mon Sep 17 00:00:00 2001
From: collie-jun <167491677+collie-jun@users.noreply.github.com>
Date: Thu, 3 Oct 2024 15:54:43 +0900
Subject: [PATCH 4/5] =?UTF-8?q?Feat:=20=EC=B1=84=ED=8C=85=EB=B0=A9=20?=
=?UTF-8?q?=EC=8B=9C=EC=9E=91=20=EB=A9=94=EC=84=B8=EC=A7=80=20=EC=B6=94?=
=?UTF-8?q?=EA=B0=80=20=EB=B0=8F=20=EC=8A=A4=EC=BC=88=EB=A0=88=ED=86=A4=20?=
=?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
travelday-fe/src/pages/chatPage/chatPage.jsx | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/travelday-fe/src/pages/chatPage/chatPage.jsx b/travelday-fe/src/pages/chatPage/chatPage.jsx
index 66ef975..6469440 100644
--- a/travelday-fe/src/pages/chatPage/chatPage.jsx
+++ b/travelday-fe/src/pages/chatPage/chatPage.jsx
@@ -414,7 +414,7 @@ const ChatPage = ({roomId,isSimple}) => {
)}
- {isLoading || messages.length === 0 ? (
+ {isLoading ? (
// 로딩 중일 때 스켈레톤을 3개 표시
<>
@@ -422,6 +422,9 @@ const ChatPage = ({roomId,isSimple}) => {
>
+ ) : messages.length === 0 ? (
+ // 메시지가 없을 때 빈 메시지 표시
+ 아직 채팅이 없습니다. 첫 번째 메시지를 보내보세요!
) : (
messages.map((message, index) => {
const previousMessage = messages[index - 1];
@@ -464,6 +467,7 @@ const ChatPage = ({roomId,isSimple}) => {
+
{toastVisible && 최대 입력은 500자까지 가능합니다}
@@ -836,4 +840,10 @@ const SkeletonText = styled.p`
font-size: 16px;
color: #333;
margin-bottom: 20px;
-`;
\ No newline at end of file
+`;
+
+const NoMessagesText = styled.div`
+ text-align: center;
+ color: #888;
+ margin-top: 20px;
+`;
From 603b1f15ca1c2d0e170dc8b25de75d813f80d347 Mon Sep 17 00:00:00 2001
From: collie-jun <167491677+collie-jun@users.noreply.github.com>
Date: Thu, 3 Oct 2024 15:56:32 +0900
Subject: [PATCH 5/5] =?UTF-8?q?Fix:=20=EC=9B=B9=EC=86=8C=EC=BC=93=20url?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
travelday-fe/src/pages/chatPage/chatPage.jsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/travelday-fe/src/pages/chatPage/chatPage.jsx b/travelday-fe/src/pages/chatPage/chatPage.jsx
index 6469440..2da0449 100644
--- a/travelday-fe/src/pages/chatPage/chatPage.jsx
+++ b/travelday-fe/src/pages/chatPage/chatPage.jsx
@@ -134,8 +134,8 @@ const ChatPage = ({roomId,isSimple}) => {
let retryCount = 0;
const connectStompClient = () => {
// console.log('STOMP 클라이언트 연결 시도 중...');
- // const socket = new SockJS('https://dev.thetravelday.co.kr/ws');
- const socket = new SockJS('http://localhost:8080/ws');
+ const socket = new SockJS('https://dev.thetravelday.co.kr/ws');
+ // const socket = new SockJS('http://localhost:8080/ws');
console.log('소켓 접속 성공');
const stompClient = Stomp.over(socket);