Skip to content

Commit

Permalink
Unhide button instead of creating a new one
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Löfgren <[email protected]>
  • Loading branch information
l0f3n committed Jan 17, 2025
1 parent 2abc363 commit 63e32a1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
20 changes: 2 additions & 18 deletions wikiweaver-ext/content/join-lobby.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
const fragment = document.createDocumentFragment();

const div = document.createElement("div");
div.classList.add("flex-horizontal-container")

// TODO: There is probably a better way to do all this
const btn = document.createElement("btn");
btn.id = "join-lobby";
btn.classList.add("button", "box", "text");
const btn = document.getElementById("join-button");
btn.onclick = HandleJoinLobbyClicked;
btn.style = "margin-top: 0.5rem; background: var(--green);";
btn.textContent = "join";

const reference = document.getElementById("leaderboard-wrapper");
const parent = document.getElementById("sidepane");

fragment.appendChild(div);
div.appendChild(btn);
parent.insertBefore(fragment, reference);
btn.hidden = false;

async function HandleJoinLobbyClicked() {
const { username } = await chrome.storage.local.get();
Expand Down
5 changes: 4 additions & 1 deletion wikiweaver-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
<button id="redraw-button" class="button box text" onclick="HandleRedrawClicked()">redraw</button>
<button id="export-button" class="button box text" onclick="HandleExportClicked()">export</button>
</div>
<div class="flex-horizontal-container">
<button id="join-button" class="button box text" hidden>join</button>
</div>
<div id="leaderboard-wrapper">
<table id="leaderboard" class="text">
<tr>
Expand Down Expand Up @@ -87,4 +90,4 @@
</div>
</body>

</html>
</html>
7 changes: 6 additions & 1 deletion wikiweaver-web/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ img {
background: var(--blue);
}

#join-button {
background: var(--green);
margin-top: 0.5rem;
}

#leaderboard-wrapper {
overflow-x: auto;
flex-shrink: 0;
Expand Down Expand Up @@ -230,4 +235,4 @@ img {

.button:hover {
filter: brightness(85%);
}
}

0 comments on commit 63e32a1

Please sign in to comment.