From 9930f27a84858d59cb9010c8edbe0448a2b4e889 Mon Sep 17 00:00:00 2001 From: Rafi Arrafif Date: Tue, 5 Aug 2025 07:05:32 +0700 Subject: [PATCH] :necktie: create config for routing --- app/(main)/genres/page.tsx | 7 +++++++ app/(main)/schedule/page.tsx | 7 +++++++ app/(main)/trending/page.tsx | 7 +++++++ shared/config/routes.ts | 9 +++++++++ shared/ui/navbar.tsx | 16 ++++++++-------- widgets/login/loginCard/Index.tsx | 3 ++- 6 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 app/(main)/genres/page.tsx create mode 100644 app/(main)/schedule/page.tsx create mode 100644 app/(main)/trending/page.tsx create mode 100644 shared/config/routes.ts diff --git a/app/(main)/genres/page.tsx b/app/(main)/genres/page.tsx new file mode 100644 index 0000000..56d0140 --- /dev/null +++ b/app/(main)/genres/page.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +const page = () => { + return
Genre Page
; +}; + +export default page; diff --git a/app/(main)/schedule/page.tsx b/app/(main)/schedule/page.tsx new file mode 100644 index 0000000..bc18a2d --- /dev/null +++ b/app/(main)/schedule/page.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +const page = () => { + return
Schedule Page
; +}; + +export default page; diff --git a/app/(main)/trending/page.tsx b/app/(main)/trending/page.tsx new file mode 100644 index 0000000..fcb174d --- /dev/null +++ b/app/(main)/trending/page.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +const page = () => { + return
Trending Page
; +}; + +export default page; diff --git a/shared/config/routes.ts b/shared/config/routes.ts new file mode 100644 index 0000000..203aa79 --- /dev/null +++ b/shared/config/routes.ts @@ -0,0 +1,9 @@ +export const routes = { + home: "/", + login: "/log-in", + signup: "/sign-up", + explore: "/explore", + trending: "/trending", + genres: "/genres", + schedule: "/schedule", +}; diff --git a/shared/ui/navbar.tsx b/shared/ui/navbar.tsx index adc62a4..d872a00 100644 --- a/shared/ui/navbar.tsx +++ b/shared/ui/navbar.tsx @@ -14,6 +14,7 @@ import { import { usePathname, useRouter } from "next/navigation"; import React, { useState } from "react"; import { delayButtonClick } from "../lib/delayButtonClick"; +import { routes } from "../config/routes"; export const AcmeLogo = () => { return ( @@ -29,7 +30,6 @@ export const AcmeLogo = () => { }; const NavbarUI = () => { - const router = useRouter(); const pathNameNow = usePathname(); const [isMenuOpen, setIsMenuOpen] = useState(false); @@ -37,23 +37,23 @@ const NavbarUI = () => { const navbarItems = [ { title: "Home", - route: "/", + route: routes.home, }, { title: "Explore", - route: "/explore", + route: routes.explore, }, { title: "Trending", - route: "/trending", + route: routes.trending, }, { title: "Genres", - route: "/genre", + route: routes.genres, }, { title: "Schedule", - route: "/schedule", + route: routes.schedule, }, ]; @@ -88,7 +88,7 @@ const NavbarUI = () => { - + Login @@ -98,7 +98,7 @@ const NavbarUI = () => { variant="solid" radius="sm" as={Link} - href="/sign-up" + href={routes.signup} > Sign Up diff --git a/widgets/login/loginCard/Index.tsx b/widgets/login/loginCard/Index.tsx index f14b622..bb73524 100644 --- a/widgets/login/loginCard/Index.tsx +++ b/widgets/login/loginCard/Index.tsx @@ -4,6 +4,7 @@ import { Card, Divider, Link } from "@heroui/react"; import React from "react"; import EmailForm from "./EmailForm"; import ContinueWithProviders from "./ContinueWithProviders"; +import { routes } from "@/shared/config/routes"; const LoginCard = () => { return ( @@ -16,7 +17,7 @@ const LoginCard = () => { {/* Sign up link */}

Don't have an account?{" "} - + Sign Up