1
1
import { useQuery } from '@apollo/client' ;
2
2
import { Edit } from '@mui/icons-material' ;
3
- import { Skeleton , Tooltip , Typography } from '@mui/material' ;
3
+ import { Box , Skeleton , Stack , Tooltip , Typography } from '@mui/material' ;
4
4
import { useInterval } from 'ahooks' ;
5
5
import { DateTime } from 'luxon' ;
6
6
import { useState } from 'react' ;
7
7
import { Helmet } from 'react-helmet-async' ;
8
8
import { useParams } from 'react-router-dom' ;
9
- import { makeStyles } from 'tss-react/mui' ;
10
9
import { PartialDeep } from 'type-fest' ;
11
10
import { RoleLabels } from '~/api/schema.graphql' ;
12
11
import { canEditAny , labelsFrom } from '~/common' ;
@@ -26,34 +25,7 @@ import { UsersQueryVariables } from '../List/users.graphql';
26
25
import { ImpersonationToggle } from './ImpersonationToggle' ;
27
26
import { UserDocument } from './UserDetail.graphql' ;
28
27
29
- const useStyles = makeStyles ( ) ( ( { spacing, breakpoints } ) => ( {
30
- root : {
31
- overflowY : 'auto' ,
32
- padding : spacing ( 4 ) ,
33
- '& > *:not(:last-child)' : {
34
- marginBottom : spacing ( 3 ) ,
35
- } ,
36
- maxWidth : breakpoints . values . md ,
37
- } ,
38
- header : {
39
- flex : 1 ,
40
- display : 'flex' ,
41
- gap : spacing ( 1 ) ,
42
- } ,
43
- name : {
44
- marginRight : spacing ( 2 ) , // a little extra between text and buttons
45
- lineHeight : 'inherit' , // centers text with buttons better
46
- } ,
47
- partnersContainer : {
48
- marginTop : spacing ( 1 ) ,
49
- } ,
50
- partner : {
51
- marginBottom : spacing ( 2 ) ,
52
- } ,
53
- } ) ) ;
54
-
55
28
export const UserDetail = ( ) => {
56
- const { classes } = useStyles ( ) ;
57
29
const { userId = '' } = useParams ( ) ;
58
30
const { data, error } = useQuery ( UserDocument , {
59
31
variables : { userId } ,
@@ -67,14 +39,34 @@ export const UserDetail = () => {
67
39
const canEditAnyFields = canEditAny ( user ) ;
68
40
69
41
return (
70
- < main className = { classes . root } >
42
+ < Stack
43
+ component = "main"
44
+ sx = { {
45
+ overflowY : 'auto' ,
46
+ p : 4 ,
47
+ gap : 3 ,
48
+ maxWidth : ( theme ) => theme . breakpoints . values . md ,
49
+ } }
50
+ >
71
51
< Helmet title = { user ?. fullName ?? undefined } />
72
52
{ error ? (
73
53
< Typography variant = "h4" > Error loading person</ Typography >
74
54
) : (
75
55
< >
76
- < div className = { classes . header } >
77
- < Typography variant = "h2" className = { classes . name } >
56
+ < Box
57
+ sx = { {
58
+ flex : 1 ,
59
+ display : 'flex' ,
60
+ gap : 1 ,
61
+ } }
62
+ >
63
+ < Typography
64
+ variant = "h2"
65
+ sx = { {
66
+ mr : 2 , // a little extra between text and buttons
67
+ lineHeight : 'inherit' , // centers text with buttons better
68
+ } }
69
+ >
78
70
{ ! user ? (
79
71
< Skeleton width = "20ch" />
80
72
) : (
@@ -103,7 +95,12 @@ export const UserDetail = () => {
103
95
/>
104
96
< ToggleCommentsButton loading = { ! user } />
105
97
< ImpersonationToggle user = { user } />
106
- </ div >
98
+ </ Box >
99
+ < DisplayProperty
100
+ label = "Status"
101
+ value = { user ?. status . value }
102
+ loading = { ! user }
103
+ />
107
104
< DisplayProperty
108
105
label = "Email"
109
106
value = { user ?. email . value }
@@ -143,20 +140,16 @@ export const UserDetail = () => {
143
140
{ ! ! user ?. partners . items . length && (
144
141
< >
145
142
< Typography variant = "h3" > Partners</ Typography >
146
- < div className = { classes . partnersContainer } >
143
+ < Stack sx = { { mt : 1 , gap : 2 } } >
147
144
{ user . partners . items . map ( ( item ) => (
148
- < PartnerListItemCard
149
- key = { item . id }
150
- partner = { item }
151
- className = { classes . partner }
152
- />
145
+ < PartnerListItemCard key = { item . id } partner = { item } />
153
146
) ) }
154
- </ div >
147
+ </ Stack >
155
148
</ >
156
149
) }
157
150
</ >
158
151
) }
159
- </ main >
152
+ </ Stack >
160
153
) ;
161
154
} ;
162
155
0 commit comments