Skip to content

Commit

Permalink
update queries inline with new ponder update (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 authored Jan 6, 2025
1 parent 30d3bce commit c5b0e3b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
6 changes: 4 additions & 2 deletions packages/nextjs/hooks/useCohortAddBuilderEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import contracts from "~~/generated/hardhat_contracts";
const BuildersQuery = gql`
query Builders($cohortAddress: String!) {
cohortBuilders(where: { cohortContractAddress: $cohortAddress }, orderBy: "timestamp", orderDirection: "desc") {
id
items {
id
}
}
}
`;
Expand All @@ -17,6 +19,6 @@ export const useAddBuilderEvents = () => {
},
});

const data = addBuilderEventsData?.cohortBuilders || [];
const data = addBuilderEventsData?.cohortBuilders.items || [];
return { data, isLoading };
};
14 changes: 8 additions & 6 deletions packages/nextjs/hooks/useCohortWithdrawEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import contracts from "~~/generated/hardhat_contracts";
const WithdrawalsQuery = gql`
query Withdrawls($cohortAddress: String!) {
cohortWithdrawals(where: { cohortContractAddress: $cohortAddress }, orderBy: "timestamp", orderDirection: "desc") {
reason
builder
amount
timestamp
id
items {
reason
builder
amount
timestamp
id
}
}
}
`;
Expand All @@ -21,7 +23,7 @@ export const useCohortWithdrawEvents = () => {
},
});

const newContractWithdrawEvents = newWithdrawEventsData?.cohortWithdrawals || [];
const newContractWithdrawEvents = newWithdrawEventsData?.cohortWithdrawals.items || [];

const data = [...newContractWithdrawEvents];

Expand Down
10 changes: 7 additions & 3 deletions packages/nextjs/pages/members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ const Members: NextPage = () => {

useEffect(() => {
if (selectedAddress) {
setFilteredEvents(allWithdrawEvents?.filter((event: any) => event.builder === selectedAddress) || []);
setFilteredEvents(
allWithdrawEvents?.filter((event: any) => {
return event.builder.toLowerCase() === selectedAddress.toLowerCase();
}) || [],
);
}
}, [selectedAddress, allWithdrawEvents]);

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedAddress]);
return (
<>
<div className="max-w-3xl px-4 py-8">
Expand Down

0 comments on commit c5b0e3b

Please sign in to comment.