diff --git a/src/layout/Mobile/NavigationBar/NavigationBarButton.tsx b/src/layout/Mobile/NavigationBar/NavigationBarButton.tsx index bf9583d..23f77dc 100644 --- a/src/layout/Mobile/NavigationBar/NavigationBarButton.tsx +++ b/src/layout/Mobile/NavigationBar/NavigationBarButton.tsx @@ -3,22 +3,40 @@ import * as NM from "@radix-ui/react-navigation-menu"; import NextLink, { LinkProps } from "next/link"; import { usePathname } from "next/navigation"; -import { ReactNode } from "react"; +import { MouseEvent, ReactNode } from "react"; -const NavLink = ({ href, ...props }: LinkProps & { children: ReactNode }) => { +import { cn } from "@/utils"; + +const NavigationBarButton = ({ + href, + disabled = false, + ...props +}: LinkProps & { children: ReactNode; disabled?: boolean }) => { const pathname = usePathname(); const isActive = href === pathname; + const handleClick = (event: MouseEvent) => { + if (disabled) { + event.preventDefault(); + } + }; + return ( - + ); }; -export default NavLink; +export default NavigationBarButton; diff --git a/src/layout/Mobile/NavigationBar/index.tsx b/src/layout/Mobile/NavigationBar/index.tsx index b4f7ae6..40cf9a1 100644 --- a/src/layout/Mobile/NavigationBar/index.tsx +++ b/src/layout/Mobile/NavigationBar/index.tsx @@ -12,23 +12,36 @@ import { cn } from "@/utils/cn"; import NavigationBarButton from "./NavigationBarButton"; const navigations = [ - { name: "홈", slug: "/", icon: }, + { + name: "홈", + slug: "/", + icon: , + disabled: false, + }, { name: "캘린더", slug: "/calendar", icon: , + disabled: true, }, { name: "지역", slug: "/map", icon: , + disabled: true, }, { name: "채팅", slug: "/chat", icon: , + disabled: true, + }, + { + name: "MY", + slug: "/mypage", + icon: , + disabled: false, }, - { name: "MY", slug: "/mypage", icon: }, ]; const NavigationBar = () => { @@ -40,15 +53,17 @@ const NavigationBar = () => { "bg-gray-scale-0", )} > - - {navigations.map((nav) => ( + + {navigations.map(({ name, slug, icon, disabled }) => ( - - {nav.icon} - {nav.name} + + {icon} + {name} ))} diff --git a/src/middleware.ts b/src/middleware.ts index 08a2d35..d64daf6 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -4,9 +4,16 @@ import { match } from "path-to-regexp"; import { getServerSideSession } from "./apis/auth/auth"; +const serviceReadyRoute = ["/chat", "/map", "/calander"]; const matchersForAuth = ["/mypage"]; const matchersForSignIn = ["/auth/sign-in"]; + export async function middleware(request: NextRequest) { + // * 아직 서비스 준비중인 페이지 + if (serviceReadyRoute.includes(request.nextUrl.pathname)) { + return NextResponse.redirect(new URL("/", request.url)); + } + // * 인증이 필요한 페이지 접근 제어! if (isMatch(request.nextUrl.pathname, matchersForAuth)) { const session = await getServerSideSession();