File tree 5 files changed +32
-48
lines changed
components/DashboardAvatars
userDashboard/components/OrgTeamMembers
5 files changed +32
-48
lines changed Original file line number Diff line number Diff line change @@ -38,18 +38,14 @@ const TeamMemberAvatarMenu = (props: Props) => {
38
38
graphql `
39
39
fragment TeamMemberAvatarMenu_teamMember on TeamMember {
40
40
isSelf
41
- user {
42
- id
43
- preferredName
44
- }
41
+ userId
45
42
isLead
46
43
}
47
44
` ,
48
45
teamMemberRef
49
46
)
50
47
const atmosphere = useAtmosphere ( )
51
- const { user} = teamMember
52
- const { id : userId , preferredName} = user
48
+ const { userId} = teamMember
53
49
const { viewerId} = atmosphere
54
50
const isSelf = userId === viewerId
55
51
const isViewerTeamAdmin = isViewerLead || isViewerOrgAdmin
@@ -60,14 +56,14 @@ const TeamMemberAvatarMenu = (props: Props) => {
60
56
< MenuItem
61
57
key = 'promote'
62
58
onClick = { togglePromote }
63
- label = { < StyledLabel > Promote { preferredName } to Team Lead</ StyledLabel > }
59
+ label = { < StyledLabel > Promote to Team Lead</ StyledLabel > }
64
60
/>
65
61
) }
66
62
{ isViewerTeamAdmin && ! isSelf && (
67
63
< MenuItem
68
64
key = 'remove'
69
65
onClick = { toggleRemove }
70
- label = { < StyledLabel > Remove { preferredName } from Team</ StyledLabel > }
66
+ label = { < StyledLabel > Remove from Team</ StyledLabel > }
71
67
/>
72
68
) }
73
69
{ ! isViewerLead && isSelf && (
Original file line number Diff line number Diff line change 1
- import styled from '@emotion/styled'
2
1
import graphql from 'babel-plugin-relay/macro'
3
2
import { useFragment } from 'react-relay'
4
3
import useAtmosphere from '~/hooks/useAtmosphere'
@@ -12,14 +11,6 @@ import useMutationProps from '../../../../hooks/useMutationProps'
12
11
import PromoteToTeamLeadMutation from '../../../../mutations/PromoteToTeamLeadMutation'
13
12
import { upperFirst } from '../../../../utils/upperFirst'
14
13
15
- const StyledDialogContainer = styled ( DialogContainer ) ( {
16
- width : 420
17
- } )
18
-
19
- const StyledButton = styled ( PrimaryButton ) ( {
20
- margin : '1.5rem auto 0'
21
- } )
22
-
23
14
interface Props {
24
15
closePortal : ( ) => void
25
16
teamMember : PromoteTeamMemberModal_teamMember$key
@@ -70,15 +61,24 @@ const PromoteTeamMemberModal = (props: Props) => {
70
61
const copy = `${ copyStart } ${ copyEnd } `
71
62
72
63
return (
73
- < StyledDialogContainer >
64
+ < DialogContainer >
74
65
< DialogTitle > { 'Are you sure?' } </ DialogTitle >
75
66
< DialogContent >
76
67
{ copy }
77
- < StyledButton size = 'medium' onClick = { handleClick } waiting = { submitting } >
78
- < IconLabel icon = 'arrow_forward' iconAfter label = { `Yes, promote ${ preferredName } ` } />
79
- </ StyledButton >
68
+ < PrimaryButton
69
+ size = 'medium'
70
+ className = 'mx-auto mt-6 mb-0'
71
+ onClick = { handleClick }
72
+ waiting = { submitting }
73
+ >
74
+ < IconLabel
75
+ icon = 'arrow_forward'
76
+ iconAfter
77
+ label = { < div className = 'break-word whitespace-normal' > Yes, promote { preferredName } </ div > }
78
+ />
79
+ </ PrimaryButton >
80
80
</ DialogContent >
81
- </ StyledDialogContainer >
81
+ </ DialogContainer >
82
82
)
83
83
}
84
84
Original file line number Diff line number Diff line change 1
- import styled from '@emotion/styled'
2
1
import graphql from 'babel-plugin-relay/macro'
3
2
import { useFragment } from 'react-relay'
4
3
import useAtmosphere from '~/hooks/useAtmosphere'
@@ -10,14 +9,6 @@ import IconLabel from '../../../../components/IconLabel'
10
9
import PrimaryButton from '../../../../components/PrimaryButton'
11
10
import RemoveTeamMemberMutation from '../../../../mutations/RemoveTeamMemberMutation'
12
11
13
- const StyledDialogContainer = styled ( DialogContainer ) ( {
14
- width : 320
15
- } )
16
-
17
- const StyledButton = styled ( PrimaryButton ) ( {
18
- margin : '1.5rem auto 0'
19
- } )
20
-
21
12
interface Props {
22
13
closePortal : ( ) => void
23
14
teamMember : RemoveTeamMemberModal_teamMember$key
@@ -44,16 +35,20 @@ const RemoveTeamMemberModal = (props: Props) => {
44
35
RemoveTeamMemberMutation ( atmosphere , { teamMemberId} )
45
36
}
46
37
return (
47
- < StyledDialogContainer >
38
+ < DialogContainer >
48
39
< DialogTitle > Are you sure?</ DialogTitle >
49
40
< DialogContent >
50
41
This will remove { preferredName } from the team.
51
42
< br />
52
- < StyledButton size = 'medium' onClick = { handleClick } >
53
- < IconLabel icon = 'arrow_forward' iconAfter label = { `Remove ${ preferredName } ` } />
54
- </ StyledButton >
43
+ < PrimaryButton size = 'medium' className = 'mx-auto mt-6 mb-0' onClick = { handleClick } >
44
+ < IconLabel
45
+ icon = 'arrow_forward'
46
+ iconAfter
47
+ label = { < div className = 'break-word whitespace-normal' > Remove { preferredName } </ div > }
48
+ />
49
+ </ PrimaryButton >
55
50
</ DialogContent >
56
- </ StyledDialogContainer >
51
+ </ DialogContainer >
57
52
)
58
53
}
59
54
Original file line number Diff line number Diff line change @@ -37,18 +37,14 @@ export const OrgTeamMemberMenu = (props: OrgTeamMemberMenuProps) => {
37
37
graphql `
38
38
fragment OrgTeamMemberMenu_teamMember on TeamMember {
39
39
isSelf
40
- user {
41
- id
42
- preferredName
43
- }
40
+ userId
44
41
isLead
45
42
}
46
43
` ,
47
44
teamMemberRef
48
45
)
49
46
const atmosphere = useAtmosphere ( )
50
- const { user} = teamMember
51
- const { id : userId , preferredName} = user
47
+ const { userId} = teamMember
52
48
const { viewerId} = atmosphere
53
49
const isSelf = userId === viewerId
54
50
const isViewerTeamAdmin = isViewerLead || isViewerOrgAdmin
@@ -57,16 +53,13 @@ export const OrgTeamMemberMenu = (props: OrgTeamMemberMenuProps) => {
57
53
< Menu ariaLabel = { 'Select your action' } { ...menuProps } >
58
54
{ isViewerTeamAdmin && ( ! isSelf || ! isViewerLead ) && (
59
55
< MenuItem
60
- label = { < StyledLabel > Promote { preferredName } to Team Lead</ StyledLabel > }
56
+ label = { < StyledLabel > Promote to Team Lead</ StyledLabel > }
61
57
key = 'promote'
62
58
onClick = { togglePromote }
63
59
/>
64
60
) }
65
61
{ isViewerTeamAdmin && ! isSelf && (
66
- < MenuItem
67
- label = { < StyledLabel > Remove { preferredName } from Team</ StyledLabel > }
68
- onClick = { toggleRemove }
69
- />
62
+ < MenuItem label = { < StyledLabel > Remove from Team</ StyledLabel > } onClick = { toggleRemove } />
70
63
) }
71
64
</ Menu >
72
65
)
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export default {
34
34
const team = await dataLoader . get ( 'teams' ) . loadNonNull ( teamId )
35
35
const [ isOrgAdmin , teamMember ] = await Promise . all ( [
36
36
isUserOrgAdmin ( viewerId , team . orgId , dataLoader ) ,
37
- dataLoader . get ( 'teamMembers' ) . loadNonNull ( TeamMemberId . join ( teamId , viewerId ) )
37
+ dataLoader . get ( 'teamMembers' ) . load ( TeamMemberId . join ( teamId , viewerId ) )
38
38
] )
39
39
const isViewerTeamLead = teamMember ?. isLead
40
40
const isSelf = viewerId === userId
You can’t perform that action at this time.
0 commit comments