Skip to content

Commit

Permalink
Show the loadout icon and count beneath energy bar
Browse files Browse the repository at this point in the history
  • Loading branch information
bjacobel committed May 9, 2024
1 parent 678698b commit 03a3efb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 45 deletions.
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;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 5 additions & 19 deletions src/app/loadout-builder/generated-sets/ExistingLoadoutsForItem.tsx
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>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ export default function GeneratedSetItem({

return (
<div>
<ExistingLoadoutsForItem item={item} />
<div className={styles.item}>
<div className={styles.swapButtonContainer}>
<LoadoutBuilderItem item={item} onShiftClick={() => pinItem(item)} />
<EnergyIncrementsWithPresstip wrapperClass={styles.energyMeter} energy={energy} />
<ExistingLoadoutsForItem item={item} />
{itemOptions.length > 1 ? (
<button
type="button"
Expand Down

0 comments on commit 03a3efb

Please sign in to comment.