@@ -136,19 +134,19 @@ export const QuestsMenu = memo(() => {
onClick={() => handleStart()}
variant="outline"
disabled={
- (currentQuest?.status === QuestStatus.Completed && currentQuest.id !== QuestType.Settle) || worldLoading
+ (currentQuest?.status === QuestStatus.Completed && currentQuest.id !== QuestType.Settle) || questsLoaded
}
className={clsx("tutorial-selector relative text-sm capitalize", {
"!border-gold/70 !text-brown !bg-gold hover:!bg-gold/70 animate-pulse hover:animate-none":
- currentQuest?.status !== QuestStatus.Completed && !worldLoading,
+ currentQuest?.status !== QuestStatus.Completed && !questsLoaded,
})}
>
-
{worldLoading ? "Loading..." : currentQuest?.name}
+
{questsLoaded ? "Loading..." : currentQuest?.name}
@@ -166,25 +164,25 @@ export const QuestsMenu = memo(() => {
className="text-sm font-semibold capitalize"
onClick={handleClaimAllQuests}
variant="red"
- disabled={worldLoading}
+ disabled={questsLoaded}
>
- {worldLoading ? "Loading..." : "Skip All Quests"}
+ {questsLoaded ? "Loading..." : "Skip All Quests"}
) : (
@@ -192,9 +190,9 @@ export const QuestsMenu = memo(() => {
variant="primary"
className="text-sm font-semibold capitalize w-6"
onClick={() => setSkipQuest(true)}
- disabled={worldLoading}
+ disabled={questsLoaded}
>
- {worldLoading ? "..." : "Skip"}
+ {questsLoaded ? "..." : "Skip"}
)}
diff --git a/client/src/ui/modules/world-structures/WorldStructuresMenu.tsx b/client/src/ui/modules/world-structures/WorldStructuresMenu.tsx
index 7473c53e0..22e5a2d58 100644
--- a/client/src/ui/modules/world-structures/WorldStructuresMenu.tsx
+++ b/client/src/ui/modules/world-structures/WorldStructuresMenu.tsx
@@ -7,7 +7,8 @@ import { useFragmentMines } from "@/hooks/helpers/useFragmentMines";
import { useGuilds } from "@/hooks/helpers/useGuilds";
import { useHyperstructureProgress, useHyperstructures } from "@/hooks/helpers/useHyperstructures";
import { useResourceBalance } from "@/hooks/helpers/useResources";
-import { useWorldStore } from "@/hooks/store/useWorldLoading";
+import useUIStore from "@/hooks/store/useUIStore";
+import { LoadingStateKey } from "@/hooks/store/useWorldLoading";
import { FragmentMinePanel } from "@/ui/components/fragmentMines/FragmentMinePanel";
import { HintSection } from "@/ui/components/hints/HintModal";
import { DisplayedAccess, HyperstructurePanel } from "@/ui/components/hyperstructures/HyperstructurePanel";
@@ -33,18 +34,16 @@ export const WorldStructuresMenu = ({ className }: { className?: string }) => {
network: { toriiClient, contractComponents },
} = useDojo();
- const isStructuresLoading = useWorldStore((state) => state.isStructuresLoading);
- const setStructuresLoading = useWorldStore((state) => state.setStructuresLoading);
+ const hyperstructuresLoaded = useUIStore((state) => state.loadingStates.hyperstructure);
+ const setLoading = useUIStore((state) => state.setLoading);
useEffect(() => {
const fetchData = async () => {
try {
- await fetchHyperstructureData(
- toriiClient,
- contractComponents as any,
- isStructuresLoading,
- setStructuresLoading,
- );
+ setLoading(LoadingStateKey.Hyperstructure, false),
+ await fetchHyperstructureData(toriiClient, contractComponents as any, hyperstructuresLoaded, () =>
+ setLoading(LoadingStateKey.Hyperstructure, true),
+ );
} catch (error) {
console.error("Failed to fetch hyperstructure data:", error);
}
@@ -142,7 +141,7 @@ export const WorldStructuresMenu = ({ className }: { className?: string }) => {
[selectedTab, hyperstructures, fragmentMines, showOnlyMine, account.address, myHyperstructures],
);
- if (isStructuresLoading) {
+ if (hyperstructuresLoaded) {
return (
Loading structures...
@@ -347,7 +346,7 @@ const fetchHyperstructureData = async (
client: ToriiClient,
components: Component
[],
isStructuresLoading: boolean,
- setStructuresLoading: (loading: boolean) => void,
+ onCompleted?: () => void,
) => {
if (!isStructuresLoading) {
return;
@@ -383,6 +382,6 @@ const fetchHyperstructureData = async (
40_000,
false,
).finally(() => {
- setStructuresLoading(false);
+ onCompleted?.();
});
};