@@ -297,7 +297,7 @@ const WorkspaceNameInput = styled.input`
297297 }
298298` ;
299299
300- const RenameErrorContainer = styled . div `
300+ const WorkspaceErrorContainer = styled . div `
301301 position: absolute;
302302 top: 100%;
303303 left: 28px;
@@ -332,7 +332,7 @@ interface ProjectSidebarProps {
332332 onAddProject : ( ) => void ;
333333 onAddWorkspace : ( projectPath : string ) => void ;
334334 onRemoveProject : ( path : string ) => void ;
335- onRemoveWorkspace : ( workspaceId : string ) => void ;
335+ onRemoveWorkspace : ( workspaceId : string ) => Promise < { success : boolean ; error ?: string } > ;
336336 onRenameWorkspace : (
337337 workspaceId : string ,
338338 newName : string
@@ -365,6 +365,9 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
365365 const [ editingWorkspaceId , setEditingWorkspaceId ] = useState < string | null > ( null ) ;
366366 const [ editingName , setEditingName ] = useState < string > ( "" ) ;
367367 const [ renameError , setRenameError ] = useState < string | null > ( null ) ;
368+ const [ removeError , setRemoveError ] = useState < { workspaceId : string ; error : string } | null > (
369+ null
370+ ) ;
368371
369372 const getProjectName = ( path : string ) => {
370373 if ( ! path || typeof path !== "string" ) {
@@ -423,6 +426,20 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
423426 }
424427 } ;
425428
429+ const handleRemoveWorkspace = async ( workspaceId : string ) => {
430+ const result = await onRemoveWorkspace ( workspaceId ) ;
431+ if ( ! result . success ) {
432+ setRemoveError ( {
433+ workspaceId,
434+ error : result . error ?? "Failed to remove workspace" ,
435+ } ) ;
436+ // Clear error after 5 seconds
437+ setTimeout ( ( ) => {
438+ setRemoveError ( null ) ;
439+ } , 5000 ) ;
440+ }
441+ } ;
442+
426443 // Handle keyboard shortcuts
427444 useEffect ( ( ) => {
428445 const handleKeyDown = ( e : KeyboardEvent ) => {
@@ -533,14 +550,17 @@ const ProjectSidebar: React.FC<ProjectSidebarProps> = ({
533550 < WorkspaceRemoveBtn
534551 onClick = { ( e ) => {
535552 e . stopPropagation ( ) ;
536- onRemoveWorkspace ( workspaceId ) ;
553+ void handleRemoveWorkspace ( workspaceId ) ;
537554 } }
538555 title = "Remove workspace"
539556 >
540557 ×
541558 </ WorkspaceRemoveBtn >
542559 { isEditing && renameError && (
543- < RenameErrorContainer > { renameError } </ RenameErrorContainer >
560+ < WorkspaceErrorContainer > { renameError } </ WorkspaceErrorContainer >
561+ ) }
562+ { ! isEditing && removeError ?. workspaceId === workspaceId && (
563+ < WorkspaceErrorContainer > { removeError . error } </ WorkspaceErrorContainer >
544564 ) }
545565 </ WorkspaceItem >
546566 ) ;
0 commit comments