aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/components/CurrentIdentity
diff options
context:
space:
mode:
authorSascha <GlancingMind@outlook.com>2021-03-20 15:13:10 +0100
committerSascha <GlancingMind@outlook.com>2021-04-13 19:07:57 +0200
commit41e85023019bc13c06a1de2c431e0bd920e9e29a (patch)
tree95ea962e484912538f3b8611d3eb54056bbf3658 /webui/src/components/CurrentIdentity
parent998ae348b10efd5af758944143b70125a98e8f86 (diff)
downloadgit-bug-41e85023019bc13c06a1de2c431e0bd920e9e29a.tar.gz
Use profile page for each identity
Authorcomponent links to the authors profile page. Replace pofile buglist with statistics
Diffstat (limited to 'webui/src/components/CurrentIdentity')
-rw-r--r--webui/src/components/CurrentIdentity/CurrentIdentity.graphql14
-rw-r--r--webui/src/components/CurrentIdentity/CurrentIdentity.tsx112
2 files changed, 0 insertions, 126 deletions
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/CurrentIdentity/CurrentIdentity.tsx b/webui/src/components/CurrentIdentity/CurrentIdentity.tsx
deleted file mode 100644
index 962ce9ec..00000000
--- a/webui/src/components/CurrentIdentity/CurrentIdentity.tsx
+++ /dev/null
@@ -1,112 +0,0 @@
-import React from 'react';
-
-import {
- Button,
- ClickAwayListener,
- Grow,
- Link,
- MenuItem,
- MenuList,
- Paper,
- Popper,
-} from '@material-ui/core';
-import Avatar from '@material-ui/core/Avatar';
-import { makeStyles } from '@material-ui/core/styles';
-import LockIcon from '@material-ui/icons/Lock';
-
-import { useCurrentIdentityQuery } from './CurrentIdentity.generated';
-
-const useStyles = makeStyles((theme) => ({
- displayName: {
- marginLeft: theme.spacing(2),
- },
- hidden: {
- display: 'none',
- },
- profileLink: {
- ...theme.typography.button,
- },
- popupButton: {
- textTransform: 'none',
- color: theme.palette.primary.contrastText,
- },
-}));
-
-const CurrentIdentity = () => {
- const classes = useStyles();
- const { loading, error, data } = useCurrentIdentityQuery();
-
- const [open, setOpen] = React.useState(false);
- const anchorRef = React.useRef<HTMLButtonElement>(null);
-
- if (error || loading || !data?.repository?.userIdentity) return null;
-
- const user = data.repository.userIdentity;
-
- const handleToggle = () => {
- setOpen((prevOpen) => !prevOpen);
- };
-
- const handleClose = (event: any) => {
- if (anchorRef.current && anchorRef.current.contains(event.target)) {
- return;
- }
- setOpen(false);
- };
-
- return (
- <>
- <Button
- ref={anchorRef}
- aria-controls={open ? 'menu-list-grow' : undefined}
- aria-haspopup="true"
- onClick={handleToggle}
- className={classes.popupButton}
- >
- <Avatar src={user.avatarUrl ? user.avatarUrl : undefined}>
- {user.displayName.charAt(0).toUpperCase()}
- </Avatar>
- <div className={classes.displayName}>{user.displayName}</div>
- <LockIcon
- color="secondary"
- className={user.isProtected ? '' : classes.hidden}
- />
- </Button>
- <Popper
- open={open}
- anchorEl={anchorRef.current}
- role={undefined}
- transition
- disablePortal
- >
- {({ TransitionProps, placement }) => (
- <Grow
- {...TransitionProps}
- style={{
- transformOrigin:
- placement === 'bottom' ? 'center top' : 'center bottom',
- }}
- >
- <Paper>
- <ClickAwayListener onClickAway={handleClose}>
- <MenuList autoFocusItem={open} id="menu-list-grow">
- <MenuItem>
- <Link
- color="inherit"
- className={classes.profileLink}
- href="/user"
- >
- Open profile
- </Link>
- </MenuItem>
- </MenuList>
- </ClickAwayListener>
- </Paper>
- </Grow>
- )}
- </Popper>
- </>
- );
-};
-
-export default CurrentIdentity;