Restyle button box to remove text from buttons
This commit is contained in:
parent
79ae2c5d2b
commit
3f6ecb84fc
|
@ -208,7 +208,8 @@ body {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
transition: opacity 0.3s ease;
|
transition: opacity 0.3s ease;
|
||||||
padding: 8px 15px;
|
padding: 15px 8px;
|
||||||
|
margin: 0px 6px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -220,13 +221,18 @@ body {
|
||||||
|
|
||||||
#button-box {
|
#button-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: column;
|
||||||
flex-wrap: nowrap;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#button-box-buttons {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
#resign-button {
|
#resign-button {
|
||||||
background-color: var(--color-primary);
|
background-color: var(--color-primary);
|
||||||
color: var(--color-on-primary);
|
color: var(--color-on-primary);
|
||||||
|
|
|
@ -154,10 +154,12 @@ class GameServer {
|
||||||
|
|
||||||
public broadcastButtonsToPlayer(conn: PlayerConnection) {
|
public broadcastButtonsToPlayer(conn: PlayerConnection) {
|
||||||
const buttons: JSX.Element[] = [];
|
const buttons: JSX.Element[] = [];
|
||||||
|
let title: string | undefined;
|
||||||
|
|
||||||
if (this.gomoku.status == 'playing' && this.getPlayerColor(conn)) {
|
if (this.gomoku.status == 'playing' && this.getPlayerColor(conn)) {
|
||||||
if (this.takebackRequesterId) {
|
if (this.takebackRequesterId) {
|
||||||
if (this.takebackRequesterId === conn.id) {
|
if (this.takebackRequesterId === conn.id) {
|
||||||
|
title = 'You requested a takeback';
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<button
|
<button
|
||||||
id="cancel-takeback-request-button"
|
id="cancel-takeback-request-button"
|
||||||
|
@ -167,10 +169,10 @@ class GameServer {
|
||||||
<svg class="icon" alt="Cancel">
|
<svg class="icon" alt="Cancel">
|
||||||
<use href="/icons/decline.svg"></use>
|
<use href="/icons/decline.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Cancel Takeback Request
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
title = 'Your opponent requests a takeback';
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<button
|
<button
|
||||||
id="accept-takeback-button"
|
id="accept-takeback-button"
|
||||||
|
@ -180,7 +182,6 @@ class GameServer {
|
||||||
<svg class="icon" alt="Accept">
|
<svg class="icon" alt="Accept">
|
||||||
<use href="/icons/accept.svg"></use>
|
<use href="/icons/accept.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Accept Takeback
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
buttons.push(
|
buttons.push(
|
||||||
|
@ -192,12 +193,12 @@ class GameServer {
|
||||||
<svg class="icon" alt="Decline">
|
<svg class="icon" alt="Decline">
|
||||||
<use href="/icons/decline.svg"></use>
|
<use href="/icons/decline.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Decline Takeback
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (this.drawRequesterId) {
|
} else if (this.drawRequesterId) {
|
||||||
if (this.drawRequesterId === conn.id) {
|
if (this.drawRequesterId === conn.id) {
|
||||||
|
title = 'You requested a draw';
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<button
|
<button
|
||||||
id="cancel-draw-request-button"
|
id="cancel-draw-request-button"
|
||||||
|
@ -207,10 +208,10 @@ class GameServer {
|
||||||
<svg class="icon" alt="Cancel">
|
<svg class="icon" alt="Cancel">
|
||||||
<use href="/icons/decline.svg"></use>
|
<use href="/icons/decline.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Cancel Draw Request
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
title = 'Your opponent offers a draw';
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<button
|
<button
|
||||||
id="accept-draw-button"
|
id="accept-draw-button"
|
||||||
|
@ -220,7 +221,6 @@ class GameServer {
|
||||||
<svg class="icon" alt="Accept">
|
<svg class="icon" alt="Accept">
|
||||||
<use href="/icons/accept.svg"></use>
|
<use href="/icons/accept.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Accept Draw
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
buttons.push(
|
buttons.push(
|
||||||
|
@ -232,7 +232,6 @@ class GameServer {
|
||||||
<svg class="icon" alt="Decline">
|
<svg class="icon" alt="Decline">
|
||||||
<use href="/icons/decline.svg"></use>
|
<use href="/icons/decline.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Decline Draw
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -242,7 +241,6 @@ class GameServer {
|
||||||
<svg class="icon" alt="Resign">
|
<svg class="icon" alt="Resign">
|
||||||
<use href="/icons/resign.svg"></use>
|
<use href="/icons/resign.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Resign
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
buttons.push(
|
buttons.push(
|
||||||
|
@ -250,7 +248,6 @@ class GameServer {
|
||||||
<svg class="icon" alt="Takeback">
|
<svg class="icon" alt="Takeback">
|
||||||
<use href="/icons/undo.svg"></use>
|
<use href="/icons/undo.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Takeback
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
buttons.push(
|
buttons.push(
|
||||||
|
@ -258,13 +255,13 @@ class GameServer {
|
||||||
<svg class="icon" alt="Draw">
|
<svg class="icon" alt="Draw">
|
||||||
<use href="/icons/draw.svg"></use>
|
<use href="/icons/draw.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Draw
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (this.gomoku.status === 'finished') {
|
} else if (this.gomoku.status === 'finished') {
|
||||||
if (this.rematchRequesterId) {
|
if (this.rematchRequesterId) {
|
||||||
if (this.rematchRequesterId === conn.id) {
|
if (this.rematchRequesterId === conn.id) {
|
||||||
|
title = 'You requested a rematch';
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<button
|
<button
|
||||||
id="cancel-rematch-request-button"
|
id="cancel-rematch-request-button"
|
||||||
|
@ -274,10 +271,10 @@ class GameServer {
|
||||||
<svg class="icon" alt="Cancel">
|
<svg class="icon" alt="Cancel">
|
||||||
<use href="/icons/decline.svg"></use>
|
<use href="/icons/decline.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Cancel Rematch Request
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
title = 'Your opponent requests a rematch';
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<button
|
<button
|
||||||
id="accept-rematch-button"
|
id="accept-rematch-button"
|
||||||
|
@ -287,7 +284,6 @@ class GameServer {
|
||||||
<svg class="icon" alt="Accept">
|
<svg class="icon" alt="Accept">
|
||||||
<use href="/icons/accept.svg"></use>
|
<use href="/icons/accept.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Accept Rematch
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
buttons.push(
|
buttons.push(
|
||||||
|
@ -299,7 +295,6 @@ class GameServer {
|
||||||
<svg class="icon" alt="Decline">
|
<svg class="icon" alt="Decline">
|
||||||
<use href="/icons/decline.svg"></use>
|
<use href="/icons/decline.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Decline Rematch
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -309,7 +304,6 @@ class GameServer {
|
||||||
<svg class="icon" alt="Rematch">
|
<svg class="icon" alt="Rematch">
|
||||||
<use href="/icons/rotate-right.svg"></use>
|
<use href="/icons/rotate-right.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
Rematch
|
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -319,12 +313,17 @@ class GameServer {
|
||||||
<svg class="icon" alt="Copy">
|
<svg class="icon" alt="Copy">
|
||||||
<use href="/icons/clipboard-copy.svg"></use>
|
<use href="/icons/clipboard-copy.svg"></use>
|
||||||
</svg>
|
</svg>
|
||||||
<span id="copy-link-text">Click to copy game link!</span>
|
<span id="copy-link-text">Copy Link</span>
|
||||||
</button>,
|
</button>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
conn.ws.send(<div id="button-box">{buttons}</div>);
|
conn.ws.send(
|
||||||
|
<div id="button-box">
|
||||||
|
<div id="button-box-title">{title}</div>
|
||||||
|
<div id="button-box-buttons">{buttons}</div>
|
||||||
|
</div>,
|
||||||
|
);
|
||||||
console.log(`Sent buttons for game ${this.id} to player ${conn.id}`);
|
console.log(`Sent buttons for game ${this.id} to player ${conn.id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue