Skip to content

feat: 대시보드 메인페이지 API 연동#124

Merged
Yejiin21 merged 8 commits intodevelopfrom
feat/#123/dashboard-mainPage-api
May 13, 2025
Merged

feat: 대시보드 메인페이지 API 연동#124
Yejiin21 merged 8 commits intodevelopfrom
feat/#123/dashboard-mainPage-api

Conversation

@Yejiin21
Copy link
Copy Markdown
Contributor

@Yejiin21 Yejiin21 commented May 12, 2025

작업 사항

  • 호스트 대시보드 메인페이지 API 연동
  • 대시보드 체크리스트 데이터 유무에 따라 UI 설정
  • 날짜 포멧 데이터 설정

스크린샷 2025-05-12 오후 8 06 12

추후 리팩토링 할 부분

  • API return 타입을 대부분 response.data로 하고 각페이지마다 데이터를 불러올때 date.result.(변수명)으로 설정. 하지만 일부분에서는 response.data.result로 API return 타입을 설정하여서 타입 통일을 할 필요가 있다.

Summary by CodeRabbit

  • 신규 기능

    • 호스트 대시보드 데이터를 조회하는 API 및 커스텀 훅이 추가되었습니다.
    • 체크리스트 및 대시보드 페이지에서 호스트 대시보드 데이터를 활용하도록 개선되었습니다.
    • 날짜 선택 컴포넌트가 외부에서 날짜를 제어하고 변경 사항을 알릴 수 있도록 확장되었습니다.
  • 버그 수정

    • 이벤트 상세 페이지에서 이벤트 데이터 접근 방식이 일관되게 수정되었습니다.
    • 날짜 및 시간 포맷팅이 개선되어 일관된 형식으로 표시됩니다.
  • 리팩터링

    • 이벤트 정보 및 수정 페이지에서 이벤트 데이터 관리 방식이 명확하게 변경되었습니다.
    • 불필요한 유틸리티 함수가 제거되고, 관련 로직이 각 컴포넌트로 이동되었습니다.
  • 스타일

    • 체크리스트 진행률 표시 및 아이콘 표시가 조건에 따라 동적으로 변경됩니다.

@Yejiin21 Yejiin21 requested review from hyeeuncho and xaexunxang May 12, 2025 11:09
@Yejiin21 Yejiin21 self-assigned this May 12, 2025
@Yejiin21 Yejiin21 added the 🔧 Feature 기능 구현 label May 12, 2025
@Yejiin21 Yejiin21 linked an issue May 12, 2025 that may be closed by this pull request
3 tasks
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented May 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

이 변경사항은 이벤트 상세 API 반환 구조를 수정하고, 호스트 대시보드 기능을 추가하며, 날짜 선택기와 대시보드 관련 컴포넌트의 데이터 흐름을 개선합니다. 또한, 이벤트 정보 관리 페이지에서 날짜 상태를 명시적으로 관리하도록 리팩토링하고, 불필요해진 이벤트 포맷팅 유틸리티를 삭제하였습니다.

Changes

파일/경로 그룹 변경 요약
src/entities/event/api/event.ts eventDetail 함수가 response.data.result 대신 response.data 전체를 반환하도록 수정. searchEvents 함수 시그니처를 가독성 좋게 개행.
src/entities/event/hook/useEventHook.ts useEventDetail 훅 내 일부 라인에서 불필요한 공백 제거.
src/entities/host/api/hostDashboard.ts
src/entities/host/hook/hostDashboardHook.ts
src/entities/host/model/hostDashboard.ts
호스트 대시보드 API 함수, 관련 타입, 커스텀 훅(useHostDashboard) 추가.
src/features/dashboard/ui/Checklist.tsx useHostDashboard 훅 사용, 체크리스트 진행 상태 로직 추가, 네비게이션 시 refetch 호출 추가, 진행 바 3→4단계로 확장.
src/pages/dashboard/ui/DashbaordPage.tsx useGetEventHookuseHostDashboard로 데이터 소스 변경, 변수명 및 참조 업데이트.
src/pages/event/ui/EventDetailsPage.tsx 이벤트 데이터 접근을 event.result로 일괄 변경.
src/widgets/dashboard/ui/EventOverview.tsx prop 타입을 dashboardDataHostDashboardResponse로 변경, 날짜/시간 포맷팅 함수 적용.
src/features/event-manage/event-create/ui/DatePicker.tsx DatePickerPropsstartDate, endDate, 변경 콜백 추가, 내부 상태 관리 및 외부와 동기화 로직 개선.
src/pages/dashboard/ui/EventDetailPage.tsx 이벤트 수정 요청 시 직접 객체 생성 방식으로 변경, 기존 포맷팅 함수 제거.
src/pages/dashboard/ui/EventInfoPage.tsx 날짜 상태를 명시적으로 관리, 이벤트 수정 요청 방식 단순화, EventDatePicker에 컨트롤드 props 적용.
src/shared/lib/formatEventRequest.ts 이벤트 데이터 포맷팅 유틸리티 함수 및 파일 삭제.

