From 90cfb36b56d024c84c5a4d25039c803b4be318dc Mon Sep 17 00:00:00 2001 From: robert Date: Sat, 16 May 2026 09:30:35 -0400 Subject: [PATCH] Adds a 'Hide player HP' toggle in the Combat Controls panel (on by default) that suppresses health bars for player characters in the DisplayView. Setting is persisted in the activeDisplay Firestore doc so it survives page reloads and takes effect in real time on the player screen. --- src/App.js | 54 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/src/App.js b/src/App.js index be46dd2..15c75f4 100644 --- a/src/App.js +++ b/src/App.js @@ -1505,6 +1505,17 @@ function ParticipantManager({ encounter, encounterPath, campaignCharacters }) { function InitiativeControls({ campaignId, encounter, encounterPath }) { const [showEndConfirm, setShowEndConfirm] = useState(false); + const { data: activeDisplayData } = useFirestoreDocument(getPath.activeDisplay()); + const hidePlayerHp = activeDisplayData?.hidePlayerHp ?? true; + + const handleToggleHidePlayerHp = async () => { + if (!db) return; + try { + await setDoc(doc(db, getPath.activeDisplay()), { hidePlayerHp: !hidePlayerHp }, { merge: true }); + } catch (err) { + console.error("Error toggling hidePlayerHp:", err); + } + }; const handleStartEncounter = async () => { if (!db || !encounter.participants || encounter.participants.length === 0) { @@ -1676,6 +1687,22 @@ function InitiativeControls({ campaignId, encounter, encounterPath }) { )} + + {/* Display Settings */} +
+
Player Display
+ +
-
-
-
- {p.type !== 'monster' && ( - - HP: {p.currentHp} / {p.maxHp} - - )} + {!(hidePlayerHp && p.type === 'character') && ( +
+
+
+ {p.type !== 'monster' && ( + + HP: {p.currentHp} / {p.maxHp} + + )} +
-
+ )} {p.conditions?.length > 0 && (