Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/feat/#72'
Browse files Browse the repository at this point in the history
  • Loading branch information
kanguk01 committed Nov 15, 2024
2 parents b716111 + 71e1569 commit 5299553
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 15 deletions.
19 changes: 17 additions & 2 deletions src/api/hooks/useTeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
useQueryClient,
UseMutationResult,
} from "@tanstack/react-query";
import { AxiosResponse, AxiosError } from "axios";
import axios, { AxiosResponse, AxiosError } from "axios";
import { apiClient } from "@/api/instance";
import {
Team,
Expand Down Expand Up @@ -43,6 +43,21 @@ export const useDeleteTeam = () => {
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["teams"] });
},
onError: (error) => {
console.error("팀 삭제 오류:", error);
if (axios.isAxiosError(error) && error.response) {
if (error.response.status === 404) {
alert("해당 팀을 찾을 수 없습니다.");
} else if (error.response.status === 403) {
alert("팀 삭제 권한이 없습니다.");
} else {
alert("팀 삭제 중 오류가 발생했습니다. 다시 시도해 주세요.");
}
} else {
alert("네트워크 오류가 발생했습니다. 인터넷 연결을 확인해 주세요.");
}
},

});
};

Expand All @@ -54,7 +69,7 @@ export const useLeaveTeam = () => {
mutationFn: async (teamId: number) => {
const confirmed = window.confirm("정말로 팀에서 나가시겠습니까?");
if (!confirmed) {
return; // 사용자가 취소를 누른 경우, 요청을 중단
return;
}
await apiClient.delete(`/api/teams/${teamId}/leave`);
},
Expand Down
10 changes: 8 additions & 2 deletions src/api/hooks/useUserData.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { apiClient } from "@/api/instance";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";

const useUserData = () => {
const [userData, setUserData] = useState({
Expand Down Expand Up @@ -34,7 +35,7 @@ const useUserData = () => {

const handleSubscription = () => {
apiClient
.post("/api/subscription/me/payment", {
.post("/api/subscription/me/subscribe", {
type: "MONTHLY",
})
.then(() => {
Expand All @@ -43,6 +44,8 @@ const useUserData = () => {
.catch((error) => console.error("error subscribtion:", error));
};



const handleDeleteAccount = () => {
// 회원 탈퇴 API 호출
if (window.confirm("정말로 회원 탈퇴를 하시겠습니까?")) {
Expand All @@ -52,7 +55,10 @@ const useUserData = () => {
alert("회원 탈퇴가 완료되었습니다.");
navigate("/");
})
.catch((error) => console.error("Error deleting account:", error));
.catch((error) => {
console.error("Error deleting account:", error);
alert("회원 탈퇴 중 오류가 발생했습니다. 다시 시도해 주세요.");
});
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ export const eventItemStyles = (status: string, isDragging: boolean) => css`
`}
`;

// 제목용
export const eventItemTitleStyles = css`
font-size: 0.9rem; /* 원하는 크기로 조정 */
font-weight: bold;
`;

export const dropdownMenuStyles = css`
position: absolute;
top: 100%;
Expand Down
8 changes: 5 additions & 3 deletions src/components/features/CustomCalendar/CustomCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
eventItemStyles,
dropdownItemStyles,
dropdownMenuStyles,
eventItemTitleStyles,
} from "./CustomCalendar.styles";
import useDeletePlan from "@/api/hooks/useDeletePlan";
import Modal from "@/components/common/Modal/Modal";
Expand Down Expand Up @@ -97,9 +98,10 @@ const VIEW_MODES = {

const calculateEventStatus = (event: CalendarEvent) => {
const now = new Date();
const nowKST = new Date(now.getTime() + (9 * 60 * 60 * 1000));
if (event.isCompleted) return "completed";
if (event.start > now) return "upcoming";
if (!event.isCompleted && event.end < now) return "incomplete";
if (event.start > nowKST) return "upcoming";
if (!event.isCompleted && event.end < nowKST) return "incomplete";
return "incomplete";
};

Expand Down Expand Up @@ -308,7 +310,7 @@ const EventContent = ({
style={{ position: "relative", cursor: "pointer" }}
>
<div>{timeText}</div>
<div>{event.title}</div>
<div css={eventItemTitleStyles}>{event.title}</div>
</div>
{isDropdownOpen && createPortal(DropdownMenu, document.body)}
</>
Expand Down
20 changes: 13 additions & 7 deletions src/pages/Friend/FriendPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,24 @@ const SearchButton = styled.span`
`;

const FriendListContainer = styled.div`
grid-template-columns: 1fr 1fr;
width: 100%;
display: grid;
gap: 16px;
box-sizing: border-box;
grid-template-columns: 1fr;
@media (min-width: ${breakpoints.lg}px) {
grid-template-columns: 1fr 1fr;
display: grid;
box-sizing: border-box;
gap:16px;
${breakpoints.tablet} {
grid-template-columns: 1fr;
width: 100%;
display: grid;
box-sizing: border-box;
}
${breakpoints.mobile} {
gap: 12px;
width: 100%;
display: grid;
box-sizing: border-box;
grid-template-columns: 1fr;
}
`;

Expand Down
3 changes: 2 additions & 1 deletion src/pages/Landing/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@ const Card = styled(motion.div)`
flex-direction: column;
@media (min-width: 768px) {
width: 70%;
width: 100%;
padding: 2rem;
}
`;

Expand Down

0 comments on commit 5299553

Please sign in to comment.