@@ -17,6 +17,7 @@ import { ThemeContext } from "../theme-context";
17
17
import { PrebuildWithStatus , Project } from "@gitpod/gitpod-protocol" ;
18
18
import { toRemoteURL } from "./render-utils" ;
19
19
import ContextMenu from "../components/ContextMenu" ;
20
+ import ConfirmationModal from "../components/ConfirmationModal"
20
21
import { prebuildStatusIcon } from "./Prebuilds" ;
21
22
22
23
export default function ( ) {
@@ -68,6 +69,7 @@ export default function () {
68
69
}
69
70
70
71
const onRemoveProject = async ( p : Project ) => {
72
+ setRemoveModalVisible ( false )
71
73
await getGitpodService ( ) . server . deleteProject ( p . id ) ;
72
74
await updateProjects ( ) ;
73
75
}
@@ -84,8 +86,24 @@ export default function () {
84
86
}
85
87
86
88
const teamOrUserSlug = ! ! team ? 't/' + team . slug : 'projects' ;
89
+ let [ isRemoveModalVisible , setRemoveModalVisible ] = useState ( false ) ;
90
+ let [ removeProjectHandler , setRemoveProjectHandler ] = useState < ( ) => void > ( ( ) => ( ) => { } )
91
+ let [ willRemoveProject , setWillRemoveProject ] = useState < Project > ( )
87
92
88
93
return < >
94
+
95
+ { isRemoveModalVisible && < ConfirmationModal
96
+ title = "Remove Project"
97
+ areYouSureText = "Are you sure you want to remove this project from this team? Team members will also lose access to this project."
98
+ children = { {
99
+ name : willRemoveProject ?. name ?? "" ,
100
+ description : willRemoveProject ?. cloneUrl ?? "" ,
101
+ } }
102
+ buttonText = "Remove Project"
103
+ visible = { isRemoveModalVisible }
104
+ onClose = { ( ) => setRemoveModalVisible ( false ) }
105
+ onConfirm = { removeProjectHandler }
106
+ /> }
89
107
< Header title = "Projects" subtitle = "Manage recently added projects." />
90
108
{ projects . length === 0 && (
91
109
< div >
@@ -133,7 +151,13 @@ export default function () {
133
151
{
134
152
title : "Remove Project" ,
135
153
customFontStyle : 'text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300' ,
136
- onClick : ( ) => onRemoveProject ( p )
154
+ onClick : ( ) => {
155
+ setWillRemoveProject ( p )
156
+ setRemoveProjectHandler ( ( ) => ( ) => {
157
+ onRemoveProject ( p )
158
+ } )
159
+ setRemoveModalVisible ( true )
160
+ }
137
161
} ,
138
162
] } />
139
163
</ div >
0 commit comments