From ef50c8fed2e6cfe0670b6aa6d21155cdb66b1ca6 Mon Sep 17 00:00:00 2001 From: Aelita4 Date: Mon, 12 Feb 2024 19:26:03 +0100 Subject: [PATCH] Rework resource bar to use new resource manager --- src/components/ResourceBar.astro | 36 ++++++------------- src/lib/utils/resourceManager.ts | 61 ++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 25 deletions(-) diff --git a/src/components/ResourceBar.astro b/src/components/ResourceBar.astro index 384b8fd..64421b9 100644 --- a/src/components/ResourceBar.astro +++ b/src/components/ResourceBar.astro @@ -13,10 +13,7 @@ const resources = await getUserResources(new ObjectId(Astro.cookies.get('userid' const resourceArray = []; for(const key in resources) { - resourceArray.push({ - name: key, - amount: resources[key as never] - }); + resourceArray.push(resources[key as never]); } ---
@@ -28,6 +25,7 @@ for(const key in resources) {
x.name === res.name)?.type ?? "solid"} data-res-amount={res.amount} + data-res-mining-rate={res.perHourMiningRate} style={(resourceTypes.find(x => x.name === res.name)?.type ?? "solid") === "solid" ? "" : "display: none;"} >
@@ -35,11 +33,11 @@ for(const key in resources) {
{resourceLang[`Label_${res.name}`]}
-
{res.amount}
+
{Math.floor(res.amount).toString()}
-
{resBarLang['Label_avaliable']} - {res.amount.toString()}
-
{resBarLang['Label_production']} - {'69'}
+
{resBarLang['Label_avaliable']} - {Math.floor(res.amount).toString()}
+
{resBarLang['Label_production']} - {res.perHourMiningRate.toString()}
{resBarLang['Label_capacity']} - {'21372137'}
@@ -132,36 +130,24 @@ for(const key in resources) {