aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/ListPage.js
diff options
context:
space:
mode:
authorQuentin Gliech <quentingliech@gmail.com>2018-07-22 01:13:06 +0200
committerQuentin Gliech <quentingliech@gmail.com>2018-07-22 01:13:06 +0200
commit6d8559048f9dcbac4ee9f65de54bda4cd1a7431c (patch)
tree4bf2bcb127924ed3265c68bd9beb4baa24def432 /webui/src/ListPage.js
parent50fd2943acac8685db92a016ee3c9dbfc95842cf (diff)
downloadgit-bug-6d8559048f9dcbac4ee9f65de54bda4cd1a7431c.tar.gz
webui: Basic bug list
Diffstat (limited to 'webui/src/ListPage.js')
-rw-r--r--webui/src/ListPage.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/webui/src/ListPage.js b/webui/src/ListPage.js
new file mode 100644
index 00000000..c873eefa
--- /dev/null
+++ b/webui/src/ListPage.js
@@ -0,0 +1,46 @@
+import React from "react";
+import { Query } from "react-apollo";
+import gql from "graphql-tag";
+import { withStyles } from "@material-ui/core/styles";
+
+import CircularProgress from "@material-ui/core/CircularProgress";
+
+import BugSummary from "./BugSummary";
+
+const QUERY = gql`
+ {
+ bugs: allBugs {
+ ...BugSummary
+ }
+ }
+
+ ${BugSummary.fragment}
+`;
+
+const styles = theme => ({
+ main: {
+ maxWidth: 600,
+ margin: "auto",
+ marginTop: theme.spacing.unit * 4
+ }
+});
+
+const List = withStyles(styles)(({ bugs, classes }) => (
+ <main className={classes.main}>
+ {bugs.map(bug => (
+ <BugSummary bug={bug} key={bug.id} />
+ ))}
+ </main>
+));
+
+const ListPage = () => (
+ <Query query={QUERY}>
+ {({ loading, error, data }) => {
+ if (loading) return <CircularProgress />;
+ if (error) return <p>Error.</p>;
+ return <List bugs={data.bugs} />;
+ }}
+ </Query>
+);
+
+export default ListPage;