Skip to content
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

Show Item Loadout Count in Loadout Optimizer #10383

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@use 'app/item-triage/ItemTriage.m.scss' as ItemTriage;

.loadoutsBar {
display: flex;
align-items: center;
}

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

23 changes: 23 additions & 0 deletions src/app/loadout-builder/generated-sets/ExistingLoadoutsForItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { DimItem } from 'app/inventory/item-types';
import { loadoutsByItemSelector } from 'app/loadout-drawer/selectors';
import helmet from 'destiny-icons/armor_types/helmet.svg';
import { useSelector } from 'react-redux';

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;

if (!loadoutsForItem || loadoutCount === 0) {
return <div className={styles.loadoutsBar} />;
}

return (
<div className={styles.loadoutsBar}>
<img src={helmet} className={styles.inLoadout} />
{loadoutCount}
</div>
);
}
2 changes: 2 additions & 0 deletions src/app/loadout-builder/generated-sets/GeneratedSetItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Dispatch } from 'react';
import { DimItem, PluggableInventoryItemDefinition } from '../../inventory/item-types';
import LoadoutBuilderItem from '../LoadoutBuilderItem';
import { LoadoutBuilderAction } from '../loadout-builder-reducer';
import ExistingLoadoutsForItem from './ExistingLoadoutsForItem';
import styles from './GeneratedSetItem.m.scss';

/**
Expand Down Expand Up @@ -116,6 +117,7 @@ export default function GeneratedSetItem({
<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
Loading