V1.0.1: Aldenfell campaign seed, content library, party overview
- Seed now resets the database and seeds the Aldenfell campaign from the campaign book: admin DM user, default weapons, locations, bestiary, pre-built encounters, and DM/shared notes - Default weapon/spell/monster library, character profile fields, locations and dice mode (new migration) - Party overview page, pagination, info tips, build preview calc - Remove stale demo-login hint; notes preserve line breaks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
} from '../api/queries';
|
||||
import { useCampaignSocket } from '../hooks/useCampaignSocket';
|
||||
import { Spinner, ErrorBanner } from '../components/Spinner';
|
||||
import { extractErrorMessage } from '../lib/format';
|
||||
import { extractErrorMessage, fmtMod, hpBarClass } from '../lib/format';
|
||||
import type { EncounterParticipant } from '../api/types';
|
||||
|
||||
function ParticipantRow({
|
||||
@@ -28,7 +28,9 @@ function ParticipantRow({
|
||||
onRemove: () => void;
|
||||
}) {
|
||||
const [hpDelta, setHpDelta] = useState('');
|
||||
const [showCombatInfo, setShowCombatInfo] = useState(false);
|
||||
const pct = Math.max(0, Math.min(100, (participant.currentHp / participant.maxHp) * 100));
|
||||
const combatInfo = participant.characterCombatInfo;
|
||||
|
||||
function applyDelta(sign: 1 | -1) {
|
||||
const amount = Number(hpDelta);
|
||||
@@ -59,7 +61,7 @@ function ParticipantRow({
|
||||
)}
|
||||
</div>
|
||||
<div className="hp-bar-track mt-sm">
|
||||
<div className="hp-bar-fill" style={{ width: `${pct}%` }} />
|
||||
<div className={hpBarClass(participant.currentHp, participant.maxHp)} style={{ width: `${pct}%` }} />
|
||||
</div>
|
||||
<div className="flex-between mt-sm flex-wrap">
|
||||
<span>
|
||||
@@ -106,6 +108,45 @@ function ParticipantRow({
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{combatInfo && (
|
||||
<div className="mt-sm">
|
||||
<button className="btn btn-ghost" onClick={() => setShowCombatInfo((s) => !s)}>
|
||||
{showCombatInfo ? 'Hide' : '⚔ Show'} Weapons & Spells
|
||||
</button>
|
||||
{showCombatInfo && (
|
||||
<div className="mt-sm">
|
||||
{combatInfo.weapons.length === 0 && combatInfo.spells.length === 0 && (
|
||||
<p style={{ color: 'var(--text-muted)', margin: 0 }}>Nothing equipped or prepared.</p>
|
||||
)}
|
||||
{combatInfo.weapons.map((w) => (
|
||||
<div key={w.characterWeaponId} className="flex-between" style={{ padding: '0.2rem 0' }}>
|
||||
<span>
|
||||
{w.name} {w.equipped && <span className="badge">equipped</span>}
|
||||
<span style={{ color: 'var(--text-muted)', marginLeft: 6, fontSize: '0.85rem' }}>
|
||||
{w.damageDice} {w.damageType} {fmtMod(w.damageBonus)}
|
||||
</span>
|
||||
</span>
|
||||
<span className="mono">{fmtMod(w.attackBonus)}</span>
|
||||
</div>
|
||||
))}
|
||||
{combatInfo.spells.length > 0 && (
|
||||
<div className="flex-row flex-wrap mt-sm">
|
||||
{combatInfo.spells.map((s) => (
|
||||
<span key={s.characterSpellId} className={`badge ${s.prepared ? 'badge-dm' : ''}`}>
|
||||
{s.name} (Lv {s.level})
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{combatInfo.spellcasting && (
|
||||
<p style={{ margin: '0.4rem 0 0', fontSize: '0.85rem', color: 'var(--text-muted)' }}>
|
||||
Spell Save DC {combatInfo.spellcasting.saveDC} · Attack {fmtMod(combatInfo.spellcasting.attackBonus)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user