+ {/* Username Section */}
+
+ setEditingUser({
+ ...editingUser,
+ username: e.target.value,
+ })
+ }
+ placeholder="Nom d'utilisateur"
+ className="text-xs sm:text-sm px-2 sm:px-3 py-1"
+ />
+
+ {/* Avatar Section */}
+
+
+
+ {/* Preview */}
+
+
+ {uploadingAvatar === editingUser.userId && (
+
+ )}
+
+
+ {/* Avatars par défaut */}
+
+
+
+ {[
+ "/avatar-1.jpg",
+ "/avatar-2.jpg",
+ "/avatar-3.jpg",
+ "/avatar-4.jpg",
+ "/avatar-5.jpg",
+ "/avatar-6.jpg",
+ ].map((defaultAvatar) => (
+
+ ))}
+
+
+
+ {/* Custom Upload */}
+
+ {
+ const file = e.target.files?.[0];
+ if (!file) return;
+
+ setUploadingAvatar(editingUser.userId);
+ try {
+ const formData = new FormData();
+ formData.append("file", file);
+
+ const response = await fetch(
+ "/api/admin/avatars/upload",
+ {
+ method: "POST",
+ body: formData,
+ }
+ );
+
+ if (response.ok) {
+ const data = await response.json();
+ setEditingUser({
+ ...editingUser,
+ avatar: data.url,
+ });
+ } else {
+ alert("Erreur lors de l'upload de l'image");
+ }
+ } catch (error) {
+ console.error("Error uploading image:", error);
+ alert("Erreur lors de l'upload de l'image");
+ } finally {
+ setUploadingAvatar(null);
+ if (e.target) {
+ e.target.value = "";
+ }
+ }
+ }}
+ className="hidden"
+ id={`avatar-upload-${editingUser.userId}`}
+ />
+
+
+
+
+ {/* HP Section */}
+
+
+
+
+ {previewHp} / {currentEditingUserData.maxHp}
+
+
+
+
+
+
+ setEditingUser({
+ ...editingUser,
+ hpDelta: parseInt(e.target.value) || 0,
+ })
+ }
+ className="flex-1 min-w-[60px] px-2 sm:px-3 py-1 bg-black/60 border border-pixel-gold/30 rounded text-white text-xs sm:text-sm text-center"
+ />
+
+
+
+
+
+
+ {/* XP Section */}
+
+
+
+
+ {formatNumber(previewXp)} /{" "}
+ {formatNumber(currentEditingUserData.maxXp)}
+
+
+
+
+
+
+ setEditingUser({
+ ...editingUser,
+ xpDelta: parseInt(e.target.value) || 0,
+ })
+ }
+ className="flex-1 min-w-[60px] px-2 sm:px-3 py-1 bg-black/60 border border-pixel-gold/30 rounded text-white text-xs sm:text-sm text-center"
+ />
+
+
+
+
+
+
+ {/* Score Section */}
+
+
+
+
+
+
+ setEditingUser({
+ ...editingUser,
+ score: parseInt(e.target.value) || 0,
+ })
+ }
+ className="flex-1 min-w-[60px] px-2 sm:px-3 py-1 bg-black/60 border border-pixel-gold/30 rounded text-white text-xs sm:text-sm text-center"
+ />
+
+
+
+
+
+ {/* Level Section */}
+
+
+
+
+
+ setEditingUser({
+ ...editingUser,
+ level: Math.max(1, parseInt(e.target.value) || 1),
+ })
+ }
+ className="flex-1 min-w-[60px] px-2 sm:px-3 py-1 bg-black/60 border border-pixel-gold/30 rounded text-white text-xs sm:text-sm text-center"
+ />
+
+
+
+
+ {/* Role Section */}
+
+
+
+
+
+
+
+
+
+
+
+
+