Sequence Diagram(s)

sequenceDiagram
    participant DashboardPage
    participant useHostDashboard
    participant hostDashboard API
    participant EventOverview

    DashboardPage->>useHostDashboard: 호출
    useHostDashboard->>hostDashboard API: eventId로 데이터 요청
    hostDashboard API-->>useHostDashboard: HostDashboardResponse 반환
    useHostDashboard-->>DashboardPage: data, refetch 반환
    DashboardPage->>EventOverview: eventInfo={data}
Loading
sequenceDiagram
    participant EventInfoPage
    participant EventDatePicker

    EventInfoPage->>EventDatePicker: startDate, endDate, onStartDateChange, onEndDateChange 전달
    EventDatePicker-->>EventInfoPage: 날짜 변경 시 콜백 호출
    EventInfoPage->>EventDatePicker: 상태 업데이트
Loading

Possibly related PRs

Suggested reviewers

  • xaexunxang

Poem

🐰
대시보드에 햇살이,
이벤트 정보 쏙쏙 담아
날짜도 콕, 체크리스트도 똑!
새 훅과 타입이 춤을 추네,
오래된 유틸은 안녕~
토끼는 깡충, 코드도 깔끔!
🎉

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ee6d293 and a8c5924.

📒 Files selected for processing (13)
  • src/entities/event/api/event.ts (1 hunks)
  • src/entities/event/hook/useEventHook.ts (1 hunks)
  • src/entities/host/api/hostDashboard.ts (1 hunks)
  • src/entities/host/hook/hostDashboardHook.ts (1 hunks)
  • src/entities/host/model/hostDashboard.ts (1 hunks)
  • src/features/dashboard/ui/Checklist.tsx (2 hunks)
  • src/features/event-manage/event-create/ui/DatePicker.tsx (3 hunks)
  • src/pages/dashboard/ui/DashbaordPage.tsx (1 hunks)
  • src/pages/dashboard/ui/EventDetailPage.tsx (2 hunks)
  • src/pages/dashboard/ui/EventInfoPage.tsx (4 hunks)
  • src/pages/event/ui/EventDetailsPage.tsx (2 hunks)
  • src/shared/lib/formatEventRequest.ts (0 hunks)
  • src/widgets/dashboard/ui/EventOverview.tsx (2 hunks)
✨ 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • 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

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.

@github-actions
Copy link
Copy Markdown

Copy link
Copy Markdown

@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: 5

🔭 Outside diff range comments (1)
src/pages/event/ui/EventDetailsPage.tsx (1)

39-46: ⚠️ Potential issue

데이터 접근 방식에 일관성 없음

여기 북마크 관련 처리에서 일관성 문제가 있습니다. 북마크 여부 확인 시에는 event.bookmarkedevent.bookmarkId를 사용하지만, 실제 함수 호출에서는 event.result.idevent.result.bookmarkId를 사용합니다.

