1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
import React from 'react';
import {
Checkbox,
Divider,
FormControl,
FormControlLabel,
FormGroup,
FormLabel,
Paper,
TextField,
} from '@material-ui/core';
import Avatar from '@material-ui/core/Avatar';
import { makeStyles } from '@material-ui/core/styles';
import { useCurrentIdentityQuery } from '../../components/CurrentIdentity/CurrentIdentity.generated';
const useStyles = makeStyles((theme) => ({
main: {
maxWidth: 1200,
margin: 'auto',
marginTop: theme.spacing(4),
},
container: {
display: 'flex',
marginBottom: theme.spacing(1),
marginRight: theme.spacing(2),
marginLeft: theme.spacing(2),
},
leftSidebar: {
marginTop: theme.spacing(2),
marginRight: theme.spacing(2),
},
content: {
marginTop: theme.spacing(5),
marginRight: theme.spacing(4),
padding: theme.spacing(3, 2),
minWidth: 800,
display: 'flex',
backgroundColor: theme.palette.background.paper,
},
rightSidebar: {
marginTop: theme.spacing(5),
flex: '0 0 200px',
},
large: {
width: theme.spacing(20),
height: theme.spacing(20),
},
control: {
paddingBottom: theme.spacing(3),
},
}));
const Identity = () => {
// eslint-disable-next-line
const classes = useStyles();
// eslint-disable-next-line
const { loading, error, data } = useCurrentIdentityQuery();
const user = data?.repository?.userIdentity;
console.log(user);
return (
<main className={classes.main}>
<div className={classes.container}>
<div className={classes.leftSidebar}>
<h1>{user?.displayName ? user?.displayName : 'none'}</h1>
<Avatar src={user?.avatarUrl ? user.avatarUrl : undefined}>
{user?.displayName.charAt(0).toUpperCase()}
</Avatar>
</div>
<Paper className={classes.content}>
<Divider variant="fullWidth" />
<FormControl component="fieldset">
<FormGroup>
<FormLabel className={classes.control} component="legend">
Your account
</FormLabel>
<TextField
className={classes.control}
label="Name"
variant="outlined"
value={user?.name ? user?.name : '---'}
/>
<TextField
className={classes.control}
label="Id (truncated)"
variant="outlined"
value={user?.humanId ? user?.humanId : '---'}
/>
<TextField
className={classes.control}
label="Id (full)"
variant="outlined"
value={user?.id ? user?.id : '---'}
/>
<TextField
className={classes.control}
label="E-Mail"
variant="outlined"
value={user?.email ? user?.email : '---'}
/>
<TextField
className={classes.control}
label="Login"
variant="outlined"
value={user?.login ? user?.login : '---'}
/>
<FormControlLabel
className={classes.control}
label="Protected"
labelPlacement="end"
value={user?.isProtected}
control={<Checkbox color="secondary" indeterminate />}
/>
</FormGroup>
</FormControl>
</Paper>
<div className={classes.rightSidebar}>
<Avatar
src={user?.avatarUrl ? user.avatarUrl : undefined}
className={classes.large}
>
{user?.displayName.charAt(0).toUpperCase()}
</Avatar>
</div>
</div>
</main>
);
};
export default Identity;
|