aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'webui/src/pages')
-rw-r--r--webui/src/pages/identity/BugList.tsx32
-rw-r--r--webui/src/pages/identity/GetBugsByUser.graphql10
-rw-r--r--webui/src/pages/identity/Identity.tsx5
3 files changed, 47 insertions, 0 deletions
diff --git a/webui/src/pages/identity/BugList.tsx b/webui/src/pages/identity/BugList.tsx
new file mode 100644
index 00000000..e1083cfb
--- /dev/null
+++ b/webui/src/pages/identity/BugList.tsx
@@ -0,0 +1,32 @@
+import React from 'react';
+
+import { Link } from '@material-ui/core';
+import CircularProgress from '@material-ui/core/CircularProgress';
+
+import { useGetBugsByUserQuery } from './GetBugsByUser.generated';
+
+type Props = {
+ humanId: string;
+};
+
+function BugList({ humanId }: Props) {
+ const { loading, error, data } = useGetBugsByUserQuery({
+ variables: {
+ query: 'author:' + humanId,
+ },
+ });
+
+ if (loading) return <CircularProgress />;
+ if (error) return <p>Error: {error}</p>;
+ const bugs = data?.repository?.allBugs.nodes;
+
+ console.log(bugs);
+ return (
+ <ol>
+ <li>{bugs ? bugs[0].title : ''}</li>
+ <Link href={'/bug/' + (bugs ? bugs[0].id : '')}>Klick</Link>
+ </ol>
+ );
+}
+
+export default BugList;
diff --git a/webui/src/pages/identity/GetBugsByUser.graphql b/webui/src/pages/identity/GetBugsByUser.graphql
new file mode 100644
index 00000000..0be85578
--- /dev/null
+++ b/webui/src/pages/identity/GetBugsByUser.graphql
@@ -0,0 +1,10 @@
+query GetBugsByUser ($query: String){
+ repository {
+ allBugs(query: $query) {
+ nodes {
+ id
+ title
+ }
+ }
+ }
+}
diff --git a/webui/src/pages/identity/Identity.tsx b/webui/src/pages/identity/Identity.tsx
index 22691b1c..43925f4f 100644
--- a/webui/src/pages/identity/Identity.tsx
+++ b/webui/src/pages/identity/Identity.tsx
@@ -14,6 +14,9 @@ import Avatar from '@material-ui/core/Avatar';
import { makeStyles } from '@material-ui/core/styles';
import { useCurrentIdentityQuery } from '../../components/CurrentIdentity/CurrentIdentity.generated';
+
+import BugList from './BugList';
+
const useStyles = makeStyles((theme) => ({
main: {
maxWidth: 1200,
@@ -59,6 +62,7 @@ const Identity = () => {
const { data } = useCurrentIdentityQuery();
const user = data?.repository?.userIdentity;
console.log(user);
+
return (
<main className={classes.main}>
<div className={classes.container}>
@@ -126,6 +130,7 @@ const Identity = () => {
</Avatar>
</div>
</div>
+ <BugList humanId={user?.humanId ? user?.humanId : ''} />
</main>
);
};