@@ -12,6 +12,7 @@ import { ProjectMenuCardContextMenu } from "./project.menu-card-context-menu";
12
12
import { ProjectMenuDetailsPlaceholder } from "./project-menu-details-placeholder" ;
13
13
import { ProjectMenuDetails } from "./project-menu-details" ;
14
14
import { downloadWorkspace } from "#/utils/download-workspace" ;
15
+ import { LoadingSpinner } from "../modals/LoadingProject" ;
15
16
16
17
interface ProjectMenuCardProps {
17
18
isConnectedToGitHub : boolean ;
@@ -32,6 +33,7 @@ export function ProjectMenuCard({
32
33
const [ contextMenuIsOpen , setContextMenuIsOpen ] = React . useState ( false ) ;
33
34
const [ connectToGitHubModalOpen , setConnectToGitHubModalOpen ] =
34
35
React . useState ( false ) ;
36
+ const [ working , setWorking ] = React . useState ( false ) ;
35
37
36
38
const toggleMenuVisibility = ( ) => {
37
39
setContextMenuIsOpen ( ( prev ) => ! prev ) ;
@@ -63,15 +65,19 @@ Finally, open up a pull request using the GitHub API and the token in the GITHUB
63
65
const handleDownloadWorkspace = ( ) => {
64
66
posthog . capture ( "download_workspace_button_clicked" ) ;
65
67
try {
66
- downloadWorkspace ( ) ;
68
+ setWorking ( true ) ;
69
+ downloadWorkspace ( ) . then (
70
+ ( ) => setWorking ( false ) ,
71
+ ( ) => setWorking ( false ) ,
72
+ ) ;
67
73
} catch ( error ) {
68
74
toast . error ( "Failed to download workspace" ) ;
69
75
}
70
76
} ;
71
77
72
78
return (
73
79
< div className = "px-4 py-[10px] w-[337px] rounded-xl border border-[#525252] flex justify-between items-center relative" >
74
- { contextMenuIsOpen && (
80
+ { ! working && contextMenuIsOpen && (
75
81
< ProjectMenuCardContextMenu
76
82
isConnectedToGitHub = { isConnectedToGitHub }
77
83
onConnectToGitHub = { ( ) => setConnectToGitHubModalOpen ( true ) }
@@ -98,7 +104,11 @@ Finally, open up a pull request using the GitHub API and the token in the GITHUB
98
104
onClick = { toggleMenuVisibility }
99
105
aria-label = "Open project menu"
100
106
>
101
- < EllipsisH width = { 36 } height = { 36 } />
107
+ { working ? (
108
+ < LoadingSpinner size = "small" />
109
+ ) : (
110
+ < EllipsisH width = { 36 } height = { 36 } />
111
+ ) }
102
112
</ button >
103
113
{ connectToGitHubModalOpen && (
104
114
< ModalBackdrop onClose = { ( ) => setConnectToGitHubModalOpen ( false ) } >
0 commit comments