Skip to content

Commit

Permalink
Merge pull request #56 from Spaces-Place/dusqo
Browse files Browse the repository at this point in the history
step4 전역상태관리
  • Loading branch information
KangYeonbae authored Dec 4, 2024
2 parents 78c7379 + 5b423c7 commit b5fd9fd
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/components/steps/BookingStep4.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { PAYMENT_METHODS } from "../../constants/bookingIndex";
import { useSelector } from 'react-redux';

export const BookingStep4 = () => {
// Redux store에서 데이터 가져오기
const { bookingData, bookingInfo, totalPrice } = useSelector(state => state.booking);

export const BookingStep4 = ({ bookingData, bookingInfo, totalPrice }) => {
// 시간 포맷팅 함수
const formatTime = (timeString) => {
if (!timeString) return '-';
Expand All @@ -11,33 +15,35 @@ export const BookingStep4 = ({ bookingData, bookingInfo, totalPrice }) => {
});
};

// 디버깅용 콘솔 로그
console.log('step4 bookingData : ', bookingData);
console.log('step4 bookingInfo : ', bookingInfo);
console.log('step4 totalPrice : ', totalPrice);

return (
<div className="booking_step">
<h2 className="booking_step4-text">예약 확인</h2>
<div className="booking_step4-round">
<div>
<h3 className="booking_step4-booking-info">예약정보</h3>
<p>공간: {bookingInfo.title}</p>
<p>날짜: {bookingData.date}</p>
<p>시간: {formatTime(bookingData.start_time)} ~ {formatTime(bookingData.end_time)}</p>
<p>인원: {bookingData.numberOfPeople}</p>
{bookingData.requirements && (
<p>공간: {bookingInfo?.title}</p>
<p>날짜: {bookingData?.date}</p>
<p>시간: {formatTime(bookingData?.start_time)} ~ {formatTime(bookingData?.end_time)}</p>
<p>인원: {bookingData?.numberOfPeople}</p>
{bookingData?.requirements && (
<p>요청사항: {bookingData.requirements}</p>
)}
</div>
<div>
<h3 className="booking_step4-booking-people">예약자 정보</h3>
<p>이름: {bookingData.name}</p>
<p>연락처: {bookingData.phone}</p>
<p>이메일: {bookingData.email}</p>
<p>이름: {bookingData?.name}</p>
<p>연락처: {bookingData?.phone}</p>
<p>이메일: {bookingData?.email}</p>
</div>
<div>
<h3 className="booking_step4-booking-payment">결제 정보</h3>
<p>결제 금액: {totalPrice.toLocaleString()}</p>
<p>결제 수단: {PAYMENT_METHODS[bookingData.paymentMethod]}</p>
<p>결제 금액: {totalPrice?.toLocaleString()}</p>
<p>결제 수단: {PAYMENT_METHODS[bookingData?.paymentMethod]}</p>
</div>
</div>
</div>
Expand Down

0 comments on commit b5fd9fd

Please sign in to comment.