import { lazy } from "react"; import { createBrowserRouter } from "react-router-dom"; import App from "@/App"; import HomeLayout from "@/layouts/HomeLayout"; import SuspenseWrapper from "@/layouts/SuspenseWrapper"; const SignIn = lazy(() => import("@/pages/SignIn")); const SignUp = lazy(() => import("@/pages/SignUp")); const AuthCallback = lazy(() => import("@/pages/AuthCallback")); const Explore = lazy(() => import("@/pages/Explore")); const Home = lazy(() => import("@/pages/Home")); const UserProfile = lazy(() => import("@/pages/UserProfile")); const MemoDetail = lazy(() => import("@/pages/MemoDetail")); const Archived = lazy(() => import("@/pages/Archived")); const Timeline = lazy(() => import("@/pages/Timeline")); const Resources = lazy(() => import("@/pages/Resources")); const Inboxes = lazy(() => import("@/pages/Inboxes")); const Setting = lazy(() => import("@/pages/Setting")); const About = lazy(() => import("@/pages/About")); const NotFound = lazy(() => import("@/pages/NotFound")); const PermissionDenied = lazy(() => import("@/pages/PermissionDenied")); export enum Routes { HOME = "/", TIMELINE = "/timeline", RESOURCES = "/resources", INBOX = "/inbox", ARCHIVED = "/archived", SETTING = "/setting", EXPLORE = "/explore", ABOUT = "/about", AUTH = "/auth", } const router = createBrowserRouter([ { path: "/", element: , children: [ { path: Routes.AUTH, element: , children: [ { path: "", element: , }, { path: "signup", element: , }, { path: "callback", element: , }, ], }, { path: "/", element: , children: [ { path: Routes.HOME, element: , }, { path: Routes.TIMELINE, element: , }, { path: Routes.RESOURCES, element: , }, { path: Routes.INBOX, element: , }, { path: Routes.ARCHIVED, element: , }, { path: Routes.SETTING, element: , }, { path: Routes.EXPLORE, element: , }, { path: "m/:uid", element: , }, { path: "u/:username", element: , }, { path: Routes.ABOUT, element: , }, { path: "403", element: , }, { path: "404", element: , }, { path: "*", element: , }, ], }, ], }, ]); export default router;