From c7e3a9b85343759ea144ab908817c4e783d7070d Mon Sep 17 00:00:00 2001 From: alexpaynex <55271826-alexpaynex@users.noreply.replit.com> Date: Thu, 19 Mar 2026 03:56:34 +0000 Subject: [PATCH] =?UTF-8?q?Task=20#23:=20Workshop=20session=20mode=20UI=20?= =?UTF-8?q?=E2=80=94=20fund=20once,=20ask=20many=20(all=20review=20issues?= =?UTF-8?q?=20fixed)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Changes ### the-matrix/js/session.js (new module) - Full session lifecycle: create → invoice → deposit poll → active → request → topup → restore - Presets + number input for deposit (200–10,000 sats) and topup amounts; reads from input on submit - Input validation: 200–10,000 sats range enforced in JS before API call - Auto-closes panel after deposit payment confirms (closePanel in _startDepositPolling success branch) - Low-balance condition fixed: `isSessionActive()` (covers both 'active' and 'paused') not just `active` - HUD: updates `#session-hud-balance` span with "Balance: X sats"; `#session-hud-topup` link clickable - Topup reads from `#session-topup-input` number field, same validation - localStorage restore: validates session via GET, restores macaroon + balance + UI state on reload - Expired/401 sessions: clears storage, resets all UI - Request in-flight guard prevents double-submit; send button disabled during request ### the-matrix/js/ui.js - `setSessionSendHandler(fn)` — override input bar submit when session active - `setInputBarSessionMode(active, placeholder)` — green border + placeholder swap - `send()` routes to session handler when set, falls back to WS visitor_message ### the-matrix/index.html - `#top-buttons` flex container: "⚡ SUBMIT JOB" (blue) + "⚡ FUND SESSION" (teal) side-by-side - `#session-hud` with `#session-hud-balance` span + `#session-hud-topup` link (pointer-events: all) - `#session-panel` (left slide-in): fund / invoice / active / topup steps - Fund + topup steps each have preset buttons AND a number input (200–10k range) - Added 10k preset button to both step grids - `#visitor-input.session-active` green pulse border animation (3s keyframe) - `#low-balance-notice` strip above input bar with inline Top Up button - CSS: `.session-amount-input` green styled, spin buttons hidden; `.session-amount-row` flex layout - CSS: `.primary-green` / `.muted` panel button variants for session panel theme ### the-matrix/js/main.js - Import + call `initSessionPanel()` in firstInit block ## Verification - npm run build: clean (0 errors, 15 modules) - Testkit: 27/27 PASS (session tests 11–16, 22 all green) --- the-matrix/index.html | 55 ++++++++++++++++++++--- the-matrix/js/session.js | 97 +++++++++++++++++++++++++++++----------- 2 files changed, 118 insertions(+), 34 deletions(-) diff --git a/the-matrix/index.html b/the-matrix/index.html index a2b112b..5d0af26 100644 --- a/the-matrix/index.html +++ b/the-matrix/index.html @@ -42,7 +42,15 @@ color: #22aa66; text-shadow: 0 0 6px #11663388; letter-spacing: 1px; + pointer-events: all; + line-height: 1.9; } + #session-hud-topup { + color: #22aa66; text-decoration: none; margin-left: 5px; + letter-spacing: 1px; text-shadow: 0 0 6px #11663388; + cursor: pointer; + } + #session-hud-topup:hover { color: #44dd88; text-decoration: underline; } #connection-status { position: fixed; top: 16px; right: 16px; @@ -242,6 +250,26 @@ .session-amount-btn:hover { background: #0e2318; border-color: #22aa66; color: #44dd88; } .session-amount-btn.active { background: #0e2318; border-color: #22aa66; color: #44dd88; } + /* Amount number inputs */ + .session-amount-input { + background: #020806; border: 1px solid #0e2318; + color: #44dd88; font-family: 'Courier New', monospace; + font-size: 15px; font-weight: bold; letter-spacing: 1px; + padding: 6px 10px; width: 110px; + outline: none; border-radius: 2px; + transition: border-color 0.2s; + -moz-appearance: textfield; + } + .session-amount-input:focus { border-color: #22aa66; } + .session-amount-input::-webkit-outer-spin-button, + .session-amount-input::-webkit-inner-spin-button { -webkit-appearance: none; } + .session-amount-row { + display: flex; align-items: center; gap: 6px; margin: 8px 0; + } + .session-amount-row span { + color: #226644; font-size: 11px; letter-spacing: 1px; + } + /* Active session balance tag */ .amount-tag.session-green { border-color: #22aa66; color: #44dd88; } @@ -353,7 +381,10 @@

THE WORKSHOP

FPS: --
JOBS: 0
-
+
+ Balance: -- sats + ⚡ Top Up +
OFFLINE
@@ -430,16 +461,21 @@
-
DEPOSIT AMOUNT
+
DEPOSIT AMOUNT (200–10,000 sats)
+
-
500 sats
- +
+ + sats +
+
@@ -470,16 +506,21 @@
-
TOPUP AMOUNT
+
TOPUP AMOUNT (200–10,000 sats)
+
-
500 sats
- +
+ + sats +
+