diff --git a/app/meeting/[id]/page.tsx b/app/meeting/[id]/page.tsx
index 30605cc..64b5433 100644
--- a/app/meeting/[id]/page.tsx
+++ b/app/meeting/[id]/page.tsx
@@ -130,7 +130,6 @@ export default function Page() {
router.push(`/result/${id}`);
};
- // ⭐ API에서 받은 내 출발지 정보를 selectedStation에 반영 (초기화 시 한 번만)
useEffect(() => {
if (
meetingData?.data?.participants &&
@@ -143,56 +142,49 @@ export default function Page() {
if (myData?.stationName) {
setTimeout(() => {
setSelectedStation(myData.stationName);
- hasInitializedRef.current = true; // 초기화 완료
+ hasInitializedRef.current = true;
}, 0);
} else {
- hasInitializedRef.current = true; // 데이터 없어도 초기화 완료
+ hasInitializedRef.current = true;
}
}
}, [meetingData, myName]);
- const myParticipant = useMemo(() => {
- if (!selectedStation || !myName) return null;
-
- const info = STATION_DATA.find((s) => s.name === selectedStation);
- if (!info) return null;
-
- return {
- id: 'me',
- name: myName,
- station: info.name,
- line: info.line,
- latitude: info.latitude,
- longitude: info.longitude,
- status: 'done',
- hexColor: '#000000',
- };
- }, [selectedStation, myName]);
-
const allParticipants = useMemo(() => {
if (!myName) return [];
const serverParticipants = meetingData?.data.participants || [];
- const others = serverParticipants
- .filter((p) => p.userName !== myName)
- .map((p, index) => {
- const stationInfo = STATION_DATA.find((s) => s.name === p.stationName);
-
- return {
- id: `other-${index}`,
- name: p.userName,
- station: p.stationName,
- line: stationInfo?.line ?? '미확인',
- latitude: p.latitude,
- longitude: p.longitude,
- status: 'done',
- hexColor: getRandomHexColor(p.userName || p.stationName || `user-${index}`),
- };
- });
+ const participantsWithColor = serverParticipants.map((p, index) => {
+ const stationInfo = STATION_DATA.find((s) => s.name === p.stationName);
+
+ return {
+ id: p.userName === myName ? 'me' : `other-${index}`,
+ name: p.userName,
+ station: p.stationName,
+ line: stationInfo?.line ?? '미확인',
+ latitude: p.latitude,
+ longitude: p.longitude,
+ status: 'done',
+ hexColor: getRandomHexColor(p.userName, id),
+ };
+ });
+
+ const myParticipant = participantsWithColor.find((p) => p.name === myName);
+ const others = participantsWithColor.filter((p) => p.name !== myName);
+
+ if (myParticipant && selectedStation) {
+ const info = STATION_DATA.find((s) => s.name === selectedStation);
+ if (info) {
+ myParticipant.station = info.name;
+ myParticipant.line = info.line;
+ myParticipant.latitude = info.latitude;
+ myParticipant.longitude = info.longitude;
+ }
+ }
return myParticipant ? [myParticipant, ...others] : others;
- }, [meetingData, myParticipant, myName]);
+ }, [meetingData, selectedStation, myName, id]);
if (!isMounted || !myName) {
return (
@@ -270,7 +262,7 @@ export default function Page() {
-
+
{allParticipants.length > 0 ? (
allParticipants.map((user) => (
{user.name.charAt(0)}
@@ -299,7 +291,7 @@ export default function Page() {
-
+
{!isResultEnabled && (
모든 팀원이 참여해야 결과를 확인할 수 있어요
diff --git a/app/recommend/page.tsx b/app/recommend/page.tsx
index c427d87..f726b29 100644
--- a/app/recommend/page.tsx
+++ b/app/recommend/page.tsx
@@ -29,17 +29,17 @@ function RecommendContent() {
// 모임 정보 조회 (purposes 정보를 가져오기 위해)
const { data: meetingData } = useCheckMeeting(meetingId);
- // 🔥 상위 카테고리 추출 (우선순위: URL > API > localStorage)
+ // 상위 카테고리 추출 (우선순위: URL > API > localStorage)
const meetingType = useMemo(() => {
if (typeof window === 'undefined') return null;
- // 1. URL 쿼리스트링에서 가져오기 (최우선)
+ // 1. URL 쿼리스트링에서 가져오기
if (meetingTypeFromUrl === '회의' || meetingTypeFromUrl === '친목') {
localStorage.setItem(`meeting_${meetingId}_meetingType`, meetingTypeFromUrl);
return meetingTypeFromUrl;
}
- // 2. API에서 purposes 가져오기 (참여자도 접근 가능)
+ // 2. API에서 purposes 가져오기
if (meetingData?.data?.purposes && meetingData.data.purposes.length > 0) {
const firstPurpose = meetingData.data.purposes[0];
if (firstPurpose === '회의' || firstPurpose === '친목') {
@@ -57,11 +57,11 @@ function RecommendContent() {
return null;
}, [meetingId, meetingData, meetingTypeFromUrl]);
- // 🔥 하위 카테고리 추출 (우선순위: URL > API > localStorage)
+ // 하위 카테고리 추출 (우선순위: URL > API > localStorage)
const defaultCategory = useMemo(() => {
if (typeof window === 'undefined') return '';
- // 1. URL 쿼리스트링에서 가져오기 (최우선)
+ // 1. URL 쿼리스트링에서 가져오기
if (categoryFromUrl) {
localStorage.setItem(`meeting_${meetingId}_category`, categoryFromUrl);
return categoryFromUrl;
@@ -71,7 +71,7 @@ function RecommendContent() {
if (meetingData?.data?.purposes && meetingData.data.purposes.length > 1) {
const subCategory = meetingData.data.purposes[meetingData.data.purposes.length - 1];
if (subCategory) {
- // localStorage에도 저장 (다음 접근 시 빠르게 사용)
+ // localStorage에도 저장
localStorage.setItem(`meeting_${meetingId}_category`, subCategory);
return subCategory;
}
@@ -140,7 +140,7 @@ function RecommendContent() {
};
const handleOpenKakaoMap = (e: React.MouseEvent, placeUrl?: string) => {
- e.stopPropagation(); // 카드 클릭 이벤트 버블링 방지
+ e.stopPropagation();
if (placeUrl) {
window.open(placeUrl, '_blank', 'noopener,noreferrer');
} else {
@@ -197,7 +197,7 @@ function RecommendContent() {
onClick={() => setSelectedPlaceId(place.id)}
className={`flex cursor-pointer flex-col gap-2 rounded border p-4 ${
selectedPlaceId === place.id
- ? 'border-blue-5 border-2' // 선택 시 파란 테두리
+ ? 'border-blue-5 border-2'
: 'border-gray-2 hover:bg-gray-1 bg-white'
}`}
>
@@ -260,7 +260,7 @@ function RecommendContent() {
- {/* [RIGHT PANEL] 데스크탑 지도 영역 (새로운 컴포넌트 적용) */}
+ {/* [RIGHT PANEL] 데스크탑 지도 영역 */}
{
const { endStation, endStationLine, userRoutes } = midpoint;
- const myRoute = userRoutes.find((route) => route.nickname === myNickname);
+
+ const routesWithColor = userRoutes.map((route) => {
+ return {
+ ...route,
+ hexColor: getRandomHexColor(route.nickname, id),
+ };
+ });
+
+ const myRoute = routesWithColor.find((route) => route.nickname === myNickname);
const travelTime = myRoute?.travelTime || 0;
const extractLineNumber = (linenumber: string): string => {
@@ -89,10 +98,10 @@ export default function Page() {
travelTime,
transferPath: myRoute?.transferPath || [],
transferPathLines,
- userRoutes,
+ userRoutes: routesWithColor,
};
});
- }, [midpointData, myNickname]);
+ }, [midpointData, myNickname, id]);
const [selectedResultId, setSelectedResultId] = useState(1);
@@ -159,7 +168,7 @@ export default function Page() {
case '서해선':
return 'bg-[#5EAC41]';
default:
- return 'bg-gray-4';
+ return 'bg-gray-400';
}
};
@@ -172,9 +181,7 @@ export default function Page() {
) : (
<>
- {/* [LEFT PANEL] 결과 리스트 영역 */}
- {/* 헤더 섹션 */}
@@ -191,7 +198,6 @@ export default function Page() {
- {/* 모바일 전용 지도 영역 */}
{locationResults.length > 0 &&
(() => {
const selectedResult =
@@ -213,9 +219,7 @@ export default function Page() {
);
})()}
- {/* 결과 리스트 & 하단 버튼 */}
- {/* 리스트 스크롤 영역 */}
{isError || locationResults.length === 0 ? (
@@ -235,7 +239,6 @@ export default function Page() {
: 'border-gray-2 hover:bg-gray-1'
}`}
>
- {/* 카드 헤더: 역 이름 & 시간 */}
{result.endStation}역
@@ -248,7 +251,6 @@ export default function Page() {
- {/* 환승 경로 (호선 아이콘) */}
내 환승경로
@@ -278,7 +280,6 @@ export default function Page() {
)}
- {/* 모임원 경로 보기 버튼 */}
- {/* 하단 버튼 */}