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 28917a1..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: [ @@ -26,6 +27,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 +42,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 +74,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; }, @@ -145,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)/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/(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/(route)/(home)/page.tsx b/src/app/(route)/(home)/page.tsx new file mode 100644 index 0000000..aba10db --- /dev/null +++ b/src/app/(route)/(home)/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 "./_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 ( +
+ + +
+ + + +
+ + +
+ ); +} 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/app/favicon.ico b/src/app/icon.ico similarity index 100% rename from src/app/favicon.ico rename to src/app/icon.ico 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/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/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/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/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; 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();