From 05e8c262b77f2268a5a5e21ec753a150b28c5db7 Mon Sep 17 00:00:00 2001
From: david raistrick <1108844+keen99@users.noreply.github.com>
Date: Wed, 23 Sep 2026 15:31:55 -0400
Subject: [PATCH] feat: stateful caffeine button with icon-only display
Replace moon/coffee action-label toggle with coffee icon plus slash overlay. ON shows amber; OFF shows a slash with no color. Accessible name (Caffeine ON/OFF) and aria-pressed carry state. Applied to admin header, encounter header, and both player display states.
---
src/App.js | 66 ++++++++++++++++--------------
src/tests/CaffeineControls.test.js | 59 ++++++++++++++++++++++++++
src/tests/ScreenControls.test.js | 4 +-
3 files changed, 97 insertions(+), 32 deletions(-)
create mode 100644 src/tests/CaffeineControls.test.js
diff --git a/src/App.js b/src/App.js
index ad5d86b..c699056 100644
--- a/src/App.js
+++ b/src/App.js
@@ -8,7 +8,7 @@ import {
UserCheck, UserX, HeartCrack, HeartPulse, Zap, EyeOff, ExternalLink, AlertTriangle,
Play as PlayIcon, Pause as PauseIcon, SkipForward as SkipForwardIcon,
StopCircle as StopCircleIcon, Users2, Dices, ChevronDown, ScrollText,
- Maximize2, Minimize2, PanelTopOpen, PanelTopClose, Moon, Coffee, Clock, ChevronRight, X,
+ Maximize2, Minimize2, PanelTopOpen, PanelTopClose, Coffee, Clock, ChevronRight, X,
Undo2, Redo2, Crosshair, Pencil
} from 'lucide-react';
@@ -338,6 +338,28 @@ function useFirestoreCollection(collectionPath, queryConstraints = []) {
// REUSABLE COMPONENTS
// ============================================================================
+function CaffeineButton({ enabled, onToggle, compact = false }) {
+ const label = `Caffeine ${enabled ? 'ON' : 'OFF'}`;
+ const size = compact ? 18 : 20;
+ return (
+
+ );
+}
+
function Modal({ onClose, title, children }) {
useEffect(() => {
const handleEsc = (event) => {
@@ -2881,14 +2903,7 @@ function EncounterManager({ campaignId, initialActiveEncounterId, campaignCharac
Managing Encounter: {selectedEncounter.name}
-
+
Create Campaign
-
+
setWakeLockEnabled(v => { localStorage.setItem('ttrpg.wakeLock', String(!v)); return !v; })}
+ />