Skip to content

Commit

Permalink
Merge pull request #780 from alleslabs/fix/proposal-votes-table
Browse files Browse the repository at this point in the history
fix: proposal votes pagination, scrolling
  • Loading branch information
evilpeach authored Feb 13, 2024
2 parents c70b717 + 00c9aa2 commit e46291c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bug fixes

- [#780](https://github.com/alleslabs/celatone-frontend/pull/780) Fix proposal vote table, scroll to top on table
- [#761](https://github.com/alleslabs/celatone-frontend/pull/761) Fix copy button tooltip alignment
- [#754](https://github.com/alleslabs/celatone-frontend/pull/754) Fix mobile guard incorrect behavior
- [#751](https://github.com/alleslabs/celatone-frontend/pull/751) Fix fail txs should have no logs and remove stone-12-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ enum AnswerType {
WEIGHTED = "weighted",
}

const tableHeaderId = "proposalVotesTable";

export const ProposalVotesTable = ({
id,
answers,
Expand All @@ -96,14 +98,6 @@ export const ProposalVotesTable = ({
const [search, setSearch] = useState("");
const debouncedSearch = useDebounce(search);

const { data, isLoading } = useProposalVotes(
id,
10,
0,
answerFilter,
debouncedSearch
);

const {
pagesQuantity,
currentPage,
Expand All @@ -120,6 +114,14 @@ export const ProposalVotesTable = ({
},
});

const { data, isLoading } = useProposalVotes(
id,
pageSize,
offset,
answerFilter,
debouncedSearch
);

const isSearching = debouncedSearch !== "" || answerFilter !== AnswerType.ALL;

const total = answers?.total ?? 0;
Expand Down Expand Up @@ -182,7 +184,7 @@ export const ProposalVotesTable = ({
};

return (
<Box>
<Box id={tableHeaderId}>
{fullVersion && (
<Grid gap={4} templateColumns={{ base: "1fr", md: "240px auto" }}>
<GridItem>
Expand Down Expand Up @@ -215,6 +217,7 @@ export const ProposalVotesTable = ({
<Pagination
currentPage={currentPage}
pagesQuantity={pagesQuantity}
scrollComponentId={tableHeaderId}
offset={offset}
totalData={total}
pageSize={pageSize}
Expand Down

0 comments on commit e46291c

Please sign in to comment.