import InfoIcon from '@mui/icons-material/Info'; import MailOutlineIcon from '@mui/icons-material/MailOutline'; import { Link, Paper, Typography } from '@mui/material'; import Avatar from '@mui/material/Avatar'; import CircularProgress from '@mui/material/CircularProgress'; import Grid from '@mui/material/Grid'; import makeStyles from '@mui/styles/makeStyles'; import { Link as RouterLink } from 'react-router-dom'; import { IdentityFragment } from '../../components/Identity/IdentityFragment.generated'; import { useGetUserStatisticQuery } from './GetUserStatistic.generated'; const useStyles = makeStyles((theme) => ({ main: { maxWidth: 1000, margin: 'auto', marginTop: theme.spacing(3), }, content: { padding: theme.spacing(0.5, 2, 2, 2), wordWrap: 'break-word', }, large: { minWidth: 200, minHeight: 200, margin: 'auto', maxWidth: '100%', maxHeight: '100%', }, heading: { marginTop: theme.spacing(3), }, header: { ...theme.typography.h4, wordBreak: 'break-word', }, infoIcon: { verticalAlign: 'bottom', }, })); type Props = { identity: IdentityFragment; }; const Identity = ({ identity }: Props) => { const classes = useStyles(); const user = identity; const { loading, error, data } = useGetUserStatisticQuery({ variables: { authorQuery: 'author:' + user?.id, participantQuery: 'participant:' + user?.id, actionQuery: 'actor:' + user?.id, }, }); if (loading) return ; if (error) return

Error: {error}

; const statistic = data?.repository; const authoredCount = statistic?.authored?.totalCount; const participatedCount = statistic?.participated?.totalCount; const actionCount = statistic?.actions?.totalCount; return (
{user?.displayName.charAt(0).toUpperCase()}

{user?.name}

Name: {user?.displayName ? user?.displayName : '---'} Id (truncated): {user?.humanId ? user?.humanId : '---'} {user?.email && ( {user?.email} )}

Statistics

Created {authoredCount} bugs. Participated to {participatedCount} bugs. Interacted with {actionCount} bugs.
); }; export default Identity;