Skip to content

Commit

Permalink
Merge pull request #19 from edisontim/ui-fixes
Browse files Browse the repository at this point in the history
UI fixes
  • Loading branch information
bob0005 authored Sep 12, 2024
2 parents 9456212 + 60dacbc commit 9c9c104
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
7 changes: 5 additions & 2 deletions ui/src/app/components/encounters/EncounterTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,17 @@ const EncounterTable = () => {
const tier = gameData.ITEMS[
encounter.tier
].replace(/\s+/g, "");

return (
<div className="flex items-center">
{` T${gameData.ITEM_TIERS[tier]}`}

{gameData.ITEM_TYPES[encounter.tier]}
<LootIcon
type={gameData.ITEM_SLOTS[tier]}
size={"w-4"}
className="pl-0.5 mt-0.5 self-center h-4 fill-current text-terminal-yellow"
className="p-0.5 mt-0.5 self-center h-4 fill-current text-terminal-yellow"
/>
{` T${gameData.ITEM_TIERS[tier]} `}
</div>
);
})()
Expand Down
30 changes: 11 additions & 19 deletions ui/src/app/components/encounters/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ export function getPurchaseItemsObjects(
purchaseItems: ItemPurchase[],
gameData: GameData
): ItemPurchaseObject[] {
const purchaseItemsObjects = purchaseItems
.filter((item) => item.equip)
.map((item) => {
const itemName = gameData.ITEMS[Number(item.item)];
return getItemData(itemName);
});
const purchaseItemsObjects = purchaseItems.map((item) => {
const itemName = gameData.ITEMS[Number(item.item)];
const itemData = getItemData(itemName);
return {
...itemData,
equip: item.equip === "1",
};
});

return purchaseItemsObjects;
}
Expand All @@ -97,9 +99,9 @@ export function getItems(
})) || [];

let updatedItems: Item[] = equippedItems.map((item: any) => {
const purchaseItem = purchaseItemsObjects.find(
(purchaseItem) => purchaseItem.slot === item.slot
);
const purchaseItem = purchaseItemsObjects
.filter((item) => item.equip)
.find((purchaseItem) => purchaseItem.slot === item.slot);
if (purchaseItem) {
return {
...purchaseItem,
Expand All @@ -123,8 +125,6 @@ export function getItems(
});

return updatedItems;
// }, [data.itemsByAdventurerQuery?.items, purchaseItemsObjects]);
// return items;
}

export function getPaths(
Expand All @@ -135,11 +135,6 @@ export function getPaths(
data: QueryData,
hasBeast: boolean
) {
// const purchaseItems = useUIStore((state) => state.purchaseItems);
// const hasBeast = useAdventurerStore((state) => state.computed.hasBeast);
// const items = getItems(purchaseItems, data, gameData);

// const outcomesWithPath = useMemo(() => {
if (!updatedAdventurer || !items) return [];
const decisionTree = getDecisionTree(
updatedAdventurer!,
Expand All @@ -152,7 +147,4 @@ export function getPaths(
(a, b) =>
b[b.length - 1].adventurer.health! - a[a.length - 1].adventurer.health!
);
// }, [updatedAdventurer?.xp, adventurerEntropy, items]);

// return outcomesWithPath;
}
1 change: 1 addition & 0 deletions ui/src/app/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export interface ItemPurchaseObject {
tier: number;
type: string;
slot: string;
equip: boolean;
}

export interface UpgradeStats {
Expand Down

0 comments on commit 9c9c104

Please sign in to comment.