From dc6bff027af98571ec43841ec884c47b2932b5b4 Mon Sep 17 00:00:00 2001
From: Gabriel Kaszewski
Date: Tue, 18 Aug 2026 10:49:16 +0200
Subject: [PATCH] Add UI improvements + refactor frontend to event-driven
architecture
Features: disabled place button during cooldown, beep on cooldown end,
hand/paint mode toggle with Space shortcut, soldier count pop animation.
Architecture: centralized DOM refs, AppState store replacing localStorage
polling, event bus decoupling socket from handlers, keyboard manager,
tool manager with Strategy pattern (paint-tool, hand-tool).
---
painter-js/index.html | 15 ++
painter-js/src/domain/app-state.js | 20 ++
painter-js/src/infrastructure/event-bus.js | 17 ++
painter-js/src/infrastructure/keyboard.js | 51 ++++++
painter-js/src/main.js | 202 +++++++++++++++------
painter-js/src/style.css | 14 ++
painter-js/src/tools/hand-tool.js | 34 ++++
painter-js/src/tools/paint-tool.js | 46 +++++
painter-js/src/ui/canvas-viewport.js | 14 +-
painter-js/src/ui/color-palette.js | 19 +-
painter-js/src/ui/cooldown-display.js | 59 ++++--
painter-js/src/ui/pixel-placer.js | 57 ------
painter-js/src/ui/tool-manager.js | 65 +++++++
13 files changed, 475 insertions(+), 138 deletions(-)
create mode 100644 painter-js/src/domain/app-state.js
create mode 100644 painter-js/src/infrastructure/event-bus.js
create mode 100644 painter-js/src/infrastructure/keyboard.js
create mode 100644 painter-js/src/tools/hand-tool.js
create mode 100644 painter-js/src/tools/paint-tool.js
delete mode 100644 painter-js/src/ui/pixel-placer.js
create mode 100644 painter-js/src/ui/tool-manager.js
diff --git a/painter-js/index.html b/painter-js/index.html
index c9652f1..bd419b1 100644
--- a/painter-js/index.html
+++ b/painter-js/index.html
@@ -85,6 +85,21 @@
You can place a pixel now
+
+
+