aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/list/ListPage.js
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-15 15:50:19 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-15 15:50:19 +0200
commit2530cee1eac225924e1119554cf475cdc46ed7dc (patch)
tree4d36ca529a2e25a3fe9f1a881d037215184ec9a1 /webui/src/list/ListPage.js
parent24d862a65c603de4ea77a2688f5c90effc65be2f (diff)
downloadgit-bug-2530cee1eac225924e1119554cf475cdc46ed7dc.tar.gz
webui: reorganize the code
Diffstat (limited to 'webui/src/list/ListPage.js')
-rw-r--r--webui/src/list/ListPage.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/webui/src/list/ListPage.js b/webui/src/list/ListPage.js
new file mode 100644
index 00000000..b7de735f
--- /dev/null
+++ b/webui/src/list/ListPage.js
@@ -0,0 +1,45 @@
+// @flow
+import CircularProgress from '@material-ui/core/CircularProgress'
+import gql from 'graphql-tag'
+import React from 'react'
+import { Query } from 'react-apollo'
+
+import BugRow from './BugRow'
+import List from './List'
+
+const QUERY = gql`
+ query($first: Int = 10, $last: Int, $after: String, $before: String) {
+ defaultRepository {
+ bugs: allBugs(first: $first, last: $last, after: $after, before: $before) {
+ totalCount
+ edges {
+ cursor
+ node {
+ ...BugRow
+ }
+ }
+ pageInfo{
+ hasNextPage
+ hasPreviousPage
+ startCursor
+ endCursor
+ }
+ }
+ }
+ }
+
+
+ ${BugRow.fragment}
+`
+
+const ListPage = () => (
+ <Query query={QUERY}>
+ {({loading, error, data, fetchMore}) => {
+ if (loading) return <CircularProgress/>
+ if (error) return <p>Error.</p>
+ return <List bugs={data.defaultRepository.bugs} fetchMore={fetchMore}/>
+ }}
+ </Query>
+)
+
+export default ListPage