Skip to content

Commit 2f743cf

Browse files
authored
Merge pull request #10331 from robojumper/stat-constraints-missing-max
Fix max stat constraints sometimes being not shown in loadout parameters
2 parents e12e6a8 + 24cc550 commit 2f743cf

File tree

5 files changed

+53
-30
lines changed

5 files changed

+53
-30
lines changed

src/app/loadout/ingame/EditInGameLoadout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default function EditInGameLoadout({
107107
colorIcon,
108108
icon,
109109
index: slot,
110-
characterId: characterId!,
110+
characterId,
111111
items: [],
112112
id: `ingame-${characterId}-${slot}`,
113113
}),

src/app/loadout/loadout-ui/LoadoutParametersDisplay.tsx

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { PressTip } from 'app/dim-ui/PressTip';
44
import { t } from 'app/i18next-t';
55
import ExoticArmorChoice, { getLockedExotic } from 'app/loadout-builder/filter/ExoticArmorChoice';
66
import { useD2Definitions } from 'app/manifest/selectors';
7-
import { AppIcon, equalsIcon, greaterThanIcon, searchIcon } from 'app/shell/icons';
7+
import { AppIcon, equalsIcon, greaterThanIcon, lessThanIcon, searchIcon } from 'app/shell/icons';
88
import clsx from 'clsx';
99
import { includesRuntimeStatMods } from '../stats';
1010
import styles from './LoadoutParametersDisplay.m.scss';
@@ -77,41 +77,63 @@ export default function LoadoutParametersDisplay({ params }: { params: LoadoutPa
7777
}
7878

7979
export function StatConstraintRange({
80-
statConstraint: s,
80+
statConstraint,
8181
className,
8282
}: {
8383
statConstraint: StatConstraint;
8484
className?: string;
8585
}) {
8686
className = clsx(className, styles.constraintRange);
87-
return s.minTier !== undefined && s.minTier !== 0 ? (
88-
<span className={className}>
89-
{(s.maxTier === 10 || s.maxTier === undefined) && s.minTier !== 10 ? (
90-
<>
91-
<AppIcon icon={greaterThanIcon} />
92-
{t('LoadoutBuilder.TierNumber', {
93-
tier: s.minTier,
94-
})}
95-
</>
96-
) : s.maxTier !== undefined && s.maxTier !== s.minTier ? (
97-
`${t('LoadoutBuilder.TierNumber', {
98-
tier: s.minTier,
99-
})}-${s.maxTier}`
100-
) : (
101-
<>
102-
<AppIcon icon={equalsIcon} />
103-
{t('LoadoutBuilder.TierNumber', {
104-
tier: s.minTier,
105-
})}
106-
</>
107-
)}
108-
</span>
109-
) : (
87+
88+
return (
11089
<span className={className}>
111-
<AppIcon icon={greaterThanIcon} />
112-
{t('LoadoutBuilder.TierNumber', {
113-
tier: 0,
114-
})}
90+
<StatConstraintRangeExpression statConstraint={statConstraint} />
11591
</span>
11692
);
11793
}
94+
95+
function StatConstraintRangeExpression({ statConstraint }: { statConstraint: StatConstraint }) {
96+
const min = statConstraint.minTier ?? 0;
97+
const max = statConstraint.maxTier ?? 10;
98+
99+
if (min === max) {
100+
// =Tmin
101+
return (
102+
<>
103+
<AppIcon icon={equalsIcon} />
104+
{t('LoadoutBuilder.TierNumber', {
105+
tier: min,
106+
})}
107+
</>
108+
);
109+
} else if (max === 10) {
110+
// >= Tmin
111+
return (
112+
<>
113+
<AppIcon icon={greaterThanIcon} />
114+
{t('LoadoutBuilder.TierNumber', {
115+
tier: min,
116+
})}
117+
</>
118+
);
119+
} else if (min === 0) {
120+
// <= Tmax
121+
return (
122+
<>
123+
<AppIcon icon={lessThanIcon} />
124+
{t('LoadoutBuilder.TierNumber', {
125+
tier: max,
126+
})}
127+
</>
128+
);
129+
} else {
130+
// Tmin-Tmax
131+
return (
132+
<>
133+
{`${t('LoadoutBuilder.TierNumber', {
134+
tier: min,
135+
})}-${max}`}
136+
</>
137+
);
138+
}
139+
}

src/app/shell/icons/Library.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export const faDiscord = 'fab fa-discord';
9191
export const faGithub = 'fab fa-github';
9292
export const saveIcon = 'fas fa-save';
9393
export const greaterThanIcon = 'fas fa-greater-than-equal';
94+
export const lessThanIcon = 'fas fa-less-than-equal';
9495
export const equalsIcon = 'fas fa-equals';
9596
export const stackIcon = 'fas fa-layer-group';
9697
export const slashIcon = 'fas fa-slash';

src/data/webfonts/fa-solid-900.ttf

132 Bytes
Binary file not shown.
36 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)