Skip to content

Commit 577ca02

Browse files
manNomi한만욱
andauthored
fix : img 버그 수정했습니다 (#209)
* fix : serverFetch 반환값이 더이상 error를 throw하지 않도록 수정했습니다 * refactor : home 페이지가 revalidate가 정상 작동하도록 수정했습니다 * refactor : 클라이언트 컴포넌트 분해했습니다 * refactor : home의 테일윈드 고정값 모두 수정했습니다 * refactor : 전체적인 홈페이지 개선했습니다 1. revalidate 작동하도록 isr로 수정했습니다 2. 컴포넌트 중 레거시 삭제 및 college -> university로 통일작업했습니다 3. 레거시 컴포넌트의 분리 및 테일윈드 값 PR 내용 반영하도록 했습니다 * refactor : 홈페이지의 추천 영역 react-query로 수정했습니다 * refactor : 레거시 삭제했습니다 * refactor : productuin 상태일때는 universities를 사용하도록 수정했습니다 * refactor : unoptimized 설정 삭제했습니다 * refactor : PR 내용 반영했습니다 * fix : 배포 서버 전 테스트용으로 endpoint 분가 수정했습니다 * refactor : 폰트 및 이미지 최적화 했습니다 * fix : 사진이 불러오지 않던 버그 수정했습니다 --------- Co-authored-by: 한만욱 <manwook-han@hanman-ug-ui-MacBookPro.local>
1 parent 5bcf179 commit 577ca02

4 files changed

Lines changed: 20 additions & 17 deletions

File tree

src/app/_home/_ui/PopularCollegeSection/_hooks/useWheelHandler.ts renamed to src/app/_home/_ui/PopularUniversitySection/_hooks/useWheelHandler.ts

File renamed without changes.

src/app/_home/_ui/PopularCollegeSection/index.tsx renamed to src/app/_home/_ui/PopularUniversitySection/index.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,34 @@ import useWheelHandler from "./_hooks/useWheelHandler";
77

88
import { ListUniversity } from "@/types/university";
99

10-
type PopularCollegeSectionProps = {
11-
colleges: ListUniversity[];
10+
type PopularUniversitySectionProps = {
11+
universities: ListUniversity[];
1212
};
1313

14-
const PopularCollegeSection = ({ colleges }: PopularCollegeSectionProps) => {
14+
const PopularUniversitySection = ({ universities }: PopularUniversitySectionProps) => {
1515
const { containerRef } = useWheelHandler();
16-
1716
return (
1817
<div ref={containerRef} className="overflow-x-auto">
1918
<div className="flex gap-2">
20-
{colleges.map((college) => (
21-
<Link key={college.id} href={`/university/${college.id}`}>
19+
{universities.map((university) => (
20+
<Link key={university.id} href={`/university/${university.id}`}>
2221
<div className="relative w-[153px]">
2322
<div className="relative w-[153px]">
2423
<div className="absolute inset-0 h-[120px] rounded-lg bg-gradient-to-b from-transparent via-black/35 to-black/70" />
2524
<Image
2625
className="h-[120px] rounded-lg object-cover"
2726
src={
28-
college.backgroundImageUrl
29-
? `${process.env.NEXT_PUBLIC_IMAGE_URL}/${college.backgroundImageUrl}`
27+
university.backgroundImageUrl
28+
? `${process.env.NEXT_PUBLIC_IMAGE_URL}/${university.backgroundImageUrl}`
3029
: "/images/default-university.jpg"
3130
}
3231
width={153}
3332
height={120}
34-
alt={`${college.koreanName || "대학교"} 배경 이미지`}
33+
alt={`${university.koreanName || "대학교"} 배경 이미지`}
3534
/>
3635
</div>
3736
<div className="absolute bottom-[9px] left-[10px] z-10 text-sm font-semibold leading-[160%] tracking-[0.15px] text-white">
38-
{college.koreanName}
37+
{university.koreanName}
3938
</div>
4039
</div>
4140
</Link>
@@ -45,4 +44,4 @@ const PopularCollegeSection = ({ colleges }: PopularCollegeSectionProps) => {
4544
);
4645
};
4746

48-
export default PopularCollegeSection;
47+
export default PopularUniversitySection;

‎src/app/_home/_ui/UniversityList/index.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const UniversityList = ({ allRegionsUniversityList }: UniversityListProps) => {
3232
isLogin && !error ? clientFetchedRecommendedUniversities : region ? (allRegionsUniversityList[region] ?? []) : [];
3333
// 홈 카드 영역에는 최대 3개만 노출
3434
const previewUniversities: ListUniversity[] = useMemo(() => universities.slice(0, 3), [universities]);
35-
3635
return (
3736
<div className="flex flex-col gap-2">
3837
<div className="flex justify-between">
@@ -55,7 +54,13 @@ const UniversityList = ({ allRegionsUniversityList }: UniversityListProps) => {
5554
background: "white",
5655
}}
5756
/>
58-
<UniversityCards colleges={previewUniversities} showCapacity={false} />
57+
<UniversityCards
58+
colleges={previewUniversities.map((college) => ({
59+
...college,
60+
logoImageUrl: college.logoImageUrl?.replace(/^\/+/, ""),
61+
}))}
62+
showCapacity={false}
63+
/>
5964
</div>
6065
);
6166
};

‎src/app/_home/index.tsx‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Image from "next/image";
22
import Link from "next/link";
33

44
import FindLastYearScoreBar from "./_ui/FindLastYearScoreBar";
5-
import PopularCollegeSection from "./_ui/PopularCollegeSection";
5+
import PopularUniversitySection from "./_ui/PopularUniversitySection";
66
import UniversityList from "./_ui/UniversityList";
77

88
import getRecommendedUniversity from "@/api/university/server/getRecommendedUniversity";
@@ -16,7 +16,7 @@ const Home = async () => {
1616

1717
// 추천 대학 정보를 가져옵니다
1818
const { data } = await getRecommendedUniversity();
19-
const recommendedColleges = data?.recommendedUniversities || [];
19+
const recommendedUniversities = data?.recommendedUniversities || [];
2020

2121
// 권역별 전체 대학 리스트를 미리 가져와 빌드합니다
2222
const allRegionsUniversityList = await getAllRegionsUniversityList();
@@ -71,7 +71,7 @@ const Home = async () => {
7171
<div className="mb-2 flex items-center gap-1.5 font-serif text-base font-semibold text-k-700">
7272
실시간 인기있는 파견학교
7373
</div>
74-
<PopularCollegeSection colleges={recommendedColleges} />
74+
<PopularUniversitySection universities={recommendedUniversities} />
7575
</div>
7676

7777
<div className="p-5">
@@ -89,7 +89,6 @@ const Home = async () => {
8989
<div className="flex gap-4">
9090
<Image
9191
loading="lazy"
92-
placeholder="blur"
9392
className="h-24 w-44 shrink-0 rounded-xl object-cover"
9493
src={news.imageUrl}
9594
alt={news.title}

0 commit comments

Comments
 (0)