()
| 6212 | } |
| 6213 | |
| 6214 | export function openAdminUserHubModal() { |
| 6215 | const isDark = document.body.classList.contains("dark-mode"); |
| 6216 | const overlayBg = isDark ? "rgba(0,0,0,0.7)" : "rgba(0,0,0,0.3)"; |
| 6217 | const contentBg = isDark ? "var(--fr-surface-dark)" : "#fff"; |
| 6218 | const contentFg = isDark ? "#e0e0e0" : "#000"; |
| 6219 | const borderCol = isDark ? "var(--fr-border-dark)" : "#ccc"; |
| 6220 | |
| 6221 | // Local helper so we ALWAYS see something (toast or alert) |
| 6222 | const safeToast = (msg, type) => { |
| 6223 | try { |
| 6224 | if (typeof showToast === "function") { |
| 6225 | showToast(msg, 7000); |
| 6226 | } else { |
| 6227 | alert(msg); |
| 6228 | } |
| 6229 | } catch (e) { |
| 6230 | console.error("showToast failed, falling back to alert", e); |
| 6231 | alert(msg); |
| 6232 | } |
| 6233 | }; |
| 6234 | |
| 6235 | let modal = document.getElementById("adminUserHubModal"); |
| 6236 | if (!modal) { |
| 6237 | modal = document.createElement("div"); |
| 6238 | modal.id = "adminUserHubModal"; |
| 6239 | modal.style.cssText = ` |
| 6240 | position:fixed; inset:0; |
| 6241 | background:${overlayBg}; |
| 6242 | display:flex; align-items:center; justify-content:center; |
| 6243 | z-index:9999; |
| 6244 | `; |
| 6245 | |
| 6246 | modal.innerHTML = ` |
| 6247 | <div class="modal-content" |
| 6248 | style=" |
| 6249 | background:${contentBg}; |
| 6250 | color:${contentFg}; |
| 6251 | padding:16px 18px; |
| 6252 | max-width:980px; |
| 6253 | width:95%; |
| 6254 | position:relative; |
| 6255 | border:1px solid ${borderCol}; |
| 6256 | max-height:90vh; |
| 6257 | overflow:auto; |
| 6258 | "> |
| 6259 | <span id="closeAdminUserHub" |
| 6260 | class="editor-close-btn" |
| 6261 | style="top:8px; right:10px;">×</span> |
| 6262 | |
| 6263 | <h3 style="margin-top:0;"> |
| 6264 | ${tf("manage_users", "Manage users")} |
| 6265 | </h3> |
| 6266 | <p class="muted" style="margin-top:-4px; margin-bottom:10px; font-size:0.9rem;"> |
| 6267 | ${tf( |
| 6268 | "manage_users_help", |
| 6269 | "Select a user from the list to change their password, delete them, or update account-level flags. Use Add User to create a brand new account." |
| 6270 | )} |
| 6271 | </p> |
no test coverage detected