diff --git a/packages/app/src/app/index.tsx b/packages/app/src/app/index.tsx index e0491c74a..500458435 100644 --- a/packages/app/src/app/index.tsx +++ b/packages/app/src/app/index.tsx @@ -1,4 +1,5 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import type { ImageAttachment } from "@/components/message-input"; import { View, Text, @@ -15,6 +16,7 @@ import { GitOptionsSection, WorkingDirectoryDropdown, } from "@/components/agent-form/agent-form-dropdowns"; +import { FileDropZone } from "@/components/file-drop-zone"; import { useDaemonRequest } from "@/hooks/use-daemon-request"; import type { SessionOutboundMessage } from "@server/server/messages"; import { useAgentFormState, type CreateAgentInitialValues } from "@/hooks/use-agent-form-state"; @@ -168,6 +170,16 @@ export default function HomeScreen() { const [branchNameEdited, setBranchNameEdited] = useState(false); const [worktreeSlugEdited, setWorktreeSlugEdited] = useState(false); const shouldSyncBaseBranchRef = useRef(true); + const addImagesRef = useRef<((images: ImageAttachment[]) => void) | null>(null); + + const handleFilesDropped = useCallback((files: ImageAttachment[]) => { + addImagesRef.current?.(files); + }, []); + + const handleAddImagesCallback = useCallback((addImages: (images: ImageAttachment[]) => void) => { + addImagesRef.current = addImages; + }, []); + const createNewBranch = isolationMode === "branch" || isolationMode === "worktree"; const createWorktree = isolationMode === "worktree"; const openDropdownSheet = useCallback( @@ -670,26 +682,27 @@ export default function HomeScreen() { : "Automatic"; return ( - - - openDropdownSheet("host")} - > - - {hostLabel} - - - } - /> + + + + openDropdownSheet("host")} + > + + {hostLabel} + + + } + /> @@ -930,10 +943,12 @@ export default function HomeScreen() { value={promptText} onChangeText={setPromptText} autoFocus + onAddImages={handleAddImagesCallback} /> + ); }