From d788f89fcb7be171594e0cce22a479eeeaa92fda Mon Sep 17 00:00:00 2001 From: oaoong Date: Sat, 2 Dec 2023 17:24:25 +0900 Subject: [PATCH 1/2] =?UTF-8?q?:sparkles:=20=EB=A1=9C=EB=94=A9=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cards/[cardId]/modify/loading.tsx | 25 +++++++++++++++++++ .../[chatRoomId]/components/ChatList.tsx | 3 --- .../chatrooms/[chatRoomId]/loading.tsx | 4 +-- src/app/(root)/(routes)/mypage/loading.tsx | 25 +++++++++++++++++++ src/app/@authModal/(...)login/loading.tsx | 25 +++++++++++++++++++ src/app/loading.tsx | 6 ++--- .../header/components/AvatarWithDropdown.tsx | 1 + .../domain/header/sections/RightSide.tsx | 13 +++++++--- src/types/declaration.d.ts | 4 +++ 9 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 src/app/(root)/(routes)/cards/[cardId]/modify/loading.tsx create mode 100644 src/app/(root)/(routes)/mypage/loading.tsx create mode 100644 src/app/@authModal/(...)login/loading.tsx create mode 100644 src/types/declaration.d.ts diff --git a/src/app/(root)/(routes)/cards/[cardId]/modify/loading.tsx b/src/app/(root)/(routes)/cards/[cardId]/modify/loading.tsx new file mode 100644 index 00000000..6c1e0885 --- /dev/null +++ b/src/app/(root)/(routes)/cards/[cardId]/modify/loading.tsx @@ -0,0 +1,25 @@ +'use client' + +import Lottie from 'react-lottie-player' +import lottieJson from '/public/loading.json' + +const Loading = () => { + return ( +
+
+ +

잠시만 기다려 주세요.

+
+
+ ) +} + +export default Loading diff --git a/src/app/(root)/(routes)/chatrooms/[chatRoomId]/components/ChatList.tsx b/src/app/(root)/(routes)/chatrooms/[chatRoomId]/components/ChatList.tsx index c8f0ddb1..b05c5b28 100644 --- a/src/app/(root)/(routes)/chatrooms/[chatRoomId]/components/ChatList.tsx +++ b/src/app/(root)/(routes)/chatrooms/[chatRoomId]/components/ChatList.tsx @@ -26,9 +26,6 @@ const ChatList = forwardRef( /> ) })} - {messages.length === 0 && ( -

채팅을 시작해보세요!

- )}
) diff --git a/src/app/(root)/(routes)/chatrooms/[chatRoomId]/loading.tsx b/src/app/(root)/(routes)/chatrooms/[chatRoomId]/loading.tsx index 29a08a58..23a58db5 100644 --- a/src/app/(root)/(routes)/chatrooms/[chatRoomId]/loading.tsx +++ b/src/app/(root)/(routes)/chatrooms/[chatRoomId]/loading.tsx @@ -1,11 +1,11 @@ 'use client' import Lottie from 'react-lottie-player' -import lottieJson from '../../../../../../public/loading.json' +import lottieJson from '/public/loading.json' const Loading = () => { return ( -
+
{ + return ( +
+
+ +

잠시만 기다려 주세요.

+
+
+ ) +} + +export default Loading diff --git a/src/app/@authModal/(...)login/loading.tsx b/src/app/@authModal/(...)login/loading.tsx new file mode 100644 index 00000000..6c1e0885 --- /dev/null +++ b/src/app/@authModal/(...)login/loading.tsx @@ -0,0 +1,25 @@ +'use client' + +import Lottie from 'react-lottie-player' +import lottieJson from '/public/loading.json' + +const Loading = () => { + return ( +
+
+ +

잠시만 기다려 주세요.

+
+
+ ) +} + +export default Loading diff --git a/src/app/loading.tsx b/src/app/loading.tsx index f4196af2..e1c6e03b 100644 --- a/src/app/loading.tsx +++ b/src/app/loading.tsx @@ -1,12 +1,12 @@ 'use client' import Lottie from 'react-lottie-player' -import lottieJson from '../../public/loading.json' +import lottieJson from '/public/loading.json' const Loading = () => { return ( -
-
+
+
{ const onClickLogout = () => { Cookies.remove(Environment.tokenName()) + Cookies.remove(Environment.refreshTokenName()) apiClient.setDefaultHeader('Authorization', '') location.reload() } diff --git a/src/components/domain/header/sections/RightSide.tsx b/src/components/domain/header/sections/RightSide.tsx index f1e859b9..4980cb91 100644 --- a/src/components/domain/header/sections/RightSide.tsx +++ b/src/components/domain/header/sections/RightSide.tsx @@ -2,6 +2,7 @@ import React from 'react' import Link from 'next/link' +import { useRouter } from 'next/navigation' import Button from '@/components/ui/button' import AppPath from '@/config/appPath' import useNotificationCountQuery from '@/hooks/api/queries/useNotificationCountQuery' @@ -33,6 +34,7 @@ type RightSideProps = { const RightSide = ({ isLoggedIn, currentUser }: RightSideProps) => { const { data } = useNotificationCountQuery({ isLoggedIn }) + const router = useRouter() return isLoggedIn ? ( <> @@ -40,10 +42,13 @@ const RightSide = ({ isLoggedIn, currentUser }: RightSideProps) => { ) : ( - ) } diff --git a/src/types/declaration.d.ts b/src/types/declaration.d.ts new file mode 100644 index 00000000..65686664 --- /dev/null +++ b/src/types/declaration.d.ts @@ -0,0 +1,4 @@ +declare module '*.json' { + const value: any + export default value +} From e7b25362009d12a6a3762107c0228248c4eec190 Mon Sep 17 00:00:00 2001 From: doggopawer Date: Sat, 2 Dec 2023 20:06:08 +0900 Subject: [PATCH 2/2] =?UTF-8?q?:tada:=20=ED=95=84=ED=84=B0=EB=A7=81=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EB=A1=9C=EB=94=A9=20fallback=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../card-list-content/CardListContent.tsx | 4 ++-- .../my-card-list-content/MyCardListContent.tsx | 4 ++-- .../NotificationListContent.tsx | 4 ++-- .../MySuggestionListContent.tsx | 4 ++-- .../InfiniteScrollLoading.tsx | 16 ++++++++++++++++ .../domain/infinite-scroll-loading/index.tsx | 3 +++ 6 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 src/components/domain/infinite-scroll-loading/InfiniteScrollLoading.tsx create mode 100644 src/components/domain/infinite-scroll-loading/index.tsx diff --git a/src/app/(root)/(routes)/cards/components/card-list-content/CardListContent.tsx b/src/app/(root)/(routes)/cards/components/card-list-content/CardListContent.tsx index f8429750..c79580b1 100644 --- a/src/app/(root)/(routes)/cards/components/card-list-content/CardListContent.tsx +++ b/src/app/(root)/(routes)/cards/components/card-list-content/CardListContent.tsx @@ -2,8 +2,8 @@ import { Suspense } from 'react' import { ErrorBoundary } from 'react-error-boundary' -import Loading from '@/app/loading' import DefaultErrorTemplate from '@/components/domain/errors/DefaultErrorTemplate' +import InfiniteScrollLoading from '@/components/domain/infinite-scroll-loading' import CardFilterSection from '../card-filter-section' import CardList from '../card-list/CardList' @@ -16,7 +16,7 @@ const CardListContent = () => { console.log('재시도')} /> } > - }> + }> diff --git a/src/app/(root)/(routes)/cards/my/components/my-card-list-content/MyCardListContent.tsx b/src/app/(root)/(routes)/cards/my/components/my-card-list-content/MyCardListContent.tsx index 63427186..2ac29773 100644 --- a/src/app/(root)/(routes)/cards/my/components/my-card-list-content/MyCardListContent.tsx +++ b/src/app/(root)/(routes)/cards/my/components/my-card-list-content/MyCardListContent.tsx @@ -2,8 +2,8 @@ import { Suspense, useState } from 'react' import { ErrorBoundary } from 'react-error-boundary' -import Loading from '@/app/loading' import DefaultErrorTemplate from '@/components/domain/errors/DefaultErrorTemplate' +import InfiniteScrollLoading from '@/components/domain/infinite-scroll-loading' import { TradeStatus } from '@/types/card' import MyCardList from '../my-card-list/MyCardList' import TradeStatusTabs from '../trade-status-tabs' @@ -22,7 +22,7 @@ const MyCardListContent = () => { console.log('재시도')} /> } > - }> + }> diff --git a/src/app/(root)/(routes)/notifications/components/notification-list-content/NotificationListContent.tsx b/src/app/(root)/(routes)/notifications/components/notification-list-content/NotificationListContent.tsx index 143ec869..307c8d93 100644 --- a/src/app/(root)/(routes)/notifications/components/notification-list-content/NotificationListContent.tsx +++ b/src/app/(root)/(routes)/notifications/components/notification-list-content/NotificationListContent.tsx @@ -2,8 +2,8 @@ import { Suspense, useState } from 'react' import { ErrorBoundary } from 'react-error-boundary' -import Loading from '@/app/loading' import DefaultErrorTemplate from '@/components/domain/errors/DefaultErrorTemplate' +import InfiniteScrollLoading from '@/components/domain/infinite-scroll-loading' import NotificationList from '../notification-list' import NotificationReadButton from '../notification-read-button' import NotificationStatusTabs from '../notification-status-tabs' @@ -21,7 +21,7 @@ const NotificationListContent = () => { console.log('재시도')} /> } > - }> + }> diff --git a/src/app/(root)/(routes)/suggestions/[myCardId]/components/my-suggestion-list-content/MySuggestionListContent.tsx b/src/app/(root)/(routes)/suggestions/[myCardId]/components/my-suggestion-list-content/MySuggestionListContent.tsx index 98f92bf4..cb22323d 100644 --- a/src/app/(root)/(routes)/suggestions/[myCardId]/components/my-suggestion-list-content/MySuggestionListContent.tsx +++ b/src/app/(root)/(routes)/suggestions/[myCardId]/components/my-suggestion-list-content/MySuggestionListContent.tsx @@ -2,8 +2,8 @@ import { Suspense, useState } from 'react' import { ErrorBoundary } from 'react-error-boundary' -import Loading from '@/app/loading' import DefaultErrorTemplate from '@/components/domain/errors/DefaultErrorTemplate' +import InfiniteScrollLoading from '@/components/domain/infinite-scroll-loading/InfiniteScrollLoading' import { DirectionType, SuggestionType } from '@/types/suggestion' import MySuggestionList from '../my-suggestion-list/MySuggestionList' import SuggestionStatusTabs from '../suggestion-status-tabs' @@ -25,7 +25,7 @@ const MySuggestionListContent = () => { console.log('재시도')} /> } > - }> + }> ( + +) + +export default InfiniteScrollLoading diff --git a/src/components/domain/infinite-scroll-loading/index.tsx b/src/components/domain/infinite-scroll-loading/index.tsx new file mode 100644 index 00000000..266a7994 --- /dev/null +++ b/src/components/domain/infinite-scroll-loading/index.tsx @@ -0,0 +1,3 @@ +import InfiniteScrollLoading from './InfiniteScrollLoading' + +export default InfiniteScrollLoading