Skip to content

Commit

Permalink
Merge pull request #10907 from DestinyItemManager/character-stats
Browse files Browse the repository at this point in the history
Work on refactoring character stats
  • Loading branch information
bhollis authored Jan 27, 2025
2 parents c122753 + 621f4ae commit 7795ac5
Show file tree
Hide file tree
Showing 12 changed files with 259 additions and 198 deletions.
4 changes: 3 additions & 1 deletion src/app/inventory-page/PhoneStores.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ function StoresInventory({
<>
{((!store.isVault && selectedCategoryId === 'Armor') ||
(store.isVault && selectedCategoryId === 'Inventory')) && (
<StoreStats store={store} style={{ paddingBottom: 8 }} />
<div className="store-cell" style={{ paddingBottom: 8 }}>
<StoreStats store={store} />
</div>
)}
{showPostmaster && buckets.byCategory.Postmaster.map(renderBucket)}
{buckets.byCategory[selectedCategoryId].map(renderBucket)}
Expand Down
4 changes: 2 additions & 2 deletions src/app/item-feed/Highlights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from 'app/utils/socket-utils';
import clsx from 'clsx';
import { BucketHashes, PlugCategoryHashes } from 'data/d2/generated-enums';
import '../store-stats/CharacterStats.scss';
import '../store-stats/CharacterStats.m.scss';
import styles from './Highlights.m.scss';

/**
Expand Down Expand Up @@ -74,7 +74,7 @@ export default function Highlights({ item }: { item: DimItem }) {
return (
<>
{item.bucket.hash !== BucketHashes.ClassArmor && (
<div className={clsx(styles.stats, 'stat-bars', 'destiny2')}>
<div className={clsx(styles.stats, 'stat-bars')}>
<div className={clsx('stat-row', styles.armorStats)}>
{item.stats?.filter((s) => s.statHash > 0).map(renderStat)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/loadout/loadout-edit/LoadoutEditBucket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function ArmorExtras({
return (
<>
{equippedItems.length === 5 && (
<div className="stat-bars destiny2">
<div className="stat-bars">
<LoadoutCharacterStats
loadout={loadout}
subclass={subclass}
Expand Down
2 changes: 1 addition & 1 deletion src/app/loadout/loadout-ui/LoadoutItemCategorySection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default function LoadoutItemCategorySection({
{items && isArmor && (
<>
{equippedItems.length === 5 && (
<div className="stat-bars destiny2">
<div className="stat-bars">
<LoadoutCharacterStats
loadout={loadout}
subclass={subclass}
Expand Down
134 changes: 134 additions & 0 deletions src/app/store-stats/CharacterStats.m.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
@use '../variables' as *;

@layer base {
:global(.stat) {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
margin-right: 2px;
line-height: 16px;
white-space: nowrap;
&:last-child {
margin-right: 0;
}
img {
height: 14px;
width: 14px;
margin-right: 2px;
opacity: 1;
}
}

/* INT/DIS/STR bars */
:global(.stat-bars) {
width: 100%;
max-width: 230px;
display: flex;
justify-content: space-around;
margin-top: 8px;
opacity: 1;
flex-direction: column;

@include phone-portrait {
margin-left: auto;
margin-right: auto;
align-items: center;
}

> div {
flex: 1;
display: flex;
flex-direction: row;
}

:global(.stat) {
flex: 0;
font-size: 11px;
color: var(--theme-header-characters-txt);
&.boostedValue {
color: $stat-modded;
font-weight: bold;
text-shadow: rgba(0, 0, 0, 0.5) 0 0 2px;
}
:global(.phone-portrait) & {
font-size: 12px;
}
}
}

// D2 stats row. Used here and in the item feed.
:global(.stat-row) {
display: flex;
flex-direction: row;
place-items: center left;

@include phone-portrait {
width: 100%;
justify-content: center;
}

&:nth-child(n + 2) {
justify-content: space-between;
}
}
}

.powerFormula {
margin-bottom: 3px;
img {
opacity: 0.6;
height: 17px;
width: 17px;
}
img[src^='data'] {
filter: invert(1);
}
> div:nth-child(2) {
display: flex;
flex-direction: row;
&::before,
&::after {
font-size: 13px;
color: var(--theme-header-characters-txt);
margin-left: 4px;
margin-right: 4px;
text-decoration: none !important;
}
&::before {
content: '=';
}
&::after {
content: '+';
}
}
}

.powerStat {
font-size: 125%;
}

.tier {
font-weight: bold;
}

.tooltipFootnote {
opacity: 0.6;
width: 80%;
margin: 10px 0 0 auto;
text-align: right;
}

.richTooltipWrapper {
margin: 8px 0 0 0;
}

.asterisk {
vertical-align: top;
margin-left: 2px;
}

.dropLevel {
display: flex;
justify-content: space-between;
}
14 changes: 14 additions & 0 deletions src/app/store-stats/CharacterStats.m.scss.d.ts

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

146 changes: 0 additions & 146 deletions src/app/store-stats/CharacterStats.scss

This file was deleted.

Loading

0 comments on commit 7795ac5

Please sign in to comment.