diff --git a/apps/web/src/app.tsx b/apps/web/src/app.tsx
index 05b7ebd..93b7301 100644
--- a/apps/web/src/app.tsx
+++ b/apps/web/src/app.tsx
@@ -5,7 +5,7 @@ import {
Navigate,
} from "react-router-dom";
import { AuthInitializer } from "@/components/auth-initializer";
-import { AuthGuard } from "@/components/auth-guard";
+// import { AuthGuard } from "@/components/auth-guard";
import { DashboardPage } from "@/pages/dashboard-page";
import { ScanPage } from "@/pages/scan-page";
import { LibraryPage } from "@/pages/library-page";
@@ -14,16 +14,16 @@ import { DiseaseDetailPage } from "@/pages/disease-detail-page";
import { DiagnosisDetailPage } from "@/pages/diagnosis-detail-page";
import { ExpertReviewsPage } from "@/pages/expert-reviews-page";
import { DiagnosesPage } from "@/pages/diagnoses-page";
-import { LoginPage } from "@/pages/login-page";
-import { RegisterPage } from "@/pages/register-page";
+// import { LoginPage } from "@/pages/login-page";
+// import { RegisterPage } from "@/pages/register-page";
import { MainLayout } from "@/components/layout/main-layout";
const queryClient = new QueryClient();
const router = createBrowserRouter([
{ path: "/", element: },
- { path: "/login", element: },
- { path: "/register", element: },
+ // { path: "/login", element: },
+ // { path: "/register", element: },
{
path: "/dashboard",
element: (
@@ -67,11 +67,9 @@ const router = createBrowserRouter([
{
path: "/expert/reviews",
element: (
-
-
-
-
-
+
+
+
),
},
{
diff --git a/apps/web/src/components/layout/mobile-nav.tsx b/apps/web/src/components/layout/mobile-nav.tsx
index 281e8d0..6403345 100644
--- a/apps/web/src/components/layout/mobile-nav.tsx
+++ b/apps/web/src/components/layout/mobile-nav.tsx
@@ -1,38 +1,58 @@
+import { createPortal } from "react-dom";
import { Link, useLocation } from "react-router-dom";
import { X, Leaf } from "lucide-react";
type Props = {
open: boolean;
onClose: () => void;
- userRole?: string | null;
};
const NAV_ITEMS = [
{ path: "/dashboard", label: "Dashboard" },
{ path: "/scan", label: "Scan Tanaman" },
{ path: "/diagnoses", label: "Diagnosa" },
- { path: "/catalog", label: "Pustaka" },
+ { path: "/catalog", label: "Pustaka", altPath: "/library" },
];
-export function MobileNav({ open, onClose, userRole }: Props) {
+export function MobileNav({ open, onClose }: Props) {
const location = useLocation();
- if (!open) return null;
-
const isActive = (path: string) => location.pathname === path;
- return (
-
+ const navContent = (
+
{/* Backdrop */}
-
+
+
{/* Panel */}
-
-
+
+ {/* Header */}
+
-
+
+
+
+
+
+
ZeaVis Edu
+
+ Smart AI for Corn Disease Detection
+
-
ZeaVis Edu
-
);
+
+ return typeof document !== "undefined"
+ ? createPortal(navContent, document.body)
+ : navContent;
}
diff --git a/apps/web/src/components/layout/navbar.tsx b/apps/web/src/components/layout/navbar.tsx
index a36db68..20993e1 100644
--- a/apps/web/src/components/layout/navbar.tsx
+++ b/apps/web/src/components/layout/navbar.tsx
@@ -1,19 +1,12 @@
import { useState } from "react";
-import { Link, useLocation, useNavigate } from "react-router-dom";
+import { Link, useLocation } from "react-router-dom";
import { Leaf, Menu } from "lucide-react";
import { MobileNav } from "./mobile-nav";
-import { Button } from "@/components/ui/button";
-import { useMutation, useQueryClient } from "@tanstack/react-query";
-import { useAuthStore } from "@/store/auth-store";
-import { apiClient } from "@/lib/api-client";
export function Navbar() {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const location = useLocation();
- const navigate = useNavigate();
- const queryClient = useQueryClient();
- const setUser = useAuthStore((state) => state.setUser);
- const user = useAuthStore((state) => state.user);
+ //
const isActive = (path: string) => location.pathname === path;
@@ -25,17 +18,6 @@ export function Navbar() {
: "text-white/85 hover:bg-white/10 hover:text-white",
].join(" ");
- const logoutMutation = useMutation({
- mutationFn: async () => {
- await apiClient.logout();
- },
- onSuccess: () => {
- setUser(null);
- queryClient.clear();
- navigate("/login");
- },
- });
-
return (
@@ -54,26 +36,35 @@ export function Navbar() {
-
+
Dashboard
Scan Tanaman
-
+
Diagnosa
-
+
Pustaka
- {user?.role === "expert" && (
-
- Review
-
- )}
+
+ Review
+