diff --git a/src/App.js b/src/App.js index acfcc70..fac6895 100644 --- a/src/App.js +++ b/src/App.js @@ -1658,6 +1658,7 @@ function InitiativeControls({ campaignId, encounter, encounterPath }) { const [showEndConfirm, setShowEndConfirm] = useState(false); const { data: activeDisplayData } = useFirestoreDocument(getPath.activeDisplay()); const hidePlayerHp = activeDisplayData?.hidePlayerHp ?? true; + const hideNpcHp = activeDisplayData?.hideNpcHp ?? false; const handleToggleHidePlayerHp = async () => { if (!db) return; @@ -1668,6 +1669,15 @@ function InitiativeControls({ campaignId, encounter, encounterPath }) { } }; + const handleToggleHideNpcHp = async () => { + if (!db) return; + try { + await storage.updateDoc(getPath.activeDisplay(), { hideNpcHp: !hideNpcHp }); + } catch (err) { + console.error("Error toggling hideNpcHp:", err); + } + }; + const handleStartEncounter = async () => { if (!db || !encounter.participants || encounter.participants.length === 0) { alert("Add participants first."); @@ -1915,6 +1925,17 @@ function InitiativeControls({ campaignId, encounter, encounterPath }) { + @@ -2592,6 +2613,7 @@ function DisplayView() { const { name, participants, round, currentTurnParticipantId, isStarted, isPaused } = activeEncounterData; const hidePlayerHp = activeDisplayData?.hidePlayerHp ?? true; + const hideNpcHp = activeDisplayData?.hideNpcHp ?? false; let participantsToRender = []; if (participants) { @@ -2693,7 +2715,7 @@ function DisplayView() { - {!(hidePlayerHp && p.type === 'character') && ( + {!(hidePlayerHp && p.type === 'character') && !(hideNpcHp && p.type !== 'character') && (
{ await selectCampaignByName('Camp'); // find the hide-player-HP toggle (role switch) - const toggle = await screen.findByRole('switch', { name: /hide/i }, { timeout: 3000 }); + const toggle = await screen.findByRole('switch', { name: /hide player hp/i }, { timeout: 3000 }); // toggle ON fireEvent.click(toggle);