Skip to content

Commit

Permalink
Merge pull request #10782 from DestinyItemManager/misc-display-fixes
Browse files Browse the repository at this point in the history
Misc early November display fixes
  • Loading branch information
chainrez authored Nov 4, 2024
2 parents 934c3e8 + 8c6d35e commit 9cad1f4
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 19 deletions.
1 change: 1 addition & 0 deletions config/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@
"Milestones": "Milestones & Challenges",
"PaleHeartPathfinder": "Pale Heart Pathfinder",
"PercentPrestige": "{{pct}}% to reset",
"PercentMax": "{{pct}}% to maximum",
"PointsUsed": "1 point used",
"PointsUsed_plural": "{{count}} points used",
"PowerBonusHeader": "+{{powerBonus}} Power Rewards",
Expand Down
2 changes: 1 addition & 1 deletion src/app/armory/Armory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default function Armory({
season: season.seasonNumber,
year: getItemYear(item) ?? '?',
})}
){Boolean(event) && <span> - {D2EventInfo[getEvent(item)!].name}</span>}
){Boolean(event) && ` - ${D2EventInfo[getEvent(item)!].name}`}
</div>
)}
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/app/progress/ReputationRank.m.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@

.factionLevel {
color: var(--theme-text-secondary);
&.max {
color: var(--theme-accent-primary);
}
}

.rankIcon {
Expand Down
1 change: 1 addition & 0 deletions src/app/progress/ReputationRank.m.scss.d.ts

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

35 changes: 18 additions & 17 deletions src/app/progress/ReputationRank.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useDynamicStringReplacer } from 'app/dim-ui/destiny-symbols/RichDestinyText';
import { t } from 'app/i18next-t';
import { t, tl } from 'app/i18next-t';
import { useD2Definitions } from 'app/manifest/selectors';
import { unadvertisedResettableVendors } from 'app/search/d2-known-values';
import { sumBy } from 'app/utils/collections';
import { DestinyProgression } from 'bungie-api-ts/destiny2';
import clsx from 'clsx';
Expand All @@ -26,8 +27,13 @@ export function ReputationRank({

const step = progressionDef.steps[Math.min(progress.level, progressionDef.steps.length - 1)];

const canReset = progressionDef.steps.length === progress.levelCap;
const canReset =
typeof progress.currentResetCount === 'number' ||
unadvertisedResettableVendors.includes(progress.progressionHash);
const resetLabel = canReset ? tl('Progress.PercentPrestige') : tl('Progress.PercentMax');

const rankTotal = sumBy(progressionDef.steps, (cur) => cur.progressTotal);
const rankPercent = Math.floor((progress.currentProgress / rankTotal) * 100);

const streakCheckboxes =
streak && Array<boolean>(5).fill(true).fill(false, streak.currentProgress);
Expand All @@ -53,8 +59,7 @@ export function ReputationRank({
{progressionDef.rankIcon && (
<BungieImage className={styles.rankIcon} src={progressionDef.rankIcon} />
)}
{canReset && `${progress.currentProgress} `}({progress.progressToNextLevel} /{' '}
{progress.nextLevelAt})
{progress.currentProgress} ({progress.progressToNextLevel} / {progress.nextLevelAt})
</div>
{streakCheckboxes && (
<div className={clsx(styles.winStreak, 'objective-row')}>
Expand All @@ -63,19 +68,15 @@ export function ReputationRank({
))}
</div>
)}
{canReset && (
<>
<div className={styles.factionLevel}>
{t('Progress.PercentPrestige', {
pct: Math.round((progress.currentProgress / rankTotal) * 100),
})}
</div>
{Boolean(progress.currentResetCount) && (
<div className={styles.factionLevel}>
{t('Progress.Resets', { count: progress.currentResetCount })}
</div>
)}
</>
<div className={clsx(styles.factionLevel, rankPercent === 100 && styles.max)}>
{t(resetLabel, {
pct: rankPercent,
})}
</div>
{Boolean(progress.currentResetCount) && (
<div className={styles.factionLevel}>
{t('Progress.Resets', { count: progress.currentResetCount })}
</div>
)}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/search/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ function SearchBar(
<AnimatePresence>
{children}

{liveQuery.length > 0 && (saveable || saved) && !isPhonePortrait && (
{liveQuery.length > 0 && valid && (saveable || saved) && !isPhonePortrait && (
<motion.button
variants={searchButtonAnimateVariants}
exit="hidden"
Expand Down
1 change: 1 addition & 0 deletions src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,7 @@
"NoEventChallenges": "You have completed all event challenges",
"NoTrackedTriumph": "You have no tracked triumphs. Track as many as you like in DIM.",
"PaleHeartPathfinder": "Pale Heart Pathfinder",
"PercentMax": "{{pct}}% to maximum",
"PercentPrestige": "{{pct}}% to reset",
"PointsUsed": "1 point used",
"PointsUsed_plural": "{{count}} points used",
Expand Down

0 comments on commit 9cad1f4

Please sign in to comment.