-
Notifications
You must be signed in to change notification settings - Fork 1
[WIP]예약 내역 페이지 구현 #18
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
Conversation
|
/gemini-code-assist 코드 리뷰 |
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.
Code Review
안녕하세요. 예약 내역 페이지 구현을 위한 PR 잘 보았습니다. 달력 기반의 UI와 반응형 처리를 위한 컴포넌트 구조화 등 많은 노력이 엿보입니다. 전반적으로 코드가 잘 작성되었지만, 몇 가지 개선점을 발견하여 리뷰를 남깁니다. 주요 내용은 코드 중복 제거, 로직 추상화, 용어 통일성 확보 등입니다. 자세한 내용은 각 파일에 남긴 코멘트를 참고해주세요.
| const [current, setCurrent] = useState({ | ||
| year: today.getFullYear(), | ||
| month: today.getMonth(), | ||
| }); | ||
|
|
||
| const calendarDates = getMonthCalendar(current.year, current.month); | ||
| const reservationMap = mapReservationsToCalendar(reservations); | ||
|
|
||
| const handlePrev = () => { | ||
| setCurrent((prev) => { | ||
| const date = new Date(prev.year, prev.month - 1, 1); | ||
| return { year: date.getFullYear(), month: date.getMonth() }; | ||
| }); | ||
| }; | ||
|
|
||
| const handleNext = () => { | ||
| setCurrent((prev) => { | ||
| const date = new Date(prev.year, prev.month + 1, 1); | ||
| return { year: date.getFullYear(), month: date.getMonth() }; | ||
| }); | ||
| }; |
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.
이 컴포넌트 내부에 월/년을 관리하는 로직(current state, handlePrev, handleNext)이 직접 구현되어 있습니다. 함께 추가된 useCalendar 훅이 정확히 동일한 기능을 제공하므로, 이 훅을 사용하여 로직을 분리하고 코드 중복을 줄이는 것이 좋습니다. 이렇게 하면 컴포넌트가 더 간결해지고 재사용성이 높아집니다.
useCalendar 훅을 사용하도록 리팩터링한 후, CalendarHeader 컴포넌트에 전달하는 props도 year, month, onPrev: prevMonth, onNext: nextMonth로 업데이트해야 합니다.
| const [current, setCurrent] = useState({ | |
| year: today.getFullYear(), | |
| month: today.getMonth(), | |
| }); | |
| const calendarDates = getMonthCalendar(current.year, current.month); | |
| const reservationMap = mapReservationsToCalendar(reservations); | |
| const handlePrev = () => { | |
| setCurrent((prev) => { | |
| const date = new Date(prev.year, prev.month - 1, 1); | |
| return { year: date.getFullYear(), month: date.getMonth() }; | |
| }); | |
| }; | |
| const handleNext = () => { | |
| setCurrent((prev) => { | |
| const date = new Date(prev.year, prev.month + 1, 1); | |
| return { year: date.getFullYear(), month: date.getMonth() }; | |
| }); | |
| }; | |
| const { year, month, prevMonth, nextMonth } = useCalendar( | |
| today.getFullYear(), | |
| today.getMonth(), | |
| ); | |
| const calendarDates = getMonthCalendar(year, month); | |
| const reservationMap = mapReservationsToCalendar(reservations); |
…-gn/GlobalNomad into feat/ReserVationStatusPage
🎯 작업 내용
예약 현황을 달력 형태로 볼 수 있는 화면을 만들었습니다
날짜를 누르면
→ 그 날짜에 있는 예약 목록이 오른쪽에 창(모달)으로 나타납니다
예약 상태(신청 / 승인 / 거절)를 색깔과 숫자 배지로 표시
날짜를 다시 누르면 열려 있던 창이 닫혀요
✅ 체크리스트
📸 스크린샷 (선택사항)
수정전

수정 후

모달 나오는 위치 날짜 박스의 좌표값을 활용하였습니다

드롭다운 펼쳤을떄
💬 추가 설명
화면(UI)을 먼저 만들고, 그 다음에 기능을 하나씩 붙이는 방식으로 작업했습니다
나중에 **실제 서버 데이터(API)**로 쉽게 바꿀 수 있게
→ 지금은 mock 데이터를 사용하고 있습니다
달력, 날짜 칸, 예약 목록을 각각 다른 컴포넌트로 나눠서 만들었습니다