From 908bad6e58604d320a59a537f5495341392952de Mon Sep 17 00:00:00 2001 From: Jkr200210 Date: Mon, 16 Mar 2026 16:37:24 +0530 Subject: [PATCH 1/3] before push 4 --- .env.development | 6 +- src/components/AdminPortal/AdminDashboard.jsx | 178 ++++++++---------- 2 files changed, 81 insertions(+), 103 deletions(-) diff --git a/.env.development b/.env.development index 4a390ef..0a26e0e 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ -VITE_API_URL=http://localhost:8088 +VITE_API_URL=http://localhost:8080 VITE_WS_URL=http://localhost:8080 -VITE_CHATBOT_URL=http://localhost:8088 -VITE_IOT_URL=http://localhost:8088 \ No newline at end of file +VITE_CHATBOT_URL=http://localhost:8080 +VITE_IOT_URL=http://localhost:8080 \ No newline at end of file diff --git a/src/components/AdminPortal/AdminDashboard.jsx b/src/components/AdminPortal/AdminDashboard.jsx index 3e199c3..a487fd7 100644 --- a/src/components/AdminPortal/AdminDashboard.jsx +++ b/src/components/AdminPortal/AdminDashboard.jsx @@ -3,7 +3,6 @@ import { useNavigate } from "react-router-dom"; import { Bell, - Settings, Activity, Users, UserCircle, @@ -23,30 +22,44 @@ function AdminDashboard() { const [hasNotification, setHasNotification] = useState(true); const navigate = useNavigate(); + const [adminData, setAdminData] = useState({ name: "", role: "" }); + + useEffect(() => { + const storedUser = localStorage.getItem("user"); + if (storedUser) { + try { + const parsed = JSON.parse(storedUser); + setAdminData({ + name: parsed.name || parsed.username || parsed.fullName || "Admin", + role: parsed.role || "Administrator", + }); + } catch (e) { + console.error("Failed to parse user from localStorage", e); + } + } + }, []); + const handleLogout = () => { - // Clear authentication data localStorage.removeItem("token"); localStorage.removeItem("user"); - - // Navigate to homepage navigate("/"); }; - const [activeTab, setActiveTab] = useState("users"); + + const [activeTab, setActiveTab] = useState("users"); const [doctorCount, setDoctorCount] = useState(0); const [specialdoctorCount, setSpecialDoctorCount] = useState(0); const [patientCount, setPatientCount] = useState(0); useEffect(() => { - fetch("http://localhost:8080/api/dashboard/counts") - .then((res) => res.json()) - .then((data) => { - setDoctorCount(data.doctorCount); - setSpecialDoctorCount(data.specialdoctorCount) - setPatientCount(data.patientCount); - }) - .catch((error) => console.error("Error fetching dashboard counts:", error)); + fetch("http://localhost:8080/api/dashboard/counts") + .then((res) => res.json()) + .then((data) => { + setDoctorCount(data.doctorCount); + setSpecialDoctorCount(data.specialdoctorCount); + setPatientCount(data.patientCount); + }) + .catch((error) => console.error("Error fetching dashboard counts:", error)); }, []); - return (
@@ -75,16 +88,16 @@ function AdminDashboard() { Admin Portal

- Welcome, Section 7{" "} - Janith + Welcome,{" "} + + {adminData.name || "..."} +

{/* Right */}
- - {/* Logout */}
-

{specialdoctorCount === 0 ? "..." : specialdoctorCount}

@@ -140,7 +151,6 @@ function AdminDashboard() {

Active Patients

-

{patientCount === 0 ? "..." : patientCount}

@@ -154,10 +164,7 @@ function AdminDashboard() {

Pending Doctors

- -

- 23 -

+

23

{/* IoT Devices */} @@ -168,7 +175,6 @@ function AdminDashboard() {

IOT Devices

-

23

@@ -179,22 +185,16 @@ function AdminDashboard() {
- - -
+ + {/* === TAB CONTENT === */}
{activeTab === "users" && } {activeTab === "accept" && } @@ -337,4 +315,4 @@ function AdminDashboard() { ); } -export default AdminDashboard; +export default AdminDashboard; \ No newline at end of file From 3f8f9b6fc3a26f022a4c0e82dd7e48fc39fea417 Mon Sep 17 00:00:00 2001 From: Jkr200210 Date: Mon, 16 Mar 2026 16:38:54 +0530 Subject: [PATCH 2/3] before push 5 --- .env.development | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.development b/.env.development index 0a26e0e..4a390ef 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ -VITE_API_URL=http://localhost:8080 +VITE_API_URL=http://localhost:8088 VITE_WS_URL=http://localhost:8080 -VITE_CHATBOT_URL=http://localhost:8080 -VITE_IOT_URL=http://localhost:8080 \ No newline at end of file +VITE_CHATBOT_URL=http://localhost:8088 +VITE_IOT_URL=http://localhost:8088 \ No newline at end of file From e2dfdee78905812c3add8c6e78e73e387b0cf9e3 Mon Sep 17 00:00:00 2001 From: Jkr200210 Date: Tue, 17 Mar 2026 00:19:32 +0530 Subject: [PATCH 3/3] before push last --- .env.development | 6 +-- src/components/AdminPortal/AdminDashboard.jsx | 49 +++++++++++-------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/.env.development b/.env.development index 4a390ef..0a26e0e 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ -VITE_API_URL=http://localhost:8088 +VITE_API_URL=http://localhost:8080 VITE_WS_URL=http://localhost:8080 -VITE_CHATBOT_URL=http://localhost:8088 -VITE_IOT_URL=http://localhost:8088 \ No newline at end of file +VITE_CHATBOT_URL=http://localhost:8080 +VITE_IOT_URL=http://localhost:8080 \ No newline at end of file diff --git a/src/components/AdminPortal/AdminDashboard.jsx b/src/components/AdminPortal/AdminDashboard.jsx index a487fd7..67e83aa 100644 --- a/src/components/AdminPortal/AdminDashboard.jsx +++ b/src/components/AdminPortal/AdminDashboard.jsx @@ -47,19 +47,23 @@ function AdminDashboard() { const [activeTab, setActiveTab] = useState("users"); const [doctorCount, setDoctorCount] = useState(0); - const [specialdoctorCount, setSpecialDoctorCount] = useState(0); + const [pendingdoctorCount, setPendingDoctorCount] = useState(0); const [patientCount, setPatientCount] = useState(0); useEffect(() => { - fetch("http://localhost:8080/api/dashboard/counts") - .then((res) => res.json()) - .then((data) => { - setDoctorCount(data.doctorCount); - setSpecialDoctorCount(data.specialdoctorCount); - setPatientCount(data.patientCount); - }) - .catch((error) => console.error("Error fetching dashboard counts:", error)); - }, []); + fetch("http://localhost:8080/api/dashboard/counts") + .then((res) => res.json()) + .then((data) => { + console.log(data); + + setDoctorCount(data.doctorCount); + setPatientCount(data.patientCount); + setPendingDoctorCount(data.pendingDoctorCount); + }) + .catch((error) => + console.error("Error fetching dashboard counts:", error) + ); +}, []); return (
@@ -115,7 +119,7 @@ function AdminDashboard() { {/* === STATS CARDS === */}
-
+
{/* Active Doctors */}
@@ -130,7 +134,7 @@ function AdminDashboard() {
- {/* Special Doctors */} + {/* Special Doctors
@@ -141,12 +145,12 @@ function AdminDashboard() {

{specialdoctorCount === 0 ? "..." : specialdoctorCount}

-
+
*/} {/* Active Patients */} -
+
-
+

Active Patients

@@ -157,20 +161,22 @@ function AdminDashboard() {
{/* Pending Doctors */} -
+
-
+

Pending Doctors

-

23

+

+ {pendingdoctorCount ?? "..."} +

{/* IoT Devices */} -
+
-
+

IOT Devices

@@ -201,6 +207,7 @@ function AdminDashboard() { Doctor Management + {/* + */}