Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the UploadPage by modularizing the UI into specialized components and extracting logic into custom hooks, specifically useUploadFiles and useUploadPageForm. The changes introduce a more structured approach to handling file uploads and form state. Review feedback highlights an inconsistency in PDF file detection between the upload hook and the UI component, which could lead to incorrect icon rendering. It also suggests enhancing the user experience by adding toast notifications when the file upload limit is reached.
src/features/upload/components/features/upload-page/UploadFileItem.tsx
Outdated
Show resolved
Hide resolved
…/team-seedLab/seed-fe into refector#54-upload-page-refector
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📝 요약 (Summary)
업로드 페이지의 구조를 정리해서 page가 더 단순한 역할만 하도록 개선했습니다.
업로드 폼 상태는 hook으로, 화면은 section과 하위 컴포넌트로 나누고, 파일 업로드 검증도 함께 보완했습니다.
✅ 주요 변경 사항 (Key Changes)
UploadPage에서 폼 상태와 제출 흐름을useUploadPageForm으로 분리했습니다.💻 상세 구현 내용 (Implementation Details)
1. 업로드 페이지 폼 로직 분리
useUploadPageForm으로 업로드 폼 상태와 제출 흐름을 분리했습니다.반환값은
fields / files / submit으로 나누어 page와 section에서 읽기 쉽게 정리했습니다.2. 업로드 페이지 화면 분리
업로드 화면을 아래 section으로 나눴습니다.
UploadTitleSectionUploadAssignmentTypeSectionUploadContentAndFileSectionUploadSubmitSection이제
UploadPage는 직접 상태와 UI를 모두 들고 있지 않고, hook 호출과 section 조립만 합니다.3. 파일 업로드 UI 분리
파일 업로드 영역은 하위 컴포넌트로 나눴습니다.
UploadFileDropzoneUploadFileListUploadFileItem이를 통해
UploadContentAndFileSection은 내용 입력과 파일 업로드 영역을 조합하는 역할만 하도록 정리했습니다.4. 과제 유형과 파일 업로드 기준 정리
업로드 페이지에서 과제 유형 기본값과 옵션 목록을 한 곳(
assignment-types)에서 관리하도록 정리했습니다.UPLOAD_ASSIGNMENT_TYPESDEFAULT_UPLOAD_ASSIGNMENT_TYPE파일 업로드 허용 형식도 constants로 정리했습니다.
UPLOAD_FILE_ACCEPTUPLOAD_FILE_TYPE_LABEL이렇게 해서 page, section, 파일 input, 검증 로직이 같은 기준을 사용하도록 맞췄습니다.
5. 파일 형식 검증, 업로드 제한 안내 추가
기존에는 파일 선택 창의 형식만 설정되어 있었고, 파일 추가 시에는 실제 검증이 없었습니다.
이번에는 파일 형식 판별 로직을 공통 utils로 분리하고,
useUploadFiles에서 직접 검증하도록 수정했습니다.또한 파일 아이콘 표시도 같은 판별 함수를 사용하도록 했습니다.
🚨 트러블 슈팅 (Trouble Shooting)
해당 없음
현재 업로드 파일 검증은 파일 형식만 다루고 있습니다.
다음 이슈에서 파일 크기 제한을 추가로 진행해야할 것 같습니다.
📸 스크린샷 (Screenshots)
해당 없음
#️⃣ 관련 이슈 (Related Issues)