From 79ae2c5d2b5a733f7fc025291ed1cf6611718e63 Mon Sep 17 00:00:00 2001 From: sepia Date: Sun, 27 Jul 2025 16:58:37 -0500 Subject: [PATCH] - update deploy script - random +x stuff because I switched directories - change heart stones to use inline svgs --- .gitignore | 0 .goosehints | 0 .pre-commit-config.yaml | 0 .prettierrc.json | 0 README.md | 0 justfile | 3 +- package.json | 0 public/icons/accept.svg | 0 public/icons/decline.svg | 0 public/icons/draw.svg | 0 public/icons/heart.svg | 3 -- public/icons/resign.svg | 0 public/icons/rotate-right.svg | 0 public/icons/undo.svg | 0 public/index.html | 2 +- public/scripts/copy-game-link.js | 0 public/scripts/handle-redirects.js | 0 ...ws-connection.js => make-ws-connection.js} | 8 +++- public/scripts/profile-editor.js | 0 public/scripts/send-ws-messages.js | 0 public/style.css | 44 ++++--------------- src/game/game-instance.test.ts | 0 src/game/game-instance.ts | 0 src/index.ts | 0 src/messages.ts | 0 .../{board-renderer.ts => board-renderer.tsx} | 26 +++++++++-- src/web-socket-handler.tsx | 0 tsconfig.json | 0 28 files changed, 41 insertions(+), 45 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .goosehints mode change 100644 => 100755 .pre-commit-config.yaml mode change 100644 => 100755 .prettierrc.json mode change 100644 => 100755 README.md mode change 100644 => 100755 justfile mode change 100644 => 100755 package.json mode change 100644 => 100755 public/icons/accept.svg mode change 100644 => 100755 public/icons/decline.svg mode change 100644 => 100755 public/icons/draw.svg delete mode 100755 public/icons/heart.svg mode change 100644 => 100755 public/icons/resign.svg mode change 100644 => 100755 public/icons/rotate-right.svg mode change 100644 => 100755 public/icons/undo.svg mode change 100644 => 100755 public/index.html mode change 100644 => 100755 public/scripts/copy-game-link.js mode change 100644 => 100755 public/scripts/handle-redirects.js rename public/scripts/{display-ws-connection.js => make-ws-connection.js} (76%) mode change 100644 => 100755 mode change 100644 => 100755 public/scripts/profile-editor.js mode change 100644 => 100755 public/scripts/send-ws-messages.js mode change 100644 => 100755 public/style.css mode change 100644 => 100755 src/game/game-instance.test.ts mode change 100644 => 100755 src/game/game-instance.ts mode change 100644 => 100755 src/index.ts mode change 100644 => 100755 src/messages.ts rename src/view/{board-renderer.ts => board-renderer.tsx} (55%) mode change 100644 => 100755 mode change 100644 => 100755 src/web-socket-handler.tsx mode change 100644 => 100755 tsconfig.json diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.goosehints b/.goosehints old mode 100644 new mode 100755 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml old mode 100644 new mode 100755 diff --git a/.prettierrc.json b/.prettierrc.json old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/justfile b/justfile old mode 100644 new mode 100755 index 601b4af..1d39d3e --- a/justfile +++ b/justfile @@ -8,7 +8,8 @@ build: bun build --compile --minify --target bun --outfile ./target/gomoku ./src/index.ts deploy: build - rsync -avz target/gomoku sepiatonesxyz:~/gomoku + rsync -avz target/gomoku sepiatonesxyz:~/gomoku/gomoku + rsync -avz --delete public/ sepiatonesxyz:~/gomoku/public test: bun test diff --git a/package.json b/package.json old mode 100644 new mode 100755 diff --git a/public/icons/accept.svg b/public/icons/accept.svg old mode 100644 new mode 100755 diff --git a/public/icons/decline.svg b/public/icons/decline.svg old mode 100644 new mode 100755 diff --git a/public/icons/draw.svg b/public/icons/draw.svg old mode 100644 new mode 100755 diff --git a/public/icons/heart.svg b/public/icons/heart.svg deleted file mode 100755 index 611c11e..0000000 --- a/public/icons/heart.svg +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/public/icons/resign.svg b/public/icons/resign.svg old mode 100644 new mode 100755 diff --git a/public/icons/rotate-right.svg b/public/icons/rotate-right.svg old mode 100644 new mode 100755 diff --git a/public/icons/undo.svg b/public/icons/undo.svg old mode 100644 new mode 100755 diff --git a/public/index.html b/public/index.html old mode 100644 new mode 100755 index 0b99d68..a7a699a --- a/public/index.html +++ b/public/index.html @@ -47,7 +47,7 @@
- + diff --git a/public/scripts/copy-game-link.js b/public/scripts/copy-game-link.js old mode 100644 new mode 100755 diff --git a/public/scripts/handle-redirects.js b/public/scripts/handle-redirects.js old mode 100644 new mode 100755 diff --git a/public/scripts/display-ws-connection.js b/public/scripts/make-ws-connection.js old mode 100644 new mode 100755 similarity index 76% rename from public/scripts/display-ws-connection.js rename to public/scripts/make-ws-connection.js index 803ad28..b532407 --- a/public/scripts/display-ws-connection.js +++ b/public/scripts/make-ws-connection.js @@ -8,7 +8,13 @@ const gameId = gameIdMeta.content; const playerId = playerIdMeta.content; // Dynamically construct WebSocket URL -const wsUrl = `ws://${window.location.host}/ws?gameId=${gameId}&playerId=${playerId}`; +let wsProtocol; +if (window.location.protocol === 'https:') { + wsProtocol = 'wss'; +} else { + wsProtocol = 'ws'; +} +const wsUrl = `${wsProtocol}://${window.location.host}/ws?gameId=${gameId}&playerId=${playerId}`; // Get the game container element const gameContainer = document.getElementById('ws-container'); diff --git a/public/scripts/profile-editor.js b/public/scripts/profile-editor.js old mode 100644 new mode 100755 diff --git a/public/scripts/send-ws-messages.js b/public/scripts/send-ws-messages.js old mode 100644 new mode 100755 diff --git a/public/style.css b/public/style.css old mode 100644 new mode 100755 index 7bae680..52ce73f --- a/public/style.css +++ b/public/style.css @@ -149,48 +149,20 @@ body { width: 24px; height: 24px; margin: auto; - overflow: hidden; } -.stone-black-heart::before, -.stone-black-heart::after, -.stone-white-heart::before, -.stone-white-heart::after { - content: ''; - position: absolute; - width: 12px; - height: 20px; - border-radius: 50% 50% 0 0; - border: 1px solid var(--color-neutral-900); - box-sizing: border-box; - transform: rotate(-45deg); - transform-origin: 0 100%; - top: 0; - left: 12px; +.stone-black-heart { + fill: var(--color-primary); + stroke: var(--color-neutral-900); } -.last-move.stone-white-heart::after, -.last-move.stone-black-heart::after, -.last-move.stone-white-heart::before, -.last-move.stone-black-heart::before { - border: 2px solid var(--color-info) !important; +.stone-white-heart { + stroke: var(--color-neutral-900); + fill: var(--color-on-primary); } -.stone-black-heart::after, -.stone-white-heart::after { - left: 0; - transform: rotate(45deg); - transform-origin: 100% 100%; -} - -.stone-black-heart::before, -.stone-black-heart::after { - background-color: var(--color-primary-light); -} - -.stone-white-heart::before, -.stone-white-heart::after { - background-color: var(--color-on-primary); +.last-move { + stroke: var(--color-info) !important; } .player-name { diff --git a/src/game/game-instance.test.ts b/src/game/game-instance.test.ts old mode 100644 new mode 100755 diff --git a/src/game/game-instance.ts b/src/game/game-instance.ts old mode 100644 new mode 100755 diff --git a/src/index.ts b/src/index.ts old mode 100644 new mode 100755 diff --git a/src/messages.ts b/src/messages.ts old mode 100644 new mode 100755 diff --git a/src/view/board-renderer.ts b/src/view/board-renderer.tsx old mode 100644 new mode 100755 similarity index 55% rename from src/view/board-renderer.ts rename to src/view/board-renderer.tsx index 44d3cf2..616c3d6 --- a/src/view/board-renderer.ts +++ b/src/view/board-renderer.tsx @@ -1,3 +1,4 @@ +import { Html } from '@elysiajs/html'; import { GomokuGame } from '../game/game-instance'; export function renderGameBoardHtml( @@ -12,13 +13,32 @@ export function renderGameBoardHtml( for (let col = 0; col < game.board[row].length; col++) { const stone = game.board[row][col]; const intersectionId = `intersection-${row}-${col}`; - let stoneHtml = ''; + let stoneHtml: JSX.Element | null; if (stone) { const colorClass = stone === 'black' ? 'stone-black-heart' : 'stone-white-heart'; const lastMoveClass = col == lastMove.col && row == lastMove.row ? 'last-move' : ''; - stoneHtml = `
`; + stoneHtml = ( + + + + + ); + } else { + stoneHtml = null; } // Calculate top and left for absolute positioning, offset by half the intersection div size @@ -37,7 +57,7 @@ export function renderGameBoardHtml( style="top: ${top}%; left: ${left}%;" ${wsAttrs} > - ${stoneHtml} + ${stoneHtml ? stoneHtml : ''} `; } } diff --git a/src/web-socket-handler.tsx b/src/web-socket-handler.tsx old mode 100644 new mode 100755 diff --git a/tsconfig.json b/tsconfig.json old mode 100644 new mode 100755