-
Notifications
You must be signed in to change notification settings - Fork 4
fix: 메인 대학 카드 상세 링크를 홈대학 slug 기반으로 수정 #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import Link from "next/link"; | ||
| import Image from "@/components/ui/FallbackImage"; | ||
| import CheveronRightFilled from "@/components/ui/icon/ChevronRightFilled"; | ||
| import { getHomeUniversitySlugByName } from "@/constants/university"; | ||
| import type { ListUniversity } from "@/types/university"; | ||
| import { convertImageUrl } from "@/utils/fileUtils"; | ||
| import shortenLanguageTestName from "@/utils/universityUtils"; | ||
|
|
@@ -17,12 +18,16 @@ const UniversityCard = ({ university, showCapacity = true, linkPrefix = "/univer | |
| ? `${university.koreanName}(${university.term})` | ||
| : university.koreanName; | ||
|
|
||
| const mappedHomeUniversitySlug = getHomeUniversitySlugByName(university.homeUniversityName); | ||
| const hasExplicitPrefix = linkPrefix !== "/university"; | ||
| const universityDetailHref = mappedHomeUniversitySlug | ||
| ? `/university/${mappedHomeUniversitySlug}/${university.id}` | ||
| : hasExplicitPrefix | ||
| ? `${linkPrefix}/${university.id}` | ||
| : "/university"; | ||
|
Comment on lines
+21
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check the structure of the university routes in the Next.js app directory
find apps/web/src/app -type d -name "*university*" 2>/dev/null | sortRepository: solid-connection/solid-connect-web Length of output: 105 🏁 Script executed: #!/bin/bash
# List the contents of the university-related directories to see route patterns
if [ -d "apps/web/src/app" ]; then
find apps/web/src/app -path "*university*" -type f -name "*.tsx" -o -path "*university*" -type f -name "*.ts" -o -path "*university*" -type f -name "page.tsx" | sort
fiRepository: solid-connection/solid-connect-web Length of output: 3384 🏁 Script executed: #!/bin/bash
# Check for the specific route patterns: [id] and [slug]/[id]
find apps/web/src/app -type f \( -name "page.tsx" -o -name "layout.tsx" \) | xargs grep -l "university" 2>/dev/null | head -20Repository: solid-connection/solid-connect-web Length of output: 433 🏁 Script executed: #!/bin/bash
# Read the UniversityCard component
cat -n apps/web/src/components/ui/UniverSityCard/index.tsxRepository: solid-connection/solid-connect-web Length of output: 4036 🏁 Script executed: #!/bin/bash
# Find and examine the getHomeUniversitySlugByName function
rg "getHomeUniversitySlugByName" --type ts --type tsx -B 2 -A 5 | head -50Repository: solid-connection/solid-connect-web Length of output: 105 🏁 Script executed: #!/bin/bash
# Check how UniversityCard is used/imported
rg "UniverSityCard|UniversityCard" --type ts --type tsx | grep -E "import|from" | head -20Repository: solid-connection/solid-connect-web Length of output: 105 🏁 Script executed: #!/bin/bash
# Find the getHomeUniversitySlugByName function
rg "getHomeUniversitySlugByName" --type ts -B 2 -A 10Repository: solid-connection/solid-connect-web Length of output: 6579 🏁 Script executed: #!/bin/bash
# Check where UniversityCard is used and with what props
rg "UniverSityCard" --type ts | head -30Repository: solid-connection/solid-connect-web Length of output: 312 🏁 Script executed: #!/bin/bash
# Check imports of UniversityCard to see usage contexts
rg "from.*UniverSityCard|import.*UniverSityCard" --type tsRepository: solid-connection/solid-connect-web Length of output: 312 🏁 Script executed: #!/bin/bash
# Check UniversityCards component to see how it uses UniversityCard
cat -n apps/web/src/components/university/UniversityCards/index.tsxRepository: solid-connection/solid-connect-web Length of output: 1062 🏁 Script executed: #!/bin/bash
# Check FavoriteContent component to see how it uses UniversityCard
cat -n apps/web/src/app/my/favorite/_ui/FavoriteContent/index.tsxRepository: solid-connection/solid-connect-web Length of output: 4157 🏁 Script executed: #!/bin/bash
# Search for any usage of UniversityCard with linkPrefix prop
rg "UniversityCard|UniverSityCard" --type ts -A 3 -B 1 | grep -E "linkPrefix|UniverSityCard|UniversityCard" | head -40Repository: solid-connection/solid-connect-web Length of output: 4101 🏁 Script executed: #!/bin/bash
# Search for all places where UniversityCards is used with linkPrefix
rg "UniversityCards" --type ts -B 2 -A 2 | grep -E "linkPrefix|UniversityCards"Repository: solid-connection/solid-connect-web Length of output: 2306 🏁 Script executed: #!/bin/bash
# Check UniversityListContent to see the full context of linkPrefix usage
cat -n apps/web/src/app/university/[homeUniversity]/_ui/UniversityListContent.tsx | head -50Repository: solid-connection/solid-connect-web Length of output: 2113 🏁 Script executed: #!/bin/bash
# Continue reading to see the full linkPrefix usage
cat -n apps/web/src/app/university/[homeUniversity]/_ui/UniversityListContent.tsx | tail -30Repository: solid-connection/solid-connect-web Length of output: 1261 URL 폴백 로직 재검토 요청 현재 라우팅 구조를 확인한 결과, 다음을 안내합니다.
🤖 Prompt for AI Agents |
||
|
|
||
| return ( | ||
| <Link | ||
| className="block" | ||
| href={`${linkPrefix}/${university.id}`} | ||
| aria-labelledby={`university-name-${university.id}`} | ||
| > | ||
| <Link className="block" href={universityDetailHref} aria-labelledby={`university-name-${university.id}`}> | ||
| <div className="relative h-[91px] w-full overflow-hidden rounded-lg border border-solid border-k-100 hover:-translate-y-0.5 hover:shadow-md hover:shadow-black/10"> | ||
| <div className="flex justify-between px-5 py-3.5"> | ||
| <div className="flex gap-[23.5px]"> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slug 미확인 시 폴백 URL에서 ID가 제외되는 동작을 확인해 주세요.
UniverSityCard와 동일하게,homeUniversitySlug가undefined로 반환될 경우 href가/university/{id}대신/university(목록 페이지)가 됩니다.homeUniversityName이 항상 inha/incheon/sungshin 중 하나일 가능성이 높습니다.homeUniversityName이 누락되거나 예상치 못한 값이 오면 카드가 목록 페이지로 이동해 사용자가 상세 정보에 접근하지 못할 수 있습니다./university/[id]라우트가 제거됐다면/university가 최선의 폴백이 맞지만, 존재한다면"/university"대신`/university/${university.id}`를 폴백으로 사용하는 것이 더 견고합니다.🛡️ 폴백에 ID를 포함하는 예시 (라우트가 여전히 존재하는 경우)
const universityDetailHref = homeUniversitySlug ? `/university/${homeUniversitySlug}/${university.id}` - : "/university"; + : `/university/${university.id}`;🤖 Prompt for AI Agents