-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gem summary UI #4061
Merged
Merged
Gem summary UI #4061
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
831e4d9
Added equipped gem summary feature based on commmunity requests.
NerdEgghead b949606
Merge branch 'master' of https://github.com/wowsims/wotlk
NerdEgghead 70dbd8b
Fixed Typescript errors.
NerdEgghead 0da78e4
Moved gem summary to below paper doll on gear tab.
NerdEgghead eaf36fe
update gem summary UI + gear tab mobile UI improvements
kayla-glick e0bcdc8
update sim title dropdown padding
kayla-glick 22cd3fe
merge conflicts
kayla-glick 99066d9
tab formatting
kayla-glick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { SimUI } from "../../sim_ui"; | ||
import { Component } from "../../components/component"; | ||
import { Player } from "../../player"; | ||
import { setItemQualityCssClass } from "../../css_utils"; | ||
import { ActionId } from "../../proto_utils/action_id"; | ||
import { UIGem as Gem } from '../../proto/ui.js'; | ||
import { ContentBlock } from "../content_block"; | ||
|
||
interface GemSummaryData { | ||
gem: Gem | ||
count: number | ||
} | ||
|
||
export class GemSummary extends Component { | ||
private readonly simUI: SimUI; | ||
private readonly player: Player<any>; | ||
|
||
private readonly container: ContentBlock; | ||
|
||
constructor(parent: HTMLElement, simUI: SimUI, player: Player<any>) { | ||
super(parent, 'gem-summary-root'); | ||
this.simUI = simUI; | ||
this.player = player; | ||
|
||
this.container = new ContentBlock(this.rootElem, 'gem-summary-container', { | ||
header: {title: 'Gem Summary'} | ||
}); | ||
player.gearChangeEmitter.on(() => this.updateTable()); | ||
} | ||
|
||
private updateTable() { | ||
this.container.bodyElement.innerHTML = ``; | ||
const fullGemList = this.player.getGear().getAllGems(this.player.isBlacksmithing()); | ||
const gemCounts: Record<string, GemSummaryData> = {}; | ||
|
||
for (const gem of fullGemList) { | ||
if (gemCounts[gem.name]) { | ||
gemCounts[gem.name].count += 1 | ||
} else { | ||
gemCounts[gem.name] = { | ||
gem: gem, | ||
count: 1, | ||
} | ||
} | ||
} | ||
|
||
for (const gemName of Object.keys(gemCounts)) { | ||
const gemData = gemCounts[gemName] | ||
const row = document.createElement('div'); | ||
row.classList.add('d-flex', 'align-items-center', 'justify-content-between') | ||
row.innerHTML = ` | ||
<a class="gem-summary-link"> | ||
<img class="gem-icon"/> | ||
<div>${gemName}</div> | ||
</a> | ||
<div>${gemData.count.toFixed(0)}</div> | ||
`; | ||
|
||
const gemLinkElem = row.querySelector('.gem-summary-link') as HTMLAnchorElement; | ||
const gemIconElem = row.querySelector('.gem-icon') as HTMLImageElement; | ||
|
||
setItemQualityCssClass(gemLinkElem, gemData.gem.quality); | ||
|
||
ActionId.fromItemId(gemData.gem.id).fill().then(filledId => { | ||
gemIconElem.src = filledId.iconUrl; | ||
filledId.setWowheadHref(gemLinkElem); | ||
}); | ||
|
||
this.container.bodyElement.appendChild(row); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#gear-tab { | ||
.tab-pane-content-container { | ||
.gear-tab-left { | ||
flex-direction: column; | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
ui/scss/core/components/individual_sim_ui/_gem_summary.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.gem-summary-root { | ||
width: 50%; | ||
|
||
.gem-summary-link { | ||
--gem-width: 2rem; | ||
|
||
display: flex; | ||
align-items: center; | ||
|
||
.gem-icon { | ||
position: unset; | ||
margin-right: map-get($spacers, 1); | ||
border-radius: 0; | ||
border: $border-default; | ||
} | ||
|
||
&:not(:last-child) { | ||
margin-bottom: map-get($spacers, 1); | ||
} | ||
} | ||
} | ||
|
||
@include media-breakpoint-down(xl) { | ||
.gem-summary-root { | ||
margin-bottom: var(--container-padding); | ||
} | ||
} | ||
|
||
@include media-breakpoint-down(md) { | ||
.gem-summary-root { | ||
width: 100%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nested
item-picker-root
class was causing rendering issues particularly on mobile