diff --git a/frontend/src/components/MainNavbar.tsx b/frontend/src/components/MainNavbar.tsx
new file mode 100644
index 0000000..895a13f
--- /dev/null
+++ b/frontend/src/components/MainNavbar.tsx
@@ -0,0 +1,48 @@
+import React, { useEffect, useState } from 'react';
+import { Outlet, useNavigate } from 'react-router-dom';
+import { useLocation } from 'react-router-dom';
+import { Link } from 'react-router-dom';
+const Navbar = () => {
+ const navigate = useNavigate();
+ const location = useLocation();
+ useEffect(() => {
+ console.log("here");
+ if (location.pathname === '/') navigate("/homepage");
+ }, [location]);
+ return (
+
+
+
+
+ );
+};
+
+export default Navbar;
diff --git a/frontend/src/components/loading.tsx b/frontend/src/components/loading.tsx
new file mode 100644
index 0000000..f337bdf
--- /dev/null
+++ b/frontend/src/components/loading.tsx
@@ -0,0 +1,9 @@
+import React from "react"
+export default function Loader(){
+ return(
+
+
+ )
+}
\ No newline at end of file
diff --git a/frontend/src/components/routes/mainroute.jsx b/frontend/src/components/routes/mainroute.jsx
index 4d69778..3299f29 100644
--- a/frontend/src/components/routes/mainroute.jsx
+++ b/frontend/src/components/routes/mainroute.jsx
@@ -10,6 +10,8 @@ import HomePage from "../../pages/HomePage";
import Register from "../Register";
import SinglePost from "../../components/SinglePost";
import LoginPage from "../Login";
+import Navbar from "../MainNavbar";
+import Loader from "../loading";
const Test = () => {
const [userId, setUserId] = useState("");
const [roomId, setRoomId] = useState("");
@@ -47,45 +49,52 @@ const Test = () => {
const Mainrouter = createBrowserRouter([
{
path: "/",
- element: ,
- },
- {
- path: "/posts",
- element: ,
- },
- {
- path: "/posts/:id",
- element: ,
- },
- {
- path: "/login",
- element: ,
- },
- {
- path: "/signup",
- element: ,
- },
- {
- path: "/room",
- element: ,
- children: [
+ element: ,
+ children:[
{
- path: "/room",
- element: ,
- index: true,
+ path:"homepage",
+ element:
+ },
+ {
+ path: "posts",
+ element: ,
},
{
- path: "/room/createroom",
- element: ,
+ path: "posts/:id",
+ element: ,
},
{
- path: "/room/joinroom",
- element: ,
+ path: "login",
+ element: ,
},
{
- path: "/room/chatting",
- element: ,
+ path: "/signup",
+ element: ,
},
+ {
+ path: "/room",
+ element: ,
+ children: [
+ {
+ path: "/room",
+ element: ,
+ index: true,
+ },
+ {
+ path: "/room/createroom",
+ element: ,
+ },
+ {
+ path: "/room/joinroom",
+ element: ,
+ },
+ {
+ path: "/room/chatting",
+ element: ,
+ },
+ ],
+ },
+
],
},
]);