Skip to content

[feature] 지원서 작성 탭 UI 완성#452

Merged
seongwon030 merged 17 commits intodevelop-fefrom
feature/#451-create-application-ui-tab-FE-127
May 31, 2025
Merged

[feature] 지원서 작성 탭 UI 완성#452
seongwon030 merged 17 commits intodevelop-fefrom
feature/#451-create-application-ui-tab-FE-127

Conversation

@seongwon030
Copy link
Member

@seongwon030 seongwon030 commented May 31, 2025

#️⃣연관된 이슈

ex) #451

📝작업 내용

추가된 것

  • mockData 로 지원서 가져오기
  • 특정 질문 ID의 필드를 동적으로 수정하는 updateQuestionField 함수 추가
  • 타입별 질문 컴포넌트 감싸는 Container추가
  • 질문 타입 검사 로직 추가 및 상수배열 추가
  • 지원서 최초 제작 시 띄우는 템플릿 data 및 UI 추가
  • 지원서 제목 컴포넌트 및 스타일 추가
  • 질문 리스트를 나열하는 스타일 컴포넌트 QuestionContainer추가

변경사항

  • CreateForm에서 CreateApplicationForm으로 이름 변경
  • title 필드명을 form_title로 변경

중점적으로 리뷰받고 싶은 부분(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

논의하고 싶은 부분(선택)

논의하고 싶은 부분이 있다면 작성해주세요.

🫡 참고사항

Summary by CodeRabbit

  • 신규 기능

    • 지원서 폼의 초기 데이터 구조 및 상수 추가.
    • 지원서 폼 생성 및 편집을 위한 새로운 화면과 컴포넌트 도입.
    • 지원서 폼 제목 및 질문 입력 필드에 스타일 적용.
  • 버그 수정

    • 모의 API 응답에서 폼 제목 필드명이 올바르게 수정됨.
  • 리팩터링

    • 질문 타입 및 폼 데이터 구조를 일관성 있게 개선.
    • 컴포넌트 및 타입 구조를 중앙 집중화하여 유지보수성 향상.
  • 스타일

    • 지원서 생성 화면 및 질문 빌더 컴포넌트에 스타일 컴포넌트 추가.

seongwon030 and others added 16 commits May 31, 2025 17:06
- 지원서 전체 타입 추가

Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
- LONG_TEXT case추가

Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
- 지원서 제목 추가
- 제목 수정 onChange추가
- 질문 리스트 Container스타일 추가

Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
@seongwon030 seongwon030 requested a review from oesnuj May 31, 2025 12:28
@seongwon030 seongwon030 added ✨ Feature 기능 개발 💻 FE Frontend labels May 31, 2025
@netlify
Copy link

netlify bot commented May 31, 2025

Deploy Preview for moadong ready!

Name Link
🔨 Latest commit 6b43dba
🔍 Latest deploy log https://app.netlify.com/projects/moadong/deploys/683b086ca957710008ecf189
😎 Deploy Preview https://deploy-preview-452--moadong.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 41
Accessibility: 87
Best Practices: 92
SEO: 92
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 31, 2025

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid regex pattern for base branch. Received: "**" at "reviews.auto_review.base_branches[0]"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

"""

Walkthrough

이 변경사항은 지원서 작성 탭의 UI 구조와 상태 관리를 개선하기 위해 기존 CreateForm 컴포넌트를 CreateApplicationForm으로 대체하고, 관련 타입, 상수, 스타일 파일을 추가 및 수정합니다. 또한, 목 데이터 구조와 API 응답 형식을 일관성 있게 정비하였습니다.

Changes

파일/경로 요약 변경 요약
frontend/src/App.tsx 라우트 컴포넌트 및 import를 CreateForm에서 CreateApplicationForm으로 변경
frontend/src/constants/INITIAL_FORM_DATA.ts INITIAL_FORM_DATA 상수 추가 및 export (초기 폼 데이터 정의)
frontend/src/mocks/api/apply.ts GET /apply/:clubId 응답 필드명 form_title로 수정
frontend/src/mocks/data/mockData.ts ApplicationFormData 타입 적용, titleform_title로 변경, 질문 ID 일련번호화, 불필요한 인터페이스 제거
frontend/src/pages/AdminPage/application/CreateApplicationForm.styles.ts FormTitle, QuestionContainer styled-components 추가
frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx CreateApplicationForm 컴포넌트 신설(상태 관리 및 UI 렌더링, 핸들러 포함), default export
frontend/src/pages/AdminPage/application/CreateForm.tsx 기존 CreateForm 컴포넌트 파일 삭제
frontend/src/pages/AdminPage/application/components/QuestionBuilder/QuestionBuilder.styles.ts QuestionFieldContainer styled-component 추가
frontend/src/pages/AdminPage/application/components/QuestionBuilder/QuestionBuilder.tsx 지원하지 않는 질문 타입 시 렌더링 차단, LONG_TEXT 처리 추가, 스타일 컨테이너로 감쌈
frontend/src/types/application.ts QUESTION_TYPE_LIST 상수 및 ApplicationFormData 인터페이스 추가, QuestionType 타입 개선

Sequence Diagram(s)

sequenceDiagram
    participant Admin as AdminPage
    participant CreateForm as CreateApplicationForm
    participant State as useState
    participant QuestionBuilder as QuestionBuilder

    Admin->>CreateForm: 렌더링 요청
    CreateForm->>State: INITIAL_FORM_DATA로 상태 초기화
    loop 질문 목록 렌더링
        CreateForm->>QuestionBuilder: 각 질문 데이터 및 핸들러 전달
        QuestionBuilder-->>CreateForm: 변경 이벤트 발생 시 콜백 호출
        CreateForm->>State: 상태 업데이트
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
/adminPage/application 페이지 기본 틀 구현 (FE-127)
탭 구조 또는 구획 구분에 따라 UI 배치 완료 (FE-127)
전체 섹션 구조 (질문 목록, 미리보기 등) 정리 (FE-127)
질문 추가 삭제 기능 및 UI 추가 (FE-127) 질문 추가/삭제 기능의 구체적 구현이 코드에서 명확히 드러나지 않음

Assessment against linked issues: Out-of-scope changes

해당 변경사항 중 목표(issue)와 무관한 기능적 코드 변경은 발견되지 않았습니다.

Possibly related PRs

  • Moadong/moadong#445: 기존 CreateForm 컴포넌트 및 라우팅 구조 도입 PR로, 현재 PR의 컴포넌트 대체 및 구조 개선과 직접적으로 연관됨.
  • Moadong/moadong#450: CreateFormQuestionBuilder 컴포넌트 타입 리팩토링 PR로, 본 PR과 타입 및 컴포넌트 관련 코드 변경에서 연관성 있음.

Suggested labels

🎨 Design

Suggested reviewers

  • oesnuj
    """
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
frontend/src/mocks/data/mockData.ts (1)

29-92: 🛠️ Refactor suggestion

질문 ID 일관성 문제 수정 필요

질문 ID가 일부만 순차적으로 변경되어 일관성이 부족합니다. 1-6번은 순차적이지만, 마지막 두 질문(105, 106번)은 여전히 비순차적입니다.

모든 질문 ID를 순차적으로 변경해주세요:

    {
-      id: 105,
+      id: 7,
      title: '전화번호 입력',
      description: '휴대전화 번호를 입력해주세요.',
      type: 'PHONE_NUMBER',
      options: {
        required: false,
      },
      items: [{ value: '' }],
    },
    {
-      id: 106,
+      id: 8,
      title: '이름 입력',
      description: '이름을 입력해주세요.',
      type: 'NAME',
      options: {
        required: true,
      },
      items: [{ value: '' }],
    },
♻️ Duplicate comments (1)
frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx (1)

108-108: 컴포넌트명 불일치 문제가 export에서도 나타납니다.

앞서 언급한 컴포넌트명 수정과 함께 export 부분도 수정이 필요합니다.

🧹 Nitpick comments (3)
frontend/src/constants/INITIAL_FORM_DATA.ts (1)

3-22: 초기 폼 데이터 구조가 적절하게 정의되었습니다.

INITIAL_FORM_DATA 상수는 새로운 지원서 생성 시 사용할 기본 구조를 잘 제공합니다. 다양한 질문 타입(SHORT_TEXT, CHOICE)의 예시가 포함되어 있고 ApplicationFormData 타입과 일치합니다.

향후 개선 고려사항:

  • 질문 ID를 하드코딩하는 대신 동적 생성 방식 검토
  • CHOICE 타입 질문의 items에 placeholder 텍스트 추가로 사용자 경험 개선
frontend/src/pages/AdminPage/application/components/QuestionBuilder/QuestionBuilder.tsx (1)

45-45: LONG_TEXT 케이스 처리 개선 검토

LONG_TEXT 타입이 ShortText 컴포넌트로 렌더링되고 있습니다. 장문형 텍스트의 경우 별도의 컴포넌트나 다른 UI가 필요할 수 있습니다.

장문형 텍스트를 위한 별도의 컴포넌트 생성을 고려해보세요:

case 'LONG_TEXT':
  return (
    <LongText
      id={id}
      title={title}
      required={options?.required}
      description={description}
      mode='builder'
      onTitleChange={onTitleChange}
      onDescriptionChange={onDescriptionChange}
    />
  );
frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx (1)

39-46: 커링 패턴을 사용한 핸들러들입니다.

현재 구현은 정확하지만, 매 렌더링마다 새로운 함수가 생성됩니다. 성능 최적화를 위해 useCallback 사용을 고려해보세요.

예시:

+import { useState, useCallback } from 'react';

-const handleTitleChange = (id: number) => (value: string) =>
-  updateQuestionField(id, 'title', value);
+const handleTitleChange = useCallback(
+  (id: number) => (value: string) => updateQuestionField(id, 'title', value),
+  []
+);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb95946 and 90eb677.

📒 Files selected for processing (10)
  • frontend/src/App.tsx (2 hunks)
  • frontend/src/constants/INITIAL_FORM_DATA.ts (1 hunks)
  • frontend/src/mocks/api/apply.ts (1 hunks)
  • frontend/src/mocks/data/mockData.ts (7 hunks)
  • frontend/src/pages/AdminPage/application/CreateApplicationForm.styles.ts (1 hunks)
  • frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx (1 hunks)
  • frontend/src/pages/AdminPage/application/CreateForm.tsx (0 hunks)
  • frontend/src/pages/AdminPage/application/components/QuestionBuilder/QuestionBuilder.styles.ts (1 hunks)
  • frontend/src/pages/AdminPage/application/components/QuestionBuilder/QuestionBuilder.tsx (4 hunks)
  • frontend/src/types/application.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • frontend/src/pages/AdminPage/application/CreateForm.tsx
🧰 Additional context used
🧬 Code Graph Analysis (4)
frontend/src/mocks/api/apply.ts (1)
frontend/src/mocks/data/mockData.ts (1)
  • mockData (25-122)
frontend/src/constants/INITIAL_FORM_DATA.ts (1)
frontend/src/types/application.ts (1)
  • ApplicationFormData (55-58)
frontend/src/mocks/data/mockData.ts (1)
frontend/src/types/application.ts (1)
  • ApplicationFormData (55-58)
frontend/src/pages/AdminPage/application/components/QuestionBuilder/QuestionBuilder.tsx (1)
frontend/src/types/application.ts (2)
  • QUESTION_TYPE_LIST (3-11)
  • QuestionType (13-13)
🔇 Additional comments (22)
frontend/src/pages/AdminPage/application/components/QuestionBuilder/QuestionBuilder.styles.ts (1)

10-12: 새로운 컨테이너 스타일 컴포넌트가 적절하게 추가되었습니다.

QuestionFieldContainer는 질문 필드를 감싸는 컨테이너로서 적절한 스타일링(width: 100%)을 가지고 있으며, 기존 스타일 컴포넌트들과 일관된 패턴을 유지하고 있습니다.

frontend/src/App.tsx (2)

18-18: 컴포넌트 이름이 더 명확하게 변경되었습니다.

CreateForm에서 CreateApplicationForm으로의 변경은 컴포넌트의 목적을 더 구체적으로 나타내며, 지원서 작성 기능임을 명확히 표현합니다.


76-79: 라우트 설정이 올바르게 업데이트되었습니다.

import 변경과 일관되게 JSX 엘리먼트도 CreateApplicationForm으로 정확히 업데이트되었습니다.

frontend/src/mocks/api/apply.ts (1)

28-28: 속성명 불일치 문제가 올바르게 수정되었습니다.

mockData.title에서 mockData.form_title로 변경하여 목 데이터의 실제 속성명과 일치시켰습니다. 이는 frontend/src/mocks/data/mockData.ts에서 정의된 ApplicationFormData 타입의 form_title 속성과 일관성을 유지합니다.

frontend/src/constants/INITIAL_FORM_DATA.ts (2)

19-19: 선택 질문의 초기값이 사용자 친화적으로 설정되었습니다.

CHOICE 타입 질문에 두 개의 빈 옵션을 제공하여 사용자가 바로 편집할 수 있도록 구성했습니다.


24-24: 적절한 export 패턴을 사용했습니다.

default export를 사용하여 상수를 명확하게 내보내고 있습니다.

frontend/src/mocks/data/mockData.ts (2)

1-1: 타입 안전성 개선을 위한 import 변경 승인

ApplicationFormData 타입을 사용하여 타입 안전성이 개선되었습니다.


25-26: form_title 필드명 변경 승인

일관성 있는 네이밍을 위해 titleform_title로 변경한 것이 적절합니다.

frontend/src/pages/AdminPage/application/components/QuestionBuilder/QuestionBuilder.tsx (3)

8-8: 중앙화된 상수 import 승인

QUESTION_TYPE_LIST 상수를 사용하여 타입 관리가 중앙화되었습니다.


23-25: 타입 검증 로직 추가 승인

지원되지 않는 질문 타입에 대한 early return 로직이 추가되어 안전성이 향상되었습니다.


133-135: 컨테이너 래핑 승인

QuestionFieldContainer로 래핑하여 일관된 스타일링이 적용되었습니다.

frontend/src/pages/AdminPage/application/CreateApplicationForm.styles.ts (2)

3-18: FormTitle 스타일링 승인

폼 제목을 위한 깔끔한 스타일링이 적용되었습니다. 특히 포커스 시 placeholder가 페이드아웃되는 효과가 좋습니다.


20-24: QuestionContainer 레이아웃 승인

질문들을 세로로 배치하고 적절한 간격(83px)을 제공하는 레이아웃이 잘 구성되었습니다.

frontend/src/types/application.ts (3)

3-11: 중앙화된 질문 타입 상수 추가 승인

QUESTION_TYPE_LIST 상수를 통해 질문 타입이 중앙화되어 유지보수성이 향상되었습니다.


13-13: 타입 파생 방식 개선 승인

typeof과 인덱스 접근을 사용한 타입 파생 방식으로 타입 안전성이 향상되었습니다.


55-58: ApplicationFormData 인터페이스 추가 승인

폼 데이터 구조를 명확히 정의한 인터페이스가 잘 작성되었습니다. form_title 필드명도 명확합니다.

frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx (6)

1-13: 임포트 구조가 깔끔하게 정리되어 있습니다.

필요한 의존성들이 모두 적절히 임포트되어 있고, TODO 주석으로 향후 개발 계획을 명시한 것도 좋습니다.


19-30: 제네릭을 활용한 타입 안전한 업데이트 함수입니다.

제네릭 <K extends keyof Question>을 사용하여 컴파일 타임에 타입 안전성을 보장하고, 불변성을 유지하면서 상태를 업데이트하는 깔끔한 구현입니다.


32-37: 간단하고 명확한 폼 제목 업데이트 핸들러입니다.

form_title 필드명 변경사항이 적절히 반영되어 있고, 구현이 정확합니다.


48-65: 선택형 질문의 items 배열을 적절히 처리하는 복잡한 로직입니다.

질문 타입 변경 시 선택형(CHOICE, MULTI_CHOICE)일 때만 items 배열을 관리하고, 최소 2개 항목을 보장하는 로직이 잘 구현되어 있습니다. 기존 items가 있으면 유지하는 것도 좋은 UX입니다.


67-74: 중첩된 options 객체를 적절히 업데이트하는 핸들러입니다.

options.required 필드를 업데이트할 때 기존 options 객체를 스프레드하여 불변성을 유지하는 구현이 정확합니다.


76-106: 깔끔한 렌더링 구조와 적절한 props 전달입니다.

  • PageContainer로 레이아웃을 감싸고 스타일드 컴포넌트를 활용한 구조가 좋습니다.
  • map을 사용하여 질문들을 렌더링하면서 QuestionBuilder에 필요한 모든 props를 적절히 전달하고 있습니다.
  • keyquestion.id를 사용하는 것도 올바른 접근입니다.

Copy link
Member

@oesnuj oesnuj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

페어프로그래밍 수고하셨슴당 🚀 🚀

Co-Authored-By: 김준서 Junseo Kim <semiwest2@gmail.com>
@seongwon030 seongwon030 merged commit be8b17c into develop-fe May 31, 2025
6 of 8 checks passed
@seongwon030 seongwon030 deleted the feature/#451-create-application-ui-tab-FE-127 branch May 31, 2025 13:49
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx (4)

3-3: TODO 코멘트 추적을 위한 이슈 생성을 고려해보세요.

질문 삭제 및 추가 기능이 아직 구현되지 않았습니다. 이러한 핵심 기능들을 체계적으로 추적하기 위해 별도 이슈를 생성하는 것을 권장합니다.

이 TODO 항목들을 위한 이슈를 생성하거나 구현 계획을 도와드릴까요?


39-46: 핸들러 최적화를 고려해보세요.

현재 핸들러들이 컴포넌트 렌더링마다 새로 생성됩니다. 성능 최적화를 위해 useCallback을 사용하는 것을 고려해보세요.

+import { useState, useCallback } from 'react';

-const handleTitleChange = (id: number) => (value: string) =>
-  updateQuestionField(id, 'title', value);
+const handleTitleChange = useCallback((id: number) => (value: string) =>
+  updateQuestionField(id, 'title', value), []);

-const handleDescriptionChange = (id: number) => (value: string) =>
-  updateQuestionField(id, 'description', value);
+const handleDescriptionChange = useCallback((id: number) => (value: string) =>
+  updateQuestionField(id, 'description', value), []);

-const handleItemsChange = (id: number) => (items: { value: string }[]) =>
-  updateQuestionField(id, 'items', items);
+const handleItemsChange = useCallback((id: number) => (items: { value: string }[]) =>
+  updateQuestionField(id, 'items', items), []);
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 39-40: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L39-L40
Added lines #L39 - L40 were not covered by tests


[warning] 42-43: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L42-L43
Added lines #L42 - L43 were not covered by tests


[warning] 45-46: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L45-L46
Added lines #L45 - L46 were not covered by tests


48-65: 타입 변경 로직의 복잡성을 개선할 수 있습니다.

현재 로직은 정확하지만 가독성 향상을 위해 리팩토링을 고려해보세요.

const handleTypeChange = (id: number) => (newType: QuestionType) => {
+  const isChoiceType = newType === 'CHOICE' || newType === 'MULTI_CHOICE';
+  const getDefaultItems = (currentItems: { value: string }[] | undefined) => {
+    if (!isChoiceType) return undefined;
+    return currentItems && currentItems.length >= 2 
+      ? currentItems 
+      : [{ value: '' }, { value: '' }];
+  };
+
  setFormData((prev) => ({
    ...prev,
    questions: prev.questions.map((q) => {
      if (q.id !== id) return q;
-      const isChoice = newType === 'CHOICE' || newType === 'MULTI_CHOICE';
      return {
        ...q,
        type: newType,
-        items: isChoice
-          ? q.items && q.items.length >= 2
-            ? q.items
-            : [{ value: '' }, { value: '' }]
-          : undefined,
+        items: getDefaultItems(q.items),
      };
    }),
  }));
};
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 48-49: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L48-L49
Added lines #L48 - L49 were not covered by tests


[warning] 54-54: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L54
Added line #L54 was not covered by tests


1-109: 테스트 커버리지 개선이 필요합니다.

정적 분석에서 지적한 대로 새로운 컴포넌트에 대한 테스트 커버리지가 부족합니다. 핵심 기능들에 대한 단위 테스트 작성을 권장합니다.

이 컴포넌트의 주요 기능들(상태 업데이트, 핸들러 동작 등)에 대한 테스트 코드 작성을 도와드릴까요?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 4-5: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L4-L5
Added lines #L4 - L5 were not covered by tests


[warning] 8-8: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L8
Added line #L8 was not covered by tests


[warning] 10-12: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L10-L12
Added lines #L10 - L12 were not covered by tests


[warning] 14-15: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L14-L15
Added lines #L14 - L15 were not covered by tests


[warning] 19-19: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L19
Added line #L19 was not covered by tests


[warning] 24-24: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L24
Added line #L24 was not covered by tests


[warning] 32-33: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L32-L33
Added lines #L32 - L33 were not covered by tests


[warning] 39-40: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L39-L40
Added lines #L39 - L40 were not covered by tests


[warning] 42-43: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L42-L43
Added lines #L42 - L43 were not covered by tests


[warning] 45-46: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L45-L46
Added lines #L45 - L46 were not covered by tests


[warning] 48-49: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L48-L49
Added lines #L48 - L49 were not covered by tests


[warning] 54-54: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L54
Added line #L54 was not covered by tests


[warning] 67-68: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L67-L68
Added lines #L67 - L68 were not covered by tests


[warning] 76-76: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L76
Added line #L76 was not covered by tests


[warning] 82-82: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L82
Added line #L82 was not covered by tests


[warning] 87-87: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L87
Added line #L87 was not covered by tests


[warning] 108-108: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L108
Added line #L108 was not covered by tests

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 90eb677 and 6b43dba.

📒 Files selected for processing (1)
  • frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx (1 hunks)
🧰 Additional context used
🪛 GitHub Check: codecov/patch
frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx

[warning] 4-5: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L4-L5
Added lines #L4 - L5 were not covered by tests


[warning] 8-8: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L8
Added line #L8 was not covered by tests


[warning] 10-12: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L10-L12
Added lines #L10 - L12 were not covered by tests


[warning] 14-15: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L14-L15
Added lines #L14 - L15 were not covered by tests


[warning] 19-19: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L19
Added line #L19 was not covered by tests


[warning] 24-24: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L24
Added line #L24 was not covered by tests


[warning] 32-33: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L32-L33
Added lines #L32 - L33 were not covered by tests


[warning] 39-40: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L39-L40
Added lines #L39 - L40 were not covered by tests


[warning] 42-43: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L42-L43
Added lines #L42 - L43 were not covered by tests


[warning] 45-46: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L45-L46
Added lines #L45 - L46 were not covered by tests


[warning] 48-49: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L48-L49
Added lines #L48 - L49 were not covered by tests


[warning] 54-54: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L54
Added line #L54 was not covered by tests


[warning] 67-68: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L67-L68
Added lines #L67 - L68 were not covered by tests


[warning] 76-76: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L76
Added line #L76 was not covered by tests


[warning] 82-82: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L82
Added line #L82 was not covered by tests


[warning] 87-87: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L87
Added line #L87 was not covered by tests


[warning] 108-108: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L108
Added line #L108 was not covered by tests

🔇 Additional comments (4)
frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx (4)

15-17: 상태 초기화 로직이 잘 구현되었습니다.

mock 데이터가 있으면 사용하고, 없으면 INITIAL_FORM_DATA로 폴백하는 로직이 적절합니다. nullish coalescing 연산자 사용도 좋습니다.


19-30: 타입 안전한 제네릭 함수가 잘 구현되었습니다.

updateQuestionField 함수는 제네릭을 활용하여 타입 안전성을 보장하면서도 재사용 가능한 유틸리티 함수로 잘 설계되었습니다.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 19-19: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L19
Added line #L19 was not covered by tests


[warning] 24-24: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L24
Added line #L24 was not covered by tests


76-105: 렌더링 로직이 잘 구조화되어 있습니다.

컴포넌트 구조가 명확하고 props 전달도 적절합니다. QuestionBuilder 컴포넌트에 필요한 모든 데이터와 핸들러를 올바르게 전달하고 있습니다.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 76-76: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L76
Added line #L76 was not covered by tests


[warning] 82-82: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L82
Added line #L82 was not covered by tests


[warning] 87-87: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L87
Added line #L87 was not covered by tests


67-74:

Details

❌ Incorrect review comment

옵션 객체 안전성을 검증해보세요.

q.options이 undefined일 가능성을 고려하여 안전한 접근을 보장해야 합니다.

다음 스크립트로 Question 타입의 options 필드가 optional인지 확인해보겠습니다:


🏁 Script executed:

#!/bin/bash
# Question 타입에서 options 필드가 optional인지 확인
ast-grep --pattern 'interface Question {
  $$$
  options$_: $$$
}'

Length of output: 68


다음 스크립트를 실행하여 Question 타입 정의와 options 필드의 optional 여부를 확인해 주세요:


🏁 Script executed:

#!/bin/bash
# Question 타입 정의와 options 필드 확인
rg -n "interface Question" -A 10

Length of output: 6197


불필요한 안전성 검증 제안입니다.
frontend/src/types/application.tsfrontend/src/mocks/data/mockData.ts 에서 Question.options 필드는 옵셔널이 아닌 필수 필드로 정의되어 있어(options: { required: boolean }), 런타임에 undefined가 될 일이 없습니다. 해당 접근은 안전하며 추가 검증은 불필요합니다.

Likely an incorrect or invalid review comment.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 67-68: frontend/src/pages/AdminPage/application/CreateApplicationForm.tsx#L67-L68
Added lines #L67 - L68 were not covered by tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FE Frontend ✨ Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] FE-127 지원서 작성 탭 UI 완성하기

2 participants

Comments