diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index a5d80be..06a8054 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -41,6 +41,10 @@ function App() { setCurrentUser(prev => ({ ...prev, ...updated })); } + function handleAdminClick() { + setScreen('admin'); + } + const isLoggedIn = Boolean(currentUser); function handleNavChange(tab) { @@ -75,6 +79,7 @@ function App() { onProfileSaved={handleProfileSaved} onShowSaved={() => setShowSaved(true)} onLogout={handleLogout} + onAdminClick={handleAdminClick} /> ); showBack = true; diff --git a/frontend/src/views/ProfileView.jsx b/frontend/src/views/ProfileView.jsx index 99ffe89..a12e27d 100644 --- a/frontend/src/views/ProfileView.jsx +++ b/frontend/src/views/ProfileView.jsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; import './ProfileView.css'; import { getUserPosition } from '../utils/geo'; -function ProfileView({ currentUser, onProfileSaved, onShowSaved, onLogout }) { +function ProfileView({ currentUser, onProfileSaved, onShowSaved, onLogout, onAdminClick }) { const [address, setAddress] = useState(currentUser?.address || ''); const [latitude, setLatitude] = useState( currentUser?.latitude != null ? String(currentUser.latitude) : '' @@ -158,6 +158,20 @@ function ProfileView({ currentUser, onProfileSaved, onShowSaved, onLogout }) { + + {currentUser?.is_admin && ( + + )}