Skip to content

Commit

Permalink
refactor: simplify (#2164)
Browse files Browse the repository at this point in the history
  • Loading branch information
NigelBreslaw authored Jul 26, 2024
1 parent c3041fa commit 6ecd82d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions native/app/store/InventoryLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ function buildUIData(get: AccountSliceGetter, inventoryPage: InventoryPageEnums)

for (const bucket of sectionBuckets as BucketHash[]) {
const bucketItems = characterData.items.get(bucket);
const equippedItem = bucketItems?.equipped;
const inventoryItems = bucketItems?.inventory ?? [];

dataArray.push(getSeparator(bucket, characterId));

Expand All @@ -195,23 +197,23 @@ function buildUIData(get: AccountSliceGetter, inventoryPage: InventoryPageEnums)
dataArray.push({
id: `${bucket}_engrams_section`,
type: UISection.Engrams,
inventory: bucketItems ? bucketItems.inventory : [],
inventory: inventoryItems,
});
break;

case SectionBuckets.LostItem:
dataArray.push({
id: `${bucket}_lost_items_section`,
type: UISection.LostItems,
inventory: bucketItems ? bucketItems.inventory : [],
inventory: inventoryItems,
});
break;

case SectionBuckets.Artifact:
dataArray.push({
id: `${bucket}_artifact_section`,
type: UISection.Artifact,
equipped: bucketItems?.equipped,
equipped: equippedItem,
});
break;

Expand All @@ -220,8 +222,8 @@ function buildUIData(get: AccountSliceGetter, inventoryPage: InventoryPageEnums)
dataArray.push({
id: `${bucket}_equip_section`,
type: UISection.CharacterEquipment,
equipped: bucketItems.equipped,
inventory: sortInventoryArray(get, bucketItems.inventory, bucket),
equipped: equippedItem,
inventory: sortInventoryArray(get, inventoryItems, bucket),
});
}
break;
Expand Down

0 comments on commit 6ecd82d

Please sign in to comment.