aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'webui/src/components')
-rw-r--r--webui/src/components/Author.tsx12
-rw-r--r--webui/src/components/BugTitleForm/BugTitleForm.tsx6
-rw-r--r--webui/src/components/CurrentIdentity/CurrentIdentity.graphql14
-rw-r--r--webui/src/components/Header/Header.tsx2
-rw-r--r--webui/src/components/Identity/CurrentIdentity.graphql9
-rw-r--r--webui/src/components/Identity/CurrentIdentity.tsx (renamed from webui/src/components/CurrentIdentity/CurrentIdentity.tsx)4
-rw-r--r--webui/src/components/Identity/IdentityFragment.graphql10
-rw-r--r--webui/src/components/Identity/UserIdentity.graphql9
-rw-r--r--webui/src/components/IfLoggedIn/IfLoggedIn.tsx2
9 files changed, 44 insertions, 24 deletions
diff --git a/webui/src/components/Author.tsx b/webui/src/components/Author.tsx
index d60e8969..272ca5b5 100644
--- a/webui/src/components/Author.tsx
+++ b/webui/src/components/Author.tsx
@@ -1,6 +1,8 @@
import React from 'react';
+import { Link as RouterLink } from 'react-router-dom';
import MAvatar from '@material-ui/core/Avatar';
+import Link from '@material-ui/core/Link';
import Tooltip from '@material-ui/core/Tooltip/Tooltip';
import { AuthoredFragment } from '../graphql/fragments.generated';
@@ -11,13 +13,11 @@ type Props = AuthoredFragment & {
};
const Author = ({ author, ...props }: Props) => {
- if (!author.email) {
- return <span {...props}>{author.displayName}</span>;
- }
-
return (
- <Tooltip title={author.email}>
- <span {...props}>{author.displayName}</span>
+ <Tooltip title={`Goto the ${author.displayName}'s profile.`}>
+ <Link {...props} component={RouterLink} to={`/user/${author.humanId}`}>
+ {author.displayName}
+ </Link>
</Tooltip>
);
};
diff --git a/webui/src/components/BugTitleForm/BugTitleForm.tsx b/webui/src/components/BugTitleForm/BugTitleForm.tsx
index 665ecd4c..1092b203 100644
--- a/webui/src/components/BugTitleForm/BugTitleForm.tsx
+++ b/webui/src/components/BugTitleForm/BugTitleForm.tsx
@@ -52,6 +52,10 @@ const useStyles = makeStyles((theme) => ({
saveButton: {
marginRight: theme.spacing(1),
},
+ author: {
+ fontWeight: 'bold',
+ color: theme.palette.text.secondary,
+ },
}));
interface Props {
@@ -182,7 +186,7 @@ function BugTitleForm({ bug }: Props) {
{bugTitleEdition ? editableBugTitle() : readonlyBugTitle()}
<div className="classes.headerSubtitle">
<Typography color={'textSecondary'}>
- <Author author={bug.author} />
+ <Author author={bug.author} className={classes.author} />
{' opened this bug '}
<Date date={bug.createdAt} />
</Typography>
diff --git a/webui/src/components/CurrentIdentity/CurrentIdentity.graphql b/webui/src/components/CurrentIdentity/CurrentIdentity.graphql
deleted file mode 100644
index 5a1786f7..00000000
--- a/webui/src/components/CurrentIdentity/CurrentIdentity.graphql
+++ /dev/null
@@ -1,14 +0,0 @@
-query CurrentIdentity {
- repository {
- userIdentity {
- id
- humanId
- displayName
- email
- name
- avatarUrl
- isProtected
- login
- }
- }
-}
diff --git a/webui/src/components/Header/Header.tsx b/webui/src/components/Header/Header.tsx
index 63146cc9..56b35968 100644
--- a/webui/src/components/Header/Header.tsx
+++ b/webui/src/components/Header/Header.tsx
@@ -8,7 +8,7 @@ import Toolbar from '@material-ui/core/Toolbar';
import Tooltip from '@material-ui/core/Tooltip/Tooltip';
import { makeStyles } from '@material-ui/core/styles';
-import CurrentIdentity from '../CurrentIdentity/CurrentIdentity';
+import CurrentIdentity from '../Identity/CurrentIdentity';
import { LightSwitch } from '../Themer';
const useStyles = makeStyles((theme) => ({
diff --git a/webui/src/components/Identity/CurrentIdentity.graphql b/webui/src/components/Identity/CurrentIdentity.graphql
new file mode 100644
index 00000000..054190df
--- /dev/null
+++ b/webui/src/components/Identity/CurrentIdentity.graphql
@@ -0,0 +1,9 @@
+#import "./IdentityFragment.graphql"
+
+query CurrentIdentity {
+ repository {
+ userIdentity {
+ ...Identity
+ }
+ }
+}
diff --git a/webui/src/components/CurrentIdentity/CurrentIdentity.tsx b/webui/src/components/Identity/CurrentIdentity.tsx
index 962ce9ec..1fd424c1 100644
--- a/webui/src/components/CurrentIdentity/CurrentIdentity.tsx
+++ b/webui/src/components/Identity/CurrentIdentity.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { Link as RouterLink } from 'react-router-dom';
import {
Button,
@@ -94,7 +95,8 @@ const CurrentIdentity = () => {
<Link
color="inherit"
className={classes.profileLink}
- href="/user"
+ component={RouterLink}
+ to={`/user/${user.humanId}`}
>
Open profile
</Link>
diff --git a/webui/src/components/Identity/IdentityFragment.graphql b/webui/src/components/Identity/IdentityFragment.graphql
new file mode 100644
index 00000000..6c4e2483
--- /dev/null
+++ b/webui/src/components/Identity/IdentityFragment.graphql
@@ -0,0 +1,10 @@
+fragment Identity on Identity {
+ id
+ humanId
+ displayName
+ email
+ name
+ avatarUrl
+ isProtected
+ login
+}
diff --git a/webui/src/components/Identity/UserIdentity.graphql b/webui/src/components/Identity/UserIdentity.graphql
new file mode 100644
index 00000000..9cf10248
--- /dev/null
+++ b/webui/src/components/Identity/UserIdentity.graphql
@@ -0,0 +1,9 @@
+#import "./IdentityFragment.graphql"
+
+query GetUserById($userId: String!) {
+ repository {
+ identity(prefix: $userId) {
+ ...Identity
+ }
+ }
+}
diff --git a/webui/src/components/IfLoggedIn/IfLoggedIn.tsx b/webui/src/components/IfLoggedIn/IfLoggedIn.tsx
index 2476aad8..ce120da1 100644
--- a/webui/src/components/IfLoggedIn/IfLoggedIn.tsx
+++ b/webui/src/components/IfLoggedIn/IfLoggedIn.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import { useCurrentIdentityQuery } from '../CurrentIdentity/CurrentIdentity.generated';
+import { useCurrentIdentityQuery } from '../Identity/CurrentIdentity.generated';
type Props = { children: () => React.ReactNode };
const IfLoggedIn = ({ children }: Props) => {