Reduced modals height on mobile, fixed public lobby button bug

This commit is contained in:
NewHappyRabbit
2025-02-24 20:52:06 +02:00
parent f995fc4ec6
commit d9beeb8c60
6 changed files with 15 additions and 7 deletions
+1 -1
View File
@@ -181,7 +181,7 @@ export class HelpModal extends LitElement {
@media screen and (max-width: 768px) {
#helpModal .modal-content {
max-height: 100vh;
max-height: 90vh;
max-width: 100vw;
width: 100%;
}
+1 -1
View File
@@ -303,7 +303,7 @@ export class HostLobbyModal extends LitElement {
@media screen and (max-width: 768px) {
.modal-content {
max-height: calc(100vh - 42px);
max-height: calc(90vh - 42px);
max-width: 100vw;
width: 100%;
}
+1 -1
View File
@@ -219,7 +219,7 @@ export class JoinPrivateLobbyModal extends LitElement {
@media screen and (max-width: 768px) {
.modal-content {
max-height: calc(100vh - 42px);
max-height: calc(90vh - 42px);
max-width: 100vw;
width: 100%;
}
+2
View File
@@ -95,6 +95,7 @@ class Client {
.addEventListener("click", () => {
if (this.usernameInput.isValid()) {
hostModal.open();
this.publicLobby.leaveLobby();
}
});
@@ -172,6 +173,7 @@ class Client {
consolex.log("leaving lobby, cancelling game");
this.gameStop();
this.gameStop = null;
this.publicLobby.leaveLobby();
}
private async handleSinglePlayer(event: CustomEvent) {
+9 -3
View File
@@ -8,7 +8,7 @@ import { getMapsImage } from "./utilities/Maps";
@customElement("public-lobby")
export class PublicLobby extends LitElement {
@state() private lobbies: Lobby[] = [];
@state() private isLobbyHighlighted: boolean = false;
@state() public isLobbyHighlighted: boolean = false;
private lobbiesInterval: number | null = null;
private currLobby: Lobby = null;
@@ -57,6 +57,7 @@ export class PublicLobby extends LitElement {
public stop() {
if (this.lobbiesInterval !== null) {
this.isLobbyHighlighted = false;
clearInterval(this.lobbiesInterval);
this.lobbiesInterval = null;
}
@@ -115,9 +116,14 @@ export class PublicLobby extends LitElement {
`;
}
leaveLobby() {
this.isLobbyHighlighted = false;
this.currLobby = null;
}
private lobbyClicked(lobby: Lobby) {
this.isLobbyHighlighted = !this.isLobbyHighlighted;
if (this.currLobby == null) {
this.isLobbyHighlighted = true;
this.currLobby = lobby;
this.dispatchEvent(
new CustomEvent("join-lobby", {
@@ -139,7 +145,7 @@ export class PublicLobby extends LitElement {
composed: true,
}),
);
this.currLobby = null;
this.leaveLobby();
}
}
}
+1 -1
View File
@@ -226,7 +226,7 @@ export class SinglePlayerModal extends LitElement {
@media screen and (max-width: 768px) {
.modal-content {
max-height: calc(100vh - 42px);
max-height: calc(90vh - 42px);
max-width: 100vw;
width: 100%;
}