Skip to content

Commit

Permalink
fligter
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Dec 20, 2024
1 parent 49c0d93 commit 5e7f77c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions client/src/ui/components/trading/ResourceArrivals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ export const AllResourceArrivals = memo(

const whitelistedGuilds = useMemo(() => {
return [
...(savedGuilds?.flatMap((guildId) => getPlayerListInGuild(Number(guildId))) || []),
...getPlayersInPlayersGuild(BigInt(account?.address || 0n)).map((player) => player.address),
...(savedGuilds
?.flatMap((guildId) => getPlayerListInGuild(Number(guildId)))
.map((player) => BigInt(player.address)) || []),
...getPlayersInPlayersGuild(BigInt(account?.address || 0n)).map((player) => BigInt(player.address)),
];
}, [account?.address, savedGuilds]);

Expand All @@ -57,7 +59,9 @@ export const AllResourceArrivals = memo(
const newIdsSet = new Set(
arrivals
.filter(
(arrival) => whitelistedGuilds.includes(arrival.originOwner) || arrival.originOwner === account.address,
(arrival) =>
whitelistedGuilds.includes(BigInt(arrival.originOwner)) ||
BigInt(arrival.originOwner) === BigInt(account.address),
)
.map((arrival) => arrival.entityId.toString()),
);
Expand All @@ -77,7 +81,9 @@ export const AllResourceArrivals = memo(
console.log("AddToSubscriptionStart - 5");
}, [arrivals, subscribedIds, addSubscribedIds]);

const guildPlayers = getPlayersInPlayersGuild(BigInt(account?.address || 0n)).map((player) => player.address);
const guildPlayers = getPlayersInPlayersGuild(BigInt(account?.address || 0n)).map((player) =>
BigInt(player.address),
);

const filteredArrivals = useMemo(
() =>
Expand All @@ -87,7 +93,7 @@ export const AllResourceArrivals = memo(
const guildCondition = showOnlyGuildMembers
? guildPlayers.length === 0
? true // If no guild players, show all arrivals
: guildPlayers.includes(arrival.originOwner)
: guildPlayers.includes(BigInt(arrival.originOwner))
: true;
return timeCondition && guildCondition;
}),
Expand Down

0 comments on commit 5e7f77c

Please sign in to comment.