Skip to content

Commit 1ff9c86

Browse files
authored
Merge pull request #260 from manNomi/fix/qa
fix : qa 사항 반영했습니다
2 parents ec2643e + 4f4d4f3 commit 1ff9c86

File tree

14 files changed

+111
-83
lines changed

14 files changed

+111
-83
lines changed

src/app/community/[boardCode]/[postId]/PostPageContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const PostPageContent = ({ boardCode, postId }: PostPageContentProps) => {
3535
handleBack={() => {
3636
router.push(`/community/${boardCode}`);
3737
}}
38-
icon={post.isOwner && <KebabMenu postId={postId} />}
38+
icon={<KebabMenu postId={postId} />}
3939
/>
4040
<Content post={post} postId={postId} />
4141
<CommentSection comments={post.postFindCommentResponses} postId={postId} refresh={refresh} />

src/app/my/_ui/MyProfileContent/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ const MyProfileContent = () => {
6565
</div>
6666

6767
{isMentor ? (
68-
<div className="w-full rounded-lg bg-secondary-500 py-2 text-center font-medium text-white">
68+
<div className="w-full cursor-pointer rounded-lg bg-secondary-500 py-2 text-center font-medium text-white">
6969
<Link href={"/my/modify"}>프로필 변경</Link>
7070
</div>
7171
) : (
7272
<div className="mt-4 flex items-center justify-between gap-3">
73-
<div className="w-full rounded-lg bg-secondary-500 py-2 text-center font-medium text-white">
73+
<div className="w-full cursor-pointer rounded-lg bg-secondary-500 py-2 text-center font-medium text-white">
7474
<Link href={"/my/modify"}>프로필 변경</Link>
7575
</div>
7676
<button
File renamed without changes.

src/app/university/SearchBar.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface SearchBarProps {
2828
initText?: string;
2929
}
3030
// --- 폼 로직을 관리하는 부모 컴포넌트 ---
31-
const SearchBar = ({ initText }: SearchBarProps) => {
31+
const SearchForm = ({ initText }: SearchBarProps) => {
3232
const router = useRouter();
3333

3434
const {
@@ -50,16 +50,19 @@ const SearchBar = ({ initText }: SearchBarProps) => {
5050
}
5151

5252
const queryString = queryParams.toString();
53-
router.push(`/university/search-results?${queryString}`);
53+
console.log("검색 실행:", queryString);
54+
router.push(`/university/search?${queryString}`);
5455
};
5556

5657
return (
5758
<form onSubmit={handleSubmit(onSubmit)} className="w-full">
58-
<div className="relative w-full">
59+
<div className="relative mb-2">
5960
<input
6061
type="text"
61-
placeholder={"해외 파견 학교를 검색하세요."}
62-
className="w-full rounded-lg border border-gray-200 bg-k-50 p-3 pl-4 pr-10 text-k-600 focus:border-primary"
62+
placeholder={"대학명을 검색해보세요..."}
63+
className={`w-full border-b bg-white p-3 pl-4 pr-10 outline-none transition-colors ${
64+
errors.searchText ? "border-red-500 focus:border-red-500" : "border-gray-200 focus:border-blue-500"
65+
}`}
6366
{...register("searchText")}
6467
/>
6568
<div className="absolute right-3 top-1/2 h-5 w-5 -translate-y-1/2 text-gray-400">
@@ -71,4 +74,4 @@ const SearchBar = ({ initText }: SearchBarProps) => {
7174
);
7275
};
7376

74-
export default SearchBar;
77+
export default SearchForm;

src/app/university/search-results/SearchResultsContent.tsx renamed to src/app/university/SearchResultsContent.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useSearchParams } from "next/navigation";
44
import React, { Suspense, useMemo, useState } from "react";
55

66
import CloudSpinnerPage from "@/components/ui/CloudSpinnerPage";
7+
import FloatingUpBtn from "@/components/ui/FloatingUpBtn";
78
import UniversityCards from "@/components/university/UniversityCards";
89

910
import RegionFilter from "./RegionFilter";
@@ -36,7 +37,7 @@ const SearchResultsContent = () => {
3637
// URL에서 전달된 국가 목록을 기본으로 사용
3738
const filteredCountries = countries as CountryCode[];
3839

39-
if (text) {
40+
if (!lang || !countries) {
4041
return {
4142
isTextSearch: true,
4243
searchText: text,
@@ -54,7 +55,7 @@ const SearchResultsContent = () => {
5455
}
5556
}, [searchParams, selectedRegion]);
5657

57-
const textSearchQuery = useGetUniversitySearchByText(searchText);
58+
const textSearchQuery = useGetUniversitySearchByText(searchText ?? "");
5859
const filterSearchQuery = useGetUniversitySearchByFilter(filterParams);
5960

6061
const { data: serachResult } = isTextSearch ? textSearchQuery : filterSearchQuery;
@@ -90,6 +91,7 @@ const SearchResultsContent = () => {
9091
<UniversityCards colleges={filteredData} className="mx-5 mt-3" />
9192
</>
9293
)}
94+
<FloatingUpBtn />
9395
</div>
9496
);
9597
};

src/app/university/application/ScorePageContent.tsx

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { useRouter } from "next/navigation";
4-
import { useMemo, useRef, useState } from "react";
4+
import { useEffect, useMemo, useRef, useState } from "react";
55

66
import ConfirmCancelModal from "@/components/modal/ConfirmCancelModal";
77
import ButtonTab from "@/components/ui/ButtonTab";
@@ -20,8 +20,6 @@ import useGetApplicationsList from "@/api/applications/client/useGetApplications
2020

2121
const PREFERENCE_CHOICE: ("1순위" | "2순위" | "3순위")[] = ["1순위", "2순위", "3순위"];
2222

23-
// API 응답 데이터의 타입을 명확하게 정의합니다.
24-
// 실제 ApplicationListResponse 타입을 사용하시는 것이 더 좋습니다.
2523
interface ScoreData {
2624
firstChoice: ScoreSheetType[];
2725
secondChoice: ScoreSheetType[];
@@ -38,38 +36,47 @@ const ScorePageContent = () => {
3836
const [searchValue, setSearchValue] = useState("");
3937
const [showNeedApply, setShowNeedApply] = useState(false);
4038

41-
// ✨ 1. 초기 데이터를 API 응답 구조와 동일하게 설정합니다.
4239
const initialData: ScoreData = {
4340
firstChoice: [],
4441
secondChoice: [],
4542
thirdChoice: [],
4643
};
4744

48-
// ✨ 2. `data`의 기본값을 위에서 정의한 initialData로 변경합니다.
49-
const { data: scoreResponseData = initialData, isLoading } = useGetApplicationsList();
45+
const {
46+
data: scoreResponseData = initialData,
47+
isError,
48+
isLoading,
49+
} = useGetApplicationsList({
50+
retry: false,
51+
});
5052

5153
const filteredAndSortedData = useMemo(() => {
52-
// 데이터가 없는 경우를 대비한 방어 코드
53-
const firstChoice = scoreResponseData?.firstChoice || [];
54-
const secondChoice = scoreResponseData?.secondChoice || [];
55-
const thirdChoice = scoreResponseData?.thirdChoice || [];
54+
// ✨ 1. 대학 이름(koreanName)을 기준으로 중복을 제거하는 헬퍼 함수
55+
const uniqueByKoreanName = (data: ScoreSheetType[]) => {
56+
// Map을 사용해 koreanName을 키로 하여 중복을 효율적으로 제거합니다.
57+
const universityMap = new Map(data.map((sheet) => [sheet.koreanName, sheet]));
58+
// Map의 값들만 다시 배열로 변환하여 반환합니다.
59+
return Array.from(universityMap.values());
60+
};
61+
62+
// ✨ 2. API 응답 데이터를 받자마자 중복부터 제거합니다.
63+
const firstChoice = uniqueByKoreanName(scoreResponseData?.firstChoice || []);
64+
const secondChoice = uniqueByKoreanName(scoreResponseData?.secondChoice || []);
65+
const thirdChoice = uniqueByKoreanName(scoreResponseData?.thirdChoice || []);
5666

57-
// 원본 데이터를 훼손하지 않기 위해 복사본을 만들어 정렬합니다.
67+
// 3. 중복이 제거된 데이터를 정렬합니다.
5868
const sortedData = {
59-
// ✨ 3. `[...scoreResponseData]`가 아니라 `[...firstChoice]`로 수정합니다.
6069
firstChoice: [...firstChoice].sort((a, b) => b.applicants.length - a.applicants.length),
6170
secondChoice: [...secondChoice].sort((a, b) => b.applicants.length - a.applicants.length),
6271
thirdChoice: [...thirdChoice].sort((a, b) => b.applicants.length - a.applicants.length),
6372
};
6473

65-
// 필터링 로직
74+
// 4. 기존 필터링 로직을 적용합니다.
6675
const applyFilters = (data: ScoreSheetType[]) => {
6776
let result = data;
68-
// 지역 필터
6977
if (regionFilter) {
7078
result = result.filter((sheet) => sheet.region === regionFilter);
7179
}
72-
// 검색어 필터
7380
if (searchValue) {
7481
result = result.filter((sheet) => sheet.koreanName.toLowerCase().includes(searchValue.toLowerCase()));
7582
}
@@ -116,6 +123,14 @@ const ScorePageContent = () => {
116123
};
117124
const scoreSheets = getScoreSheet();
118125

126+
useEffect(() => {
127+
if (isLoading) return;
128+
if (isError) {
129+
alert("지원 현황을 불러오는 중에 오류가 발생했습니다. 지원 절차를 진행해주세요.");
130+
router.replace("/university/application/apply");
131+
}
132+
}, [isError, isLoading, router]);
133+
119134
if (isLoading) {
120135
return <CloudSpinnerPage />;
121136
}
@@ -145,7 +160,7 @@ const ScorePageContent = () => {
145160
style={{ padding: "10px 0 10px 18px" }}
146161
/>
147162

148-
<div className="mx-5 mt-2.5 flex w-[calc(100%-44px)] flex-col gap-3 overflow-x-auto">
163+
<div className="mx-auto mt-2.5 flex w-full flex-col gap-3 overflow-x-auto">
149164
{scoreSheets.map((choice) => (
150165
<ScoreSheet key={choice.koreanName} scoreSheet={choice} />
151166
))}

src/app/university/application/apply/DoneStep.tsx

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,31 @@ import BlockBtn from "@/components/button/BlockBtn";
66
const DoneStep = () => {
77
const router = useRouter();
88
return (
9-
<div className="mt-52 flex h-full flex-col items-center">
9+
<div className="mt-52 flex h-full flex-col items-center justify-center gap-6">
1010
<Image src="/images/survey-complete-icon.png" width={120} height={120} alt="지원 완료" />
11-
<div className="font-serif text-2xl font-semibold text-k-800">지원 완료</div>
11+
<div className="text-center font-serif text-2xl font-semibold text-k-800">
12+
학교 지원이
13+
<br />
14+
<span className="text-secondary">완료</span>
15+
되었어요!
16+
</div>
1217

13-
<div className="fixed bottom-14 w-full max-w-[600px] bg-white">
14-
<div className="mb-[37px] px-5">
15-
<BlockBtn
16-
onClick={() => {
17-
router.push("/");
18-
}}
19-
>
20-
홈으로
21-
</BlockBtn>
22-
</div>
18+
<div className="mt-10 flex w-full flex-col gap-3 px-5 pt-8">
19+
<BlockBtn
20+
className="bg-primary-900 text-white"
21+
onClick={() => {
22+
router.push("/university/application");
23+
}}
24+
>
25+
지원자 현황 보기
26+
</BlockBtn>
27+
<BlockBtn
28+
onClick={() => {
29+
router.push("/");
30+
}}
31+
>
32+
홈으로
33+
</BlockBtn>
2334
</div>
2435
</div>
2536
);

src/app/university/page.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { Metadata } from "next";
22

33
import TopDetailNavigation from "@/components/layout/TopDetailNavigation";
44

5-
import SchoolSearchForm from "./PageContent";
6-
import SearchBar from "./SearchBar";
5+
import SearchResultsContent from "./SearchResultsContent";
76

87
export const metadata: Metadata = {
98
title: "파견 학교 목록",
@@ -13,14 +12,7 @@ const Page = async () => {
1312
return (
1413
<>
1514
<TopDetailNavigation title="파견학교 검색" />
16-
<main className="flex flex-1 flex-col p-5">
17-
<h2 className="mb-1 text-2xl font-bold">오직 나를 위한</h2>
18-
<h2 className="mb-6 text-2xl font-bold">맞춤 파견 학교 찾기</h2>
19-
<div className="relative mb-4">
20-
<SearchBar />
21-
</div>
22-
<SchoolSearchForm />
23-
</main>
15+
<SearchResultsContent />
2416
</>
2517
);
2618
};

src/app/university/score/submit/gpa/GpaSubmitForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ const GpaSubmitForm = () => {
7777
<SubmitResult
7878
title="학점 입력 완료"
7979
description="성적 승인은 최대 3일까지 걸릴 수 있습니다."
80-
buttonText="어학성적 입력하기"
81-
onClick={() => router.push("/university/score/submit/language-test")}
80+
buttonText="홈으로"
81+
onClick={() => router.push("/")}
8282
handleClose={() => setShowResult(false)}
8383
infoRows={infoRows}
8484
/>

src/app/university/search-results/page.tsx

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)