diff --git a/ui/core/components/individual_sim_ui/gem_summary.ts b/ui/core/components/individual_sim_ui/gem_summary.tsx similarity index 76% rename from ui/core/components/individual_sim_ui/gem_summary.ts rename to ui/core/components/individual_sim_ui/gem_summary.tsx index e0a971e246..0beddab44a 100644 --- a/ui/core/components/individual_sim_ui/gem_summary.ts +++ b/ui/core/components/individual_sim_ui/gem_summary.tsx @@ -1,9 +1,10 @@ -import { Component } from '../../components/component'; import { setItemQualityCssClass } from '../../css_utils'; import { Player } from '../../player'; import { UIGem as Gem } from '../../proto/ui.js'; import { ActionId } from '../../proto_utils/action_id'; import { SimUI } from '../../sim_ui'; +import { TypedEvent } from '../../typed_event'; +import { Component } from '../component'; import { ContentBlock } from '../content_block'; interface GemSummaryData { @@ -26,6 +27,20 @@ export class GemSummary extends Component { header: { title: 'Gem Summary' }, }); player.gearChangeEmitter.on(() => this.updateTable()); + + const headerElement = this.container.headerElement; + if (headerElement) { + const unequipButton = document.createElement('button'); + unequipButton.innerHTML = ` Unequip All Gems`; + unequipButton.classList.add('btn', 'btn-sm', 'btn-link', 'gem-reset-button'); + unequipButton.id = 'unequip-all-gems-btn'; + unequipButton.onclick = () => this.unequipAllGems(); + headerElement.appendChild(unequipButton); + } + } + + private unequipAllGems() { + this.player.setGear(TypedEvent.nextEventID(), this.player.getGear().withoutGems()); } private updateTable() { diff --git a/ui/scss/shared/_gems.scss b/ui/scss/shared/_gems.scss index 2e9c50d880..95bf70fae0 100644 --- a/ui/scss/shared/_gems.scss +++ b/ui/scss/shared/_gems.scss @@ -4,7 +4,7 @@ position: relative; width: var(--gem-width); height: var(--gem-width); - + &:not(:last-child) { margin-right: 1px; } @@ -30,3 +30,11 @@ height: 100%; inset: 0; } + +.gem-reset-button { + margin-left: auto; + display: flex; + align-items: center; + padding: 0; + color: $link-danger-color; +}