Skip to content

Commit

Permalink
added missing dependency for metrics data
Browse files Browse the repository at this point in the history
  • Loading branch information
Privilege Mendes committed Oct 25, 2023
1 parent a2a8177 commit 2b5496c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions frontend/src/pages/shop/items-shop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,20 @@ export const ItemsShop: FC = () => {
];
}
filtered = items.filter((entry) => !toRemove.includes(entry));
};
}
return filtered;
}, [items]);


const metricsData = useMemo(()=>{
const metricsData = useMemo(() => {
if (metrics) {
let itemAverage = 0;
let itemMinimum = 0;

if (filteredItems.length != 0) {
itemMinimum = findMinimumValue(filteredItems.map((x) => uISTToIST(Number(x.sell.price))));
itemAverage = findAverageValue(filteredItems.map((x) => uISTToIST(Number(x.sell.price))));
}

return [
metrics.amountSold,
metrics.collectionSize,
Expand All @@ -56,7 +55,7 @@ export const ItemsShop: FC = () => {
];
}
return [];
}, [filteredItems]);
}, [metrics, filteredItems]);

if (!filteredItems) return <></>;
const assetsCount = filteredItems.length;
Expand All @@ -66,9 +65,9 @@ export const ItemsShop: FC = () => {
<AssetHeaderContainer>
<AssetHeader>{metrics ? <MarketplaceMetrics data={metricsData} asset={METRICS_ITEM} /> : <></>}</AssetHeader>
<AssetItemFilters section={SECTION.SHOP} />
<AssetFilterCount customColor={color.darkGrey}>Market: {text.param.amountOfItems(assetsCount)}</AssetFilterCount>
<HorizontalDivider />
</AssetHeaderContainer>
<AssetFilterCount customColor={color.darkGrey}>Market: {text.param.amountOfItems(assetsCount)}</AssetFilterCount>
<HorizontalDivider />
{selectedId && item && <ItemDetailsMarket itemInMarket={item} selectItemInMarket={(id: string) => setSelectedId(id)} />}
{filteredItems.length > 0 ? (
<ItemCardsMarket itemsInMarket={filteredItems} isLoading={fetched} selectItemInMarketId={(id: string) => setSelectedId(id)} />
Expand Down

0 comments on commit 2b5496c

Please sign in to comment.