Skip to content

Commit 4eda891

Browse files
committed
combined #closeModal() & #closeMenu() to #closeAll()
1 parent 343ac5c commit 4eda891

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

vanilla-build/js/view.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ export default class View {
3535
status: { isComplete, winner },
3636
} = game;
3737

38-
this.#closeModal();
39-
this.#closeMenu();
38+
this.#closeAll();
4039
this.#clearMoves();
4140
this.#updateScoreboard(
4241
playersWithStats[0].wins,
@@ -82,12 +81,6 @@ export default class View {
8281
icon.classList.toggle("fa-chevron-up");
8382
}
8483

85-
#closeMenu() {
86-
if (!this.$.menuItems.classList.contains("hidden")) {
87-
this.#toggleMenu();
88-
}
89-
}
90-
9184
#handlePlayerMove(squareEl, player) {
9285
const icon = document.createElement("i");
9386
icon.classList.add("fa-solid", player.iconClass, player.colorClass);
@@ -111,7 +104,10 @@ export default class View {
111104
winner !== null ? `${winner.name} wins!` : "Tie game!";
112105
}
113106

114-
#closeModal() {
107+
#closeAll() {
108+
if (!this.$.menuItems.classList.contains("hidden")) {
109+
this.#toggleMenu();
110+
}
115111
this.$.modal.classList.add("hidden");
116112
}
117113

0 commit comments

Comments
 (0)