Structure needs
diff --git a/client/src/components/worldmap/hyperstructures/HyperStructureCaravans/HyperStructureCaravan.tsx b/client/src/components/worldmap/hyperstructures/HyperStructureCaravans/HyperStructureCaravan.tsx
index fa405ab07d..a36fd936ba 100644
--- a/client/src/components/worldmap/hyperstructures/HyperStructureCaravans/HyperStructureCaravan.tsx
+++ b/client/src/components/worldmap/hyperstructures/HyperStructureCaravans/HyperStructureCaravan.tsx
@@ -16,7 +16,8 @@ import { getComponentValue } from "@latticexyz/recs";
import { useDojo } from "../../../../DojoContext";
import Button from "../../../../elements/Button";
import { Resource } from "../../../../types";
-import { HyperStructureInterface } from "../../../../hooks/helpers/useHyperstructure";
+import { HyperStructureInterface, useHyperstructure } from "../../../../hooks/helpers/useHyperstructure";
+import useUIStore from "../../../../hooks/store/useUIStore";
type CaravanProps = {
caravan: CaravanInterface;
@@ -28,6 +29,9 @@ type CaravanProps = {
export const HyperStructureCaravan = ({ caravan, hyperstructureData, ...props }: CaravanProps) => {
const { isMine, owner, arrivalTime, capacity } = caravan;
const nextBlockTimestamp = useBlockchainStore((state) => state.nextBlockTimestamp);
+ const hyperstructures = useUIStore((state) => state.hyperstructures);
+ const setHyperstructures = useUIStore((state) => state.setHyperstructures);
+ const { getHyperstructure } = useHyperstructure();
const [isLoading, setIsLoading] = useState(false);
const hasArrived = arrivalTime !== undefined && nextBlockTimestamp !== undefined && arrivalTime <= nextBlockTimestamp;
@@ -79,9 +83,16 @@ export const HyperStructureCaravan = ({ caravan, hyperstructureData, ...props }:
});
};
+ const updateHyperStructure = () => {
+ const newHyperstructure = getHyperstructure(hyperstructureData.orderId, hyperstructureData.uiPosition);
+ hyperstructures[hyperstructureData.orderId - 1] = newHyperstructure;
+ setHyperstructures([...hyperstructures]);
+ };
+
const onClick = async () => {
setIsLoading(true);
await transferAndReturn();
+ updateHyperStructure();
setIsLoading(false);
};
diff --git a/client/src/components/worldmap/hyperstructures/HyperstructuresListComponent.tsx b/client/src/components/worldmap/hyperstructures/HyperstructuresListComponent.tsx
index 9715b87d2b..46cc074655 100644
--- a/client/src/components/worldmap/hyperstructures/HyperstructuresListComponent.tsx
+++ b/client/src/components/worldmap/hyperstructures/HyperstructuresListComponent.tsx
@@ -34,7 +34,7 @@ export const HyperstructuresListComponent = ({}: HyperstructuresListComponentPro
{chosenOrder && showFeedPopup && (
setShowFeedPopup(false)} order={chosenOrder} />
)}
- {chosenOrder && (
+ {chosenOrder && hyperstructures && (
Hyperstructure of your order:
- Progress: {props.hyperstructure?.progress}%
+ Progress: {props.hyperstructure?.progress.toFixed(2)}%