Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Dec 15, 2024
1 parent 8914aa5 commit 2776a38
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 115 deletions.
2 changes: 1 addition & 1 deletion client/src/dojo/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const addMarketSubscription = async <S extends Schema>(
},
},
components,
30_000,
30_000,
false,
);
};
41 changes: 21 additions & 20 deletions client/src/hooks/helpers/useArmies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ const formatArmies = (

const structure = getComponentValue(Structure, getEntityIdFromKeys([BigInt(entityOwner.entity_owner_id)]));

const structurePosition = structure && getComponentValue(Position, getEntityIdFromKeys([BigInt(structure.entity_id)]));
const structurePosition =
structure && getComponentValue(Position, getEntityIdFromKeys([BigInt(structure.entity_id)]));

const isMine = (owner?.address || 0n) === ContractAddress(playerAddress);
const isMercenary = owner === undefined;
Expand Down Expand Up @@ -171,7 +172,7 @@ export const useArmiesByEntityOwner = ({ entity_owner_entity_id }: { entity_owne
Protectee,
EntityName,
Stamina,
Structure
Structure,
},
},
account: { account },
Expand All @@ -197,7 +198,7 @@ export const useArmiesByEntityOwner = ({ entity_owner_entity_id }: { entity_owne
Owner,
Realm,
Stamina,
Structure
Structure,
);
}, [armies]);

Expand Down Expand Up @@ -228,7 +229,7 @@ export const useArmiesByEntityOwnerWithPositionAndQuantity = ({
Protectee,
EntityName,
Stamina,
Structure
Structure,
},
},
account: { account },
Expand Down Expand Up @@ -259,7 +260,7 @@ export const useArmiesByEntityOwnerWithPositionAndQuantity = ({
Owner,
Realm,
Stamina,
Structure
Structure,
);
}, [armies]);

Expand All @@ -286,7 +287,7 @@ export const getArmiesByBattleId = () => {
Protectee,
EntityName,
Stamina,
Structure
Structure,
},
},
account: { account },
Expand All @@ -311,7 +312,7 @@ export const getArmiesByBattleId = () => {
Owner,
Realm,
Stamina,
Structure
Structure,
);
};
return armiesByBattleId;
Expand All @@ -335,7 +336,7 @@ export const useArmyByArmyEntityId = (entityId: ID): ArmyInfo | undefined => {
Protectee,
EntityName,
Stamina,
Structure
Structure,
},
},
account: { account },
Expand All @@ -359,7 +360,7 @@ export const useArmyByArmyEntityId = (entityId: ID): ArmyInfo | undefined => {
Owner,
Realm,
Stamina,
Structure
Structure,
)[0];
};

Expand All @@ -382,7 +383,7 @@ export const getUserArmyInBattle = (battle_id: ID) => {
Protectee,
EntityName,
Stamina,
Structure
Structure,
},
},
} = useDojo();
Expand Down Expand Up @@ -412,7 +413,7 @@ export const getUserArmyInBattle = (battle_id: ID) => {
Owner,
Realm,
Stamina,
Structure
Structure,
)[0];
}, [battle_id]);

Expand Down Expand Up @@ -447,7 +448,7 @@ export const useOwnArmiesByPosition = ({
Protectee,
EntityName,
Stamina,
Structure
Structure,
},
},
} = useDojo();
Expand Down Expand Up @@ -477,7 +478,7 @@ export const useOwnArmiesByPosition = ({
Owner,
Realm,
Stamina,
Structure
Structure,
).filter((army) =>
playerStructures.some((structure) => structure.entity_id === army.entityOwner.entity_owner_id),
);
Expand Down Expand Up @@ -513,7 +514,7 @@ export const useEnemyArmiesByPosition = ({
Protectee,
EntityName,
Stamina,
Structure
Structure,
},
},
} = useDojo();
Expand Down Expand Up @@ -542,7 +543,7 @@ export const useEnemyArmiesByPosition = ({
Owner,
Realm,
Stamina,
Structure
Structure,
).filter((army) =>
playerStructures.every((structure) => structure.entity_id !== army.entityOwner.entity_owner_id),
);
Expand Down Expand Up @@ -570,7 +571,7 @@ export const getArmyByEntityId = () => {
Protectee,
EntityName,
Stamina,
Structure
Structure,
},
},
account: { account },
Expand All @@ -595,7 +596,7 @@ export const getArmyByEntityId = () => {
Owner,
Realm,
Stamina,
Structure
Structure,
)[0];
};

