Skip to content

Commit fe3aaa8

Browse files
authored
Merge pull request #605 from solid-connection/fix/application-score-applied-university-ui
fix: 지원자 현황 지원 대학 표시 수정
2 parents e1c3eb0 + 58c92f2 commit fe3aaa8

4 files changed

Lines changed: 50 additions & 9 deletions

File tree

apps/web/src/app/university/application/ScorePageContent.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import { useGetApplicationsList } from "@/apis/applications";
88
import ConfirmCancelModal from "@/components/modal/ConfirmCancelModal";
99
import { DEFAULT_MAX_CHOICE_COUNT, getHomeUniversityById, REGIONS_KO } from "@/constants/university";
1010
import useAuthStore from "@/lib/zustand/useAuthStore";
11+
import { IconExpandMoreFilled } from "@/public/svgs/community";
1112
import type { Applicant, ScoreSheet as ScoreSheetType } from "@/types/application";
1213
import type { RegionKo } from "@/types/university";
13-
import { getApplicationDetailHref, MobileScoreSheet } from "./ScoreSheet";
14+
import { getApplicationDetailHref, MobileScoreSheet, ScoreSheetLogo } from "./ScoreSheet";
1415

1516
type ApplicantScope = "all" | "withApplicants";
1617
type ScoreSort = "applicants" | "gpa";
@@ -160,7 +161,7 @@ const AppliedUniversitySection = ({
160161
}) => (
161162
<section className="mt-5">
162163
<div className="flex items-center justify-between gap-3">
163-
<h1 className="text-k-900 typo-bold-4">지원한 대학({appliedUniversities.length})</h1>
164+
<h1 className="text-k-900 typo-bold-4">지원한 대학 ({appliedUniversities.length})</h1>
164165
<button
165166
type="button"
166167
onClick={onChangeUniversities}
@@ -198,12 +199,12 @@ const AppliedUniversityRow = ({ preference, scoreSheet }: AppliedUniversity) =>
198199
href={getApplicationDetailHref(scoreSheet.koreanName)}
199200
className="flex h-11 items-center gap-2.5 rounded-lg border border-k-50 bg-white px-3.5 shadow-[0_0_10px_rgba(0,0,0,0.05)]"
200201
>
201-
<span className="size-5 shrink-0 rounded-full bg-k-50" aria-hidden />
202+
<ScoreSheetLogo scoreSheet={scoreSheet} className="size-5" />
202203
<span className="min-w-0 flex-1 truncate text-k-900 typo-sb-7">
203204
{scoreSheet.koreanName} ({preference}/{capacity})
204205
</span>
205-
<span className="text-k-500" aria-hidden>
206-
˅
206+
<span className="flex size-6 shrink-0 items-center justify-center text-k-600" aria-hidden>
207+
<IconExpandMoreFilled />
207208
</span>
208209
</Link>
209210
);
@@ -342,7 +343,15 @@ const uniqueScoreSheets = (scoreSheets: ScoreSheetType[]) => {
342343
const prev = scoreSheetMap.get(key);
343344
scoreSheetMap.set(
344345
key,
345-
prev ? { ...prev, applicants: mergeApplicants(prev.applicants, scoreSheet.applicants) } : scoreSheet,
346+
prev
347+
? {
348+
...prev,
349+
englishName: prev.englishName ?? scoreSheet.englishName,
350+
logoImageUrl: prev.logoImageUrl ?? scoreSheet.logoImageUrl,
351+
backgroundImageUrl: prev.backgroundImageUrl ?? scoreSheet.backgroundImageUrl,
352+
applicants: mergeApplicants(prev.applicants, scoreSheet.applicants),
353+
}
354+
: scoreSheet,
346355
);
347356
}
348357

apps/web/src/app/university/application/ScoreSheet.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import clsx from "clsx";
44
import Link from "next/link";
55
import { useState } from "react";
6+
import Image from "@/components/ui/FallbackImage";
67
import { IconExpandMoreFilled } from "@/public/svgs/community";
78
import type { Applicant, ScoreSheet as ScoreSheetType } from "@/types/application";
89
import { formatLanguageTestScore, isLanguageTestEnum, languageTestMapping } from "@/types/score";
@@ -61,6 +62,26 @@ const getScoreSheetCapacity = (scoreSheet: ScoreSheetType) => {
6162
return String(scoreSheet.studentCapacity);
6263
};
6364

65+
export const ScoreSheetLogo = ({
66+
scoreSheet,
67+
className,
68+
size = 20,
69+
}: {
70+
scoreSheet: Pick<ScoreSheetType, "logoImageUrl">;
71+
className?: string;
72+
size?: number;
73+
}) => (
74+
<Image
75+
src={scoreSheet.logoImageUrl ?? ""}
76+
alt=""
77+
width={size}
78+
height={size}
79+
className={clsx("shrink-0 rounded-full border border-k-50 bg-white object-cover", className)}
80+
fallbackSrc="/svgs/placeholders/university-logo-placeholder.svg"
81+
aria-hidden
82+
/>
83+
);
84+
6485
export const MobileScoreSheet = ({ scoreSheet, defaultOpen = false, detailHref }: ScoreSheetProps) => {
6586
const [tableOpened, setTableOpened] = useState(defaultOpen);
6687
const resolvedDetailHref = detailHref ?? getApplicationDetailHref(scoreSheet.koreanName);
@@ -81,7 +102,7 @@ export const MobileScoreSheet = ({ scoreSheet, defaultOpen = false, detailHref }
81102
)}
82103
onClick={toggleTableOpened}
83104
>
84-
<span className="size-5 shrink-0 rounded-full bg-white" aria-hidden />
105+
<ScoreSheetLogo scoreSheet={scoreSheet} className="size-5" />
85106
<Link
86107
href={resolvedDetailHref}
87108
className="min-w-0 flex-1 truncate text-k-900 typo-sb-7"

apps/web/src/app/university/application/[universityName]/ApplicationUniversityDetailContent.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,16 @@ const findScoreSheetWithApplicants = (
234234

235235
const baseScoreSheet = matches[0].scoreSheet;
236236
const applicantMap = new Map<string, Applicant>();
237+
const mergedUniversityImages = matches.reduce(
238+
(images, { scoreSheet }) => ({
239+
logoImageUrl: images.logoImageUrl ?? scoreSheet.logoImageUrl,
240+
backgroundImageUrl: images.backgroundImageUrl ?? scoreSheet.backgroundImageUrl,
241+
}),
242+
{
243+
logoImageUrl: baseScoreSheet.logoImageUrl,
244+
backgroundImageUrl: baseScoreSheet.backgroundImageUrl,
245+
},
246+
);
237247

238248
for (const { preferenceOrder, scoreSheet } of matches) {
239249
for (const applicant of scoreSheet.applicants) {
@@ -249,6 +259,7 @@ const findScoreSheetWithApplicants = (
249259

250260
return {
251261
...baseScoreSheet,
262+
...mergedUniversityImages,
252263
applicants: Array.from(applicantMap.values()),
253264
};
254265
};

apps/web/src/types/application.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export interface ScoreSheet {
2222
id?: number;
2323
koreanName: string;
2424
englishName?: string;
25-
logoImageUrl?: string;
26-
backgroundImageUrl?: string;
25+
logoImageUrl?: string | null;
26+
backgroundImageUrl?: string | null;
2727
studentCapacity: number | null;
2828
region: string;
2929
country: string;

0 commit comments

Comments
 (0)