diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index aca6d5c..ecabd6f 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -21,6 +21,8 @@ function cycleTag(tag) {
function AdminPanel() {
const [users, setUsers] = useState([]);
+
+ const [open, setOpen] = useState(false);
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [role, setRole] = useState("user");
@@ -35,6 +37,12 @@ function AdminPanel() {
loadUsers().catch(() => {});
}, []);
+ const resetForm = () => {
+ setEmail("");
+ setPassword("");
+ setRole("user");
+ };
+
const createUser = async () => {
setMsg("");
try {
@@ -42,44 +50,31 @@ function AdminPanel() {
method: "POST",
body: JSON.stringify({ email, password, role }),
});
- setEmail("");
- setPassword("");
- setRole("user");
setMsg("✅ User erstellt.");
await loadUsers();
+ resetForm();
+ setOpen(false);
} catch (e) {
setMsg("❌ Fehler: " + (e?.message || "unknown"));
}
};
+ const closeModal = () => {
+ setOpen(false);
+ setMsg("");
+ // optional: resetForm(); // wenn du beim Schließen leeren willst
+ };
+
return (
-
Admin Dashboard
-
-
-
setEmail(e.target.value)}
- placeholder="Email"
- style={styles.input}
- />
-
setPassword(e.target.value)}
- placeholder="Initial Passwort"
- type="password"
- style={styles.input}
- />
-
-
+
+
Admin Dashboard
+
- {msg &&
{msg}
}
-
-
Vorhandene User
+
Vorhandene User
{users.map((u) => (
@@ -91,10 +86,59 @@ function AdminPanel() {
))}
+
+ {/* Modal */}
+ {open && (
+
+
e.stopPropagation()}>
+
+
Neuen User anlegen
+
+
+
+
+
setEmail(e.target.value)}
+ placeholder="Email"
+ style={styles.input}
+ autoFocus
+ />
+
setPassword(e.target.value)}
+ placeholder="Initial Passwort"
+ type="password"
+ style={styles.input}
+ />
+
+
+ {msg &&
{msg}
}
+
+
+
+
+
+
+
+ Tipp: Am Handy ist das Modal leichter zu bedienen als die Grid-Zeile.
+
+
+
+
+ )}
);
}
+
export default function App() {
const [me, setMe] = useState(null);
const [loginEmail, setLoginEmail] = useState("admin@local");
@@ -445,4 +489,24 @@ const styles = {
background: "rgba(255,255,255,0.55)",
border: "1px solid rgba(0,0,0,0.10)",
},
+ modalOverlay: {
+ position: "fixed",
+ inset: 0,
+ background: "rgba(0,0,0,0.45)",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ padding: 16,
+ zIndex: 9999,
+ },
+ modalCard: {
+ width: "100%",
+ maxWidth: 520,
+ borderRadius: 18,
+ border: "1px solid rgba(0,0,0,0.25)",
+ background: "linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.42))",
+ boxShadow: "0 18px 50px rgba(0,0,0,0.35)",
+ padding: 14,
+ backdropFilter: "blur(6px)",
+ },
};