Skip to content
Merged
24 changes: 20 additions & 4 deletions src/components/Gnb/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,17 @@ const getNotification = () => {
};

const NavBar = () => {
const { isLoggedIn, nickName, role, coconut, email, phoneNumber, profileImage, setLogin } =
useAuthStore();
const {
isLoggedIn,
nickName,
role,
coconut,
setCoconut,
email,
phoneNumber,
profileImage,
setLogin,
} = useAuthStore();
const [isOpenSidebar, setIsOpenSidebar] = useState<boolean>(false);
const [isOpenNotification, setIsOpenNotification] = useState<boolean>(false);
const [isOpenUserMenu, setIsOpenUserMenu] = useState<boolean>(false);
Expand Down Expand Up @@ -159,14 +168,17 @@ const NavBar = () => {
const avatarImage = avatarImages.find((avatar) => avatar.key === profileImage);
setUserImage(avatarImage ? avatarImage.src : user_img.src);
setLogin(nickName, role, coconut, email, phoneNumber, profileImage);
if (userData.coconut !== coconut) {
handleCoconutChange(userData.coconut);
}
} catch (error) {
console.error(error);
}
};

fetchUserInfo();
}
}, [setLogin]);
}, [setLogin, coconut]);

useEffect(() => {
const handleOutsideClick = (event: MouseEvent) => {
Expand Down Expand Up @@ -201,13 +213,17 @@ const NavBar = () => {
};
}, [isOpenUserMenu, isOpenNotification, isOpenSidebar]);

const handleCoconutChange = (newCoconut: number) => {
setCoconut(newCoconut);
};

const hasUnreadNotifications = notificationData.some((notification) => !notification.isRead);
const hasNotifications = realTimeNotifications.length > 0;

return (
<div className="z-40 flex items-center justify-between border-b-2 border-color-line-100 bg-color-background-100 px-24 py-6 mobile:px-4 tablet:px-5 mobile-tablet:py-3">
<div className="flex items-center">
<div className="mr-14 text-2xl bold mobile-tablet:mr-0">
<div className="bold mr-14 text-2xl mobile-tablet:mr-0">
<Link href={NavigationPath.LANDING}>
<Image src={logo} width={100} alt="니가가라하와이 로고" />
</Link>
Expand Down
58 changes: 31 additions & 27 deletions src/components/Landing/MapMarker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ export default function MapMarker() {
return (
<>
<div className="bold mb-7 mt-7 flex justify-center">
<h1 className="mb-10 mt-24 animate-bounce text-4xl">🛬 사용자 이용현황 🛬</h1>
<h1 className="mb-10 mt-24 animate-bounce text-4xl mobile-tablet:text-2xl">
🛬 사용자 이용현황 🛬
</h1>
</div>
<div className="pc:-mr-16 pc:-ml-10 flex items-center rounded-xl bg-color-blue-400 bg-opacity-15 mobile-tablet:ml-0 mobile-tablet:flex-col">
<div className="flex items-center rounded-xl bg-color-blue-400 bg-opacity-15 pc:-ml-10 pc:-mr-16 mobile-tablet:ml-0 mobile-tablet:flex-col">
{/* 지도 */}
<div className="sw-full mobile-tablet:order-2">
<ComposableMap
Expand Down Expand Up @@ -158,35 +160,37 @@ export default function MapMarker() {
{/* 통계 */}
<div className="flex h-[400px] w-1/3 flex-col items-center rounded-xl bg-color-gray-50 p-4 shadow-2xl hover:scale-[1.05] pc:-ml-5 mobile-tablet:order-1 mobile-tablet:mt-10 mobile-tablet:w-[400px]">
{selectedRegion ? (

<>
<h2 className="text-lg bold">{regionNames[selectedRegion.name]} 통계</h2>
<h2 className="bold text-lg">{regionNames[selectedRegion.name]} 통계</h2>
<p>총 서비스 수: {selectedRegion.totalCount}</p>
{ selectedRegion.totalCount === 0 ? (
<div className="flex h-full w-full items-center justify-center">
<p className="text-lg bold text-center">통계 자료가 없습니다!<br/>여러분의 꿈을 추가해 보세요! 🚀</p>
</div>
) : (
<PieChart width={300} height={300}>
<Pie
data={selectedRegion.details}
dataKey="value"
nameKey="name"
cx="50%"
cy="50%"
outerRadius={80}
label
>
{selectedRegion.details.map((entry, index) => (
<Cell key={`cell${index}`} fill={entry.fill} />
))}
</Pie>
<Tooltip />
</PieChart>
)}
{selectedRegion.totalCount === 0 ? (
<div className="flex h-full w-full items-center justify-center">
<p className="bold text-center text-lg">
통계 자료가 없습니다!
<br />
여러분의 꿈을 추가해 보세요! 🚀
</p>
</div>
) : (
<PieChart width={300} height={300}>
<Pie
data={selectedRegion.details}
dataKey="value"
nameKey="name"
cx="50%"
cy="50%"
outerRadius={80}
label
>
{selectedRegion.details.map((entry, index) => (
<Cell key={`cell${index}`} fill={entry.fill} />
))}
</Pie>
<Tooltip />
</PieChart>
)}
<p className="text-sm">마커를 클릭하면 해당 지역 통계를 볼 수 있습니다.</p>
</>

) : (
<p>마커를 클릭하면 해당 지역 통계를 볼 수 있습니다.</p>
)}
Expand Down
150 changes: 69 additions & 81 deletions src/features/DetailMaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,18 @@ export default function RequestDetailDreamer() {
}, [isPlaceholderData, currentPage, itemsPerPage, totalItems, makerId, queryClient]);

const handleKakaoShare = () => {
if (typeof window === "undefined") return;

const currentUrl = window.location.href;
if (typeof window !== "undefined" && window.Kakao) {
const Kakao = window.Kakao;
Kakao.Share.createDefaultButton({
container: "#kakaotalk-sharing-btn",
if (window.Kakao) {
window.Kakao.Share.sendDefault({
objectType: "feed",
content: {
title: makerProfileInfo?.nickName || "Maker님",
description: makerProfileInfo?.description || "여행 플랜 상세내용보기",
imageUrl:
"https://scontent-ssn1-1.cdninstagram.com/v/t51.29350-15/440535983_1166519591460822_7666710914928913519_n.jpg?stp=dst-jpg_e35_s1080x1080_tt6&_nc_ht=scontent-ssn1-1.cdninstagram.com&_nc_cat=106&_nc_ohc=CzF6FbL6gvEQ7kNvgHzHfiF&_nc_gid=947375cfb83d43c5abb8aeacb63ed59a&edm=ANTKIIoBAAAA&ccb=7-5&oh=00_AYDtqZ0h00aA8oATSGX48sg79D3ROGTLYUaZSjkcbYafCQ&oe=67A60D41&_nc_sid=d885a2",
title: makerProfileInfo?.nickName || "Maker님" + " Maker님",
description: makerProfileInfo?.description || "Maker의 설명",
imageUrl: "https://ifh.cc/g/wvkbqP.png",
imageWidth: 400,
imageHeight: 200,
link: {
mobileWebUrl: currentUrl,
webUrl: currentUrl,
Expand All @@ -190,30 +191,15 @@ export default function RequestDetailDreamer() {
});
}
};

useEffect(() => {
if (makerProfileInfo) {
setIsFollowed(makerProfileInfo.isFollowed);
}
}, [makerProfileInfo]);

const handleFacebookShare = () => {
if (typeof window !== "undefined" && window.FB) {
const shareUrl = `https://fs2-4-team2-go-for-me.vercel.app/maker-detail/${makerId}`;

window.FB.ui(
{
method: "share",
href: shareUrl,
},
(response) => {
if (response) {
alert("공유를 성공했습니다!");
} else {
console.error("공유 실패 - URL:", shareUrl);
}
},
);
}
return window.open(`http://www.facebook.com/sharer/sharer.php?u=${location.href}`);
};

const sharePromptContent = (
Expand All @@ -230,15 +216,16 @@ export default function RequestDetailDreamer() {
);

return (
<> <style>
{`
<>
<style>
{`
@media (min-width: 744px) and (max-width: 2700px) {
.main-container {
padding: 0 24px;
}
}
`}
</style>
</style>
<div className="relative mt-20 grid w-full grid-cols-7 gap-10 mobile-tablet:flex mobile-tablet:flex-col">
{/* 왼쪽 열 */}
<div className="col-span-5 flex flex-col">
Expand Down Expand Up @@ -314,7 +301,7 @@ export default function RequestDetailDreamer() {
</div>
</div>
<div className="flex flex-col gap-10 mobile-tablet:gap-10">
<hr className="border-color-line-100 mt-10" />
<hr className="mt-10 border-color-line-100" />
<div>
<div className="pc:hidden">{sharePromptContent}</div>
</div>
Expand Down Expand Up @@ -346,64 +333,14 @@ export default function RequestDetailDreamer() {
<p className="bold mb-8 text-2xl text-color-black-400 mobile-tablet:text-lg">
서비스 가능 지역
</p>

<Selector
category="locations"
selectedTypes={makerProfileInfo?.serviceArea ?? []}
data={filteredLocations}
className="flex gap-4"
className="flex w-full gap-4 mobile-tablet:w-full"
/>
</div>
<div>
<div>
<p className="mb-8 text-lg bold">리뷰({makerProfileInfo?.totalReviews})</p>
<div className="mb-10 flex items-center justify-center gap-10 mobile:flex-col">
<div className="flex flex-col items-center justify-center gap-4">
<div className="flex items-end gap-2">
<p className="text-[64px] bold leading-[76.38px]">
{makerProfileInfo?.averageRating}
</p>
<p className="text-[38px] leading-[45.38px] text-color-gray-100">/5</p>
</div>
<div className="flex justify-end">
<StarRating
initialRating={Number(makerProfileInfo?.averageRating)}
readonly={true}
/>
</div>
</div>
<div className="rounded-[16px] bg-color-background-200 px-[22px] py-4 shadow-md">
<ReviewGraph reviewStats={reviewStats} />
</div>
</div>
</div>
{findMakerReview?.list && findMakerReview.list.length > 0 && (
<>
{findMakerReview?.list?.map((review, index) => (
<div key={index} className="border-b border-color-line-100 py-8">
<div className="flex items-center gap-3">
<p className="border-r border-color-line-200 pr-3 text-md">
{review.writer.nickName}
</p>
<p className="text-md text-color-gray-300">
{formatToSimpleDate(review.createdAt)}
</p>
</div>
<div className="mb-4 mt-2">
<StarRating type={true} initialRating={review.rating} readonly={true} />
</div>
<p className="text-2lg">{review.content}</p>
</div>
))}
<div className="my-8 mobile-tablet:mb-[104px]">
<Pagination
currentPage={currentPage}
totalPages={totalPages}
onPageChange={handlePageChange}
/>
</div>
</>
)}
</div>
</div>
</div>

Expand Down Expand Up @@ -451,6 +388,57 @@ export default function RequestDetailDreamer() {
</div>
</div>
</div>
<div>
<div>
<p className="bold mb-8 text-lg pc:mt-12">리뷰({makerProfileInfo?.totalReviews})</p>
<div className="mb-10 flex items-center justify-center gap-10 mobile:flex-col">
<div className="flex flex-col items-center justify-center gap-4">
<div className="flex items-end gap-2">
<p className="bold text-[64px] leading-[76.38px]">
{makerProfileInfo?.averageRating}
</p>
<p className="text-[38px] leading-[45.38px] text-color-gray-100">/5</p>
</div>
<div className="flex justify-end">
<StarRating
initialRating={Number(makerProfileInfo?.averageRating)}
readonly={true}
/>
</div>
</div>
<div className="rounded-[16px] bg-color-background-200 px-[22px] py-4 shadow-md mobile-tablet:mb-[104px]">
<ReviewGraph reviewStats={reviewStats} />
</div>
</div>
</div>
{findMakerReview?.list && findMakerReview.list.length > 0 && (
<>
{findMakerReview?.list?.map((review, index) => (
<div key={index} className="border-b border-color-line-100 py-8">
<div className="flex items-center gap-3">
<p className="border-r border-color-line-200 pr-3 text-md">
{review.writer.nickName}
</p>
<p className="text-md text-color-gray-300">
{formatToSimpleDate(review.createdAt)}
</p>
</div>
<div className="mb-4 mt-2">
<StarRating type={true} initialRating={review.rating} readonly={true} />
</div>
<p className="text-2lg">{review.content}</p>
</div>
))}
<div className="my-8 mobile-tablet:mb-[104px]">
<Pagination
currentPage={currentPage}
totalPages={totalPages}
onPageChange={handlePageChange}
/>
</div>
</>
)}
</div>
{isLoginModalOpen && (
<div>
<ModalLayout label="알림" closeModal={() => setIsLoginModalOpen(false)}>
Expand Down
1 change: 1 addition & 0 deletions src/features/ProfileDreamer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default function ProfileDreamer() {
},
onSuccess: () => {
removeOAuthToken();
alert("Dreamer님 가입을 축하드립니다!");
router.push("/login");
},
onError: (error: any) => {
Expand Down
Loading