diff --git a/app/javascript/src/Routes.tsx b/app/javascript/src/Routes.tsx index 9ca3819..db22c21 100644 --- a/app/javascript/src/Routes.tsx +++ b/app/javascript/src/Routes.tsx @@ -2,29 +2,36 @@ import type { FC } from "react"; import React from "react"; import { Switch, Route } from "react-router-dom"; +import { useCurrentUser } from "./contexts/UserProvider"; import { Dashbaord, Home, Orders, Wallet } from "./pages"; export const Routes: FC = () => { + const { isAuthenticated } = useCurrentUser(); + return ( - - - - - - - - - - - - - - - + {isAuthenticated && ( + <> + + + + + + + + + + + + + + + + + )} ); }; diff --git a/app/javascript/src/components/Navbar/Navbar.tsx b/app/javascript/src/components/Navbar/Navbar.tsx index 16f8f1e..fde8013 100644 --- a/app/javascript/src/components/Navbar/Navbar.tsx +++ b/app/javascript/src/components/Navbar/Navbar.tsx @@ -1,5 +1,6 @@ import * as React from "react"; import { MenuIcon } from "@heroicons/react/outline"; +import cs from "classnames"; import XStakeLogo from "../../assets/images/logo.png"; import { useApp } from "../../contexts/AppProvider"; @@ -9,13 +10,12 @@ const linkStyles = "cursor-pointer bg-transparent hover:bg-gray-100 h-full px-4 font-bold flex items-center"; export const Navbar = () => { + const { isAuthenticated } = useCurrentUser(); const { setSideNavExpanded } = useApp(); const handleExpandSideNav = () => { setSideNavExpanded((prevState) => !prevState); }; - const { isAuthenticated } = useCurrentUser(); - const csrfToken = document .querySelector('meta[name="csrf-token"]') @@ -24,7 +24,10 @@ export const Navbar = () => { return (