@@ -17,15 +17,15 @@ import { getCurrentTeam, TeamsContext } from "./teams-context";
17
17
export function getTeamSettingsMenu ( team ?: Team ) {
18
18
return [
19
19
{
20
- title : ' General' ,
20
+ title : " General" ,
21
21
link : [ `/t/${ team ?. slug } /settings` ] ,
22
22
} ,
23
23
] ;
24
24
}
25
25
26
26
export default function TeamSettings ( ) {
27
27
const [ modal , setModal ] = useState ( false ) ;
28
- const [ teamSlug , setTeamSlug ] = useState ( '' ) ;
28
+ const [ teamSlug , setTeamSlug ] = useState ( "" ) ;
29
29
const [ isUserOwner , setIsUserOwner ] = useState ( true ) ;
30
30
const { teams } = useContext ( TeamsContext ) ;
31
31
const { user } = useContext ( UserContext ) ;
@@ -38,46 +38,66 @@ export default function TeamSettings() {
38
38
( async ( ) => {
39
39
if ( ! team ) return ;
40
40
const members = await getGitpodService ( ) . server . getTeamMembers ( team . id ) ;
41
- const currentUserInTeam = members . find ( member => member . userId === user ?. id ) ;
42
- setIsUserOwner ( currentUserInTeam ?. role === ' owner' ) ;
41
+ const currentUserInTeam = members . find ( ( member ) => member . userId === user ?. id ) ;
42
+ setIsUserOwner ( currentUserInTeam ?. role === " owner" ) ;
43
43
} ) ( ) ;
44
44
} , [ ] ) ;
45
45
46
46
if ( ! isUserOwner ) {
47
- return < Redirect to = "/" />
48
- } ;
47
+ return < Redirect to = "/" /> ;
48
+ }
49
49
const deleteTeam = async ( ) => {
50
50
if ( ! team || ! user ) {
51
- return
51
+ return ;
52
52
}
53
53
await getGitpodService ( ) . server . deleteTeam ( team . id , user . id ) ;
54
54
document . location . href = gitpodHostUrl . asDashboard ( ) . toString ( ) ;
55
55
} ;
56
56
57
- return < >
58
- < PageWithSubMenu subMenu = { getTeamSettingsMenu ( team ) } title = "Settings" subtitle = "Manage general team settings." >
59
- < h3 > Delete Team</ h3 >
60
- < p className = "text-base text-gray-500 pb-4 max-w-2xl" > Deleting this team will also remove all associated data with this team, including projects and workspaces. Deleted teams cannot be restored!</ p >
61
- < button className = "danger secondary" onClick = { ( ) => setModal ( true ) } > Delete Team</ button >
62
- </ PageWithSubMenu >
57
+ return (
58
+ < >
59
+ < PageWithSubMenu
60
+ subMenu = { getTeamSettingsMenu ( team ) }
61
+ title = "Settings"
62
+ subtitle = "Manage general team settings."
63
+ >
64
+ < h3 > Delete Team</ h3 >
65
+ < p className = "text-base text-gray-500 pb-4 max-w-2xl" >
66
+ Deleting this team will also remove all associated data with this team, including projects and
67
+ workspaces. Deleted teams cannot be restored!
68
+ </ p >
69
+ < button className = "danger secondary" onClick = { ( ) => setModal ( true ) } >
70
+ Delete Team
71
+ </ button >
72
+ </ PageWithSubMenu >
63
73
64
- < ConfirmationModal
65
- title = "Delete Team"
66
- buttonText = "Delete Team"
67
- buttonDisabled = { teamSlug !== team ! . slug }
68
- visible = { modal }
69
- warningText = "Warning: This action cannot be reversed."
70
- onClose = { close }
71
- onConfirm = { deleteTeam }
72
- >
73
- < p className = "text-base text-gray-500" > You are about to permanently delete < b > { team ?. slug } </ b > including all associated data with this team.</ p >
74
- < ol className = "text-gray-500 text-m list-outside list-decimal" >
75
- < li className = "ml-5" > All < b > projects</ b > added in this team will be deleted and cannot be restored afterwards.</ li >
76
- < li className = "ml-5" > All < b > workspaces</ b > opened for projects within this team will be deleted for all team members and cannot be restored afterwards.</ li >
77
- < li className = "ml-5" > All < b > members</ b > of this team will lose access to this team, associated projects and workspaces.</ li >
78
- </ ol >
79
- < p className = "pt-4 pb-2 text-gray-600 dark:text-gray-400 text-base font-semibold" > Type < CodeText > { team ?. slug } </ CodeText > to confirm</ p >
80
- < input autoFocus className = "w-full" type = "text" onChange = { e => setTeamSlug ( e . target . value ) } > </ input >
81
- </ ConfirmationModal >
82
- </ >
74
+ < ConfirmationModal
75
+ title = "Delete Team"
76
+ buttonText = "Delete Team"
77
+ buttonDisabled = { teamSlug !== team ! . slug }
78
+ visible = { modal }
79
+ warningText = "Warning: This action cannot be reversed."
80
+ onClose = { close }
81
+ onConfirm = { deleteTeam }
82
+ >
83
+ < p className = "text-base text-gray-500" >
84
+ You are about to permanently delete < b > { team ?. slug } </ b > including all associated data with this
85
+ team.
86
+ </ p >
87
+ < ol className = "text-gray-500 text-m list-outside list-decimal" >
88
+ < li className = "ml-5" >
89
+ All < b > projects</ b > added in this team will be deleted and cannot be restored afterwards.
90
+ </ li >
91
+ < li className = "ml-5" >
92
+ All < b > members</ b > of this team will lose access to this team, associated projects and
93
+ workspaces.
94
+ </ li >
95
+ </ ol >
96
+ < p className = "pt-4 pb-2 text-gray-600 dark:text-gray-400 text-base font-semibold" >
97
+ Type < CodeText > { team ?. slug } </ CodeText > to confirm
98
+ </ p >
99
+ < input autoFocus className = "w-full" type = "text" onChange = { ( e ) => setTeamSlug ( e . target . value ) } > </ input >
100
+ </ ConfirmationModal >
101
+ </ >
102
+ ) ;
83
103
}
0 commit comments