Skip to content

Commit

Permalink
Replaced item.isEditable with a dedicated prop on ItemUseButton compo…
Browse files Browse the repository at this point in the history
…nent. (#177)
  • Loading branch information
kgar authored Dec 16, 2023
1 parent 5ceda2a commit 59c745d
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/components/item-list/ItemUseButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
export let item: any;
export let imgUrlOverride: string | undefined = undefined;
export let disabled: boolean = false;
const showRoll = getContext<Readable<boolean>>(
CONSTANTS.CONTEXT_GRID_CELL_HOVER,
Expand All @@ -18,9 +19,9 @@
class="item-image"
class:item-use-button-has-focus={buttonIsFocused}
style="background-image: url('{imgUrlOverride ?? item.img}')"
class:show-roll={item.isEditable && $showRoll}
class:show-roll={!disabled && $showRoll}
>
{#if item.isEditable}
{#if !disabled}
<button
type="button"
class="item-use-button icon-button"
Expand Down
2 changes: 1 addition & 1 deletion src/components/spellbook/SpellbookList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
cssClass={FoundryAdapter.getSpellRowClasses(spell)}
>
<ItemTableCell primary={true}>
<ItemUseButton item={spell} imgUrlOverride={spellImgUrl} />
<ItemUseButton disabled={!$context.editable} item={spell} imgUrlOverride={spellImgUrl} />
<ItemName
on:toggle={() => toggleSummary($context.actor)}
item={spell}
Expand Down
2 changes: 1 addition & 1 deletion src/sheets/actor/tabs/ActorActionsTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
let:toggleSummary
>
<ItemTableCell primary={true}>
<ItemUseButton item={actionItem.item} />
<ItemUseButton disabled={!$context.editable} item={actionItem.item} />
<ItemName
item={actionItem.item}
on:toggle={() => toggleSummary($context.actor)}
Expand Down
2 changes: 1 addition & 1 deletion src/sheets/character/parts/FavoriteFeaturesList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}}
>
<ItemTableCell primary={true}>
<ItemUseButton {item} />
<ItemUseButton disabled={!$context.editable} {item} />
<ItemName
on:toggle={() => toggleSummary($context.actor)}
hasChildren={false}
Expand Down
2 changes: 1 addition & 1 deletion src/sheets/character/parts/FavoriteSpellsList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
cssClass={FoundryAdapter.getSpellRowClasses(spell)}
>
<ItemTableCell primary={true}>
<ItemUseButton item={spell} imgUrlOverride={spellImgUrl} />
<ItemUseButton disabled={!$context.editable} item={spell} imgUrlOverride={spellImgUrl} />
<ItemName
on:toggle={() => toggleSummary($context.actor)}
item={spell}
Expand Down
2 changes: 1 addition & 1 deletion src/sheets/character/parts/InventoryList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
cssClass={getInventoryRowClasses(item)}
>
<ItemTableCell primary={true} title={item.name}>
<ItemUseButton {item} />
<ItemUseButton disabled={!$context.editable} {item} />
<ItemName
on:toggle={() => toggleSummary($context.actor)}
cssClass="extra-small-gap"
Expand Down
2 changes: 1 addition & 1 deletion src/sheets/character/tabs/CharacterFeaturesTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
}}
>
<ItemTableCell primary={true}>
<ItemUseButton {item} />
<ItemUseButton disabled={!$context.editable} {item} />
<ItemName
on:toggle={() => toggleSummary($context.actor)}
hasChildren={false}
Expand Down
2 changes: 1 addition & 1 deletion src/sheets/npc/tabs/NpcAbilitiesTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
cssClass={FoundryAdapter.getInventoryRowClasses(item, ctx)}
>
<ItemTableCell primary={true}>
<ItemUseButton {item} />
<ItemUseButton disabled={!$context.editable} {item} />
<ItemName
on:toggle={() => toggleSummary($context.actor)}
cssClass="extra-small-gap"
Expand Down
2 changes: 1 addition & 1 deletion src/sheets/vehicle/tabs/VehicleAttributesTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
cssClass={FoundryAdapter.getInventoryRowClasses(item, ctx)}
>
<ItemTableCell primary={true}>
<ItemUseButton {item} />
<ItemUseButton disabled={!$context.editable} {item} />
<ItemName
on:toggle={() => toggleSummary($context.actor)}
cssClass="extra-small-gap"
Expand Down
2 changes: 1 addition & 1 deletion src/sheets/vehicle/tabs/VehicleCargoAndCrewTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
disabled={!$context.editable}
/>
{:else}
<ItemUseButton {item} />
<ItemUseButton disabled={!$context.editable} {item} />
<ItemName
on:toggle={() => toggleSummary($context.actor)}
cssClass="extra-small-gap"
Expand Down

0 comments on commit 59c745d

Please sign in to comment.