diff --git a/frontend/dist/index.html b/frontend/dist/index.html
index 8ab2616..1407310 100644
--- a/frontend/dist/index.html
+++ b/frontend/dist/index.html
@@ -11,7 +11,7 @@
Schichtplaner — Veranstaltungsschichtpläne
-
+
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index b40ce55..3800596 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -651,6 +651,20 @@ export default function App() {
onSubmit={handleGuestSubmit}
/>
)}
+
+ {showProfileModal && (
+ setShowProfileModal(false)}
+ onUserUpdated={(updatedUser) => {
+ setUser(updatedUser);
+ setShowProfileModal(false);
+ refreshEvents();
+ }}
+ onRefreshSkills={refreshSkills}
+ />
+ )}
);
}
diff --git a/frontend/src/components/Navbar.jsx b/frontend/src/components/Navbar.jsx
index 96cee5c..b7c9a9b 100644
--- a/frontend/src/components/Navbar.jsx
+++ b/frontend/src/components/Navbar.jsx
@@ -62,13 +62,17 @@ export default function Navbar({
{user ? (
- [ {user.display_name || user.username} ]
+ { e.stopPropagation(); onOpenProfile(); }} className="text-emerald-500 font-semibold hover:underline cursor-pointer">
+ [ {user.display_name || user.username} ]
+
) : savedGuestName ? (
-
- [ 👤 GAST: {savedGuestName} ]
+ { e.stopPropagation(); onOpenProfile(); }} className="text-amber-400 font-semibold flex items-center gap-1 hover:underline cursor-pointer" title="Klicken um Gast-Name zu ändern">
+ [ 👤 GAST: {savedGuestName} ✏️ ]
) : (
- [ GAST-MODUS ]
+ { e.stopPropagation(); onOpenProfile(); }} className="text-amber-500 font-semibold hover:underline cursor-pointer" title="Klicken um Gast-Name einzutragen">
+ [ GAST-MODUS ✏️ ]
+
)}
diff --git a/frontend/src/components/ProfileModal.jsx b/frontend/src/components/ProfileModal.jsx
index 2167dfd..a8c91dd 100644
--- a/frontend/src/components/ProfileModal.jsx
+++ b/frontend/src/components/ProfileModal.jsx
@@ -4,7 +4,9 @@ import { apiFetch } from '../api/client';
import { getRandomSkillColor } from '../utils/colors';
export default function ProfileModal({ user, skills, onClose, onUserUpdated, onRefreshSkills }) {
- const [displayName, setDisplayName] = useState(user?.display_name || '');
+ const [displayName, setDisplayName] = useState(
+ user?.display_name || localStorage.getItem('guest_display_name') || ''
+ );
const [selectedSkillIds, setSelectedSkillIds] = useState(
user?.skills ? user.skills.map(s => s.id) : []
);
@@ -26,15 +28,22 @@ export default function ProfileModal({ user, skills, onClose, onUserUpdated, onR
setSavingProfile(true);
try {
- const updatedUser = await apiFetch('/users/me/', {
- method: 'PATCH',
- body: JSON.stringify({
- display_name: displayName.trim(),
- skill_ids: selectedSkillIds
- })
- });
- setSuccess('Profil und Anzeigename erfolgreich aktualisiert!');
- onUserUpdated(updatedUser);
+ if (user) {
+ const updatedUser = await apiFetch('/users/me/', {
+ method: 'PATCH',
+ body: JSON.stringify({
+ display_name: displayName.trim(),
+ skill_ids: selectedSkillIds
+ })
+ });
+ setSuccess('Profil und Anzeigename erfolgreich aktualisiert!');
+ if (onUserUpdated) onUserUpdated(updatedUser);
+ } else {
+ localStorage.setItem('guest_display_name', displayName.trim());
+ window.dispatchEvent(new Event('guest_name_updated'));
+ setSuccess('Gast-Name erfolgreich gespeichert!');
+ setTimeout(() => onClose(), 600);
+ }
} catch (err) {
setError(err.message || 'Speichern des Profils fehlgeschlagen.');
} finally {