Skip to content

Commit

Permalink
Merge pull request #44 from Mallang-Trip/develop
Browse files Browse the repository at this point in the history
V0.0.34
  • Loading branch information
DaeHee99 authored Jan 22, 2024
2 parents f4b5b9e + 926c2c6 commit b496e59
Show file tree
Hide file tree
Showing 15 changed files with 336 additions and 63 deletions.
3 changes: 3 additions & 0 deletions src/api/party.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export const deleteProposalCancel = async (proposalId) =>
export const deleteQuitParty = async (partyId) =>
await DELETE(`/party/quit/${partyId}`, true);

export const deleteQuitReservationParty = async (partyId) =>
await DELETE(`/party/reservation/${partyId}`, true);

export const postNewParty = async (data) =>
await POST("/party/create", data, true);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { customRoundOne } from "../../../../../../../utils";

function ReservationItem({
selectPartyHandler,
partyId,
Expand Down Expand Up @@ -31,9 +33,12 @@ function ReservationItem({
<p className="text-xl font-bold">{name}</p>
<p className="text-sm">{`${startDate
.slice(5)
.replace("-", "/")} | ${headcount}/${capacity}명 | ${
.replace(
"-",
"/"
)} | ${headcount}/${capacity}명 | ${customRoundOne(
price / 10000
}만원 | ${driverName} 드라이버`}</p>
)}만원 | ${driverName} 드라이버`}</p>
</div>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/pages/LandingPage/PartyList/PartyBox/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useNavigate } from "react-router-dom";
import { customRoundOne } from "../../../../utils";

function PartyBox({
partyId,
Expand Down Expand Up @@ -28,9 +29,9 @@ function PartyBox({
<div className="w-full absolute bottom-0 left-0 flex justify-center text-white bg-black bg-opacity-50 py-1 rounded-b-lg">
{`${startDate
.slice(5)
.replace("-", "/")} | ${headcount}/${capacity}명 | ${
.replace("-", "/")} | ${headcount}/${capacity}명 | ${customRoundOne(
price / 10000
}만원`}
)}만원`}
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useNavigate } from "react-router-dom";
import { dateToStringHan } from "../../../../../utils";
import { customRoundOne, dateToStringHan } from "../../../../../utils";

const statusObj = {
RECRUITING: "가입 중",
Expand Down Expand Up @@ -44,9 +44,9 @@ function ReservationItem({
<p className="text-xl font-bold">{name}</p>
<p className="text-sm">{`${dateToStringHan(startDate).slice(
6
)} | ${headcount}/${capacity}명 | ${
)} | ${headcount}/${capacity}명 | ${customRoundOne(
(price * capacity) / 10000
}만원 | ${driverName} 드라이버`}</p>
)}만원 | ${driverName} 드라이버`}</p>
<p className="text-sm">{statusObj[status]}</p>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/pages/PartyHistoryPage/PartyItem/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useNavigate } from "react-router-dom";
import { customRoundOne } from "../../../utils";

function PartyItem({
partyId,
Expand Down Expand Up @@ -28,9 +29,9 @@ function PartyItem({
<div className="w-full absolute bottom-0 left-0 flex justify-center text-white bg-black bg-opacity-50 py-1 rounded-b-lg">
{`${startDate
.slice(5)
.replace("-", "/")} | ${headcount}/${capacity}명 | ${
.replace("-", "/")} | ${headcount}/${capacity}명 | ${customRoundOne(
price / 10000
}만원`}
)}만원`}
</div>
</div>
);
Expand Down
82 changes: 55 additions & 27 deletions src/pages/PartyPage/CreditInfo/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { useEffect, useState } from "react";
import { priceToString } from "../../../utils";
import { priceToString, dateToKoreanDataTime } from "../../../utils";

function CreditInfo({ totalPrice, capacity }) {
function CreditInfo({
totalPrice,
capacity,
partyStatus,
paymentAmount,
createdAt,
}) {
const [middleCount, setMiddleCount] = useState([]);

useEffect(() => {
Expand All @@ -15,35 +21,57 @@ function CreditInfo({ totalPrice, capacity }) {
return (
<>
<div className="flex flex-col gap-1 mt-7 mb-5">
<p className="text-lg text-black font-bold">예약금 결제</p>
<p className="text-sm text-darkgray font-medium">{`여행자 ${capacity}명 가입 즉시 또는 파티원 전원 말랑레디 완료 즉시 자동결제`}</p>
</div>
<div className="text-sm text-black font-medium">
<p>
여행자 <span className="text-primary">{`${capacity}명`}</span> 가입
즉시 인당{" "}
<span className="text-primary">{`${priceToString(
Math.floor(totalPrice / capacity)
)}원`}</span>
<p className="text-lg text-black font-bold">
예약금 결제
{partyStatus === "SEALED" && (
<span className="text-sm text-darkgray font-medium">
{` (${dateToKoreanDataTime(createdAt)} 결제 완료)`}
</span>
)}
</p>
{middleCount.map((count) => (
<p key={count}>
드라이버 + 여행자{" "}
<span className="text-primary">{`${count}명`}</span> 전원 말랑레디
완료 즉시 인당{" "}
{partyStatus === "SEALED" ? (
<p className="text-sm text-darkgray font-medium flex gap-8 items-center">
<span>{`${priceToString(paymentAmount)}원`}</span>
<button
className="underline underline-offset-2"
onClick={() => alert("현재는 지원하지 않습니다.")}
>
카드 영수증
</button>
</p>
) : (
<p className="text-sm text-darkgray font-medium">{`여행자 ${capacity}명 가입 즉시 또는 파티원 전원 말랑레디 완료 즉시 자동결제`}</p>
)}
</div>
{partyStatus !== "SEALED" && (
<div className="text-sm text-black font-medium">
<p>
여행자 <span className="text-primary">{`${capacity}명`}</span> 가입
즉시 인당{" "}
<span className="text-primary">{`${priceToString(
Math.floor(totalPrice / count)
Math.floor(totalPrice / capacity)
)}원`}</span>
</p>
))}
<p>
<span className="text-darkgray">독점 예약</span> 또는 드라이버 +
여행자 <span className="text-primary">1명</span> 전원 말랑레디 완료 시{" "}
<span className="text-primary">{`${priceToString(
totalPrice
)}원`}</span>
</p>
</div>
{middleCount.map((count) => (
<p key={count}>
드라이버 + 여행자{" "}
<span className="text-primary">{`${count}명`}</span> 전원 말랑레디
완료 즉시 인당{" "}
<span className="text-primary">{`${priceToString(
Math.floor(totalPrice / count)
)}원`}</span>
</p>
))}
<p>
<span className="text-darkgray">독점 예약</span> 또는 드라이버 +
여행자 <span className="text-primary">1명</span> 전원 말랑레디 완료
{" "}
<span className="text-primary">{`${priceToString(
totalPrice
)}원`}</span>
</p>
</div>
)}
<div className="flex flex-col gap-1 my-7">
<p className="text-lg text-black font-bold">
기한 상관 없이 타인이 예약 취소 시
Expand Down
23 changes: 23 additions & 0 deletions src/pages/PartyPage/DriverReview/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useNavigate } from "react-router-dom";
import { computeGapDay } from "../../../utils";

function DriverReview({ driverId, startDate }) {
const navigation = useNavigate();

if (computeGapDay(startDate) > 0) return null;
return (
<div className="my-7">
<p className="text-lg text-black font-bold">드라이버 리뷰를 남겨주세요</p>
<div className="my-2.5 flex justify-center sm:justify-start sm:ml-48 items-center">
<button
className="w-44 py-3 text-lg font-bold border rounded-full bg-primary text-white border-primary"
onClick={() => navigation(`/driver/profile/${driverId}`)}
>
리뷰 작성하기
</button>
</div>
</div>
);
}

export default DriverReview;
18 changes: 16 additions & 2 deletions src/pages/PartyPage/MallangReady/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@ import { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import { useSelector } from "react-redux";
import { putMallangReady } from "../../../api/party";
import { computeGapDay } from "../../../utils";
import WhatReady from "./WhatReady";

function MallangReady({ members, driverReady, getPartyData }) {
function MallangReady({
members,
driverReady,
getPartyData,
partyStatus,
startDate,
}) {
const user = useSelector((state) => state.user);
const { partyId } = useParams();
const [ready, setReady] = useState(false);
Expand All @@ -25,6 +32,8 @@ function MallangReady({ members, driverReady, getPartyData }) {
setReady(members.filter((item) => item.userId === user.userId)[0]?.ready);
}, []);

if (computeGapDay(startDate) <= 0 && partyStatus !== "RECRUITING")
return null;
return (
<div className="my-7">
<p className="text-lg text-black font-bold">말랑레디</p>
Expand All @@ -36,8 +45,13 @@ function MallangReady({ members, driverReady, getPartyData }) {
: "bg-white text-darkgray border-darkgray"
}`}
onClick={readyClickHandler}
disabled={partyStatus !== "RECRUITING"}
>
{`말랑레디 ${ready ? "ON" : "OFF"}`}
{partyStatus === "RECRUITING"
? `말랑레디 ${ready ? "ON" : "OFF"}`
: computeGapDay(startDate) > 2
? "말랑트립 확정"
: "말랑트립 최종 확정"}
</button>
</div>
<WhatReady />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ function Status({ ready, agreement }) {
제안 취소
</div>
);
if (agreement === "EXIT")
return (
<div className="w-[104px] mt-3 py-1.5 rounded-full text-xs font-medium text-[#E30000] bg-[#FFEAEA]">
가입 탈퇴
</div>
);
if (agreement === "PROPOSER")
return (
<div className="w-[104px] mt-3 py-1.5 rounded-full text-xs font-medium text-primary bg-skyblue">
Expand Down
4 changes: 4 additions & 0 deletions src/pages/PartyPage/PartyMember/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ function PartyMember({
? "WAITING"
: partyStatus === "CANCELED_BY_DRIVER_REFUSED"
? "REFUSE"
: partyStatus === "CANCELED_BY_DRIVER_QUIT"
? "EXIT"
: proposal?.driverAgreement
}
{...driverInfo}
Expand Down Expand Up @@ -81,6 +83,8 @@ function PartyMember({
? "PROPOSER"
: partyStatus === "CANCELED_BY_PROPOSER"
? "CANCELED"
: partyStatus === "CANCELED_BY_ALL_QUIT"
? "EXIT"
: proposal?.memberAgreement?.filter(
(member) => member.userId === item.userId
)[0].status
Expand Down
Loading

0 comments on commit b496e59

Please sign in to comment.