-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from dolthub/taylor/branch-pagination
Add pagination to branch list page
- Loading branch information
Showing
21 changed files
with
229 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 33 additions & 19 deletions
52
web/components/pageComponents/DatabasePage/ForBranches/BranchesPage/BranchList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,46 @@ | ||
import { BranchFragment } from "@gen/graphql-types"; | ||
import InfiniteScroll from "react-infinite-scroller"; | ||
import BranchRow from "./BranchRow"; | ||
import css from "./index.module.css"; | ||
|
||
type Props = { | ||
branches: BranchFragment[]; | ||
onDeleteClicked: (b: BranchFragment) => void; | ||
loadMore: () => Promise<void>; | ||
hasMore: boolean; | ||
}; | ||
|
||
export default function BranchList(props: Props): JSX.Element { | ||
return ( | ||
<table className={css.table} data-cy="branch-list"> | ||
<thead> | ||
<tr> | ||
<th>Branch name</th> | ||
<th>Last updated by</th> | ||
<th>Last updated</th> | ||
<th aria-hidden="true" /> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{props.branches.map(b => ( | ||
<BranchRow | ||
onDeleteClicked={() => props.onDeleteClicked(b)} | ||
key={b._id} | ||
branch={b} | ||
/> | ||
))} | ||
</tbody> | ||
</table> | ||
<InfiniteScroll | ||
// Passing extra props to infinite scroll seems to apply those props to the top level div, | ||
// so we can't spread props here. | ||
loadMore={props.loadMore} | ||
hasMore={props.hasMore} | ||
loader={<div className={css.loader}>Loading branches ...</div>} | ||
useWindow={false} | ||
initialLoad={false} | ||
getScrollParent={() => document.getElementById("main-content")} | ||
> | ||
<table className={css.table} data-cy="branch-list"> | ||
<thead> | ||
<tr> | ||
<th>Branch name</th> | ||
<th>Last updated by</th> | ||
<th>Last updated</th> | ||
<th aria-hidden="true" /> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{props.branches.map(b => ( | ||
<BranchRow | ||
onDeleteClicked={() => props.onDeleteClicked(b)} | ||
key={b._id} | ||
branch={b} | ||
/> | ||
))} | ||
</tbody> | ||
</table> | ||
</InfiniteScroll> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.