11import { useCallback , useEffect , useMemo , useRef , useState } from "react" ;
2- import { AlignLeft , Columns2 , FolderOpen } from "lucide-react" ;
2+ import { AlignLeft , Columns2 } from "lucide-react" ;
33import "./styles/base.css" ;
44import "./styles/buttons.css" ;
55import "./styles/sidebar.css" ;
@@ -37,7 +37,6 @@ import { TabletLayout } from "./features/layout/components/TabletLayout";
3737import { PhoneLayout } from "./features/layout/components/PhoneLayout" ;
3838import { useLayoutNodes } from "./features/layout/hooks/useLayoutNodes" ;
3939import { useWorkspaces } from "./features/workspaces/hooks/useWorkspaces" ;
40- import { useWorkspaceDropZone } from "./features/workspaces/hooks/useWorkspaceDropZone" ;
4140import { useThreads } from "./features/threads/hooks/useThreads" ;
4241import { useWindowDrag } from "./features/layout/hooks/useWindowDrag" ;
4342import { useGitStatus } from "./features/git/hooks/useGitStatus" ;
@@ -343,8 +342,6 @@ function MainApp() {
343342 activeWorkspaceId,
344343 setActiveWorkspaceId,
345344 addWorkspace,
346- addWorkspaceFromPath,
347- filterWorkspacePaths,
348345 addCloneAgent,
349346 addWorktreeAgent,
350347 connectWorkspace,
@@ -1393,21 +1390,14 @@ function MainApp() {
13931390 listThreadsForWorkspace
13941391 } ) ;
13951392
1396- const handleWorkspaceAdded = useCallback (
1397- ( workspace : WorkspaceInfo ) => {
1398- setActiveThreadId ( null , workspace . id ) ;
1399- if ( isCompact ) {
1400- setActiveTab ( "codex" ) ;
1401- }
1402- } ,
1403- [ isCompact , setActiveTab , setActiveThreadId ] ,
1404- ) ;
1405-
14061393 const handleAddWorkspace = useCallback ( async ( ) => {
14071394 try {
14081395 const workspace = await addWorkspace ( ) ;
14091396 if ( workspace ) {
1410- handleWorkspaceAdded ( workspace ) ;
1397+ setActiveThreadId ( null , workspace . id ) ;
1398+ if ( isCompact ) {
1399+ setActiveTab ( "codex" ) ;
1400+ }
14111401 }
14121402 } catch ( error ) {
14131403 const message = error instanceof Error ? error . message : String ( error ) ;
@@ -1420,75 +1410,7 @@ function MainApp() {
14201410 } ) ;
14211411 alert ( `Failed to add workspace.\n\n${ message } ` ) ;
14221412 }
1423- } , [ addDebugEntry , addWorkspace , handleWorkspaceAdded ] ) ;
1424-
1425- const handleAddWorkspaceFromPath = useCallback (
1426- async ( path : string ) => {
1427- try {
1428- const workspace = await addWorkspaceFromPath ( path ) ;
1429- if ( workspace ) {
1430- handleWorkspaceAdded ( workspace ) ;
1431- }
1432- } catch ( error ) {
1433- const message = error instanceof Error ? error . message : String ( error ) ;
1434- addDebugEntry ( {
1435- id : `${ Date . now ( ) } -client-add-workspace-error` ,
1436- timestamp : Date . now ( ) ,
1437- source : "error" ,
1438- label : "workspace/add error" ,
1439- payload : message
1440- } ) ;
1441- alert ( `Failed to add workspace.\n\n${ message } ` ) ;
1442- }
1443- } ,
1444- [ addDebugEntry , addWorkspaceFromPath , handleWorkspaceAdded ] ,
1445- ) ;
1446-
1447- const dropIndicatorTimeoutRef = useRef < number | null > ( null ) ;
1448- const [ dropIndicatorActive , setDropIndicatorActive ] = useState ( false ) ;
1449- const showDropAddIndicator = useCallback ( ( ) => {
1450- setDropIndicatorActive ( true ) ;
1451- if ( dropIndicatorTimeoutRef . current !== null ) {
1452- window . clearTimeout ( dropIndicatorTimeoutRef . current ) ;
1453- }
1454- dropIndicatorTimeoutRef . current = window . setTimeout ( ( ) => {
1455- dropIndicatorTimeoutRef . current = null ;
1456- setDropIndicatorActive ( false ) ;
1457- } , 900 ) ;
1458- } , [ ] ) ;
1459-
1460- useEffect ( ( ) => {
1461- return ( ) => {
1462- if ( dropIndicatorTimeoutRef . current !== null ) {
1463- window . clearTimeout ( dropIndicatorTimeoutRef . current ) ;
1464- }
1465- } ;
1466- } , [ ] ) ;
1467-
1468- const handleDropWorkspacePaths = useCallback (
1469- async ( paths : string [ ] ) => {
1470- showDropAddIndicator ( ) ;
1471- const uniquePaths = Array . from (
1472- new Set ( paths . map ( ( path ) => path . trim ( ) ) . filter ( Boolean ) ) ,
1473- ) ;
1474- const allowedPaths = await filterWorkspacePaths ( uniquePaths ) ;
1475- allowedPaths . forEach ( ( path ) => {
1476- void handleAddWorkspaceFromPath ( path ) ;
1477- } ) ;
1478- } ,
1479- [ filterWorkspacePaths , handleAddWorkspaceFromPath , showDropAddIndicator ] ,
1480- ) ;
1481-
1482- const {
1483- dropTargetRef : workspaceDropTargetRef ,
1484- isDragOver : isWorkspaceDropActive ,
1485- handleDragOver : handleWorkspaceDragOver ,
1486- handleDragEnter : handleWorkspaceDragEnter ,
1487- handleDragLeave : handleWorkspaceDragLeave ,
1488- handleDrop : handleWorkspaceDrop ,
1489- } = useWorkspaceDropZone ( {
1490- onDropPaths : handleDropWorkspacePaths ,
1491- } ) ;
1413+ } , [ addDebugEntry , addWorkspace , isCompact , setActiveTab , setActiveThreadId ] ) ;
14921414
14931415 const handleAddAgent = useCallback (
14941416 async ( workspace : ( typeof workspaces ) [ number ] ) => {
@@ -1757,10 +1679,6 @@ function MainApp() {
17571679 onDebug : addDebugEntry ,
17581680 } ) ;
17591681 const isDefaultScale = Math . abs ( uiScale - 1 ) < 0.001 ;
1760- const dropOverlayActive = isWorkspaceDropActive || dropIndicatorActive ;
1761- const dropOverlayText = isWorkspaceDropActive
1762- ? "Drop Project Here"
1763- : "Adding Project..." ;
17641682 const appClassName = `app ${ isCompact ? "layout-compact" : "layout-desktop" } ${
17651683 isPhone ? " layout-phone" : ""
17661684 } ${ isTablet ? " layout-tablet" : "" } ${
@@ -2179,31 +2097,9 @@ function MainApp() {
21792097 "--ui-scale" : String ( uiScale )
21802098 } as React . CSSProperties
21812099 }
2182- ref = { workspaceDropTargetRef }
2183- onDragOver = { handleWorkspaceDragOver }
2184- onDragEnter = { handleWorkspaceDragEnter }
2185- onDragLeave = { handleWorkspaceDragLeave }
2186- onDrop = { handleWorkspaceDrop }
21872100 >
21882101 < div className = "drag-strip" id = "titlebar" data-tauri-drag-region />
21892102 < TitlebarExpandControls { ...sidebarToggleProps } />
2190- < div
2191- className = { `workspace-drop-overlay${
2192- dropOverlayActive ? " is-active" : ""
2193- } `}
2194- aria-hidden
2195- >
2196- < div
2197- className = { `workspace-drop-overlay-text${
2198- dropOverlayText === "Adding Project..." ? " is-busy" : ""
2199- } `}
2200- >
2201- { dropOverlayText === "Drop Project Here" && (
2202- < FolderOpen className = "workspace-drop-overlay-icon" aria-hidden />
2203- ) }
2204- { dropOverlayText }
2205- </ div >
2206- </ div >
22072103 { isPhone ? (
22082104 < PhoneLayout
22092105 approvalToastsNode = { approvalToastsNode }
0 commit comments