다음과 같이 모든 event 데이터 접근을 일관되게 수정하세요:

  const handleLikeClick = () => {
-    if (event.bookmarked) {
-      if (event.bookmarkId === null) {
+    if (event.result.bookmarked) {
+      if (event.result.bookmarkId === null) {
        return;
      }
      deleteBookmark({ eventId: event.result.id, bookmarkId: event.result.bookmarkId });
    } else {
      createBookmark(event.result.id);
    }
  };
🧹 Nitpick comments (2)
src/pages/dashboard/ui/DashbaordPage.tsx (1)

27-28: 판매 금액 표시에 적절한 fallback 처리가 되었습니다.

데이터가 없을 경우의 fallback 처리가 잘 되어 있습니다.

파일 이름에 오타가 있습니다: DashbaordPage.tsxDashboardPage.tsx로 수정하는 것이 좋습니다.

src/entities/host/model/hostDashboard.ts (1)

1-9: 인터페이스 명확성 개선 제안

인터페이스 구조는 명확하지만, 각 필드에 대한 설명이 없어 특히 ticketOptionticket 불리언 필드의 목적이 불분명합니다.

아래와 같이 JSDoc 주석을 추가하여 각 필드의 용도를 명확히 하는 것이 좋습니다:

+/**
+ * 호스트 대시보드 응답 데이터 인터페이스
+ */
 export interface HostDashboardResponse {
+  /** 이벤트 이름 */
   eventName: string;
+  /** 이벤트 시작 일시 (ISO 8601 형식) */
   eventStartDate: string;
+  /** 이벤트 종료 일시 (ISO 8601 형식) */
   eventEndDate: string;
+  /** 총 티켓 수량 */
   totalTicketCnt: number;
+  /** 총 가격 */
   totalPrice: number;
+  /** 티켓 옵션 활성화 여부 */
   ticketOption: boolean;
+  /** 티켓 생성 여부 */
   ticket: boolean;
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 92c43d1 and 5252efe.

📒 Files selected for processing (10)
  • src/entities/event/api/event.ts (1 hunks)
  • src/entities/event/hook/useEventHook.ts (1 hunks)
  • src/entities/host/api/hostDashboard.ts (1 hunks)
  • src/entities/host/hook/hostDashboardHook.ts (1 hunks)
  • src/entities/host/model/hostDashboard.ts (1 hunks)
  • src/features/dashboard/ui/Checklist.tsx (2 hunks)
  • src/pages/dashboard/ui/DashbaordPage.tsx (1 hunks)
  • src/pages/event/ui/EventDetailsPage.tsx (2 hunks)
  • src/pages/search/ui/SearchPage.tsx (1 hunks)
  • src/widgets/dashboard/ui/EventOverview.tsx (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
src/entities/event/hook/useEventHook.ts (1)
src/entities/event/api/event.ts (1)
  • eventDetail (7-12)
src/entities/event/api/event.ts (3)
src/entities/event/model/event.ts (2)
  • PaginationParams (19-22)
  • EventItem (30-34)
src/shared/types/api/apiResponse.ts (1)
  • ApiResponse (1-5)
src/shared/types/api/http-client.ts (1)
  • axiosClient (6-13)
src/entities/host/api/hostDashboard.ts (3)
src/shared/types/api/http-client.ts (1)
  • axiosClient (6-13)
src/shared/types/api/apiResponse.ts (1)
  • ApiResponse (1-5)
src/entities/host/model/hostDashboard.ts (1)
  • HostDashboardResponse (1-9)
src/widgets/dashboard/ui/EventOverview.tsx (2)
src/entities/host/model/hostDashboard.ts (1)
  • HostDashboardResponse (1-9)
src/shared/lib/date.ts (2)
  • formatDate (1-9)
  • formatTime (10-15)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: storybook
🔇 Additional comments (17)
src/pages/search/ui/SearchPage.tsx (1)

85-85: EventCard 컴포넌트에 id prop 추가 구현이 잘되었습니다.

이벤트 카드에 id prop을 추가한 변경사항은 PR 목표에 맞게 API 응답 데이터 구조 표준화를 지원합니다. 이것은 향후 API 반환 타입을 일관되게 만들기 위한 좋은 단계입니다.

src/pages/dashboard/ui/DashbaordPage.tsx (5)

7-8: 새로운 useHostDashboard 훅 import 잘 구현되었습니다.

대시보드 페이지에서 새롭게 구현된 useHostDashboard 훅을 import하는 변경이 적절하게 이루어졌습니다.


10-10: useHostDashboard 훅 사용으로 변경 잘 적용되었습니다.

기존 훅에서 새로운 useHostDashboard 훅으로의 변경이 깔끔하게 이루어졌습니다.


15-15: 이벤트 이름 표시에 대한 fallback 처리가 적절합니다.

데이터가 없을 경우의 fallback 텍스트 처리가 잘 되어 있습니다.


17-17: EventOverview 컴포넌트에 데이터 전달 방식 변경이 잘 적용되었습니다.

새로운 데이터 구조에 맞게 eventInfo 속성에 data를 전달하도록 변경되었습니다.


22-23: 티켓 판매 수 표시에 적절한 fallback 처리가 되었습니다.

데이터가 없을 경우의 fallback 처리가 잘 되어 있습니다.

src/entities/event/api/event.ts (2)

15-18: 함수 시그니처 개선

searchEvents 함수의 시그니처가 가독성 있게 재구성되었습니다. 가독성이 좋아졌네요!


7-11:

Details

✅ Verification successful

API 반환 패턴 변경에 대한 주의

eventDetail 함수가 이전에는 response.data.result를 반환했을 것으로 추정되나, 이제 response.data 전체를 반환하도록 변경되었습니다. 이는 PR 설명에서 언급된 API 반환 타입 통일을 위한 일부로 보입니다.

이 변경으로 인해 eventDetail 함수를 사용하는 컴포넌트에서는 데이터 접근 방식을 수정해야 할 수 있습니다:


🏁 Script executed:

#!/bin/bash
# eventDetail 함수 사용 패턴 확인
echo "eventDetail 함수 사용 패턴 확인..."
rg -A 3 "eventDetail\(" src/

Length of output: 348


🏁 Script executed:

#!/bin/bash
# useEventHook.ts 전체 내용 확인
cat src/entities/event/hook/useEventHook.ts

Length of output: 609


🏁 Script executed:

#!/bin/bash
# useEventDetail 훅 사용 위치 확인
echo "useEventDetail 사용 위치 검색 중..."
rg -n "useEventDetail" src/

Length of output: 839


🏁 Script executed:

#!/bin/bash
# 페이지에서 eventDetail 반환값 사용 방식 확인
echo "=== EventInfoPage.tsx ==="
cat src/pages/dashboard/ui/EventInfoPage.tsx
echo ""
echo "=== EventDetailPage.tsx ==="
cat src/pages/dashboard/ui/EventDetailPage.tsx
echo ""
echo "=== EventDetailsPage.tsx ==="
cat src/pages/event/ui/EventDetailsPage.tsx

Length of output: 13844


eventDetail 반환 형태 확인 완료 – 변경 반영됨

eventDetail이 이제 response.data 전체를 반환하고, 이를 사용하는 훅과 페이지들에서 모두 data?.result로 접근하도록 이미 업데이트된 것을 확인했습니다. 추가 수정이 필요 없습니다.

src/widgets/dashboard/ui/EventOverview.tsx (3)

1-2: 적절한 타입 및 유틸리티 함수 가져오기

기존 dashboardData 타입 대신 HostDashboardResponse 타입을 사용하고, 날짜 형식화를 위한 유틸리티 함수를 가져오도록 변경되었습니다. 이는 올바른 접근법입니다.


4-4: 컴포넌트 프롭 타입 업데이트

컴포넌트 프롭 타입이 새로운 HostDashboardResponse 인터페이스에 맞게 올바르게 업데이트되었습니다.


18-27: 날짜 형식화 개선

날짜 표시 방식이 하드코딩된 문자열 연결에서 재사용 가능한 유틸리티 함수를 사용하는 방식으로 개선되었습니다. 이런 접근법은 날짜 형식을 일관되게 유지하는 데 도움이 됩니다.

조건부 렌더링도 적절하게 처리되어 eventInfo가 없을 경우 "날짜 정보 없음"을 표시합니다.

src/pages/event/ui/EventDetailsPage.tsx (1)

68-120: 이벤트 데이터 접근 개선

이벤트 데이터를 event.result 객체를 통해 일관되게 접근하도록 수정한 것이 좋습니다. 이는 PR 목표에 언급된 API 반환 타입 통일화 작업과 일치합니다.

src/features/dashboard/ui/Checklist.tsx (5)

3-6: 리소스 및 훅 추가 적절

완료 상태를 표시하기 위한 아이콘과 대시보드 데이터를 가져오기 위한 훅을 적절하게 추가했습니다.


11-11: 대시보드 데이터 사용 구현

호스트 대시보드 데이터를 가져오기 위한 훅 사용이 적절합니다. 데이터와 함께 refetch 함수도 가져와 상태 업데이트에 활용하고 있습니다.


32-35: 네비게이션 처리 함수 적절

네비게이션 전 데이터를 다시 가져오는 함수가 적절하게 구현되었습니다. 페이지 이동 시 최신 상태를 유지하는 데 도움이 됩니다.


44-49: 진행 상태 표시 UI 구현 적절

진행 상태에 따라 프로그레스 바의 색상이 변경되도록 구현이 잘 되었습니다. 사용자에게 시각적 피드백을 적절히 제공합니다.


53-58: 체크리스트 아이콘 조건부 표시 적절

완료 상태에 따라 체크 아이콘을 다르게 표시하는 구현이 잘 되었습니다. 사용자에게 명확한 시각적 피드백을 제공합니다.

Comment on lines +14 to +15
queryFn: () => eventDetail({ eventId, userId: user?.id }),
enabled: !!user?.id,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

공백 제거 변경이 잘 적용되었습니다.

이 부분의 변경은 단순 공백 제거에 불과하지만, eventDetail API 함수의 반환 구조 변경(response.data.result → response.data)과 연관되어 있습니다. 현재 이 훅 자체는 큰 수정이 필요하지 않았지만, 이 훅을 사용하는 컴포넌트들이 데이터 접근 방식을 적절히 수정했는지 확인해주세요.


🏁 Script executed:

#!/bin/bash
# 이 훅을 사용하는 컴포넌트 검색
echo "useEventDetail 훅을 사용하는 파일 검색:"
rg -l "useEventDetail" --type tsx

Length of output: 130


🏁 Script executed:

#!/bin/bash
# useEventHook 훅을 사용하는 컴포넌트 검색
echo "useEventHook 훅을 사용하는 파일 검색:"
rg -l "useEventHook" -g '*.{ts,tsx}'

Length of output: 318


🏁 Script executed:

#!/bin/bash
# data.result 사용 여부 검색
echo "data.result 사용 검색:"
rg -n "data\\.result" -g '*.{ts,tsx}'

Length of output: 2536


eventDetail 반환 구조 변경에 따른 컴포넌트 수정 필요

response.data.resultresponse.data로 API 반환값이 바뀌었으므로, 아직 data.result를 참조하고 있는 컴포넌트들을 직접 data로 참조하도록 수정해야 합니다. 다음 파일들을 점검 및 리팩토링해 주세요:

  • src/widgets/event/ui/TicketInfo.tsx
  • src/pages/dashboard/ui/EventInfoPage.tsx
  • src/pages/dashboard/ui/ticket/TicketListPage.tsx
  • src/pages/dashboard/ui/EventDetailPage.tsx
  • 기타 data.result를 사용 중인 파일들 (rg 결과 참조)

수정 예시:

- const tickets = data.result;
+ const tickets = data;

위 파일들의 모든 data.result 참조를 data로 교체하고, 맵핑 로직이나 변수명도 일관되게 업데이트해 주세요.

Committable suggestion skipped: line range outside the PR's diff.

@github-actions
Copy link
Copy Markdown

Copy link
Copy Markdown

@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

🧹 Nitpick comments (1)
src/pages/dashboard/ui/EventDetailPage.tsx (1)

35-52: UpdateEventRequest 객체 구성이 체계적으로 구현됨

기존 formatEventRequest 유틸리티 함수 대신 명시적으로 UpdateEventRequest 객체를 구성하는 방식으로 변경한 것이 좋습니다. 각 필드마다 fallback 값을 제공하여 데이터 무결성을 보장하고 있습니다.

다만, data.result가 존재하는지 확인하는 방어적인 코드가 추가되면 더 안전할 것 같습니다.

 const requestData: UpdateEventRequest = {
-  hostChannelId: data.result.hostChannelId || hostChannelId,
+  hostChannelId: data?.result?.hostChannelId || hostChannelId,
   title: data.result.title,
   startDate: data.result.startDate,
   endDate: data.result.endDate,
   // ... 다른 필드들
 };
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5252efe and ee6d293.

📒 Files selected for processing (6)
  • src/entities/host/hook/hostDashboardHook.ts (1 hunks)
  • src/features/dashboard/ui/Checklist.tsx (2 hunks)
  • src/features/event-manage/event-create/ui/DatePicker.tsx (3 hunks)
  • src/pages/dashboard/ui/EventDetailPage.tsx (2 hunks)
  • src/pages/dashboard/ui/EventInfoPage.tsx (4 hunks)
  • src/shared/lib/formatEventRequest.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • src/shared/lib/formatEventRequest.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/entities/host/hook/hostDashboardHook.ts
  • src/features/dashboard/ui/Checklist.tsx
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/pages/dashboard/ui/EventDetailPage.tsx (2)
src/features/dashboard/model/event.ts (1)
  • UpdateEventRequest (3-10)
src/shared/types/baseEventType.ts (1)
  • OnlineType (1-1)
src/pages/dashboard/ui/EventInfoPage.tsx (2)
src/features/dashboard/model/event.ts (1)
  • UpdateEventRequest (3-10)
src/shared/types/baseEventType.ts (1)
  • OnlineType (1-1)
🔇 Additional comments (15)
src/pages/dashboard/ui/EventDetailPage.tsx (2)

10-11: 적절한 import 추가

새로운 타입을 가져오는 import 문이 깔끔하게 추가되었습니다.


54-54: mutate 호출 구조 변경

요청 데이터를 명시적으로 전달하는 방식으로 변경되었습니다. 이는 코드의 가독성과 유지보수성을 향상시킵니다.

src/pages/dashboard/ui/EventInfoPage.tsx (6)

13-13: 필요한 타입 import 추가

UpdateEventRequest 타입을 명시적으로 가져와서 타입 안정성을 높였습니다.


35-36: 날짜 상태 변수의 명시적 관리

startDateendDate 상태 변수를 추가하여 날짜 정보를 명시적으로 관리하는 것은 좋은 개선입니다. 이를 통해 날짜 정보의 관리가 더 명확해집니다.


41-58: UpdateEventRequest 객체 구성이 개선됨

이전의 formatEventRequest 유틸리티 함수 대신 명시적으로 UpdateEventRequest 객체를 구성하는 방식으로 변경한 것이 좋습니다. 각 필드마다 현재 상태 값과 data.result의 값을 적절하게 체크하고 fallback을 제공하고 있습니다.


60-68: 에러 핸들링 개선

에러 발생 시 console.error를 통해 자세한 에러 정보를 로깅하는 기능이 추가되었습니다. 이는 디버깅과 문제 해결에 큰 도움이 됩니다.


85-86: 상태 초기화 로직 추가

useEffect 내에서 startDate와 endDate 상태를 초기화하는 로직이 추가되었습니다. 이는 데이터가 로드될 때 적절하게 상태를 설정하기 위한 중요한 부분입니다.


101-106: DatePicker 컴포넌트 사용 방식 개선

EventDatePicker 컴포넌트에 startDate, endDate 및 변경 핸들러를 명시적으로 전달하여 제어 컴포넌트 방식으로 사용하는 것으로 변경되었습니다. 이는 상태 관리를 더 명확하게 하고 코드의 가독성을 높입니다.

src/features/event-manage/event-create/ui/DatePicker.tsx (7)

11-14: DatePickerProps 인터페이스 확장

컴포넌트의 재사용성을 높이기 위해 인터페이스에 새로운 속성들을 추가한 것은 좋은 개선입니다. 이를 통해 제어 컴포넌트 방식으로도 사용할 수 있게 되었습니다.


18-27: 컴포넌트 파라미터 구조 개선

새로 추가된 속성들을 반영하여 컴포넌트 파라미터 구조를 업데이트했습니다. 이름을 initialStartDate와 initialEndDate로 변경하여 의도를 더 명확하게 표현했습니다.


28-29: 상태 초기화 방식 개선

Date 객체를 null로 초기화하는 것은 적절한 방식입니다. 이전에는 빈 문자열로 초기화되어 있었을 수 있는데, Date 객체에 대해 null을 사용하는 것이 더 의미론적으로 맞습니다.


33-52: useEffect를 통한 날짜 상태 동기화 로직

컴포넌트가 두 가지 방식(eventState와 props)으로 동작할 수 있도록 useEffect를 사용하여 날짜 상태를 동기화하는 로직이 잘 구현되었습니다. 기존 코드와의 호환성을 유지하면서 새로운 기능을 추가한 좋은 예입니다.


59-59: 시간 옵션 포맷팅 수정

padStart를 사용하여 시간 옵션의 분 값을 포맷팅하도록 수정한 것은 좋은 개선입니다. 이렇게 하면 "0:0"과 같은 형식 대신 "00:00"과 같이 일관된 형식의 시간 문자열을 얻을 수 있습니다.


82-97: 조건부 상태 업데이트 및 콜백 호출

setEventState와 onStartDateChange, onEndDateChange 콜백을 조건부로 호출하는 로직이 잘 구현되어 있습니다. 이를 통해 컴포넌트가 두 가지 사용 방식(내부 상태 관리와 외부 제어)을 모두 지원할 수 있게 되었습니다.


98-98: 의존성 배열 업데이트

useEffect의 의존성 배열에 새로운 콜백 함수들을 추가한 것은 적절합니다. 이를 통해 콜백 함수가 변경될 때마다 effect가 다시 실행되어 최신 상태를 유지할 수 있습니다.

Comment on lines +79 to +80
const startISO = new Date(start.getTime() + 9 * 60 * 60 * 1000).toISOString();
const endISO = new Date(end.getTime() + 9 * 60 * 60 * 1000).toISOString();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

타임존 처리 관련 고려사항

날짜에 9시간을 더하는 방식으로 타임존 처리를 하고 있는데, 이는 한국 시간(KST, UTC+9)을 위한 것으로 보입니다. 하지만 이러한 하드코딩된 시간 조정은 문제가 될 수 있습니다.

타임존 처리는 Date 객체의 메서드나 moment.js, date-fns와 같은 라이브러리를 사용하여 좀 더 명시적으로 처리하는 것이 좋습니다. 현재 방식은 다른 타임존의 사용자에게 혼란을 줄 수 있습니다.

- const startISO = new Date(start.getTime() + 9 * 60 * 60 * 1000).toISOString();
- const endISO = new Date(end.getTime() + 9 * 60 * 60 * 1000).toISOString();
+ // date-fns 사용 예시
+ import { format, addHours } from 'date-fns';
+ import { zonedTimeToUtc } from 'date-fns-tz';
+ 
+ const startISO = zonedTimeToUtc(start, 'Asia/Seoul').toISOString();
+ const endISO = zonedTimeToUtc(end, 'Asia/Seoul').toISOString();

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Copy Markdown
Member

@hyeeuncho hyeeuncho left a comment

Choose a reason for hiding this comment

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

고생하셨습니당

@Yejiin21 Yejiin21 force-pushed the feat/#123/dashboard-mainPage-api branch from ee6d293 to a8c5924 Compare May 13, 2025 07:35
@Yejiin21 Yejiin21 merged commit 328a3bf into develop May 13, 2025
1 of 2 checks passed
@Yejiin21 Yejiin21 deleted the feat/#123/dashboard-mainPage-api branch May 13, 2025 07:36
@github-actions
Copy link
Copy Markdown

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

Labels

🔧 Feature 기능 구현

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 대시보드 메인페이지 API 연동

2 participants