Skip to content

Commit

Permalink
Merge pull request #166 from TRIP-Side-Project/dev
Browse files Browse the repository at this point in the history
merge: 12차 찐 최종 dev -> main 합병 잡업(찐 최종)
  • Loading branch information
Emma-Hyejin authored Jan 14, 2024
2 parents b4ef4d3 + 968577c commit fdb6c2f
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 67 deletions.
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<link rel="icon" href="/src/assets/img//favicon.png">
<link rel="apple-touch-icon" href="/src/assets/img/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta content="TRIPTRIP" property="og:title"/>
<meta content="website" property="og:type"/>
<meta content="국내 여행을 떠나고 싶을 땐 - TRIPTRIP" property="og:description"/>
<meta content="/src/assets/img/LogoThumbnail.png" property="og:image"/>
<meta property="og:title" content="TRIPTRIP" />
<meta property="og:type" content="website" />
<meta property="og:description"content="국내 여행을 떠나고 싶을 땐 - TRIPTRIP" />
<meta property="og:image"content="/src/assets/img/LogoThumbnail.png"/>
<title>TRIPTRIP</title>
</head>
<body>
Expand Down
Binary file modified src/assets/img/LogoThumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/header/Topnav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface navSelectType {
const Topnav = ({ trip }: navSelectType) => {
//console.log(trip);
const navStyle =
"px-1 md:px-7 py-2 font-medium md:font-semibold text-BASIC_WHITE hover:text-MAIN_COLOR dark:text-BASIC_BLACK dark:hover:text-MAIN_COLOR";
"px-1 md:px-4 py-2 font-medium md:font-semibold text-BASIC_WHITE hover:text-MAIN_COLOR dark:text-BASIC_BLACK dark:hover:text-MAIN_COLOR";
const navContainer =
"px-2 flex justify-between md:justify-end w-full bg-BASIC_BLACK dark:bg-LIGHT_GRAY_COLOR";
const setCode = useSetRecoilState(menuSelector);
Expand Down
73 changes: 60 additions & 13 deletions src/components/mineItems/LikeForum.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,71 @@
import Close from "@/assets/svg/Close";
import Category from "@/common/category/Category";
import useFormatDate from "@/hooks/useFormatDate";
import { LikeForumProps } from "@/types/myProfile";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import axios from "axios";
import { Link } from "react-router-dom";

const LikeForum = ({ data }: LikeForumProps) => {
console.log(data);
//gap-3
const formattedDate = useFormatDate(data && data.createdAt);
const queryClient = useQueryClient();
const BASE_URL = import.meta.env.VITE_BASE_URL;
const ACCESS_TOKEN = window.localStorage.getItem("access_token");

const handleDeleteMine = useMutation({
mutationFn: (interestArticleId: number) => {
return axios.delete(
`${BASE_URL}/api/interest-articles/${interestArticleId}`,
{
headers: {
accessToken: `Bearer ${ACCESS_TOKEN}`,
},
},
);
},
onSettled: () => queryClient.invalidateQueries({ queryKey: ["mineDatas"] }),
});

const DeleteMineClick = async (interestArticleId: number) => {
try {
await handleDeleteMine.mutateAsync(interestArticleId);
} catch (err) {
throw new Error(`내 아이템 삭제 ${err}`);
}
};

return (
<div className="flex flex-col w-full gap-3 px-3 py-2 border rounded-lg whitespace-nowrap bg-BASIC_WHITE">
<Link to={`/forum/detail/${data.articleId}`}>
<div className="relative flex flex-row justify-between text-xs">
<div className="relative scale-75 -left-3 -top-1">
<Category isEditor={data.writerRole} />
</div>
<div className="flex flex-row w-full px-3 py-2 border rounded-lg whitespace-nowrap bg-BASIC_WHITE">
<div className="flex flex-col flex-1 gap-3 ">
<Link to={`/forum/detail/${data.articleId}`}>
<div className="relative flex flex-row justify-between flex-1 text-xs">
<div className="relative scale-75 -left-3 -top-1">
<Category isEditor={data.writerRole} />
</div>

<div className=" text-LIGHT_GRAY_COLOR">{data.createdAt}</div>
</div>
<div className="text-lg font-semibold text-BASIC_BLACK">
{data.title}
</div>
</Link>
<div className=" text-LIGHT_GRAY_COLOR">{formattedDate}</div>
</div>
<div className="text-lg font-semibold text-BASIC_BLACK">
{data.title}
</div>
</Link>
</div>
<div className=" text-BASIC_BLACK">
<button
type="button"
className="ms-auto -mx-1 -my-1.5 justify-center items-center flex-shrink-0 text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700"
data-dismiss-target="#toast-notification"
aria-label="Close"
onClick={(e) => {
e.preventDefault();
console.log(data.articleId);
DeleteMineClick(data.articleId);
}}
>
<Close fillColor={"#111111"} width={"18px"} height={"18px"} />
</button>
</div>
</div>
);
};
Expand Down
100 changes: 53 additions & 47 deletions src/components/mineItems/LikeItem.tsx
Original file line number Diff line number Diff line change
@@ -1,64 +1,70 @@
import Close from "@/assets/svg/Close";
import { LikeMerchanProps } from "@/types/myProfile";
import { useNavigate } from "react-router-dom";
// import { useMutation } from "@tanstack/react-query";
// import axios from "axios";
import { useMutation } from "@tanstack/react-query";
import axios from "axios";

const Likeitem = ({ data }: LikeMerchanProps) => {
const navigation = useNavigate();
// const BASE_URL = import.meta.env.VITE_BASE_URL;
// const ACCESS_TOKEN = window.localStorage.getItem("access_token");
const BASE_URL = import.meta.env.VITE_BASE_URL;
const ACCESS_TOKEN = window.localStorage.getItem("access_token");

// const handleDeleteMine = useMutation({
// mutationFn: (interesItemId: number) => {
// return axios.delete(`${BASE_URL}/api/interest-items/${interesItemId}`, {
// headers: {
// accessToken: `Bearer ${ACCESS_TOKEN}`,
// },
// });
// },
// });
const handleDeleteMine = useMutation({
mutationFn: (interesItemId: number) => {
return axios.delete(`${BASE_URL}/api/interest-items/${interesItemId}`, {
headers: {
accessToken: `Bearer ${ACCESS_TOKEN}`,
},
});
},
});

// const DeleteMineClick = async (interesItemId: number) => {
// try {
// await handleDeleteMine.mutateAsync(interesItemId);
// } catch (err) {
// throw new Error(`내 아이템 삭제 ${err}`);
// }
// };
const DeleteMineClick = async (interesItemId: number) => {
try {
await handleDeleteMine.mutateAsync(interesItemId);
} catch (err) {
throw new Error(`내 아이템 삭제 ${err}`);
}
};
console.log(data);
return (
<div
className="flex flex-row w-full p-2 border rounded-lg whitespace-nowrap bg-BASIC_WHITE"
onClick={() => navigation(`/products/detail/${data && data.id}`)}
>
<img
src={data.imageUrl}
className="rounded-lg w-[100px] sm:w-[130px] h-[100px] mr-3"
/>
<div className="flex flex-col flex-1 text-BASIC_BLACK">
<div className="flex flex-row justify-between ">
<div className="flex flex-row w-full p-2 border rounded-lg whitespace-nowrap bg-BASIC_WHITE">
<div
className="flex flex-row flex-1"
onClick={() => navigation(`/products/detail/${data && data.id}`)}
>
<img
src={data.imageUrl}
className="rounded-lg w-[100px] sm:w-[130px] h-[100px] mr-3"
/>

<div className="flex flex-col ">
<div className="text-sm font-semibold whitespace-normal sm:text-lg">
{data.title.slice(0, 28)}..
{data.title.slice(0, 30)}..
</div>
<div className="flex-1 text-sm text-LIGHT_GRAY_COLOR ">
{data.shopName}
</div>
<div className="pr-4 text-sm text-right">
{String(data.minPrice).replace(/\B(?=(\d{3})+(?!\d))/g, ",")}
</div>
<button
type="button"
className="ms-auto -mx-1.5 -my-1.5 justify-center items-center flex-shrink-0 text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700"
data-dismiss-target="#toast-notification"
aria-label="Close"
onClick={(e) => {
e.preventDefault();
// DeleteMineClick(data.id);
}}
>
<Close fillColor={"#111111"} width={"18px"} height={"18px"} />
</button>
</div>
</div>

<div className="flex-1 text-sm text-LIGHT_GRAY_COLOR">
{data.shopName}
</div>
<div className="flex justify-end text-base">{data.maxPrice}</div>
<div className="text-BASIC_BLACK">
<button
type="button"
className="ms-auto -mx-1 -my-1.5 justify-center items-center flex-shrink-0 text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700"
data-dismiss-target="#toast-notification"
aria-label="Close"
onClick={(e) => {
e.preventDefault();
console.log(data.id);
DeleteMineClick(data.id);
}}
>
<Close fillColor={"#111111"} width={"18px"} height={"18px"} />
</button>
</div>
</div>
);
Expand Down
6 changes: 5 additions & 1 deletion src/components/mypage/EditProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MyPageModal from "@/components/modal/MypageModal";
import { useState } from "react";
import { useEffect, useState } from "react";
// import Temp from "@/assets/img/temp.png";
import Setting from "@/assets/svg/Setting";
import { MyDataProps } from "@/types/myProfile";
Expand All @@ -23,6 +23,10 @@ const EditProfile = ({ data }: MyDataProps) => {
setActiveBtn(item);
};

useEffect(() => {
setSelectedTab("likeMerchan");
}, []);

//style
const summaryTitle =
"mr-1.5 sm:mx-5 text-[11px] sm:text-sm rounded-lg bg-zinc-200 p-1 sm:bg-inherit";
Expand Down
2 changes: 1 addition & 1 deletion src/components/mypage/Mine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Mine = () => {
);
//Tab 변경에 따른 데이터 컴포넌트
const [mineContent, setMineContent] = useState();

console.log(selectedTab);
const getMineDatas = async () => {
try {
let URL;
Expand Down

0 comments on commit fdb6c2f

Please sign in to comment.