New source found from dndbeyond.com
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useContext, useState } from "react";
|
||||
import React, { useCallback, useState } from "react";
|
||||
|
||||
import {
|
||||
CharacterTheme,
|
||||
@@ -7,10 +7,10 @@ import {
|
||||
} from "@dndbeyond/character-rules-engine/es";
|
||||
|
||||
import { useSidebar } from "~/contexts/Sidebar";
|
||||
import a11yStyles from "~/styles/accessibility.module.css";
|
||||
import { PaneComponentEnum } from "~/subApps/sheet/components/Sidebar/types";
|
||||
|
||||
import { ThemeButton } from "../../../Shared/components/common/Button";
|
||||
import { InventoryManagerContext } from "../../../Shared/managers/InventoryManagerContext";
|
||||
import { PaneIdentifierUtils } from "../../../Shared/utils";
|
||||
import InventoryItem from "../../components/InventoryItem";
|
||||
import { InventoryTableHeader } from "../../components/InventoryTableHeader";
|
||||
@@ -42,8 +42,6 @@ const InventoryActions: React.FC<InventoryActionsProps> = ({
|
||||
onShowContentsClick,
|
||||
showContents,
|
||||
}) => {
|
||||
const { inventoryManager } = useContext(InventoryManagerContext);
|
||||
|
||||
if (isReadonly) {
|
||||
return null;
|
||||
}
|
||||
@@ -57,24 +55,20 @@ const InventoryActions: React.FC<InventoryActionsProps> = ({
|
||||
|
||||
return (
|
||||
<div className={classNames.join(" ")}>
|
||||
{inventoryManager.canAddToContainer(container.container) ? (
|
||||
<span
|
||||
role="button"
|
||||
className="ct-inventory__action"
|
||||
onClick={(evt) => onContainerClick(evt, container, true)}
|
||||
onKeyDown={(evt) => {
|
||||
if (evt.key === "Enter") {
|
||||
onContainerClick(evt, container, true);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{container.isCharacterContainer()
|
||||
? `+ Add ${containerName}`
|
||||
: `+ Add items to your ${containerName}`}
|
||||
</span>
|
||||
) : (
|
||||
<span />
|
||||
)}
|
||||
<span
|
||||
role="button"
|
||||
className="ct-inventory__action"
|
||||
onClick={(evt) => onContainerClick(evt, container, true)}
|
||||
onKeyDown={(evt) => {
|
||||
if (evt.key === "Enter") {
|
||||
onContainerClick(evt, container, true);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{container.isCharacterContainer()
|
||||
? `+ Add ${containerName}`
|
||||
: `+ Add items to your ${containerName}`}
|
||||
</span>
|
||||
{inventory.length > 0 && (
|
||||
<span
|
||||
role="button"
|
||||
@@ -192,7 +186,7 @@ const Inventory: React.FC<Props> = ({
|
||||
|
||||
return (
|
||||
<div className="ct-inventory">
|
||||
{/*<h2 style={visuallyHidden}>Inventory</h2>*/}
|
||||
<h2 className={a11yStyles.screenreaderOnly}>Inventory</h2>
|
||||
{showTableHeader && <InventoryTableHeader showNotes={showNotes} />}
|
||||
<div className="ct-inventory__items">
|
||||
{isEmpty ? (
|
||||
@@ -205,7 +199,7 @@ const Inventory: React.FC<Props> = ({
|
||||
onContainerClick={handleContainerShow}
|
||||
/>
|
||||
) : (
|
||||
<React.Fragment>
|
||||
<>
|
||||
{showContents &&
|
||||
inventory.map((item) => (
|
||||
<InventoryItem
|
||||
@@ -232,7 +226,7 @@ const Inventory: React.FC<Props> = ({
|
||||
onShowContentsClick={setShowContents}
|
||||
showContents={showContents}
|
||||
/>
|
||||
</React.Fragment>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user