-
Notifications
You must be signed in to change notification settings - Fork 3
fix: 대학 상세 어학 로고 경로 수정 #595
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,47 @@ | ||
| export const DEFAULT_LANGUAGE_TEST_LOGO_SRC = "/images/language/default.png"; | ||
| const LANGUAGE_TEST_LOGO_BASE_PATH = "/university-static/images/language"; | ||
|
|
||
| export const DEFAULT_LANGUAGE_TEST_LOGO_SRC = `${LANGUAGE_TEST_LOGO_BASE_PATH}/default.png`; | ||
|
|
||
| export const logoMap = { | ||
| TOEIC: "/images/language/toeic.png", | ||
| TOEFL_IBT: "/images/language/toefl_ibt.png", | ||
| TOEFL_ITP: "/images/language/toefl_itp.png", | ||
| IELTS: "/images/language/ielts.png", | ||
| JLPT: "/images/language/jlpt.png", | ||
| NEW_HSK: "/images/language/new_hsk.png", | ||
| ETC: "/images/language/etc.png", | ||
| DALF: "/images/language/dalf.png", | ||
| DELF: "/images/language/delf.jpg", | ||
| CEFR: "/images/language/cefr.png", | ||
| TCF: "/images/language/tcf.png", | ||
| TEF: "/images/language/tef.png", | ||
| DUOLINGO: "/images/language/duolingo.svg", | ||
| TOEIC: `${LANGUAGE_TEST_LOGO_BASE_PATH}/toeic.png`, | ||
| TOEFL_IBT: `${LANGUAGE_TEST_LOGO_BASE_PATH}/toefl_ibt.png`, | ||
| TOEFL_ITP: `${LANGUAGE_TEST_LOGO_BASE_PATH}/toefl_itp.png`, | ||
| IELTS: `${LANGUAGE_TEST_LOGO_BASE_PATH}/ielts.png`, | ||
| JLPT: `${LANGUAGE_TEST_LOGO_BASE_PATH}/jlpt.png`, | ||
| NEW_HSK: `${LANGUAGE_TEST_LOGO_BASE_PATH}/new_hsk.png`, | ||
| ETC: `${LANGUAGE_TEST_LOGO_BASE_PATH}/etc.png`, | ||
| DALF: `${LANGUAGE_TEST_LOGO_BASE_PATH}/dalf.png`, | ||
| DELF: `${LANGUAGE_TEST_LOGO_BASE_PATH}/delf.jpg`, | ||
| CEFR: `${LANGUAGE_TEST_LOGO_BASE_PATH}/cefr.png`, | ||
| TCF: `${LANGUAGE_TEST_LOGO_BASE_PATH}/tcf.png`, | ||
| TEF: `${LANGUAGE_TEST_LOGO_BASE_PATH}/tef.png`, | ||
| DUOLINGO: `${LANGUAGE_TEST_LOGO_BASE_PATH}/duolingo.svg`, | ||
| } as const; | ||
|
|
||
| type LanguageTestLogoType = keyof typeof logoMap; | ||
|
|
||
| const languageTestLogoAliases: Record<string, LanguageTestLogoType> = { | ||
| HSK: "NEW_HSK", | ||
| DUOLINGO_ENGLISH_TEST: "DUOLINGO", | ||
| }; | ||
|
|
||
| const normalizeLanguageTestLogoType = (type: string): LanguageTestLogoType | undefined => { | ||
| const normalizedType = type | ||
| .trim() | ||
| .toUpperCase() | ||
| .replace(/[./]/g, "") | ||
| .replace(/[\s-]+/g, "_"); | ||
| const logoType = languageTestLogoAliases[normalizedType] ?? normalizedType; | ||
|
|
||
| return logoType in logoMap ? (logoType as LanguageTestLogoType) : undefined; | ||
| }; | ||
|
|
||
| export const getLanguageTestLogo = (type: string): string => { | ||
| return type in logoMap ? logoMap[type as LanguageTestLogoType] : DEFAULT_LANGUAGE_TEST_LOGO_SRC; | ||
| const logoType = normalizeLanguageTestLogoType(type); | ||
|
|
||
| return logoType ? logoMap[logoType] : DEFAULT_LANGUAGE_TEST_LOGO_SRC; | ||
| }; | ||
|
|
||
| export const formatLanguageTestName = (type: string): string => { | ||
| return type.replace(/_/g, " "); | ||
| return type.trim().replace(/_/g, " "); | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
1. 구분자 정규화 순서, 한 번만 더 점검해주세요!
.와/를 먼저 언더스코어 없이 완전히 지워버리고, 그 다음에야 공백·하이픈만_로 바꾸고 있어요. 이 순서라면:"TOEFL.IBT"→"TOEFLIBT"(언더스코어 없음)"TOEFL/IBT"→"TOEFLIBT"(언더스코어 없음)둘 다
logoMap의"TOEFL_IBT"키와 매칭되지 않아, 정작 존재하는 로고인데도 기본 로고로 폴백돼버려요. PR 목표가 ".,/, 공백, 하이픈과 같은 구분자 정규화"인데,.와/만 구분자 취급을 못 받고 있는 셈이죠.한 번에 처리하도록 정규식을 합쳐주시면 의도한 동작을 회복할 수 있어요.
🔧 제안하는 수정
const normalizedType = type .trim() .toUpperCase() - .replace(/[./]/g, "") - .replace(/[\s-]+/g, "_"); + .replace(/[\s./-]+/g, "_");📝 Committable suggestion
🤖 Prompt for AI Agents