-
-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show the loadout icon and count beneath energy bar
- Loading branch information
Showing
4 changed files
with
34 additions
and
45 deletions.
There are no files selected for viewing
25 changes: 2 additions & 23 deletions
25
src/app/loadout-builder/generated-sets/ExistingLoadoutsForItem.m.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 |
---|---|---|
@@ -1,27 +1,6 @@ | ||
.inGameLoadoutList { | ||
margin: 0; | ||
padding: 0; | ||
list-style-type: none; | ||
display: flex; | ||
justify-content: start; | ||
gap: 3px; | ||
margin-right: 3px; | ||
|
||
li { | ||
margin: 0; | ||
} | ||
} | ||
@use 'app/item-triage/ItemTriage.m.scss' as ItemTriage; | ||
|
||
.loadoutsBar { | ||
display: flex; | ||
justify-content: start; | ||
width: 100%; | ||
line-height: 10px; | ||
padding-bottom: 4px; | ||
height: 10px; | ||
} | ||
|
||
.loadoutCount { | ||
text-align: right; | ||
flex-grow: 1; | ||
align-items: center; | ||
} |
28 changes: 26 additions & 2 deletions
28
src/app/loadout-builder/generated-sets/ExistingLoadoutsForItem.m.scss.d.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
24 changes: 5 additions & 19 deletions
24
src/app/loadout-builder/generated-sets/ExistingLoadoutsForItem.tsx
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 |
---|---|---|
@@ -1,37 +1,23 @@ | ||
import { PressTip } from 'app/dim-ui/PressTip'; | ||
import { DimItem } from 'app/inventory/item-types'; | ||
import { loadoutsByItemSelector } from 'app/loadout-drawer/selectors'; | ||
import InGameLoadoutIcon from 'app/loadout/ingame/InGameLoadoutIcon'; | ||
import { partition } from 'lodash'; | ||
import helmet from 'destiny-icons/armor_types/helmet.svg'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
import { InGameLoadout } from 'app/loadout-drawer/loadout-types'; | ||
import styles from './ExistingLoadoutsForItem.m.scss'; | ||
|
||
export default function ExistingLoadoutsForItem({ item }: { item: DimItem }) { | ||
const loadoutsByItem = useSelector(loadoutsByItemSelector); | ||
const loadoutsForItem = loadoutsByItem[item.id]; | ||
const loadoutCount = loadoutsForItem?.length || 0; | ||
const [inGameLoadouts, dimLoadouts] = partition( | ||
loadoutsForItem, | ||
({ loadout }) => 'index' in loadout, | ||
); | ||
|
||
if (!loadoutsForItem || loadoutCount === 0) { | ||
return <div className={styles.loadoutsBar} />; | ||
} | ||
|
||
return ( | ||
<PressTip tooltip={null} className={styles.loadoutsBar}> | ||
<ul className={styles.inGameLoadoutList}> | ||
{inGameLoadouts.map(({ loadout }) => ( | ||
<li key={loadout.id}> | ||
<InGameLoadoutIcon loadout={loadout as InGameLoadout} size={10} /> | ||
</li> | ||
))} | ||
</ul> | ||
{Boolean(inGameLoadouts.length) && Boolean(dimLoadouts.length) && '+'} | ||
<span className={styles.loadoutCount}>{loadoutCount}</span> | ||
</PressTip> | ||
<div className={styles.loadoutsBar}> | ||
<img src={helmet} className={styles.inLoadout} /> | ||
{loadoutCount} | ||
</div> | ||
); | ||
} |
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