diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 38a9b352..40e11a03 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -2,6 +2,7 @@ import type { Metadata } from 'next'; import '@/styles/globals.css'; import KakaoInitializer from '@/components/common/Button/KakaoButton/KakaoInitializer'; +import ScrollToTop from '@/components/common/ScrollToTop'; import ReactQueryProvider from '@/components/ReactQueryProvider'; import { suite } from '@/styles/font'; @@ -19,6 +20,7 @@ export default function RootLayout({
+ {children}
diff --git a/src/app/pick/invite/page.tsx b/src/app/pick/invite/page.tsx index fab7199d..70f04799 100644 --- a/src/app/pick/invite/page.tsx +++ b/src/app/pick/invite/page.tsx @@ -41,7 +41,7 @@ const InviteHandler = () => { : WishpoolCardImage; return ( <> -
+
{ router.push(PATH.PICK_LIST); }} /> -
{children}
+
{children}
); diff --git a/src/app/pick/select/page.tsx b/src/app/pick/select/page.tsx index 9f00720c..a27cfb51 100644 --- a/src/app/pick/select/page.tsx +++ b/src/app/pick/select/page.tsx @@ -5,6 +5,7 @@ import { useRouter } from 'next/navigation'; import { useEffect, useState } from 'react'; import Button from '@/components/common/Button'; +import Toast from '@/components/common/Toast'; import CarouselCard from '@/components/pick/select/CarouselCard'; import GiftLoading from '@/components/pick/select/GiftLoading'; import { PATH } from '@/constants/common/path'; @@ -17,6 +18,7 @@ const SelectPage = () => { const [items, setItems] = useState([]); const [loading, setLoading] = useState(false); + const [toast, setToast] = useState(false); useEffect(() => { const initialItems = getInitialItems(); @@ -26,6 +28,16 @@ const SelectPage = () => { const { ref, active } = useCarouselCard(); const handleRemove = (id: number) => { + if (items.length <= 1) { + setToast(true); + + setTimeout(() => { + window.location.reload(); + }, 1000); + + return; + } + const updatedItems = items.filter((item) => item.giftId !== id); setItems(updatedItems); }; @@ -47,6 +59,7 @@ const SelectPage = () => { return (
+ {toast && 선물은 최소 1개 이상 선택해야 해요!}
{
-
+
{ const { isOpen, onOpen, onClose } = useModal(); const [isError, setIsError] = useState(false); - const { data: wishpool } = useGetWishpoolDetail(wishpoolId); const imageKey = wishpool?.imageKey || ''; const { data: wishpoolImage } = useGetWishpoolImage(imageKey); @@ -77,14 +76,18 @@ const DetailPage = () => {

- {wishpool?.celebrant}에게 보내는 위시풀 + {wishpool?.celebrant}님을 위한 위시풀

{wishpool?.joinCount}명 참여 - +
))} + {wishpools && wishpools.length === 0 && ( +
+
+

+ 위시풀 기록이 아직 없어요. +

+

첫 위시풀을 만들어볼까요?

+
+
+ +
+
+ )}
diff --git a/src/assets/images/congrats.png b/src/assets/images/congrats.png index ecafe925..a2111e5f 100644 Binary files a/src/assets/images/congrats.png and b/src/assets/images/congrats.png differ diff --git a/src/components/common/InfoBox/InfoBox.tsx b/src/components/common/InfoBox/InfoBox.tsx index d4689574..db8a7ccb 100644 --- a/src/components/common/InfoBox/InfoBox.tsx +++ b/src/components/common/InfoBox/InfoBox.tsx @@ -10,7 +10,7 @@ const INFO_MESSAGE = { export const INFO_NOTICE_LIST = [ { - title: '생일자는 진짜 필요한 걸 고를 수 있어요.', + title: '생일자는 진짜 필요한 선물을 고를 수 있어요.', content: ( <> 친구들이 제안한 선물 중에서
diff --git a/src/components/common/ScrollToTop.tsx b/src/components/common/ScrollToTop.tsx new file mode 100644 index 00000000..4b23f944 --- /dev/null +++ b/src/components/common/ScrollToTop.tsx @@ -0,0 +1,16 @@ +'use client'; + +import { usePathname } from 'next/navigation'; +import { useEffect } from 'react'; + +const ScrollToTop = () => { + const pathname = usePathname(); + + useEffect(() => { + window.scrollTo(0, 0); + }, [pathname]); + + return null; +}; + +export default ScrollToTop; diff --git a/src/utils/commons/getOrigin.ts b/src/utils/commons/getOrigin.ts new file mode 100644 index 00000000..fe8e3812 --- /dev/null +++ b/src/utils/commons/getOrigin.ts @@ -0,0 +1,4 @@ +export const getOrigin = () => { + if (typeof window !== 'undefined') return window.location.origin; + return process.env.NEXT_PUBLIC_API_URL; +};