import * as React from "react"; import { Collapsible, CollapsibleHeaderCallout, CollapsibleHeaderContent, } from "@dndbeyond/character-components/es"; import { HitPointInfo } from "@dndbeyond/character-rules-engine/es"; import HealthAdjuster from "../HealthAdjuster"; interface Props { hitPointInfo: HitPointInfo; isInteractive: boolean; initiallyCollapsed: boolean; onSave: (hitPointDiff: number) => void; heading?: string; } export default class VehicleHealthAdjuster extends React.PureComponent { static defaultProps = { isInteractive: false, initiallyCollapsed: true, }; handleAdjustHealth = (hitPointDiff: number): void => { const { onSave } = this.props; if (onSave) { onSave(hitPointDiff); } }; render() { const { hitPointInfo, isInteractive, initiallyCollapsed, heading } = this.props; let tempHp: number = hitPointInfo.tempHp === null ? 0 : hitPointInfo.tempHp; let extraNode: React.ReactNode = (
{hitPointInfo.remainingHp + tempHp} / {hitPointInfo.totalHp + tempHp}
); let headerCalloutNode: React.ReactNode = ( ); let headerNode: React.ReactNode = ( ); return (
Current HP
{hitPointInfo.remainingHp}
Max HP
{hitPointInfo.totalHp}
{isInteractive && ( )}
); } }