fix(app): enable image drop on new workspace screen (#850)
Wrap the screen in FileDropZone so dragged images are forwarded into the composer, matching the new-draft screen.
This commit is contained in:
@@ -9,6 +9,7 @@ import { useQuery } from "@tanstack/react-query";
|
|||||||
import { ChevronDown, GitBranch, GitPullRequest } from "lucide-react-native";
|
import { ChevronDown, GitBranch, GitPullRequest } from "lucide-react-native";
|
||||||
import { Composer } from "@/components/composer";
|
import { Composer } from "@/components/composer";
|
||||||
import { splitComposerAttachmentsForSubmit } from "@/components/composer-attachments";
|
import { splitComposerAttachmentsForSubmit } from "@/components/composer-attachments";
|
||||||
|
import { FileDropZone } from "@/components/file-drop-zone";
|
||||||
import { Combobox, ComboboxItem } from "@/components/ui/combobox";
|
import { Combobox, ComboboxItem } from "@/components/ui/combobox";
|
||||||
import type { ComboboxOption as ComboboxOptionType } from "@/components/ui/combobox";
|
import type { ComboboxOption as ComboboxOptionType } from "@/components/ui/combobox";
|
||||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
@@ -639,6 +640,9 @@ export function NewWorkspaceScreen({
|
|||||||
const handleAddImagesCallback = useCallback((addImages: (images: ImageAttachment[]) => void) => {
|
const handleAddImagesCallback = useCallback((addImages: (images: ImageAttachment[]) => void) => {
|
||||||
addImagesRef.current = addImages;
|
addImagesRef.current = addImages;
|
||||||
}, []);
|
}, []);
|
||||||
|
const handleFilesDropped = useCallback((files: ImageAttachment[]) => {
|
||||||
|
addImagesRef.current?.(files);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const renderPickerOption = useCallback(
|
const renderPickerOption = useCallback(
|
||||||
({
|
({
|
||||||
@@ -713,6 +717,7 @@ export function NewWorkspaceScreen({
|
|||||||
: "No matching refs.";
|
: "No matching refs.";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<FileDropZone onFilesDropped={handleFilesDropped}>
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<ScreenHeader
|
<ScreenHeader
|
||||||
left={
|
left={
|
||||||
@@ -789,6 +794,7 @@ export function NewWorkspaceScreen({
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
</FileDropZone>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user