@@ -14,9 +14,11 @@ export default function AdminDashboard() {
1414 const [ dropdownOpen , setDropdownOpen ] = useState ( false ) ;
1515 const dropdownRef = useRef ( null ) ;
1616
17+ // Handle form change
1718 const handleChange = ( e ) =>
1819 setFormData ( { ...formData , [ e . target . name ] : e . target . value } ) ;
1920
21+ // Submit new user
2022 const handleSubmit = async ( e ) => {
2123 e . preventDefault ( ) ;
2224 setMessage ( "Creating user..." ) ;
@@ -48,6 +50,7 @@ export default function AdminDashboard() {
4850 }
4951 } ;
5052
53+ // Fetch users
5154 const fetchUsers = async ( ) => {
5255 try {
5356 const res = await fetch (
@@ -64,6 +67,7 @@ export default function AdminDashboard() {
6467 fetchUsers ( ) ;
6568 } , [ ] ) ;
6669
70+ // Dropdown click outside handler
6771 useEffect ( ( ) => {
6872 const handleClickOutside = ( event ) => {
6973 if ( dropdownRef . current && ! dropdownRef . current . contains ( event . target ) ) {
@@ -81,42 +85,37 @@ export default function AdminDashboard() {
8185
8286 return (
8387 < div style = { styles . container } >
84- { /* ====== STICKY NAVBAR = ===== */ }
88+ { /* ===== NAVBAR ===== */ }
8589 < nav style = { styles . navbar } >
8690 < div style = { styles . logoSection } >
8791 < img
88- src = "https://i.ibb.co/BcQX07D/edme- logo-white .png" // Replace with your logo if needed
92+ src = "/ logo.png"
8993 alt = "FAT-EIBL Logo"
9094 style = { styles . logo }
9195 />
9296 < span style = { styles . logoText } > FAT-EIBL</ span >
9397 </ div >
9498
9599 < div style = { styles . navLinks } >
96- < a href = "#" style = { { ...styles . navLinksBase , ...styles . linkActive } } >
100+ < a href = "#" style = { { ...styles . navLink , ...styles . activeLink } } >
97101 Dashboard
98102 </ a >
99- < a href = "#" style = { styles . navLinksBase } >
100- Users
101- </ a >
102- < a href = "#" style = { styles . navLinksBase } >
103- Departments
104- </ a >
105- < a href = "#" style = { styles . navLinksBase } >
106- Reports
107- </ a >
108- < a href = "#" style = { styles . navLinksBase } >
109- Settings
110- </ a >
103+ < a href = "#" style = { styles . navLink } > Users</ a >
104+ < a href = "#" style = { styles . navLink } > Departments</ a >
105+ < a href = "#" style = { styles . navLink } > Reports</ a >
106+ < a href = "#" style = { styles . navLink } > Settings</ a >
111107 </ div >
112108
113109 < div style = { styles . userSection } ref = { dropdownRef } >
114- < img
115- src = "https://cdn-icons-png.flaticon.com/512/847/847969.png"
116- alt = "User Avatar"
117- style = { styles . avatar }
118- onClick = { ( ) => setDropdownOpen ( ! dropdownOpen ) }
119- />
110+ < div style = { styles . userWrapper } onClick = { ( ) => setDropdownOpen ( ! dropdownOpen ) } >
111+ < img
112+ src = "https://cdn-icons-png.flaticon.com/512/847/847969.png"
113+ alt = "User Avatar"
114+ style = { styles . avatar }
115+ />
116+ < span style = { styles . userName } > Admin</ span >
117+ </ div >
118+
120119 { dropdownOpen && (
121120 < div style = { styles . dropdown } >
122121 < p style = { styles . dropdownItem } > 👤 Admin</ p >
@@ -129,13 +128,12 @@ export default function AdminDashboard() {
129128 </ div >
130129 </ nav >
131130
132- { /* ====== MAIN CONTENT = ===== */ }
131+ { /* ===== MAIN CONTENT ===== */ }
133132 < main style = { styles . main } >
134133 < h1 style = { styles . title } > Admin Dashboard</ h1 >
135- < p style = { styles . subtitle } >
136- Manage users, departments, and system access.
137- </ p >
134+ < p style = { styles . subtitle } > Manage users, departments, and system access.</ p >
138135
136+ { /* CREATE USER CARD */ }
139137 < div style = { styles . card } >
140138 < h2 style = { styles . cardTitle } > Create New User</ h2 >
141139 < form onSubmit = { handleSubmit } style = { styles . form } >
@@ -223,12 +221,11 @@ export default function AdminDashboard() {
223221 ) }
224222 </ div >
225223
224+ { /* USERS TABLE */ }
226225 < div style = { styles . tableCard } >
227226 < h3 style = { styles . tableTitle } > Registered Users</ h3 >
228227 { users . length === 0 ? (
229- < p style = { { textAlign : "center" , color : "#777" } } >
230- No users found.
231- </ p >
228+ < p style = { { textAlign : "center" , color : "#777" } } > No users found.</ p >
232229 ) : (
233230 < table style = { styles . table } >
234231 < thead >
@@ -260,6 +257,7 @@ export default function AdminDashboard() {
260257 ) ;
261258}
262259
260+ //
263261// =======================
264262// STYLES
265263// =======================
@@ -277,7 +275,7 @@ const styles = {
277275 justifyContent : "space-between" ,
278276 alignItems : "center" ,
279277 backgroundColor : "#003a85" ,
280- color : "#f0f4ff " ,
278+ color : "#fff " ,
281279 padding : "10px 40px" ,
282280 boxShadow : "0 3px 10px rgba(0,0,0,0.1)" ,
283281 } ,
@@ -287,45 +285,55 @@ const styles = {
287285 gap : "10px" ,
288286 } ,
289287 logo : {
290- width : "42px" ,
291- height : "42px" ,
288+ width : "40px" ,
289+ height : "40px" ,
290+ borderRadius : "6px" ,
291+ backgroundColor : "#fff" ,
292+ padding : "4px" ,
292293 objectFit : "contain" ,
293- backgroundColor : "transparent" ,
294294 } ,
295295 logoText : {
296- fontSize : "1.4rem " ,
296+ fontSize : "1.3rem " ,
297297 fontWeight : "700" ,
298- color : "#ffffff" ,
299- letterSpacing : "0.5px" ,
298+ color : "#fff" ,
300299 } ,
301300 navLinks : {
302301 display : "flex" ,
303- gap : "30px " ,
302+ gap : "25px " ,
304303 alignItems : "center" ,
305304 } ,
306- navLinksBase : {
305+ navLink : {
307306 color : "#dbe9ff" ,
308307 textDecoration : "none" ,
309308 fontWeight : "500" ,
310309 fontSize : "1rem" ,
311310 transition : "color 0.2s ease" ,
312311 } ,
313- linkActive : {
312+ activeLink : {
314313 color : "#ffffff" ,
315- fontWeight : "600 " ,
314+ fontWeight : "700 " ,
316315 textDecoration : "underline" ,
317316 } ,
318317 userSection : {
319318 position : "relative" ,
319+ } ,
320+ userWrapper : {
321+ display : "flex" ,
322+ alignItems : "center" ,
323+ gap : "8px" ,
320324 cursor : "pointer" ,
321325 } ,
322326 avatar : {
323- width : "40px " ,
324- height : "40px " ,
327+ width : "38px " ,
328+ height : "38px " ,
325329 borderRadius : "50%" ,
326- border : "2px solid #f0f4ff " ,
330+ border : "2px solid #fff " ,
327331 boxShadow : "0 0 6px rgba(255,255,255,0.6)" ,
328332 } ,
333+ userName : {
334+ color : "#fff" ,
335+ fontWeight : "500" ,
336+ } ,
329337 dropdown : {
330338 position : "absolute" ,
331339 right : 0 ,
@@ -335,7 +343,6 @@ const styles = {
335343 borderRadius : "10px" ,
336344 boxShadow : "0 3px 12px rgba(0,0,0,0.15)" ,
337345 minWidth : "150px" ,
338- overflow : "hidden" ,
339346 zIndex : 2000 ,
340347 } ,
341348 dropdownItem : {
0 commit comments