Refactor button box code a bit, and fix color of copy game link icon

This commit is contained in:
sepia 2025-07-23 15:03:19 -05:00
parent e8bfdaaa30
commit 74bb200f8f
5 changed files with 64 additions and 59 deletions

View file

@ -14,12 +14,12 @@ function copyGameLink() {
clearTimeout(window.copyButtonTimeoutId);
}
copyLinkButton.querySelector('img').src = '/icons/copy-success.svg';
copyLinkButton.querySelector('use').href = '/icons/copy-success.svg';
copyLinkText.textContent = 'Game link copied!';
copyLinkButton.classList.add('copied-state');
window.copyButtonTimeoutId = setTimeout(() => {
copyLinkButton.querySelector('img').src = originalIconSrc;
copyLinkButton.querySelector('use').href = originalIconSrc;
copyLinkText.textContent = originalTextContent;
copyLinkButton.classList.remove('copied-state');
window.copyButtonTimeoutId = null;

View file

@ -1,4 +1,5 @@
document.addEventListener('htmx:wsAfterMessage', function (e) {
console.log(e.detail.message);
const message = JSON.parse(e.detail.message);
if (message.type === 'redirect_to_game') {
window.location.href = '/?gameId=' + message.gameId;

View file

@ -221,9 +221,9 @@ body {
margin-top: 20px;
}
img.icon {
width: 1em;
height: 1em;
.icon {
width: 1.4em;
height: 1.4em;
vertical-align: middle;
}
@ -249,6 +249,8 @@ button:hover {
#button-box {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: center;
gap: 10px;
margin-top: 20px;