Эх сурвалжийг харах

fix: hide Dashboard button for User role in home nav

Only admin/agent see the Dashboard link. User (dealer) role sees
their name only — no access to the agent dashboard.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tony T 5 өдөр өмнө
parent
commit
2637d4d049
1 өөрчлөгдсөн 15 нэмэгдсэн , 13 устгасан
  1. 15 13
      client/src/pages/Home.tsx

+ 15 - 13
client/src/pages/Home.tsx

@@ -231,19 +231,21 @@ function Nav() {
               >
                 {user?.name || user?.email}
               </span>
-              <a
-                href={`${import.meta.env.BASE_URL}dashboard`}
-                className="px-3 py-2 rounded-lg text-sm font-semibold transition-colors"
-                style={{
-                  background: "#14532D",
-                  color: "#fff",
-                  fontFamily: "'Source Sans 3', sans-serif",
-                  borderRadius: "8px",
-                  padding: "6px 16px",
-                }}
-              >
-                Dashboard
-              </a>
+              {(user?.role === "admin" || user?.role === "agent") && (
+                <a
+                  href={`${import.meta.env.BASE_URL}dashboard`}
+                  className="px-3 py-2 rounded-lg text-sm font-semibold transition-colors"
+                  style={{
+                    background: "#14532D",
+                    color: "#fff",
+                    fontFamily: "'Source Sans 3', sans-serif",
+                    borderRadius: "8px",
+                    padding: "6px 16px",
+                  }}
+                >
+                  Dashboard
+                </a>
+              )}
             </div>
           ) : (
             <a