From 4735443e2e3f777389459108ae045255e171128f Mon Sep 17 00:00:00 2001 From: Aelita4 Date: Mon, 7 Oct 2024 11:47:09 +0200 Subject: [PATCH] Add planet name and fix transition in resource bar --- src/components/ResourceBar.astro | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/ResourceBar.astro b/src/components/ResourceBar.astro index 43dae4e..d5cf005 100644 --- a/src/components/ResourceBar.astro +++ b/src/components/ResourceBar.astro @@ -11,14 +11,14 @@ const lang = await getLocales(Astro.cookies.get('language')?.value ?? await getH const planetId = new ObjectId(Astro.cookies.get('planetid')?.value ?? ''); -const resources = locationManager.getPlanet(planetId)?.resources; +const planet = locationManager.getPlanet(planetId); -if(!resources) return; +if(!planet) return; -resources.calculateCurrentAvailableResources(); +planet.resources.calculateCurrentAvailableResources(); const resourceArray: Resource[] = []; -for(const key of resources.resources) { +for(const key of planet.resources.resources) { resourceArray.push(key); } --- @@ -26,6 +26,9 @@ for(const key of resources.resources) {
+
+ {planet.name} +
{resourceArray.map(res =>