Profile_Fixes #4
@@ -41,6 +41,10 @@ function App() {
|
|||||||
setCurrentUser(prev => ({ ...prev, ...updated }));
|
setCurrentUser(prev => ({ ...prev, ...updated }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleAdminClick() {
|
||||||
|
setScreen('admin');
|
||||||
|
}
|
||||||
|
|
||||||
const isLoggedIn = Boolean(currentUser);
|
const isLoggedIn = Boolean(currentUser);
|
||||||
|
|
||||||
function handleNavChange(tab) {
|
function handleNavChange(tab) {
|
||||||
@@ -75,6 +79,7 @@ function App() {
|
|||||||
onProfileSaved={handleProfileSaved}
|
onProfileSaved={handleProfileSaved}
|
||||||
onShowSaved={() => setShowSaved(true)}
|
onShowSaved={() => setShowSaved(true)}
|
||||||
onLogout={handleLogout}
|
onLogout={handleLogout}
|
||||||
|
onAdminClick={handleAdminClick}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
showBack = true;
|
showBack = true;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import './ProfileView.css';
|
import './ProfileView.css';
|
||||||
import { getUserPosition } from '../utils/geo';
|
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 [address, setAddress] = useState(currentUser?.address || '');
|
||||||
const [latitude, setLatitude] = useState(
|
const [latitude, setLatitude] = useState(
|
||||||
currentUser?.latitude != null ? String(currentUser.latitude) : ''
|
currentUser?.latitude != null ? String(currentUser.latitude) : ''
|
||||||
@@ -158,6 +158,20 @@ function ProfileView({ currentUser, onProfileSaved, onShowSaved, onLogout }) {
|
|||||||
<polyline points="9 18 15 12 9 6" />
|
<polyline points="9 18 15 12 9 6" />
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{currentUser?.is_admin && (
|
||||||
|
<button className="profile-menu-item" onClick={onAdminClick}>
|
||||||
|
<div className="menu-item-icon menu-item-icon--primary">
|
||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
<path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<span className="menu-item-label">Panel de Administración</span>
|
||||||
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="menu-item-chevron">
|
||||||
|
<polyline points="9 18 15 12 9 6" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="profile-location-section">
|
<div className="profile-location-section">
|
||||||
|
|||||||
Reference in New Issue
Block a user