Skip to content

Commit

Permalink
Merge pull request #47 from Mallang-Trip/develop
Browse files Browse the repository at this point in the history
V0.0.37
  • Loading branch information
DaeHee99 authored Feb 5, 2024
2 parents de8b5f0 + c217dd7 commit 2f847bc
Show file tree
Hide file tree
Showing 29 changed files with 844 additions and 252 deletions.
11 changes: 11 additions & 0 deletions src/api/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ export const makeNewCoupleChat = async (userId) =>

export const getPartyChatId = async (partyId) =>
await GET(`/chat/party/${partyId}`, true);

export const getChatBlockList = async () => await GET("/chat/block", true);

export const blockUser = async (userId) =>
await POST(`/chat/block/${userId}`, {}, true);

export const nonBlockUser = async (userId) =>
await DELETE(`/chat/block/${userId}`, true);

export const kickPartyChatUser = async (chatRoomId, userId) =>
await DELETE(`/chat/party/${chatRoomId}?userId=${userId}`, true);
10 changes: 5 additions & 5 deletions src/api/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export const putComment = async (data, reviewId) =>
export const deleteComment = async (reviewId) =>
await DELETE(`/driver/review/${reviewId}`, true);

export const applyDriver = async (data) =>
await POST(`/driver/apply`, data, true);

export const getDriverMyInfo = async () => await GET(`/driver/my`, true);
export const getDriverMyInfo = async () => await GET("/driver/my", true);

export const putDriverMyInfo = async (data) =>
await PUT(`/driver/my`, data, true);
await PUT("/driver/my", data, true);

