fix: replace alert with inline error, extract sidebar inline style
This commit is contained in:
parent
67935ec234
commit
abf93a0848
@ -97,7 +97,7 @@
|
|||||||
|
|
||||||
<div class="sidebar-card">
|
<div class="sidebar-card">
|
||||||
<p class="sidebar-card__label">How to play</p>
|
<p class="sidebar-card__label">How to play</p>
|
||||||
<p style="font-size:.82rem;color:var(--ink-soft);line-height:1.55;">
|
<p class="sidebar-hint">
|
||||||
Draw the country's outline from memory. City dots are hints. Press <strong>Submit</strong> when done or wait for the timer.
|
Draw the country's outline from memory. City dots are hints. Press <strong>Submit</strong> when done or wait for the timer.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -170,6 +170,8 @@
|
|||||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M3 8h10M9 4l4 4-4 4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M3 8h10M9 4l4 4-4 4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<span class="field-error" id="lobby-error" role="alert"></span>
|
||||||
|
|
||||||
<p class="form-footer"><a href="#" style="color:var(--sea);font-weight:600;">Join a game instead</a></p>
|
<p class="form-footer"><a href="#" style="color:var(--sea);font-weight:600;">Join a game instead</a></p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -21,13 +21,20 @@ document.getElementById("reg-btn")?.addEventListener("click", async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const errorEl = /** @type {HTMLElement|null} */ (
|
||||||
|
document.getElementById("lobby-error")
|
||||||
|
);
|
||||||
|
if (errorEl) errorEl.textContent = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (button) button.disabled = true;
|
if (button) button.disabled = true;
|
||||||
await createLobby(lobbyName);
|
await createLobby(lobbyName);
|
||||||
saveLobbyName(lobbyName);
|
saveLobbyName(lobbyName);
|
||||||
window.location.href = "lobby.html";
|
window.location.href = "lobby.html";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert(error instanceof Error ? error.message : "Could not create lobby.");
|
if (errorEl)
|
||||||
|
errorEl.textContent =
|
||||||
|
error instanceof Error ? error.message : "Could not create lobby.";
|
||||||
if (button) button.disabled = false;
|
if (button) button.disabled = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -265,6 +265,12 @@
|
|||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar-hint {
|
||||||
|
font-size: 0.82rem;
|
||||||
|
color: var(--ink-soft);
|
||||||
|
line-height: 1.55;
|
||||||
|
}
|
||||||
|
|
||||||
/* Controls */
|
/* Controls */
|
||||||
.game-controls {
|
.game-controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user