11import React from 'react'
2- import { useHistory , useLocation , Link as RouteLink } from 'react-router-dom'
2+ import { useHistory , useLocation } from 'react-router-dom'
33import { string } from 'prop-types'
44import {
55 Stack ,
66 SimpleGrid ,
77 Divider ,
88 Heading ,
99 Icon ,
10- Text ,
1110 Badge ,
12- Link ,
11+ Box ,
1312} from '@chakra-ui/core'
1413import { useQuery } from '@apollo/client'
1514import { useUserState } from './UserState'
@@ -22,29 +21,12 @@ import EditableUserPassword from './EditableUserPassword'
2221import { TrackerButton } from './TrackerButton'
2322import { LoadingMessage } from './LoadingMessage'
2423import { ErrorFallbackMessage } from './ErrorFallbackMessage'
25- import { ErrorBoundary } from 'react-error-boundary'
26- import { ListOf } from './ListOf'
2724
2825export default function UserPage ( ) {
2926 const location = useLocation ( )
3027 const history = useHistory ( )
3128 const { currentUser } = useUserState ( )
3229
33- // const {
34- // loading: queryUserLoading,
35- // error: queryUserError,
36- // data: queryUserData,
37- // } = useQuery(QUERY_USER, {
38- // context: {
39- // headers: {
40- // authorization: currentUser.jwt,
41- // },
42- // },
43- // variables: {
44- // userName: currentUser.userName,
45- // },
46- // })
47-
4830 const {
4931 loading : queryUserLoading ,
5032 error : queryUserError ,
@@ -69,10 +51,6 @@ export default function UserPage() {
6951 return < ErrorFallbackMessage error = { queryUserError } />
7052 }
7153
72- const affiliations = queryUserData . userPage . affiliations . edges . map (
73- ( e ) => e . node ,
74- )
75-
7654 return (
7755 < SimpleGrid columns = { { md : 1 , lg : 2 } } spacing = "60px" width = "100%" >
7856 < Stack p = { 25 } spacing = { 4 } >
@@ -95,56 +73,37 @@ export default function UserPage() {
9573 />
9674 </ Stack >
9775
98- < Stack Stack p = { 25 } spacing = "4" >
99- < Heading as = "h1" size = "lg" textAlign = "left" >
100- < Trans > Organizations</ Trans >
101- </ Heading >
102- < ListOf
103- elements = { affiliations }
104- ifEmpty = { ( ) => < Trans > No Organizations</ Trans > }
105- mb = "4"
106- >
107- { ( { permission, organization } , index ) => (
108- < ErrorBoundary key = { `userpage-errorbound-${ index } ` } FallbackComponent = { ErrorFallbackMessage } >
109- < Stack
110- mb = "2"
111- flexDirection = { [ 'column' , 'row' ] }
112- align = { [ 'flex-start' , 'center' ] }
113- key = { `${ organization . slug } :${ index } ` }
114- >
115- < Stack isInline align = "center" w = { [ '100%' , '70%' ] } >
116- < Link
117- as = { RouteLink }
118- to = { `/organizations/${ organization . slug } ` }
119- >
120- < Text fontWeight = "semibold" isTruncated mr = "1" >
121- { organization . name }
122- </ Text >
123- </ Link >
124- { organization . verified && (
125- < Icon name = "check-circle" color = "blue.500" />
126- ) }
127- </ Stack >
128- < Stack isInline align = "center" >
129- < Text fontWeight = "bold" > Role:</ Text >
130- < Badge
131- color = "primary"
132- bg = "transparent"
133- borderColor = "primary"
134- borderWidth = "1px"
135- >
136- { permission }
137- </ Badge >
138- </ Stack >
139- < Divider />
140- </ Stack >
141- </ ErrorBoundary >
142- ) }
143- </ ListOf >
144- < Divider />
76+ < Stack p = { 25 } spacing = "4" >
14577 < Heading as = "h1" size = "lg" textAlign = "left" >
14678 < Trans > Account Details</ Trans >
14779 </ Heading >
80+ < Box >
81+ < Icon
82+ size = "icons.lg"
83+ name = { queryUserData . userPage . tfaValidated ? 'check' : 'close' }
84+ color = {
85+ queryUserData . userPage . tfaValidated ? 'green.500' : 'red.500'
86+ }
87+ pr = { 2 }
88+ />
89+ < Badge variant = "outline" color = "gray.900" >
90+ < Trans > 2FA Validated</ Trans >
91+ </ Badge >
92+ </ Box >
93+ < Box >
94+ < Icon
95+ size = "icons.lg"
96+ name = { queryUserData . userPage . emailValidated ? 'check' : 'close' }
97+ color = {
98+ queryUserData . userPage . emailValidated ? 'green.500' : 'red.500'
99+ }
100+ pr = { 2 }
101+ />
102+ < Badge variant = "outline" color = "gray.900" >
103+ < Trans > Email Validated</ Trans >
104+ </ Badge >
105+ </ Box >
106+
148107 < TrackerButton
149108 w = { [ '100%' , '50%' ] }
150109 variant = "primary"
0 commit comments