@@ -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/navigation/TopLeftNavigation.tsx b/client/src/ui/modules/navigation/TopLeftNavigation.tsx
index ed6befec1..ebab40085 100644
--- a/client/src/ui/modules/navigation/TopLeftNavigation.tsx
+++ b/client/src/ui/modules/navigation/TopLeftNavigation.tsx
@@ -1,6 +1,6 @@
import { configManager } from "@/dojo/setup";
import { useDojo } from "@/hooks/context/DojoContext";
-import { useEntities, useEntitiesUtils } from "@/hooks/helpers/useEntities";
+import { PlayerStructure, useEntitiesUtils } from "@/hooks/helpers/useEntities";
import { useQuery } from "@/hooks/helpers/useQuery";
import useUIStore from "@/hooks/store/useUIStore";
import useNextBlockTimestamp from "@/hooks/useNextBlockTimestamp";
@@ -92,13 +92,11 @@ const WorkersHutTooltipContent = () => {
);
};
-export const TopLeftNavigation = memo(() => {
+export const TopLeftNavigation = memo(({ structures }: { structures: PlayerStructure[] }) => {
const { setup } = useDojo();
const { isMapView, handleUrlChange, hexPosition } = useQuery();
- const { playerStructures } = useEntities();
const { getEntityInfo } = useEntitiesUtils();
- const structures = playerStructures();
const isSpectatorMode = useUIStore((state) => state.isSpectatorMode);
const structureEntityId = useUIStore((state) => state.structureEntityId);
diff --git a/client/src/ui/modules/navigation/TopNavigation.tsx b/client/src/ui/modules/navigation/TopNavigation.tsx
index b8ebb09ab..551b1137c 100644
--- a/client/src/ui/modules/navigation/TopNavigation.tsx
+++ b/client/src/ui/modules/navigation/TopNavigation.tsx
@@ -1,5 +1,4 @@
import { useGetAllPlayers } from "@/hooks/helpers/use-get-all-players";
-
import { memo } from "react";
import { Rewards } from "../rewards/Rewards";
import { SettingsWindow } from "../settings/Settings";
@@ -7,12 +6,11 @@ import { Social } from "../social/Social";
export const TopMiddleNavigation = memo(() => {
const getPlayers = useGetAllPlayers();
- const players = getPlayers();
return (
<>
-
+
diff --git a/client/src/ui/modules/settings/Settings.tsx b/client/src/ui/modules/settings/Settings.tsx
index 700b8e54d..90f532b42 100644
--- a/client/src/ui/modules/settings/Settings.tsx
+++ b/client/src/ui/modules/settings/Settings.tsx
@@ -1,8 +1,8 @@
+import { ReactComponent as Controller } from "@/assets/icons/Controller.svg";
import { ReactComponent as Copy } from "@/assets/icons/common/copy.svg";
import { ReactComponent as Next } from "@/assets/icons/common/fast-forward.svg";
import { ReactComponent as Muted } from "@/assets/icons/common/muted.svg";
import { ReactComponent as Unmuted } from "@/assets/icons/common/unmuted.svg";
-import { ReactComponent as Controller } from "@/assets/icons/Controller.svg";
import { ReactComponent as DojoMark } from "@/assets/icons/dojo-mark-full-dark.svg";
import { ReactComponent as RealmsWorld } from "@/assets/icons/rw-logo.svg";
import { useDojo } from "@/hooks/context/DojoContext";
@@ -18,7 +18,7 @@ import Button from "@/ui/elements/Button";
import { Checkbox } from "@/ui/elements/Checkbox";
import { Headline } from "@/ui/elements/Headline";
import { RangeInput } from "@/ui/elements/RangeInput";
-import { addressToNumber, displayAddress } from "@/ui/utils/utils";
+import { addressToNumber, currencyIntlFormat, displayAddress } from "@/ui/utils/utils";
import { ContractAddress } from "@bibliothecadao/eternum";
import { useEffect, useRef, useState } from "react";
import { toast } from "sonner";
@@ -42,6 +42,16 @@ export const SettingsWindow = () => {
const isSoundOn = useUIStore((state) => state.isSoundOn);
const toggleSound = useUIStore((state) => state.toggleSound);
+ const getCurrentDonkeyWeightMinimum = () => {
+ return Number(localStorage.getItem("WEIGHT_MINIMUM") || 0);
+ };
+
+ const [donkeyWeightLimit, setDonkeyWeightLimit] = useState(getCurrentDonkeyWeightMinimum());
+
+ useEffect(() => {
+ localStorage.setItem("WEIGHT_MINIMUM", donkeyWeightLimit.toString());
+ }, [donkeyWeightLimit]);
+
const { toggleFullScreen, isFullScreen } = useScreenOrientation();
const [fullScreen, setFullScreen] = useState
(isFullScreen());
@@ -61,7 +71,7 @@ export const SettingsWindow = () => {
const isOpen = useUIStore((state) => state.isPopupOpen(settings));
- const GRAPHICS_SETTING = localStorage.getItem("GRAPHICS_SETTING") as GraphicsSettings || GraphicsSettings.HIGH;
+ const GRAPHICS_SETTING = (localStorage.getItem("GRAPHICS_SETTING") as GraphicsSettings) || GraphicsSettings.HIGH;
return (
togglePopup(settings)} show={isOpen} title={settings}>
@@ -145,6 +155,18 @@ export const SettingsWindow = () => {
+
+ Donkey Settings
+
+
diff --git a/client/src/ui/modules/social/Social.tsx b/client/src/ui/modules/social/Social.tsx
index 92178c677..a38abdb77 100644
--- a/client/src/ui/modules/social/Social.tsx
+++ b/client/src/ui/modules/social/Social.tsx
@@ -1,5 +1,5 @@
import { useDojo } from "@/hooks/context/DojoContext";
-import { useHyperstructureData } from "@/hooks/store/useLeaderBoardStore";
+import { useHyperstructureData, useLeaderBoardStore } from "@/hooks/store/useLeaderBoardStore";
import useUIStore from "@/hooks/store/useUIStore";
import { HintSection } from "@/ui/components/hints/HintModal";
import { social } from "@/ui/components/navigation/Config";
@@ -12,11 +12,11 @@ import { Tabs } from "@/ui/elements/tab";
import { ContractAddress, ID, Player } from "@bibliothecadao/eternum";
import { useEntityQuery } from "@dojoengine/react";
import { Has } from "@dojoengine/recs";
-import { useMemo, useState } from "react";
+import { useEffect, useMemo, useState } from "react";
import { EndSeasonButton } from "./EndSeasonButton";
import { PlayerId } from "./PlayerId";
-export const Social = ({ players }: { players: Player[] }) => {
+export const Social = ({ getPlayers }: { getPlayers: () => Player[] }) => {
const {
setup: {
components: {
@@ -26,7 +26,7 @@ export const Social = ({ players }: { players: Player[] }) => {
} = useDojo();
const [selectedTab, setSelectedTab] = useState(0);
const [isExpanded, setIsExpanded] = useState(false);
-
+ const [isLoading, setIsLoading] = useState(false);
const [selectedGuild, setSelectedGuild] = useState(0);
const [selectedPlayer, setSelectedPlayer] = useState(0n);
@@ -35,8 +35,21 @@ export const Social = ({ players }: { players: Player[] }) => {
const gameEnded = useEntityQuery([Has(GameEnded)]);
+ const [players, setPlayers] = useState(() => getPlayers());
+ const playersByRank = useLeaderBoardStore((state) => state.playersByRank);
+
const updateLeaderboard = useHyperstructureData();
+ const handleUpdatePoints = () => {
+ setIsLoading(true);
+ updateLeaderboard();
+ };
+
+ useEffect(() => {
+ setPlayers(getPlayers());
+ setIsLoading(false);
+ }, [playersByRank]);
+
const viewGuildMembers = (guildEntityId: ID) => {
if (selectedGuild === guildEntityId) {
setSelectedPlayer(0n);
@@ -112,7 +125,7 @@ export const Social = ({ players }: { players: Player[] }) => {
{gameEnded.length === 0 && }
-
diff --git a/client/src/ui/modules/world-structures/WorldStructuresMenu.tsx b/client/src/ui/modules/world-structures/WorldStructuresMenu.tsx
index 7473c53e0..2e55caf1e 100644
--- a/client/src/ui/modules/world-structures/WorldStructuresMenu.tsx
+++ b/client/src/ui/modules/world-structures/WorldStructuresMenu.tsx
@@ -7,7 +7,6 @@ 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 { FragmentMinePanel } from "@/ui/components/fragmentMines/FragmentMinePanel";
import { HintSection } from "@/ui/components/hints/HintModal";
import { DisplayedAccess, HyperstructurePanel } from "@/ui/components/hyperstructures/HyperstructurePanel";
@@ -19,39 +18,15 @@ import { HintModalButton } from "@/ui/elements/HintModalButton";
import { ResourceIcon } from "@/ui/elements/ResourceIcon";
import { currencyFormat, currencyIntlFormat, divideByPrecision } from "@/ui/utils/utils";
import { BattleSide, ContractAddress, ID, ResourcesIds, findResourceById } from "@bibliothecadao/eternum";
-import { Metadata } from "@dojoengine/recs";
-import { S } from "@dojoengine/recs/dist/types-3444e4c1";
-import { getEntities } from "@dojoengine/state";
-import { ToriiClient } from "@dojoengine/torii-wasm";
import { ArrowRight } from "lucide-react";
-import { Component, useCallback, useEffect, useMemo, useState } from "react";
+import { useCallback, useMemo, useState } from "react";
import { Tabs } from "../../elements/tab";
export const WorldStructuresMenu = ({ className }: { className?: string }) => {
const {
account: { account },
- network: { toriiClient, contractComponents },
} = useDojo();
- const isStructuresLoading = useWorldStore((state) => state.isStructuresLoading);
- const setStructuresLoading = useWorldStore((state) => state.setStructuresLoading);
-
- useEffect(() => {
- const fetchData = async () => {
- try {
- await fetchHyperstructureData(
- toriiClient,
- contractComponents as any,
- isStructuresLoading,
- setStructuresLoading,
- );
- } catch (error) {
- console.error("Failed to fetch hyperstructure data:", error);
- }
- };
- fetchData();
- }, [toriiClient, contractComponents]);
-
const [selectedTab, setSelectedTab] = useState(0);
const [showOnlyMine, setShowOnlyMine] = useState(false);
@@ -142,14 +117,6 @@ export const WorldStructuresMenu = ({ className }: { className?: string }) => {
[selectedTab, hyperstructures, fragmentMines, showOnlyMine, account.address, myHyperstructures],
);
- if (isStructuresLoading) {
- return (
-
-
Loading structures...
-
- );
- }
-
return (
<>
@@ -342,47 +309,3 @@ const EntityHeader = ({ entity }: { entity: any }) => {
);
};
-
-const fetchHyperstructureData = async (
- client: ToriiClient,
- components: Component