From 9739e23115ea98043b2047aa882f976689e8b9f3 Mon Sep 17 00:00:00 2001 From: Jeongmin Lee Date: Sun, 13 Oct 2024 16:14:48 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=94=A7=20chore:=20metadata=20layout?= =?UTF-8?q?=EC=97=90=EC=84=9C=20page=EB=A1=9C=20=EC=88=98=EC=A0=95=20#65?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(home)/page.tsx | 26 -------------------- src/app/layout.tsx | 27 --------------------- src/app/page.tsx | 53 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 53 deletions(-) delete mode 100644 src/app/(home)/page.tsx create mode 100644 src/app/page.tsx diff --git a/src/app/(home)/page.tsx b/src/app/(home)/page.tsx deleted file mode 100644 index 85a0e70..0000000 --- a/src/app/(home)/page.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { FloatingButton } from "@/components/core/Button"; -import { HomeHeader } from "@/layout/Mobile/MobileHeader"; -import NavigationBar from "@/layout/Mobile/NavigationBar"; - -import { - FestivalHot, - FestivalRecommend, - FestivalThisWeek, - TopReviews, -} from "./_components"; - -export default async function Home() { - return ( -
- - -
- - - -
- - -
- ); -} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 79f1933..ac61d1a 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,7 +1,6 @@ import "../styles/globals.css"; import "../styles/reset.css"; -import type { Metadata } from "next"; import Script from "next/script"; import { ReactNode } from "react"; @@ -16,32 +15,6 @@ import { cn } from "@/utils/cn"; import { Pretendard } from "./fonts"; -export const metadata: Metadata = { - metadataBase: new URL("https://www.odiga.kr"), - title: { - default: "피에스타", - template: "%s - 피에스타", - }, - description: - "한국의 공식 및 비공식 축제 모두를 한곳에서! 날짜, 장소, 프로그램 등 다양한 국내 축제 정보를 확인하고, 대학 축제와 같은 특별한 행사도 피에스타에서 만나보세요.", - openGraph: { - siteName: "피에스타", - title: "피에스타", - type: "website", - description: - "한국의 공식 및 비공식 축제 모두를 한곳에서! 날짜, 장소, 프로그램 등 다양한 국내 축제 정보를 확인하고, 대학 축제와 같은 특별한 행사도 피에스타에서 만나보세요.", - images: [ - { - url: "/opengraph-image.png", - alt: "Fiesta OG Image", - width: 1200, - height: 630, - }, - ], - url: "https://www.odiga.kr", - }, -}; - export default async function RootLayout({ children, }: Readonly<{ diff --git a/src/app/page.tsx b/src/app/page.tsx new file mode 100644 index 0000000..6369bca --- /dev/null +++ b/src/app/page.tsx @@ -0,0 +1,53 @@ +import { Metadata } from "next"; + +import { FloatingButton } from "@/components/core/Button"; +import { HomeHeader } from "@/layout/Mobile/MobileHeader"; +import NavigationBar from "@/layout/Mobile/NavigationBar"; + +import { + FestivalHot, + FestivalRecommend, + FestivalThisWeek, + TopReviews, +} from "./(home)/_components"; + +export const metadata: Metadata = { + title: { + default: "피에스타", + template: "%s - 피에스타", + }, + description: + "한국의 공식 및 비공식 축제 모두를 한곳에서! 날짜, 장소, 프로그램 등 다양한 국내 축제 정보를 확인하고, 대학 축제와 같은 특별한 행사도 피에스타에서 만나보세요.", + openGraph: { + siteName: "피에스타", + title: "피에스타", + type: "website", + description: + "한국의 공식 및 비공식 축제 모두를 한곳에서! 날짜, 장소, 프로그램 등 다양한 국내 축제 정보를 확인하고, 대학 축제와 같은 특별한 행사도 피에스타에서 만나보세요.", + images: [ + { + url: "/opengraph-image.png", + alt: "Fiesta OG Image", + width: 1200, + height: 630, + }, + ], + url: "https://www.odiga.kr", + }, +}; + +export default async function Home() { + return ( +
+ + +
+ + + +
+ + +
+ ); +} From f2906e680964abbc0b6a0ef806af54c6654c5258 Mon Sep 17 00:00:00 2001 From: Jeongmin Lee Date: Sun, 13 Oct 2024 16:15:59 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=92=85=20style:=20favicon=20asset=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD=20#65?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/{favicon.ico => icon.ico} | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename src/app/{favicon.ico => icon.ico} (100%) diff --git a/src/app/favicon.ico b/src/app/icon.ico similarity index 100% rename from src/app/favicon.ico rename to src/app/icon.ico From d8c1efdb6b562ecce9385dfdf35695264d24cdf3 Mon Sep 17 00:00:00 2001 From: Jeongmin Lee Date: Sun, 13 Oct 2024 16:16:37 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=E2=9C=A8=20feat:=20refresh=20token=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95=20#65?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auth.ts | 44 ++++++++++--------- .../core/Button/BasicButton/BasicButton.tsx | 23 +++++----- src/lib/jwt.ts | 6 ++- 3 files changed, 41 insertions(+), 32 deletions(-) diff --git a/auth.ts b/auth.ts index 28917a1..bcee232 100644 --- a/auth.ts +++ b/auth.ts @@ -26,6 +26,7 @@ export const { handlers, auth, signIn, signOut, unstable_update } = NextAuth({ async signIn() { return true; }, + redirect: async ({ url, baseUrl }) => { if (url.startsWith("/")) return `${baseUrl}${url}`; if (url) { @@ -40,27 +41,6 @@ export const { handlers, auth, signIn, signOut, unstable_update } = NextAuth({ return baseUrl; }, async jwt({ token, session, user, trigger, account }) { - if (!!token.accessToken) { - const decodedJWT = decodeToken(token.accessToken); - - if ( - !!token.refreshToken && - !!decodedJWT?.exp && - decodedJWT?.exp * 1000 < Date.now() - ) { - console.log("토큰 재발급"); - const { accessToken, refreshToken } = await getRefreshToken( - token.refreshToken, - ); - - const decodedJWT = decodeToken(accessToken); - - token.accessToken = accessToken; - token.refreshToken = refreshToken; - token.exp = decodedJWT?.exp; - } - } - if (trigger === "update") { token.user = { ...session.user, @@ -93,6 +73,28 @@ export const { handlers, auth, signIn, signOut, unstable_update } = NextAuth({ } } + if (!token.accessToken) { + return null; + } + + const decodedJWT = decodeToken(token.accessToken); + if ( + !!token.refreshToken && + !!decodedJWT?.exp && + decodedJWT?.exp * 1000 < Date.now() + ) { + console.log("토큰 재발급"); + const { accessToken, refreshToken } = await getRefreshToken( + token.refreshToken, + ); + + const decodedJWT = decodeToken(accessToken); + + token.accessToken = accessToken; + token.refreshToken = refreshToken; + token.exp = decodedJWT?.exp; + } + return token; }, diff --git a/src/components/core/Button/BasicButton/BasicButton.tsx b/src/components/core/Button/BasicButton/BasicButton.tsx index 2a600f5..272c9d2 100644 --- a/src/components/core/Button/BasicButton/BasicButton.tsx +++ b/src/components/core/Button/BasicButton/BasicButton.tsx @@ -1,19 +1,22 @@ -import { ButtonHTMLAttributes, FC } from "react"; +import { ComponentPropsWithoutRef, ElementType } from "react"; import { cn } from "@/utils/cn"; -interface Props - extends Omit< - ButtonHTMLAttributes, - "children" | "label" | "className" - > { +interface Props { + as?: T; label: string; className?: string; } -const BasicButton: FC = ({ className, label, ...props }) => { +const BasicButton = ({ + as, + className, + label, + ...props +}: Props & Omit, keyof Props>) => { + const Component = as || "button"; return ( - +
{label}
+ ); }; diff --git a/src/lib/jwt.ts b/src/lib/jwt.ts index 3f9b025..e59f58c 100644 --- a/src/lib/jwt.ts +++ b/src/lib/jwt.ts @@ -1,6 +1,10 @@ import { decodeJwt } from "jose"; -export const decodeToken = (token: string) => { +export const decodeToken = (token?: string) => { + if (!token) { + return null; + } + try { const decoded = decodeJwt(token); return decoded; From ea2544568b2a281d6593f427fbfba856c6a46791 Mon Sep 17 00:00:00 2001 From: Jeongmin Lee Date: Sun, 13 Oct 2024 17:02:26 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E2=9C=A8=20feat:=20=EB=9D=BC=EC=9A=B0?= =?UTF-8?q?=ED=8A=B8=20=EC=A0=95=EB=A6=AC=20=EB=B0=8F=20lint=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=A0=95=EB=A6=AC=20#65?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.json | 40 ++++++++++--------- auth.ts | 10 +++++ src/apis/user/me/me.ts | 2 + src/apis/user/me/meType.ts | 2 +- .../(home)/_components/FestivalHot.tsx | 0 .../RecommendFestivalFallbackUI.tsx | 0 .../RecommendFestivalHeader.tsx | 0 .../RecommendFestivalSkeleton.tsx | 0 .../_components/FestivalRecommend/index.tsx | 0 .../(home)/_components/FestivalThisWeek.tsx | 0 .../(home)/_components/TopReviews.tsx | 0 .../{ => (route)}/(home)/_components/index.ts | 0 src/app/{ => (route)/(home)}/page.tsx | 2 +- .../(out-of-service)}/calendar/page.tsx | 0 .../(out-of-service)}/calendar/view.tsx | 0 .../(out-of-service)}/chat/page.tsx | 0 .../(out-of-service)}/chat/view.tsx | 0 .../(out-of-service)}/map/page.tsx | 0 .../(out-of-service)}/map/view.tsx | 0 src/app/{ => (route)}/auth/sign-in/page.tsx | 6 +-- .../DetailFestivalCarousel/index.tsx | 0 .../_components/DetailCategory.tsx | 0 .../_components/DetailChat.tsx | 0 .../_components/DetailInfo.tsx | 0 .../_components/DetailTitle.tsx | 0 .../_components/index.tsx | 0 .../DetailFestivalInfoPanel/index.tsx | 0 .../Around/_components/AroundPlaceTile.tsx | 0 .../DetailFestivalTab/Around/index.tsx | 0 .../DetailFestivalTab/Detail/index.tsx | 0 .../_components/TopKeywords/TopKeywords.tsx | 0 .../TopKeywords/TopKeywordsSkeleton.tsx | 0 .../TopKeywords/TopKeywordsTile.tsx | 0 .../_components/TotalReviews/TotalReview.tsx | 0 .../TotalReviews/TotalReviewFallback.tsx | 0 .../TotalReviews/TotalReviewList.tsx | 0 .../TotalReviews/TotalReviewListItem.tsx | 12 +++--- .../DetailFestivalTab/Review/index.tsx | 0 .../_components/DetailFestivalTab/index.tsx | 4 +- .../[festivalId]/_components/index.tsx | 0 .../festivals/[festivalId]/page.tsx | 0 .../[festivalId]/review/[reviewId]/page.tsx | 0 .../[festivalId]/review/[reviewId]/view.tsx | 16 ++++---- .../review/new/_components/Input_rating.tsx | 0 .../[festivalId]/review/new/page.tsx | 0 .../[festivalId]/review/new/view.tsx | 0 .../festivals/[festivalId]/view.tsx | 0 .../festivals/mostlike/page.tsx | 0 .../festivals/mostlike/view.tsx | 0 .../new/_components/CreateFestivalButton.tsx | 0 .../_components/CreateFestivalFirstStep.tsx | 2 +- .../_components/CreateFestivalSecondStep.tsx | 0 .../new/_components/DurationFestivalInput.tsx | 0 .../festivals/new/_components/index.tsx | 0 .../festivals/new/page.tsx | 0 .../festivals/new/view.tsx | 0 .../festivals/thisweek/page.tsx | 0 .../festivals/thisweek/view.tsx | 0 .../_components/Badges/MypageBadgeCount.tsx | 0 .../_components/Badges/MypageBadgeItem.tsx | 0 .../Badges/MypageBadgeSkeleton.tsx | 0 .../_components/Badges/MypageBadges.tsx | 0 .../_components/Bookmark/MyPageScrab.tsx | 0 .../Bookmark/MypageBookmarkFallback.tsx | 0 .../Bookmark/MypageBookmarkSkeleton.tsx | 2 +- .../mypage/_components/MypageAvatar.tsx | 8 ++-- .../mypage/_components/MypageHeader.tsx | 0 .../mypage/_components/MypageTab.tsx | 2 +- src/app/{ => (route)}/mypage/page.tsx | 0 .../_components/MypageSettingsKeywords.tsx | 0 .../_components/MypageSettingsProfile.tsx | 0 .../_components/MypageSettingsTab.tsx | 2 +- .../{ => (route)}/mypage/settings/page.tsx | 0 .../{ => (route)}/mypage/settings/view.tsx | 0 src/app/{ => (route)}/mypage/view.tsx | 0 .../onboarding/_components/index.ts | 0 .../_components/onBoardingLoading/index.tsx | 0 .../onBoardingStep/OnBoardingButton.tsx | 0 .../onBoardingStep/OnBoardingCategories.tsx | 0 .../onBoardingStep/OnBoardingCompanies.tsx | 0 .../onBoardingStep/OnBoardingMoods.tsx | 0 .../onBoardingStep/OnBoardingPriorities.tsx | 0 .../onBoardingStep/OnBoardingTitle.tsx | 0 .../_components/onBoardingStep/index.tsx | 1 + .../OnboardingCompleteConfetti.tsx | 0 .../OnboardingImageDownloadButton.tsx | 0 .../onboarding/complete/page.tsx | 0 .../onboarding/complete/view.tsx | 0 src/app/{ => (route)}/onboarding/page.tsx | 0 src/app/{ => (route)}/onboarding/view.tsx | 0 .../SearchFestivalFallback.tsx | 0 .../_components/SearchFestivalList/index.tsx | 0 .../_components/SearchHistory/index.tsx | 0 .../TrendingFestivalSkeleton.tsx | 0 .../_components/TrendingFestival/index.tsx | 0 src/app/{(home) => (route)}/search/page.tsx | 0 src/app/{(home) => (route)}/search/view.tsx | 0 .../RecommendFestival.stories.tsx | 6 +-- .../RecommendFestival/RecommendFestival.tsx | 2 +- .../BookingButton/BookingButton.stories.tsx | 8 +--- .../Button/BookingButton/BookingButton.tsx | 3 +- .../core/Progress/ProgressBar/ProgressBar.tsx | 2 +- .../imageUploader/ImageUploader.tsx | 1 + src/hooks/session/useUpdateUserSession.tsx | 1 + src/hooks/useSwipingContainer.ts | 1 + src/lib/Providers/UserProvider.tsx | 18 ++++----- src/store/user.ts | 6 +-- src/utils/reviewEntityToFiles.ts | 2 +- 108 files changed, 87 insertions(+), 74 deletions(-) rename src/app/{ => (route)}/(home)/_components/FestivalHot.tsx (100%) rename src/app/{ => (route)}/(home)/_components/FestivalRecommend/RecommendFestivalFallbackUI.tsx (100%) rename src/app/{ => (route)}/(home)/_components/FestivalRecommend/RecommendFestivalHeader.tsx (100%) rename src/app/{ => (route)}/(home)/_components/FestivalRecommend/RecommendFestivalSkeleton.tsx (100%) rename src/app/{ => (route)}/(home)/_components/FestivalRecommend/index.tsx (100%) rename src/app/{ => (route)}/(home)/_components/FestivalThisWeek.tsx (100%) rename src/app/{ => (route)}/(home)/_components/TopReviews.tsx (100%) rename src/app/{ => (route)}/(home)/_components/index.ts (100%) rename src/app/{ => (route)/(home)}/page.tsx (98%) rename src/app/{ => (route)/(out-of-service)}/calendar/page.tsx (100%) rename src/app/{ => (route)/(out-of-service)}/calendar/view.tsx (100%) rename src/app/{ => (route)/(out-of-service)}/chat/page.tsx (100%) rename src/app/{ => (route)/(out-of-service)}/chat/view.tsx (100%) rename src/app/{ => (route)/(out-of-service)}/map/page.tsx (100%) rename src/app/{ => (route)/(out-of-service)}/map/view.tsx (100%) rename src/app/{ => (route)}/auth/sign-in/page.tsx (92%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalCarousel/index.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalInfoPanel/_components/DetailCategory.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalInfoPanel/_components/DetailChat.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalInfoPanel/_components/DetailInfo.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalInfoPanel/_components/DetailTitle.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalInfoPanel/_components/index.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalInfoPanel/index.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/Around/_components/AroundPlaceTile.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/Around/index.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/Detail/index.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/Review/_components/TopKeywords/TopKeywords.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/Review/_components/TopKeywords/TopKeywordsSkeleton.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/Review/_components/TopKeywords/TopKeywordsTile.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/Review/_components/TotalReviews/TotalReview.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/Review/_components/TotalReviews/TotalReviewFallback.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/Review/_components/TotalReviews/TotalReviewList.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/Review/_components/TotalReviews/TotalReviewListItem.tsx (95%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/Review/index.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/DetailFestivalTab/index.tsx (93%) rename src/app/{(home) => (route)}/festivals/[festivalId]/_components/index.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/page.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/review/[reviewId]/page.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/review/[reviewId]/view.tsx (95%) rename src/app/{(home) => (route)}/festivals/[festivalId]/review/new/_components/Input_rating.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/review/new/page.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/review/new/view.tsx (100%) rename src/app/{(home) => (route)}/festivals/[festivalId]/view.tsx (100%) rename src/app/{(home) => (route)}/festivals/mostlike/page.tsx (100%) rename src/app/{(home) => (route)}/festivals/mostlike/view.tsx (100%) rename src/app/{(home) => (route)}/festivals/new/_components/CreateFestivalButton.tsx (100%) rename src/app/{(home) => (route)}/festivals/new/_components/CreateFestivalFirstStep.tsx (96%) rename src/app/{(home) => (route)}/festivals/new/_components/CreateFestivalSecondStep.tsx (100%) rename src/app/{(home) => (route)}/festivals/new/_components/DurationFestivalInput.tsx (100%) rename src/app/{(home) => (route)}/festivals/new/_components/index.tsx (100%) rename src/app/{(home) => (route)}/festivals/new/page.tsx (100%) rename src/app/{(home) => (route)}/festivals/new/view.tsx (100%) rename src/app/{(home) => (route)}/festivals/thisweek/page.tsx (100%) rename src/app/{(home) => (route)}/festivals/thisweek/view.tsx (100%) rename src/app/{ => (route)}/mypage/_components/Badges/MypageBadgeCount.tsx (100%) rename src/app/{ => (route)}/mypage/_components/Badges/MypageBadgeItem.tsx (100%) rename src/app/{ => (route)}/mypage/_components/Badges/MypageBadgeSkeleton.tsx (100%) rename src/app/{ => (route)}/mypage/_components/Badges/MypageBadges.tsx (100%) rename src/app/{ => (route)}/mypage/_components/Bookmark/MyPageScrab.tsx (100%) rename src/app/{ => (route)}/mypage/_components/Bookmark/MypageBookmarkFallback.tsx (100%) rename src/app/{ => (route)}/mypage/_components/Bookmark/MypageBookmarkSkeleton.tsx (88%) rename src/app/{ => (route)}/mypage/_components/MypageAvatar.tsx (89%) rename src/app/{ => (route)}/mypage/_components/MypageHeader.tsx (100%) rename src/app/{ => (route)}/mypage/_components/MypageTab.tsx (97%) rename src/app/{ => (route)}/mypage/page.tsx (100%) rename src/app/{ => (route)}/mypage/settings/_components/MypageSettingsKeywords.tsx (100%) rename src/app/{ => (route)}/mypage/settings/_components/MypageSettingsProfile.tsx (100%) rename src/app/{ => (route)}/mypage/settings/_components/MypageSettingsTab.tsx (98%) rename src/app/{ => (route)}/mypage/settings/page.tsx (100%) rename src/app/{ => (route)}/mypage/settings/view.tsx (100%) rename src/app/{ => (route)}/mypage/view.tsx (100%) rename src/app/{ => (route)}/onboarding/_components/index.ts (100%) rename src/app/{ => (route)}/onboarding/_components/onBoardingLoading/index.tsx (100%) rename src/app/{ => (route)}/onboarding/_components/onBoardingStep/OnBoardingButton.tsx (100%) rename src/app/{ => (route)}/onboarding/_components/onBoardingStep/OnBoardingCategories.tsx (100%) rename src/app/{ => (route)}/onboarding/_components/onBoardingStep/OnBoardingCompanies.tsx (100%) rename src/app/{ => (route)}/onboarding/_components/onBoardingStep/OnBoardingMoods.tsx (100%) rename src/app/{ => (route)}/onboarding/_components/onBoardingStep/OnBoardingPriorities.tsx (100%) rename src/app/{ => (route)}/onboarding/_components/onBoardingStep/OnBoardingTitle.tsx (100%) rename src/app/{ => (route)}/onboarding/_components/onBoardingStep/index.tsx (98%) rename src/app/{ => (route)}/onboarding/complete/_components/OnboardingCompleteConfetti.tsx (100%) rename src/app/{ => (route)}/onboarding/complete/_components/OnboardingImageDownloadButton.tsx (100%) rename src/app/{ => (route)}/onboarding/complete/page.tsx (100%) rename src/app/{ => (route)}/onboarding/complete/view.tsx (100%) rename src/app/{ => (route)}/onboarding/page.tsx (100%) rename src/app/{ => (route)}/onboarding/view.tsx (100%) rename src/app/{(home) => (route)}/search/_components/SearchFestivalList/SearchFestivalFallback.tsx (100%) rename src/app/{(home) => (route)}/search/_components/SearchFestivalList/index.tsx (100%) rename src/app/{(home) => (route)}/search/_components/SearchHistory/index.tsx (100%) rename src/app/{(home) => (route)}/search/_components/TrendingFestival/TrendingFestivalSkeleton.tsx (100%) rename src/app/{(home) => (route)}/search/_components/TrendingFestival/index.tsx (100%) rename src/app/{(home) => (route)}/search/page.tsx (100%) rename src/app/{(home) => (route)}/search/view.tsx (100%) diff --git a/.eslintrc.json b/.eslintrc.json index 2c0621a..d26339b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,21 +8,7 @@ "plugin:@tanstack/eslint-plugin-query/recommended" ], "rules": { - "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], - "@typescript-eslint/no-unused-vars": [ - "error", - { "argsIgnorePattern": "^_" } - ], "unused-imports/no-unused-imports": "error", - "unused-imports/no-unused-vars": [ - "warn", - { - "vars": "all", - "varsIgnorePattern": "^_", - "args": "after-used", - "argsIgnorePattern": "^_" - } - ], "react-hooks/rules-of-hooks": "off", "react-hooks/exhaustive-deps": "off", "eol-last": ["error", "always"], @@ -53,11 +39,29 @@ "rules": { "simple-import-sort/imports": "warn", "simple-import-sort/exports": "warn", - "no-unused-vars": "warn", - "@typescript-eslint/no-unused-vars": "warn", - "tailwindcss/no-custom-classname": "warn", + "tailwindcss/no-custom-classname": [ + "warn", + { + "whitelist": ["pagination_fraction"] + } + ], "tailwindcss/no-unnecessary-arbitrary-value": "off", - "tailwindcss/enforces-shorthand": "off" + "tailwindcss/enforces-shorthand": "off", + + // ? https://velog.io/@sumi-0011/eslint%EC%9D%98-no-unused-vars-%EA%B7%9C%EC%B9%99%EA%B3%BC-typescript%EC%9D%98-interface-%EB%AC%B8%EB%B2%95-%EC%B6%A9%EB%8F%8C-%ED%95%B4%EA%B2%B0%EB%B0%A9%EB%B2%95 + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": [ + "error", + { + "args": "all", + "argsIgnorePattern": "^_", + "caughtErrors": "all", + "caughtErrorsIgnorePattern": "^_", + "destructuredArrayIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "ignoreRestSiblings": true + } + ] } } ], diff --git a/auth.ts b/auth.ts index bcee232..68d76d7 100644 --- a/auth.ts +++ b/auth.ts @@ -8,6 +8,7 @@ import { SocialLoginRequest } from "@/apis/auth/authType"; import { getMe } from "@/apis/user/me/me"; import { env } from "@/env"; import { decodeToken } from "@/lib/jwt"; +import type { UserMeResponse } from "@/apis/user/me/meType"; export const { handlers, auth, signIn, signOut, unstable_update } = NextAuth({ providers: [ @@ -147,6 +148,15 @@ declare module "next-auth" { iat?: number; sub?: string; } + + interface User { + userId: number; + nickname: string; + statusMessage: string; + profileImage: string; + isProfileRegistered: boolean; + userTypeId: number; + } } declare module "next-auth/jwt" { interface JWT { diff --git a/src/apis/user/me/me.ts b/src/apis/user/me/me.ts index c2d16ac..57efa66 100644 --- a/src/apis/user/me/me.ts +++ b/src/apis/user/me/me.ts @@ -4,6 +4,8 @@ import instance, { FiestaFetchOptions } from "@/apis/instance"; import { FIESTA_ENDPOINTS } from "@/config"; import { ProfileMeUpdateSchemaType } from "@/validations/ProfileUpdateMeSchema"; +import { UserMeResponse } from "./meType"; + export const getMe = async (options?: FiestaFetchOptions) => { const endpoint = FIESTA_ENDPOINTS.users.me; const { data } = await instance.get(endpoint, { diff --git a/src/apis/user/me/meType.ts b/src/apis/user/me/meType.ts index 4fcee1b..de5bff2 100644 --- a/src/apis/user/me/meType.ts +++ b/src/apis/user/me/meType.ts @@ -1,4 +1,4 @@ -type UserMeResponse = { +export type UserMeResponse = { userId: number; email: string; nickname: string; diff --git a/src/app/(home)/_components/FestivalHot.tsx b/src/app/(route)/(home)/_components/FestivalHot.tsx similarity index 100% rename from src/app/(home)/_components/FestivalHot.tsx rename to src/app/(route)/(home)/_components/FestivalHot.tsx diff --git a/src/app/(home)/_components/FestivalRecommend/RecommendFestivalFallbackUI.tsx b/src/app/(route)/(home)/_components/FestivalRecommend/RecommendFestivalFallbackUI.tsx similarity index 100% rename from src/app/(home)/_components/FestivalRecommend/RecommendFestivalFallbackUI.tsx rename to src/app/(route)/(home)/_components/FestivalRecommend/RecommendFestivalFallbackUI.tsx diff --git a/src/app/(home)/_components/FestivalRecommend/RecommendFestivalHeader.tsx b/src/app/(route)/(home)/_components/FestivalRecommend/RecommendFestivalHeader.tsx similarity index 100% rename from src/app/(home)/_components/FestivalRecommend/RecommendFestivalHeader.tsx rename to src/app/(route)/(home)/_components/FestivalRecommend/RecommendFestivalHeader.tsx diff --git a/src/app/(home)/_components/FestivalRecommend/RecommendFestivalSkeleton.tsx b/src/app/(route)/(home)/_components/FestivalRecommend/RecommendFestivalSkeleton.tsx similarity index 100% rename from src/app/(home)/_components/FestivalRecommend/RecommendFestivalSkeleton.tsx rename to src/app/(route)/(home)/_components/FestivalRecommend/RecommendFestivalSkeleton.tsx diff --git a/src/app/(home)/_components/FestivalRecommend/index.tsx b/src/app/(route)/(home)/_components/FestivalRecommend/index.tsx similarity index 100% rename from src/app/(home)/_components/FestivalRecommend/index.tsx rename to src/app/(route)/(home)/_components/FestivalRecommend/index.tsx diff --git a/src/app/(home)/_components/FestivalThisWeek.tsx b/src/app/(route)/(home)/_components/FestivalThisWeek.tsx similarity index 100% rename from src/app/(home)/_components/FestivalThisWeek.tsx rename to src/app/(route)/(home)/_components/FestivalThisWeek.tsx diff --git a/src/app/(home)/_components/TopReviews.tsx b/src/app/(route)/(home)/_components/TopReviews.tsx similarity index 100% rename from src/app/(home)/_components/TopReviews.tsx rename to src/app/(route)/(home)/_components/TopReviews.tsx diff --git a/src/app/(home)/_components/index.ts b/src/app/(route)/(home)/_components/index.ts similarity index 100% rename from src/app/(home)/_components/index.ts rename to src/app/(route)/(home)/_components/index.ts diff --git a/src/app/page.tsx b/src/app/(route)/(home)/page.tsx similarity index 98% rename from src/app/page.tsx rename to src/app/(route)/(home)/page.tsx index 6369bca..aba10db 100644 --- a/src/app/page.tsx +++ b/src/app/(route)/(home)/page.tsx @@ -9,7 +9,7 @@ import { FestivalRecommend, FestivalThisWeek, TopReviews, -} from "./(home)/_components"; +} from "./_components"; export const metadata: Metadata = { title: { diff --git a/src/app/calendar/page.tsx b/src/app/(route)/(out-of-service)/calendar/page.tsx similarity index 100% rename from src/app/calendar/page.tsx rename to src/app/(route)/(out-of-service)/calendar/page.tsx diff --git a/src/app/calendar/view.tsx b/src/app/(route)/(out-of-service)/calendar/view.tsx similarity index 100% rename from src/app/calendar/view.tsx rename to src/app/(route)/(out-of-service)/calendar/view.tsx diff --git a/src/app/chat/page.tsx b/src/app/(route)/(out-of-service)/chat/page.tsx similarity index 100% rename from src/app/chat/page.tsx rename to src/app/(route)/(out-of-service)/chat/page.tsx diff --git a/src/app/chat/view.tsx b/src/app/(route)/(out-of-service)/chat/view.tsx similarity index 100% rename from src/app/chat/view.tsx rename to src/app/(route)/(out-of-service)/chat/view.tsx diff --git a/src/app/map/page.tsx b/src/app/(route)/(out-of-service)/map/page.tsx similarity index 100% rename from src/app/map/page.tsx rename to src/app/(route)/(out-of-service)/map/page.tsx diff --git a/src/app/map/view.tsx b/src/app/(route)/(out-of-service)/map/view.tsx similarity index 100% rename from src/app/map/view.tsx rename to src/app/(route)/(out-of-service)/map/view.tsx diff --git a/src/app/auth/sign-in/page.tsx b/src/app/(route)/auth/sign-in/page.tsx similarity index 92% rename from src/app/auth/sign-in/page.tsx rename to src/app/(route)/auth/sign-in/page.tsx index a81ac75..5702c97 100644 --- a/src/app/auth/sign-in/page.tsx +++ b/src/app/(route)/auth/sign-in/page.tsx @@ -29,7 +29,7 @@ const SignIn = () => { { /> { /> = ({ review }) => { const { mutate: deleteReviewMutate, isPending: isDeleting } = useMutation({ mutationFn: async (reviewId: number) => await deleteReview(reviewId), - onSuccess: (data) => { + onSuccess: () => { queryClient.invalidateQueries({ queryKey: reviewsKeys.all, }), @@ -52,8 +52,7 @@ const TotalReviewListItem: FC = ({ review }) => { const handleDelete = (reviewId: number) => { deleteReviewMutate(reviewId); }; - - const myReviewOptions: Array = [ + const myReviewOptions = [ { label: "수정하기", onClick: () => @@ -67,7 +66,7 @@ const TotalReviewListItem: FC = ({ review }) => { }, ]; - const othersReviewOptions: Array = [ + const othersReviewOptions = [ { label: "신고하기", onClick: () => setIsOpenReportDialog(true), @@ -78,7 +77,8 @@ const TotalReviewListItem: FC = ({ review }) => { return user?.userId === review.user.userId ? myReviewOptions : othersReviewOptions; - }, [review]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [user?.userId, review.user.userId]); return (
= ({ festivals, session }) => { }; return ( - + - {TabList.map(({ name }, index) => ( + {TabList.map(({ name }) => ( = ({ keywords, reviewId, festivalId }) => { const queryClient = useQueryClient(); const router = useRouter(); - const { data: review, isLoading } = useQuery({ + const { data: review } = useQuery({ queryKey: reviewsKeys.detail(reviewId), queryFn: () => getReview(reviewId), }); const { mutate: updateReviewMutate } = useMutation({ mutationFn: (payload: UpdateReviewSchemaType) => updateReview(payload), - onSuccess: (data) => { + onSuccess: () => { queryClient.invalidateQueries({ queryKey: reviewsKeys.all }); queryClient.invalidateQueries({ queryKey: topKeywordFestivalKeys.list({ festivalId }), @@ -70,16 +70,16 @@ const ReviewEditView: FC = ({ keywords, reviewId, festivalId }) => { formState: { isSubmitting }, } = methods; - const handleReviewImagesToFile = async (review: Review) => { - const files = await reviewEntityToFiles(review.images); - setValue("images", files); - }; - useEffect(() => { + const handleReviewImagesToFile = async (review: Review) => { + const files = await reviewEntityToFiles(review.images); + setValue("images", files); + }; + if (review) { handleReviewImagesToFile(review); } - }, [review]); + }, [review, setValue]); const onSubmit = async (data: UpdateReviewSchemaType) => { try { diff --git a/src/app/(home)/festivals/[festivalId]/review/new/_components/Input_rating.tsx b/src/app/(route)/festivals/[festivalId]/review/new/_components/Input_rating.tsx similarity index 100% rename from src/app/(home)/festivals/[festivalId]/review/new/_components/Input_rating.tsx rename to src/app/(route)/festivals/[festivalId]/review/new/_components/Input_rating.tsx diff --git a/src/app/(home)/festivals/[festivalId]/review/new/page.tsx b/src/app/(route)/festivals/[festivalId]/review/new/page.tsx similarity index 100% rename from src/app/(home)/festivals/[festivalId]/review/new/page.tsx rename to src/app/(route)/festivals/[festivalId]/review/new/page.tsx diff --git a/src/app/(home)/festivals/[festivalId]/review/new/view.tsx b/src/app/(route)/festivals/[festivalId]/review/new/view.tsx similarity index 100% rename from src/app/(home)/festivals/[festivalId]/review/new/view.tsx rename to src/app/(route)/festivals/[festivalId]/review/new/view.tsx diff --git a/src/app/(home)/festivals/[festivalId]/view.tsx b/src/app/(route)/festivals/[festivalId]/view.tsx similarity index 100% rename from src/app/(home)/festivals/[festivalId]/view.tsx rename to src/app/(route)/festivals/[festivalId]/view.tsx diff --git a/src/app/(home)/festivals/mostlike/page.tsx b/src/app/(route)/festivals/mostlike/page.tsx similarity index 100% rename from src/app/(home)/festivals/mostlike/page.tsx rename to src/app/(route)/festivals/mostlike/page.tsx diff --git a/src/app/(home)/festivals/mostlike/view.tsx b/src/app/(route)/festivals/mostlike/view.tsx similarity index 100% rename from src/app/(home)/festivals/mostlike/view.tsx rename to src/app/(route)/festivals/mostlike/view.tsx diff --git a/src/app/(home)/festivals/new/_components/CreateFestivalButton.tsx b/src/app/(route)/festivals/new/_components/CreateFestivalButton.tsx similarity index 100% rename from src/app/(home)/festivals/new/_components/CreateFestivalButton.tsx rename to src/app/(route)/festivals/new/_components/CreateFestivalButton.tsx diff --git a/src/app/(home)/festivals/new/_components/CreateFestivalFirstStep.tsx b/src/app/(route)/festivals/new/_components/CreateFestivalFirstStep.tsx similarity index 96% rename from src/app/(home)/festivals/new/_components/CreateFestivalFirstStep.tsx rename to src/app/(route)/festivals/new/_components/CreateFestivalFirstStep.tsx index 74f996d..8ef9591 100644 --- a/src/app/(home)/festivals/new/_components/CreateFestivalFirstStep.tsx +++ b/src/app/(route)/festivals/new/_components/CreateFestivalFirstStep.tsx @@ -30,7 +30,7 @@ const CreateFestivalFirstStep = () => { ( + render={({ field: { onChange, value } }) => ( { {Array.from({ length: 6 }).map((_, idx) => (
))}
diff --git a/src/app/mypage/_components/MypageAvatar.tsx b/src/app/(route)/mypage/_components/MypageAvatar.tsx similarity index 89% rename from src/app/mypage/_components/MypageAvatar.tsx rename to src/app/(route)/mypage/_components/MypageAvatar.tsx index 0d764c8..95809d6 100644 --- a/src/app/mypage/_components/MypageAvatar.tsx +++ b/src/app/(route)/mypage/_components/MypageAvatar.tsx @@ -1,11 +1,11 @@ import * as Avatar from "@radix-ui/react-avatar"; -import { User } from "next-auth"; -import React, { FC } from "react"; +import type { User } from "next-auth"; +import { FC } from "react"; import { UserTypeImage } from "@/utils"; interface Props { - user: (User & UserMeResponse) | null; + user: User | null; } const MypageAvatar: FC = ({ user }) => { @@ -32,7 +32,7 @@ const MypageAvatar: FC = ({ user }) => { src={UserTypeImage[user?.userTypeId]} alt={user?.nickname ?? "피에스타"} /> - + = ({ badges }) => { return ( - {TabList.map(({ name }, index) => ( + {TabList.map(({ name }) => ( = ({ className="mb-[30px] flex h-[47px] w-full" aria-label="Manage your account" > - {TabList.map(({ name }, index) => ( + {TabList.map(({ name }) => ( = ({ useEffect(() => { trigger(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const onSubmit = async (data: OnboardingModel) => { diff --git a/src/app/onboarding/complete/_components/OnboardingCompleteConfetti.tsx b/src/app/(route)/onboarding/complete/_components/OnboardingCompleteConfetti.tsx similarity index 100% rename from src/app/onboarding/complete/_components/OnboardingCompleteConfetti.tsx rename to src/app/(route)/onboarding/complete/_components/OnboardingCompleteConfetti.tsx diff --git a/src/app/onboarding/complete/_components/OnboardingImageDownloadButton.tsx b/src/app/(route)/onboarding/complete/_components/OnboardingImageDownloadButton.tsx similarity index 100% rename from src/app/onboarding/complete/_components/OnboardingImageDownloadButton.tsx rename to src/app/(route)/onboarding/complete/_components/OnboardingImageDownloadButton.tsx diff --git a/src/app/onboarding/complete/page.tsx b/src/app/(route)/onboarding/complete/page.tsx similarity index 100% rename from src/app/onboarding/complete/page.tsx rename to src/app/(route)/onboarding/complete/page.tsx diff --git a/src/app/onboarding/complete/view.tsx b/src/app/(route)/onboarding/complete/view.tsx similarity index 100% rename from src/app/onboarding/complete/view.tsx rename to src/app/(route)/onboarding/complete/view.tsx diff --git a/src/app/onboarding/page.tsx b/src/app/(route)/onboarding/page.tsx similarity index 100% rename from src/app/onboarding/page.tsx rename to src/app/(route)/onboarding/page.tsx diff --git a/src/app/onboarding/view.tsx b/src/app/(route)/onboarding/view.tsx similarity index 100% rename from src/app/onboarding/view.tsx rename to src/app/(route)/onboarding/view.tsx diff --git a/src/app/(home)/search/_components/SearchFestivalList/SearchFestivalFallback.tsx b/src/app/(route)/search/_components/SearchFestivalList/SearchFestivalFallback.tsx similarity index 100% rename from src/app/(home)/search/_components/SearchFestivalList/SearchFestivalFallback.tsx rename to src/app/(route)/search/_components/SearchFestivalList/SearchFestivalFallback.tsx diff --git a/src/app/(home)/search/_components/SearchFestivalList/index.tsx b/src/app/(route)/search/_components/SearchFestivalList/index.tsx similarity index 100% rename from src/app/(home)/search/_components/SearchFestivalList/index.tsx rename to src/app/(route)/search/_components/SearchFestivalList/index.tsx diff --git a/src/app/(home)/search/_components/SearchHistory/index.tsx b/src/app/(route)/search/_components/SearchHistory/index.tsx similarity index 100% rename from src/app/(home)/search/_components/SearchHistory/index.tsx rename to src/app/(route)/search/_components/SearchHistory/index.tsx diff --git a/src/app/(home)/search/_components/TrendingFestival/TrendingFestivalSkeleton.tsx b/src/app/(route)/search/_components/TrendingFestival/TrendingFestivalSkeleton.tsx similarity index 100% rename from src/app/(home)/search/_components/TrendingFestival/TrendingFestivalSkeleton.tsx rename to src/app/(route)/search/_components/TrendingFestival/TrendingFestivalSkeleton.tsx diff --git a/src/app/(home)/search/_components/TrendingFestival/index.tsx b/src/app/(route)/search/_components/TrendingFestival/index.tsx similarity index 100% rename from src/app/(home)/search/_components/TrendingFestival/index.tsx rename to src/app/(route)/search/_components/TrendingFestival/index.tsx diff --git a/src/app/(home)/search/page.tsx b/src/app/(route)/search/page.tsx similarity index 100% rename from src/app/(home)/search/page.tsx rename to src/app/(route)/search/page.tsx diff --git a/src/app/(home)/search/view.tsx b/src/app/(route)/search/view.tsx similarity index 100% rename from src/app/(home)/search/view.tsx rename to src/app/(route)/search/view.tsx diff --git a/src/components/Swiper/RecommendFestival/RecommendFestival.stories.tsx b/src/components/Swiper/RecommendFestival/RecommendFestival.stories.tsx index 5a44bf1..0785ecf 100644 --- a/src/components/Swiper/RecommendFestival/RecommendFestival.stories.tsx +++ b/src/components/Swiper/RecommendFestival/RecommendFestival.stories.tsx @@ -1,6 +1,6 @@ import type { Meta, StoryObj } from "@storybook/react"; -import RecommendFestivalFallbackUI from "../../../app/(home)/_components/FestivalRecommend/RecommendFestivalFallbackUI"; +import RecommendFestivalFallbackUI from "../../../app/(route)/(home)/_components/FestivalRecommend/RecommendFestivalFallbackUI"; import RecoomendFestivalList from "./RecommendFestival"; const meta: Meta = { @@ -17,13 +17,13 @@ type Story = StoryObj; export const Default: Story = { args: {}, - render: (args) => ( + render: (_args) => (
{/* */}
), }; export const NoSession: Story = { args: {}, - render: (args) => ( + render: () => (
diff --git a/src/components/Swiper/RecommendFestival/RecommendFestival.tsx b/src/components/Swiper/RecommendFestival/RecommendFestival.tsx index e89554d..0b82ec6 100644 --- a/src/components/Swiper/RecommendFestival/RecommendFestival.tsx +++ b/src/components/Swiper/RecommendFestival/RecommendFestival.tsx @@ -10,7 +10,7 @@ import { Autoplay, Pagination } from "swiper/modules"; import { Swiper, SwiperSlide } from "swiper/react"; import { RecommendFestivalResponse } from "@/apis/festivals/recommendFestival/recommendFestivalType"; -import RecommendFestivalHeader from "@/app/(home)/_components/FestivalRecommend/RecommendFestivalHeader"; +import RecommendFestivalHeader from "@/app/(route)/(home)/_components/FestivalRecommend/RecommendFestivalHeader"; import { formatToKoreanDate } from "@/lib/dayjs"; interface Props { diff --git a/src/components/core/Button/BookingButton/BookingButton.stories.tsx b/src/components/core/Button/BookingButton/BookingButton.stories.tsx index a82d632..8f043b1 100644 --- a/src/components/core/Button/BookingButton/BookingButton.stories.tsx +++ b/src/components/core/Button/BookingButton/BookingButton.stories.tsx @@ -8,13 +8,7 @@ const meta: Meta = { component: BookingButton, parameters: {}, - argTypes: { - label: { - control: { - type: "text", - }, - }, - }, + argTypes: {}, }; export default meta; diff --git a/src/components/core/Button/BookingButton/BookingButton.tsx b/src/components/core/Button/BookingButton/BookingButton.tsx index a804d51..7991cd9 100644 --- a/src/components/core/Button/BookingButton/BookingButton.tsx +++ b/src/components/core/Button/BookingButton/BookingButton.tsx @@ -8,14 +8,13 @@ import BasicButton from "../BasicButton/BasicButton"; import ScrabButton from "./ScrabButton"; interface Props { - label?: string; className?: string; festival: DetailFestivalResponse; } const BookingButton: FC = ({ className, - label = "예매하기", + festival, }) => { const linkInfo = useMemo(() => { diff --git a/src/components/core/Progress/ProgressBar/ProgressBar.tsx b/src/components/core/Progress/ProgressBar/ProgressBar.tsx index 2c8b674..0d2f4c6 100644 --- a/src/components/core/Progress/ProgressBar/ProgressBar.tsx +++ b/src/components/core/Progress/ProgressBar/ProgressBar.tsx @@ -15,7 +15,7 @@ const ProgressBar: FC = ({ }) => { return (
- {[...Array(totalSteps)].map((v, index) => ( + {[...Array(totalSteps)].map((_, index) => ( = index + 1} /> ))}
diff --git a/src/components/imageUploader/ImageUploader.tsx b/src/components/imageUploader/ImageUploader.tsx index 891cd29..d196e44 100644 --- a/src/components/imageUploader/ImageUploader.tsx +++ b/src/components/imageUploader/ImageUploader.tsx @@ -54,6 +54,7 @@ const ImageUploader = ({ onChange, value, label }: Props) => { } else { setBase64([]); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const handleChange = ( diff --git a/src/hooks/session/useUpdateUserSession.tsx b/src/hooks/session/useUpdateUserSession.tsx index c80c9e0..c8273ba 100644 --- a/src/hooks/session/useUpdateUserSession.tsx +++ b/src/hooks/session/useUpdateUserSession.tsx @@ -1,4 +1,5 @@ "use client"; +/* eslint-disable react-hooks/exhaustive-deps */ import { useSearchParams } from "next/navigation"; import { useSession } from "next-auth/react"; diff --git a/src/hooks/useSwipingContainer.ts b/src/hooks/useSwipingContainer.ts index 6747f2b..219f3cf 100644 --- a/src/hooks/useSwipingContainer.ts +++ b/src/hooks/useSwipingContainer.ts @@ -1,3 +1,4 @@ +/* eslint-disable react-hooks/exhaustive-deps */ "use client"; import { MouseEvent, useCallback, useEffect, useRef } from "react"; diff --git a/src/lib/Providers/UserProvider.tsx b/src/lib/Providers/UserProvider.tsx index bd4bf50..b750d22 100644 --- a/src/lib/Providers/UserProvider.tsx +++ b/src/lib/Providers/UserProvider.tsx @@ -13,19 +13,19 @@ const UserProvider: FC = ({ children }) => { const setUser = useUserStore((state) => state.updateUser); const { data: session } = useSession(); - const initializeUserProfile = async () => { - if (session) { - const { user } = session; - return setUser(user); - } - setUser(null); - }; - useEffect(() => { + const initializeUserProfile = async () => { + if (session) { + const { user } = session; + return setUser(user); + } + setUser(null); + }; + if (session) { initializeUserProfile(); } - }, [session]); + }, [session, setUser]); return <>{children}; }; diff --git a/src/store/user.ts b/src/store/user.ts index 63a8045..3dc035c 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -1,13 +1,13 @@ -import { User } from "next-auth"; +import type { User } from "next-auth"; import { create } from "zustand"; import { createJSONStorage, persist } from "zustand/middleware"; type State = { - user: (User & UserMeResponse) | null; + user: User | null; }; type Action = { - updateUser: (_user: (User & UserMeResponse) | null) => void; + updateUser: (_user: User | null) => void; }; export const useUserStore = create( diff --git a/src/utils/reviewEntityToFiles.ts b/src/utils/reviewEntityToFiles.ts index eb5bd45..98cd4ea 100644 --- a/src/utils/reviewEntityToFiles.ts +++ b/src/utils/reviewEntityToFiles.ts @@ -4,7 +4,7 @@ export async function reviewEntityToFiles(urls?: Image[]): Promise { if (!urls) return []; const files = await Promise.all( - urls.map(async ({ imageId, imageUrl }, index) => { + urls.map(async ({ imageId, imageUrl }) => { const extension = imageUrl.split(".").pop()?.toLowerCase(); const response = await fetch(imageUrl); const blob = await response.blob();