From e23b71ee9c3f3c71c6c05c2b2d71b2c39973735c Mon Sep 17 00:00:00 2001 From: Kim Dong Hyun <107387817+doggopawer@users.noreply.github.com> Date: Sat, 2 Dec 2023 20:18:57 +0900 Subject: [PATCH] :truck: merge develop (#155) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :sparkles: 로딩 개선 (#154) * :sparkles: 로딩 개선 * :tada: 필터링 리스트 페이지 로딩 fallback 변경 --------- Co-authored-by: doggopawer * :tada: sitemap 및 robots 추가 (#156) --------- Co-authored-by: 정재희 --- .../cards/[cardId]/modify/loading.tsx | 25 +++++++++++++++ .../card-list-content/CardListContent.tsx | 4 +-- .../MyCardListContent.tsx | 4 +-- .../[chatRoomId]/components/ChatList.tsx | 3 -- .../chatrooms/[chatRoomId]/loading.tsx | 4 +-- src/app/(root)/(routes)/mypage/loading.tsx | 25 +++++++++++++++ .../NotificationListContent.tsx | 4 +-- .../MySuggestionListContent.tsx | 4 +-- src/app/@authModal/(...)login/loading.tsx | 25 +++++++++++++++ src/app/loading.tsx | 6 ++-- src/app/robots.ts | 13 ++++++++ src/app/sitemap.ts | 12 +++++++ .../header/components/AvatarWithDropdown.tsx | 1 + .../domain/header/sections/RightSide.tsx | 13 +++++--- .../InfiniteScrollLoading.tsx | 16 ++++++++++ .../domain/infinite-scroll-loading/index.tsx | 3 ++ src/types/declaration.d.ts | 4 +++ src/types/metadata-interface.d.ts | 31 +++++++++++++++++++ 18 files changed, 177 insertions(+), 20 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/app/robots.ts create mode 100644 src/app/sitemap.ts create mode 100644 src/components/domain/infinite-scroll-loading/InfiniteScrollLoading.tsx create mode 100644 src/components/domain/infinite-scroll-loading/index.tsx create mode 100644 src/types/declaration.d.ts create mode 100644 src/types/metadata-interface.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)/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)/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/(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('재시도')} /> } > - }> + }> { + 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 ( -
-
+
+
({ + url: `${Environment.currentAddress()}${route('' as never)}`, + lastModified: new Date().toISOString().split('T')[0], + })) + + return [...routes] +} diff --git a/src/components/domain/header/components/AvatarWithDropdown.tsx b/src/components/domain/header/components/AvatarWithDropdown.tsx index 2893854c..3a1cd6ef 100644 --- a/src/components/domain/header/components/AvatarWithDropdown.tsx +++ b/src/components/domain/header/components/AvatarWithDropdown.tsx @@ -21,6 +21,7 @@ const AvatarWithDropdown = ({ imageUrl }: { imageUrl?: string }) => { 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/components/domain/infinite-scroll-loading/InfiniteScrollLoading.tsx b/src/components/domain/infinite-scroll-loading/InfiniteScrollLoading.tsx new file mode 100644 index 00000000..448218a8 --- /dev/null +++ b/src/components/domain/infinite-scroll-loading/InfiniteScrollLoading.tsx @@ -0,0 +1,16 @@ +import Lottie from 'react-lottie-player' +import lottieJson from '/public/loading.json' + +const InfiniteScrollLoading = () => ( + +) + +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 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 +} diff --git a/src/types/metadata-interface.d.ts b/src/types/metadata-interface.d.ts new file mode 100644 index 00000000..e66553fe --- /dev/null +++ b/src/types/metadata-interface.d.ts @@ -0,0 +1,31 @@ +type Robots = { + rules: + | { + userAgent?: string | string[] + allow?: string | string[] + disallow?: string | string[] + crawlDelay?: number + } + | Array<{ + userAgent: string | string[] + allow?: string | string[] + disallow?: string | string[] + crawlDelay?: number + }> + sitemap?: string | string[] + host?: string +} + +type Sitemap = Array<{ + url: string + lastModified?: string | Date + changeFrequency?: + | 'always' + | 'hourly' + | 'daily' + | 'weekly' + | 'monthly' + | 'yearly' + | 'never' + priority?: number +}>