export const applyDriver = async (data) =>
await POST("/driver/apply", data, true);
24 changes: 10 additions & 14 deletions src/components/Footer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,29 @@ function Footer() {
>
회사 소개
</button>
<div>|</div>
<span>|</span>
<button
className="hover:underline underline-offset-2 focus:outline-none"
onClick={() => navigation("/policy/user/service")}
>
이용약관
</button>
<div>|</div>
<span>|</span>
<button
className="hover:underline underline-offset-2 text-primary focus:outline-none"
onClick={() => navigation("/policy/user/privacy")}
>
개인정보처리방침
</button>
<div>|</div>
<span>|</span>
<button
className="hover:underline underline-offset-2 focus:outline-none"
onClick={() => navigation("/policy/user/location")}
>
위치기반 서비스 이용약관
</button>
<div>|</div>
<button className="hover:underline underline-offset-2 focus:outline-none">
환불 및 위약금 정책
</button>
<span>|</span>
<span>통신판매업신고번호 2024-경기의왕-0056호</span>
</div>
<div className="sm:hidden">
<div className="flex gap-3 justify-center items-center flex-wrap">
Expand All @@ -46,14 +44,14 @@ function Footer() {
>
회사 소개
</button>
<div>|</div>
<span>|</span>
<button
className="hover:underline underline-offset-2 focus:outline-none"
onClick={() => navigation("/policy/user/service")}
>
이용약관
</button>
<div>|</div>
<span>|</span>
<button
className="hover:underline underline-offset-2 text-primary focus:outline-none"
onClick={() => navigation("/policy/user/privacy")}
Expand All @@ -68,14 +66,12 @@ function Footer() {
>
위치기반 서비스 이용약관
</button>
<div>|</div>
<button className="hover:underline underline-offset-2 focus:outline-none">
환불 및 위약금 정책
</button>
<span>|</span>
<span>통신판매업신고번호 2024-경기의왕-0056호</span>
</div>
</div>
<div className="flex justify-center items-center pt-3">
Copyright ⓒ 2023 mallangtrip. All rights reserved.
Copyright ⓒ 2024 mallangtrip. All rights reserved.
</div>
</div>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/HeadTitle/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ function HeadTitle({
{myParty ? "수정 제안 결정 중" : "코스 변경 제안 중"}
</p>
)}
{partyStatus === "CANCELED_BY_EXPIRATION" && (
<p className="text-[#E30000] text-lg">모집 기간 만료</p>
)}
</div>
{isDriver === true && (
<div
Expand Down
38 changes: 18 additions & 20 deletions src/components/PlaceMap/MapBox/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,25 @@ function MapBox({ markerData, setMarkerData, setClicked, setClickedData }) {
};

useEffect(() => {
if (markerData.length === 0)
navigator.geolocation.getCurrentPosition(
(position) => {
setMarkerData([
{
destinationId: -1,
lat: position.coords.latitude,
lon: position.coords.longitude,
},
]);
if (markerData.length === 0) {
setMarkerData([
{
destinationId: -1,
lat: 37.283192168869,
lon: 127.044128202435,
},
() =>
setMarkerData([
{
destinationId: -1,
lat: 37.2840931,
lon: 127.0453753,
},
])
);
else initTmap();
]);

navigator.geolocation.getCurrentPosition((position) => {
setMarkerData([
{
destinationId: -1,
lat: position.coords.latitude,
lon: position.coords.longitude,
},
]);
});
} else initTmap();
}, [markerData]);

return <div id="TMapApp" className="w-full mx-auto" ref={mapRef} />;
Expand Down
9 changes: 0 additions & 9 deletions src/components/ProfileModal/ButtonBox/Button/index.jsx

This file was deleted.

126 changes: 126 additions & 0 deletions src/components/ProfileModal/ButtonBox/ButtonList/BlockModal/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import { useEffect, useRef, useState } from "react";
import { blockUser, nonBlockUser } from "../../../../../api/chat";

function BlockModal({
showModal,
setShowModal,
isChatBlock,
setIsChatBlock,
userId,
nickname,
}) {
const modalRef = useRef();
const [message, setMessage] = useState("");
const [loading, setLoading] = useState(false);
const [complete, setComplete] = useState(false);

const blockChatUser = async () => {
if (loading) return;

try {
setLoading(true);

isChatBlock ? await nonBlockUser(userId) : await blockUser(userId);

if (isChatBlock)
setMessage(
<div>
<span className="text-primary">{nickname}</span>
님을 차단 해제하였습니다.
</div>
);
else
setMessage(
<div>
<span className="text-primary">{nickname}</span>
님을 차단하였습니다.
</div>
);

setComplete(true);
setIsChatBlock(!isChatBlock);
} catch (e) {
console.log(e);
} finally {
setLoading(false);
}
};

const closeModal = () => setShowModal(false);

const modalOutSideClick = (e) => {
if (modalRef.current === e.target) closeModal();
};

const handleKeyPress = (event) => {
if (event.key === "Escape") closeModal();
};

useEffect(() => {
if (!showModal) return document.body.classList.remove("overflow-hidden");
document.body.classList.add("overflow-hidden");

setComplete(false);

if (isChatBlock)
setMessage(
<div>
<span className="text-primary">{nickname}</span>
님을 차단 해제하시겠습니까?
</div>
);
else
setMessage(
<div>
<span className="text-primary">{nickname}</span>
님을 차단하시겠습니까?
</div>
);

document.addEventListener("keydown", handleKeyPress);
return () => {
document.removeEventListener("keydown", handleKeyPress);
};
}, [showModal]);

return (
<div
className={`modal-container fixed top-0 left-0 z-50 w-screen h-real-screen bg-darkgray bg-opacity-50 scale-100 flex ${
showModal ? "active" : ""
}`}
ref={modalRef}
onClick={(e) => modalOutSideClick(e)}
>
<div className="m-auto shadow w-96 rounded-xl">
<div className="flex flex-col justify-center h-64 text-center text-black whitespace-pre bg-white rounded-t-xl">
{message}
</div>
{!complete ? (
<div className="flex">
<button
className="w-full h-16 text-lg text-center text-darkgray rounded-bl-xl bg-lightgray"
onClick={closeModal}
>
취소
</button>
<button
className="w-full h-16 text-lg text-center text-white rounded-br-xl bg-primary"
onClick={blockChatUser}
>
확인
</button>
</div>
) : (
<button
className="w-full h-16 text-lg text-center text-white rounded-b-xl bg-primary"
onClick={closeModal}
>
확인
</button>
)}
</div>
</div>
);
}

export default BlockModal;
12 changes: 12 additions & 0 deletions src/components/ProfileModal/ButtonBox/ButtonList/Button/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function Button({ name, onClick }) {
return (
<button
className="rounded-full py-2 px-5 border border-primary text-base text-primary bg-skyblue"
onClick={() => onClick()}
>
{name}
</button>
);
}

export default Button;
Loading

0 comments on commit 2f847bc

Please sign in to comment.