From 022f510369688084af5bcf314a97fd332d7ee265 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 4 Feb 2020 22:03:21 +0100 Subject: webui: convert more things to typescript --- webui/src/CurrentIdentity.tsx | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 webui/src/CurrentIdentity.tsx (limited to 'webui/src/CurrentIdentity.tsx') diff --git a/webui/src/CurrentIdentity.tsx b/webui/src/CurrentIdentity.tsx new file mode 100644 index 00000000..0a697cdd --- /dev/null +++ b/webui/src/CurrentIdentity.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import Avatar from '@material-ui/core/Avatar'; +import { makeStyles } from '@material-ui/core/styles'; + +import { useCurrentIdentityQuery } from './CurrentIdentity.generated'; + +const useStyles = makeStyles(theme => ({ + displayName: { + marginLeft: theme.spacing(2), + }, +})); + +const CurrentIdentity = () => { + const classes = useStyles(); + const { loading, error, data } = useCurrentIdentityQuery(); + + if (error || loading || !data?.defaultRepository?.userIdentity) + return null; + + const user = data.defaultRepository.userIdentity; + return ( + <> + + {user.displayName.charAt(0).toUpperCase()} + +
{user.displayName}
+ + ); +}; + +export default CurrentIdentity; -- cgit From e5f52401b2a839881fedef5a446f0ed21d2d34c2 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 11 Feb 2020 20:16:56 +0100 Subject: webui: typecheck remaining bug list components --- webui/src/CurrentIdentity.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'webui/src/CurrentIdentity.tsx') diff --git a/webui/src/CurrentIdentity.tsx b/webui/src/CurrentIdentity.tsx index 0a697cdd..07ff648c 100644 --- a/webui/src/CurrentIdentity.tsx +++ b/webui/src/CurrentIdentity.tsx @@ -14,8 +14,7 @@ const CurrentIdentity = () => { const classes = useStyles(); const { loading, error, data } = useCurrentIdentityQuery(); - if (error || loading || !data?.defaultRepository?.userIdentity) - return null; + if (error || loading || !data?.defaultRepository?.userIdentity) return null; const user = data.defaultRepository.userIdentity; return ( -- cgit From 9ddcb4b09215f942cb7889f9756d426ad3c90253 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 11 Feb 2020 20:54:01 +0100 Subject: webui: force import order --- webui/src/CurrentIdentity.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webui/src/CurrentIdentity.tsx') diff --git a/webui/src/CurrentIdentity.tsx b/webui/src/CurrentIdentity.tsx index 07ff648c..5b8fcbb9 100644 --- a/webui/src/CurrentIdentity.tsx +++ b/webui/src/CurrentIdentity.tsx @@ -1,6 +1,6 @@ -import React from 'react'; import Avatar from '@material-ui/core/Avatar'; import { makeStyles } from '@material-ui/core/styles'; +import React from 'react'; import { useCurrentIdentityQuery } from './CurrentIdentity.generated'; -- cgit From 465f7ca73d7093eeeecb6553c804d8cfb06e6652 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 11 Feb 2020 21:49:19 +0100 Subject: webui: stop using defaultRepository --- webui/src/CurrentIdentity.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'webui/src/CurrentIdentity.tsx') diff --git a/webui/src/CurrentIdentity.tsx b/webui/src/CurrentIdentity.tsx index 5b8fcbb9..256f44c4 100644 --- a/webui/src/CurrentIdentity.tsx +++ b/webui/src/CurrentIdentity.tsx @@ -14,9 +14,9 @@ const CurrentIdentity = () => { const classes = useStyles(); const { loading, error, data } = useCurrentIdentityQuery(); - if (error || loading || !data?.defaultRepository?.userIdentity) return null; + if (error || loading || !data?.repository?.userIdentity) return null; - const user = data.defaultRepository.userIdentity; + const user = data.repository.userIdentity; return ( <> -- cgit