Expand All @@ -619,7 +620,7 @@ export const getArmyByEntityId = () => {
Owner,
Realm,
Stamina,
Structure
Structure,
)[0];
};

Expand All @@ -645,7 +646,7 @@ export const getArmiesByPosition = () => {
Protectee,
EntityName,
Stamina,
Structure
Structure,
},
},
} = useDojo();
Expand All @@ -669,7 +670,7 @@ export const getArmiesByPosition = () => {
Owner,
Realm,
Stamina,
Structure
Structure,
);
};

Expand Down
98 changes: 49 additions & 49 deletions client/src/three/scenes/Worldmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,63 +680,63 @@ export default class WorldmapScene extends HexagonScene {

// Skip if we've already fetched this chunk
if (this.fetchedChunks.has(chunkKey)) {
console.log("Already fetched");
return;
console.log("Already fetched");
return;
}

// Add to fetched chunks before the query to prevent concurrent duplicate requests
this.fetchedChunks.add(chunkKey);

try {
await getEntities(
this.dojo.network.toriiClient,
{
Composite: {
operator: "And",
clauses: [
{
Member: {
model: "s0_eternum-Tile",
member: "col",
operator: "Gte",
value: { Primitive: { U32: startCol - range } },
},
},
{
Member: {
model: "s0_eternum-Tile",
member: "col",
operator: "Lte",
value: { Primitive: { U32: startCol + range } },
},
},
{
Member: {
model: "s0_eternum-Tile",
member: "row",
operator: "Gte",
value: { Primitive: { U32: startRow - range } },
},
},
{
Member: {
model: "s0_eternum-Tile",
member: "row",
operator: "Lte",
value: { Primitive: { U32: startRow + range } },
},
},
],
await getEntities(
this.dojo.network.toriiClient,
{
Composite: {
operator: "And",
clauses: [
{
Member: {
model: "s0_eternum-Tile",
member: "col",
operator: "Gte",
value: { Primitive: { U32: startCol - range } },
},
},
{
Member: {
model: "s0_eternum-Tile",
member: "col",
operator: "Lte",
value: { Primitive: { U32: startCol + range } },
},
},
{
Member: {
model: "s0_eternum-Tile",
member: "row",
operator: "Gte",
value: { Primitive: { U32: startRow - range } },
},
},
this.dojo.network.contractComponents as any,
1000,
false,
);
},
{
Member: {
model: "s0_eternum-Tile",
member: "row",
operator: "Lte",
value: { Primitive: { U32: startRow + range } },
},
},
],
},
},
this.dojo.network.contractComponents as any,
1000,
false,
);
} catch (error) {
// If there's an error, remove the chunk from cached set so it can be retried
this.fetchedChunks.delete(chunkKey);
console.error('Error fetching tile entities:', error);
// If there's an error, remove the chunk from cached set so it can be retried
this.fetchedChunks.delete(chunkKey);
console.error("Error fetching tile entities:", error);
}
}

Expand Down
6 changes: 1 addition & 5 deletions client/src/ui/components/resources/InventoryResources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ export const InventoryResources = ({

setIsSyncing(true);
try {
await addToSubscription(
dojo.network.toriiClient,
dojo.network.contractComponents as any,
entityId.toString(),
);
await addToSubscription(dojo.network.toriiClient, dojo.network.contractComponents as any, entityId.toString());
localStorage.setItem(cacheKey, now.toString());
} catch (error) {
console.error("Fetch failed", error);
Expand Down
6 changes: 4 additions & 2 deletions client/src/ui/components/resources/TravelInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const TravelInfo = ({
setDonkeyBalance(calculatedDonkeyBalance);

const onlyDonkeysAndLords = resources.every(
(r) => r.resourceId === ResourcesIds.Donkey || r.resourceId === ResourcesIds.Lords
(r) => r.resourceId === ResourcesIds.Donkey || r.resourceId === ResourcesIds.Lords,
);

if (setCanCarry) {
Expand All @@ -66,7 +66,9 @@ export const TravelInfo = ({
{`${Math.floor(travelTime / 60)} hrs ${travelTime % 60} mins`}
</td>
</tr>
):''}
) : (
""
)}
<tr className="hover:bg-gold/5 transition-colors">
<td className="px-4 py-1 font-semibold text-right whitespace-nowrap">Total Transfer Weight</td>
<td className="px-4 py-1 text-gold text-left whitespace-nowrap">{`${currencyFormat(
Expand Down
14 changes: 7 additions & 7 deletions client/src/ui/layouts/World.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ export const World = ({ backgroundImage }: { backgroundImage: string }) => {

console.log("world loading", worldLoading);

try {
await addMarketSubscription(dojo.network.toriiClient, dojo.network.contractComponents as any);
} catch (error) {
console.error("Fetch failed", error);
} finally {
setMarketLoading(false);
}
try {
await addMarketSubscription(dojo.network.toriiClient, dojo.network.contractComponents as any);
} catch (error) {
console.error("Fetch failed", error);
} finally {
setMarketLoading(false);
}
};

fetch();
Expand Down
2 changes: 1 addition & 1 deletion client/src/ui/utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ export const getSeasonAddresses = async (): Promise<ResourceAddresses> => {
console.error("Error loading season addresses:", error);
return {};
}
}
};
export const calculateDonkeysNeeded = (orderWeight: number): number => {
const configManager = ClientConfigManager.instance();
const donkeyCapacityGrams = configManager.getCapacityConfig(CapacityConfigCategory.Donkey);
Expand Down
9 changes: 8 additions & 1 deletion landing/src/components/modules/bridge-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,14 @@ export const BridgeIn = () => {
<div className="text-xs text-slate-500 uppercase mb-1">To Realm</div>

<Select onValueChange={(value) => setRealmEntityId(Number(value))}>
<SelectTrigger className={"w-full " + (!realmEntityId ? "bg-dark-brown dark:[background:linear-gradient(45deg,#1a1311,#1a1311)_padding-box,conic-gradient(from_var(--border-angle),#8b7355_80%,_#c6a366_86%,_#e5c088_90%,_#c6a366_94%,_#8b7355)_border-box] border border-transparent animate-border [background:linear-gradient(45deg,#ffffff,#ffffff)_padding-box,conic-gradient(from_var(--border-angle),#8b7355_80%,_#c6a366_86%,_#e5c088_90%,_#c6a366_94%,_#8b7355)_border-box]" : "border-gold/15")}>
<SelectTrigger
className={
"w-full " +
(!realmEntityId
? "bg-dark-brown dark:[background:linear-gradient(45deg,#1a1311,#1a1311)_padding-box,conic-gradient(from_var(--border-angle),#8b7355_80%,_#c6a366_86%,_#e5c088_90%,_#c6a366_94%,_#8b7355)_border-box] border border-transparent animate-border [background:linear-gradient(45deg,#ffffff,#ffffff)_padding-box,conic-gradient(from_var(--border-angle),#8b7355_80%,_#c6a366_86%,_#e5c088_90%,_#c6a366_94%,_#8b7355)_border-box]"
: "border-gold/15")
}
>
{address ? (
<SelectValue placeholder="Select Realm To Transfer" />
) : (
Expand Down
Loading

0 comments on commit 2776a38

Please sign in to comment.