Skip to content

Commit

Permalink
fix: 2H and i weapon settings missing on character sheet
Browse files Browse the repository at this point in the history
Fixes #797
  • Loading branch information
elyukai committed May 6, 2021
1 parent 2ad037e commit 3f9fae3
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions src/App/Views/Sheets/CombatSheet/CombatSheetMeleeWeapons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react"
import { Textfit } from "react-textfit"
import { fmap, fmapF } from "../../../../Data/Functor"
import { flength, fnull, intercalate, List, map, replicateR, subscriptF, toArray } from "../../../../Data/List"
import { bindF, fromMaybe, Just, Maybe } from "../../../../Data/Maybe"
import { bindF, catMaybes, ensure, fromMaybe, Just, Maybe, maybeRNull } from "../../../../Data/Maybe"
import { lookupF } from "../../../../Data/OrderedMap"
import { Record } from "../../../../Data/Record"
import { bimap, fst, isTuple, snd } from "../../../../Data/Tuple"
Expand Down Expand Up @@ -84,10 +84,33 @@ export const CombatSheetMeleeWeapons: React.FC<Props> = props => {
const getPrimaryAtIndex =
(i: number) => pipe (MWA.primary, subscriptF (i), renderMaybe)

const weapon_settings = pipe_ (
List (
Maybe.guardReplace (MWA.isTwoHandedWeapon (e)) ("2H"),
Maybe.guardReplace (MWA.isImprovisedWeapon (e)) ("i"),
),
catMaybes,
ensure (List.notNull),
fmap (intercalate (", "))
)

return (
<tr key={MWA.id (e)}>
<td className="name">
<Textfit max={11} min={7} mode="single">{MWA.name (e)}</Textfit>
<Textfit max={11} min={7} mode="single">
{MWA.name (e)}
{maybeRNull ((str: string) => (
<>
{" "}
<span className="weapon-settings">
{"("}
{str}
{")"}
</span>
</>
))
(weapon_settings)}
</Textfit>
</td>
<td className="combat-technique">{MWA.combatTechnique (e)}</td>
<td className="damage-bonus">
Expand Down

0 comments on commit 3f9fae3

Please sign in to comment.