diff --git a/src/components/Gnb/NavBar.tsx b/src/components/Gnb/NavBar.tsx index cf03553c..3133faa6 100644 --- a/src/components/Gnb/NavBar.tsx +++ b/src/components/Gnb/NavBar.tsx @@ -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(false); const [isOpenNotification, setIsOpenNotification] = useState(false); const [isOpenUserMenu, setIsOpenUserMenu] = useState(false); @@ -159,6 +168,9 @@ 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); } @@ -166,7 +178,7 @@ const NavBar = () => { fetchUserInfo(); } - }, [setLogin]); + }, [setLogin, coconut]); useEffect(() => { const handleOutsideClick = (event: MouseEvent) => { @@ -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 (
-
+
니가가라하와이 로고 diff --git a/src/components/Landing/MapMarker.tsx b/src/components/Landing/MapMarker.tsx index 2c2d8c0a..e774c309 100644 --- a/src/components/Landing/MapMarker.tsx +++ b/src/components/Landing/MapMarker.tsx @@ -108,9 +108,11 @@ export default function MapMarker() { return ( <>
-

🛬 사용자 이용현황 🛬

+

+ 🛬 사용자 이용현황 🛬 +

-
+
{/* 지도 */}
{selectedRegion ? ( - <> -

{regionNames[selectedRegion.name]} 통계

+

{regionNames[selectedRegion.name]} 통계

총 서비스 수: {selectedRegion.totalCount}

- { selectedRegion.totalCount === 0 ? ( -
-

통계 자료가 없습니다!
여러분의 꿈을 추가해 보세요! 🚀

-
- ) : ( - - - {selectedRegion.details.map((entry, index) => ( - - ))} - - - - )} + {selectedRegion.totalCount === 0 ? ( +
+

+ 통계 자료가 없습니다! +
+ 여러분의 꿈을 추가해 보세요! 🚀 +

+
+ ) : ( + + + {selectedRegion.details.map((entry, index) => ( + + ))} + + + + )}

마커를 클릭하면 해당 지역 통계를 볼 수 있습니다.

- ) : (

마커를 클릭하면 해당 지역 통계를 볼 수 있습니다.

)} diff --git a/src/features/DetailMaker.tsx b/src/features/DetailMaker.tsx index 6ba16a52..09694a6f 100644 --- a/src/features/DetailMaker.tsx +++ b/src/features/DetailMaker.tsx @@ -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, @@ -190,6 +191,7 @@ export default function RequestDetailDreamer() { }); } }; + useEffect(() => { if (makerProfileInfo) { setIsFollowed(makerProfileInfo.isFollowed); @@ -197,23 +199,7 @@ export default function RequestDetailDreamer() { }, [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 = ( @@ -230,15 +216,16 @@ export default function RequestDetailDreamer() { ); return ( - <> +
{/* 왼쪽 열 */}
@@ -314,7 +301,7 @@ export default function RequestDetailDreamer() {
-
+
{sharePromptContent}
@@ -346,64 +333,14 @@ export default function RequestDetailDreamer() {

서비스 가능 지역

+
-
-
-

리뷰({makerProfileInfo?.totalReviews})

-
-
-
-

- {makerProfileInfo?.averageRating} -

-

/5

-
-
- -
-
-
- -
-
-
- {findMakerReview?.list && findMakerReview.list.length > 0 && ( - <> - {findMakerReview?.list?.map((review, index) => ( -
-
-

- {review.writer.nickName} -

-

- {formatToSimpleDate(review.createdAt)} -

-
-
- -
-

{review.content}

-
- ))} -
- -
- - )} -
@@ -451,6 +388,57 @@ export default function RequestDetailDreamer() {
+
+
+

리뷰({makerProfileInfo?.totalReviews})

+
+
+
+

+ {makerProfileInfo?.averageRating} +

+

/5

+
+
+ +
+
+
+ +
+
+
+ {findMakerReview?.list && findMakerReview.list.length > 0 && ( + <> + {findMakerReview?.list?.map((review, index) => ( +
+
+

+ {review.writer.nickName} +

+

+ {formatToSimpleDate(review.createdAt)} +

+
+
+ +
+

{review.content}

+
+ ))} +
+ +
+ + )} +
{isLoginModalOpen && (
setIsLoginModalOpen(false)}> diff --git a/src/features/ProfileDreamer.tsx b/src/features/ProfileDreamer.tsx index 45f03c4a..0902d15b 100644 --- a/src/features/ProfileDreamer.tsx +++ b/src/features/ProfileDreamer.tsx @@ -44,6 +44,7 @@ export default function ProfileDreamer() { }, onSuccess: () => { removeOAuthToken(); + alert("Dreamer님 가입을 축하드립니다!"); router.push("/login"); }, onError: (error: any) => { diff --git a/src/features/SystemLog.tsx b/src/features/SystemLog.tsx index b2efed6f..2a6a1dbc 100644 --- a/src/features/SystemLog.tsx +++ b/src/features/SystemLog.tsx @@ -1,98 +1,86 @@ export default function MetricPage() { return (
-

네트워크 모니터링

- - - - - - - -

시스템 지표 모니터링

- - - - - - - - - - - +

네트워크 모니터링

+
+ + + + + + + +
+

+ 시스템 지표 모니터링 +

+
+ + + + + + + + + + + +
); } diff --git a/src/pages/follow-maker/index.tsx b/src/pages/follow-maker/index.tsx index 574bb485..5f9ab64b 100644 --- a/src/pages/follow-maker/index.tsx +++ b/src/pages/follow-maker/index.tsx @@ -5,4 +5,4 @@ export function FollowedMakerPage() { return ; } -export default withAuthAccess(FollowedMakerPage); +export default withAuthAccess(FollowedMakerPage, "DREAMER"); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index bc153b27..865c58a9 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -6,20 +6,55 @@ import Hero from "@/components/Landing/Hero"; import Features from "@/components/Landing/Features"; import MapMarker from "@/components/Landing/MapMarker"; import beachBackground7 from "@public/assets/Landing-img/img_07.jpg"; +import userService from "@/services/userService"; +import useAuthStore from "@/stores/useAuthStore"; + +const getUserInfo = async () => { + const userData = await userService.getUserInfo(); + return userData; +}; + +const getProfileInfo = async () => { + const profileData = await userService.getProfileInfo(); + return profileData; +}; export default function Home() { const router = useRouter(); const [isHydrated, setIsHydrated] = useState(false); + const [isRefreshed, setIsRefreshed] = useState(false); + const { setLogin } = useAuthStore(); useEffect(() => { - if (router.isReady) { - const aceessToken = router.query.auth as string; - if (aceessToken) { - setAccessToken(aceessToken); - router.push("/"); + const fetchData = async () => { + try { + if (router.isReady) { + const accessToken = router.query.auth as string; + if (accessToken) { + setAccessToken(accessToken); + + const userInfo = await getUserInfo(); + const profileInfo = await getProfileInfo(); + + setLogin( + userInfo.nickName, + userInfo.role as "DREAMER" | "MAKER", + userInfo.coconut, + userInfo.email, + userInfo.phoneNumber, + profileInfo.image, + ); + setIsRefreshed(true); + router.push("/"); + window.location.reload(); + } + } + } catch (error) { + console.error("사용자 정보 가져오기 실패:", error); } - } - }, [router.isReady, router.query.auth]); + }; + fetchData(); + }, [router.isReady, router.query.auth, setLogin, isRefreshed]); useEffect(() => { setIsHydrated(true); diff --git a/src/pages/plan-request/index.tsx b/src/pages/plan-request/index.tsx index c57a7605..1120b288 100644 --- a/src/pages/plan-request/index.tsx +++ b/src/pages/plan-request/index.tsx @@ -24,4 +24,4 @@ export function PlanRequestPage() { ); } -export default withAuthAccess(PlanRequestPage); +export default withAuthAccess(PlanRequestPage, "DREAMER"); diff --git a/src/pages/profile/dreamer/edit/[id].tsx b/src/pages/profile/dreamer/edit/[id].tsx index 9d8b33b7..df90950a 100644 --- a/src/pages/profile/dreamer/edit/[id].tsx +++ b/src/pages/profile/dreamer/edit/[id].tsx @@ -4,4 +4,4 @@ import withAuthAccess from "@/stores/withAuthAccess"; export function ProfileEditDreamerPage() { return ; } -export default withAuthAccess(ProfileEditDreamerPage); +export default withAuthAccess(ProfileEditDreamerPage, "DREAMER"); diff --git a/src/stores/useAuthStore.tsx b/src/stores/useAuthStore.tsx index 7ee3c136..7a106de0 100644 --- a/src/stores/useAuthStore.tsx +++ b/src/stores/useAuthStore.tsx @@ -20,6 +20,7 @@ interface AuthState { profileImage?: string, ) => void; setLogout: () => void; + setCoconut: (newCoconut: number) => void; } const useAuthStore = create()( @@ -50,6 +51,7 @@ const useAuthStore = create()( phoneNumber: "", profileImage: "", }), + setCoconut: (newCoconut: number) => set({ coconut: newCoconut }), }), { name: "auth", diff --git a/src/styles/globals.css b/src/styles/globals.css index b57f7130..4325515a 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -129,3 +129,23 @@ button { .recharts-layer :focus { outline: none; } + +.grid-container { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); + gap: 16px; +} + +.iframe-item { + width: 100%; + height: 200px; + border: none; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); +} + +@media (max-width: 768px) { + .iframe-item { + height: 150px; + } +}