Update frontend/src/components/Panel.jsx
Browse files
frontend/src/components/Panel.jsx
CHANGED
@@ -45,7 +45,7 @@ const Panel = ({
|
|
45 |
}
|
46 |
};
|
47 |
|
48 |
-
|
49 |
<div className={`sidebar-panel ${isCollapsed ? 'collapsed' : ''}`}>
|
50 |
<div className="sidebar-header">
|
51 |
{!isCollapsed && (
|
@@ -74,37 +74,10 @@ const Panel = ({
|
|
74 |
</svg>
|
75 |
</button>
|
76 |
|
77 |
-
{/* Affichage du nom d'utilisateur */}
|
78 |
{userName && (
|
79 |
<div className="user-info">
|
80 |
<span className="username">{userName}</span>
|
81 |
-
{userRole === "Administrateur" && (
|
82 |
-
<button
|
83 |
-
onClick={() => {
|
84 |
-
if (typeof setPage === 'function') {
|
85 |
-
setPage("Administrateur");
|
86 |
-
} else {
|
87 |
-
console.error("setPage n'est pas une fonction:", setPage);
|
88 |
-
// Alternative pour éviter le blocage
|
89 |
-
window.location.href = window.location.href.split("?")[0] + "?page=admin";
|
90 |
-
}
|
91 |
-
}}
|
92 |
-
className="admin-btn"
|
93 |
-
>
|
94 |
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#4CAF50" viewBox="0 0 16 16">
|
95 |
-
<path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z"/>
|
96 |
-
</svg>
|
97 |
-
Admin
|
98 |
-
</button>
|
99 |
-
)}
|
100 |
-
<button onClick={onLogout} className="logout-btn">
|
101 |
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
102 |
-
<path d="M8.90002 7.56001C9.21002 3.96001 11.06 2.49001 15.11 2.49001H15.24C19.71 2.49001 21.5 4.28001 21.5 8.75001V15.27C21.5 19.74 19.71 21.53 15.24 21.53H15.11C11.09 21.53 9.24002 20.08 8.91002 16.54" stroke="#FF5252" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
103 |
-
<path d="M15 12H3.62" stroke="#FF5252" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
104 |
-
<path d="M5.85 8.65002L2.5 12L5.85 15.35" stroke="#FF5252" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
105 |
-
</svg>
|
106 |
-
Déconnexion
|
107 |
-
</button>
|
108 |
</div>
|
109 |
)}
|
110 |
</>
|
@@ -127,7 +100,7 @@ const Panel = ({
|
|
127 |
</button>
|
128 |
</div>
|
129 |
|
130 |
-
{/*
|
131 |
<div className="conversations-list">
|
132 |
<div className="conversation-today">
|
133 |
<h6 className="conversation-today-title">Aujourd'hui</h6>
|
@@ -163,6 +136,31 @@ const Panel = ({
|
|
163 |
<h6 className="conversation-before-title">Les 30 derniers jours</h6>
|
164 |
</div>
|
165 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
</div>
|
167 |
);
|
168 |
};
|
|
|
45 |
}
|
46 |
};
|
47 |
|
48 |
+
return (
|
49 |
<div className={`sidebar-panel ${isCollapsed ? 'collapsed' : ''}`}>
|
50 |
<div className="sidebar-header">
|
51 |
{!isCollapsed && (
|
|
|
74 |
</svg>
|
75 |
</button>
|
76 |
|
77 |
+
{/* Affichage du nom d'utilisateur uniquement */}
|
78 |
{userName && (
|
79 |
<div className="user-info">
|
80 |
<span className="username">{userName}</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
</div>
|
82 |
)}
|
83 |
</>
|
|
|
100 |
</button>
|
101 |
</div>
|
102 |
|
103 |
+
{/* Liste des conversations */}
|
104 |
<div className="conversations-list">
|
105 |
<div className="conversation-today">
|
106 |
<h6 className="conversation-today-title">Aujourd'hui</h6>
|
|
|
136 |
<h6 className="conversation-before-title">Les 30 derniers jours</h6>
|
137 |
</div>
|
138 |
</div>
|
139 |
+
|
140 |
+
{/* Nouveau footer avec les boutons */}
|
141 |
+
{!isCollapsed && (
|
142 |
+
<div className="sidebar-footer">
|
143 |
+
{userRole === "Administrateur" && (
|
144 |
+
<button
|
145 |
+
onClick={() => setPage("Administrateur")}
|
146 |
+
className="admin-btn"
|
147 |
+
>
|
148 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#4CAF50" viewBox="0 0 16 16">
|
149 |
+
<path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z"/>
|
150 |
+
</svg>
|
151 |
+
Administration
|
152 |
+
</button>
|
153 |
+
)}
|
154 |
+
<button onClick={onLogout} className="logout-btn">
|
155 |
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
156 |
+
<path d="M8.90002 7.56001C9.21002 3.96001 11.06 2.49001 15.11 2.49001H15.24C19.71 2.49001 21.5 4.28001 21.5 8.75001V15.27C21.5 19.74 19.71 21.53 15.24 21.53H15.11C11.09 21.53 9.24002 20.08 8.91002 16.54" stroke="#FF5252" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
157 |
+
<path d="M15 12H3.62" stroke="#FF5252" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
158 |
+
<path d="M5.85 8.65002L2.5 12L5.85 15.35" stroke="#FF5252" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
|
159 |
+
</svg>
|
160 |
+
Déconnexion
|
161 |
+
</button>
|
162 |
+
</div>
|
163 |
+
)}
|
164 |
</div>
|
165 |
);
|
166 |
};
|