Disable drag and drop on chat page
This commit is contained in:
parent
d763dfee50
commit
bb9c49e955
1 changed files with 2 additions and 72 deletions
|
|
@ -120,7 +120,6 @@ function ChatPage() {
|
||||||
>(new Set());
|
>(new Set());
|
||||||
// previousResponseIds now comes from useChat context
|
// previousResponseIds now comes from useChat context
|
||||||
const [isUploading, setIsUploading] = useState(false);
|
const [isUploading, setIsUploading] = useState(false);
|
||||||
const [isDragOver, setIsDragOver] = useState(false);
|
|
||||||
const [isFilterDropdownOpen, setIsFilterDropdownOpen] = useState(false);
|
const [isFilterDropdownOpen, setIsFilterDropdownOpen] = useState(false);
|
||||||
const [availableFilters, setAvailableFilters] = useState<
|
const [availableFilters, setAvailableFilters] = useState<
|
||||||
KnowledgeFilterData[]
|
KnowledgeFilterData[]
|
||||||
|
|
@ -131,7 +130,6 @@ function ChatPage() {
|
||||||
const [dropdownDismissed, setDropdownDismissed] = useState(false);
|
const [dropdownDismissed, setDropdownDismissed] = useState(false);
|
||||||
const [isUserInteracting, setIsUserInteracting] = useState(false);
|
const [isUserInteracting, setIsUserInteracting] = useState(false);
|
||||||
const [isForkingInProgress, setIsForkingInProgress] = useState(false);
|
const [isForkingInProgress, setIsForkingInProgress] = useState(false);
|
||||||
const dragCounterRef = useRef(0);
|
|
||||||
const messagesEndRef = useRef<HTMLDivElement>(null);
|
const messagesEndRef = useRef<HTMLDivElement>(null);
|
||||||
const inputRef = useRef<HTMLTextAreaElement>(null);
|
const inputRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
@ -274,43 +272,6 @@ function ChatPage() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Remove the old pollTaskStatus function since we're using centralized system
|
|
||||||
|
|
||||||
const handleDragEnter = (e: React.DragEvent) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
dragCounterRef.current++;
|
|
||||||
if (dragCounterRef.current === 1) {
|
|
||||||
setIsDragOver(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDragOver = (e: React.DragEvent) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDragLeave = (e: React.DragEvent) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
dragCounterRef.current--;
|
|
||||||
if (dragCounterRef.current === 0) {
|
|
||||||
setIsDragOver(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDrop = (e: React.DragEvent) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
dragCounterRef.current = 0;
|
|
||||||
setIsDragOver(false);
|
|
||||||
|
|
||||||
const files = Array.from(e.dataTransfer.files);
|
|
||||||
if (files.length > 0) {
|
|
||||||
handleFileUpload(files[0]); // Upload first file only
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleFilePickerClick = () => {
|
const handleFilePickerClick = () => {
|
||||||
fileInputRef.current?.click();
|
fileInputRef.current?.click();
|
||||||
};
|
};
|
||||||
|
|
@ -1957,31 +1918,12 @@ function ChatPage() {
|
||||||
<div className="flex-1 flex flex-col gap-4 min-h-0 overflow-hidden">
|
<div className="flex-1 flex flex-col gap-4 min-h-0 overflow-hidden">
|
||||||
{/* Messages Area */}
|
{/* Messages Area */}
|
||||||
<div
|
<div
|
||||||
className={`flex-1 overflow-y-auto overflow-x-hidden scrollbar-hide space-y-6 min-h-0 transition-all relative ${
|
className={`flex-1 overflow-y-auto overflow-x-hidden scrollbar-hide space-y-6 min-h-0 transition-all relative`}
|
||||||
isDragOver
|
|
||||||
? "bg-primary/10 border-2 border-dashed border-primary rounded-lg p-4"
|
|
||||||
: ""
|
|
||||||
}`}
|
|
||||||
onDragEnter={handleDragEnter}
|
|
||||||
onDragOver={handleDragOver}
|
|
||||||
onDragLeave={handleDragLeave}
|
|
||||||
onDrop={handleDrop}
|
|
||||||
>
|
>
|
||||||
{messages.length === 0 && !streamingMessage ? (
|
{messages.length === 0 && !streamingMessage ? (
|
||||||
<div className="flex items-center justify-center h-full text-muted-foreground">
|
<div className="flex items-center justify-center h-full text-muted-foreground">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
{isDragOver ? (
|
{isUploading ? (
|
||||||
<>
|
|
||||||
<Upload className="h-12 w-12 mx-auto mb-4 text-primary" />
|
|
||||||
<p className="text-primary font-medium">
|
|
||||||
Drop your document here
|
|
||||||
</p>
|
|
||||||
<p className="text-sm mt-2">
|
|
||||||
I'll process it and add it to our conversation
|
|
||||||
context
|
|
||||||
</p>
|
|
||||||
</>
|
|
||||||
) : isUploading ? (
|
|
||||||
<>
|
<>
|
||||||
<Loader2 className="h-12 w-12 mx-auto mb-4 animate-spin" />
|
<Loader2 className="h-12 w-12 mx-auto mb-4 animate-spin" />
|
||||||
<p>Processing your document...</p>
|
<p>Processing your document...</p>
|
||||||
|
|
@ -2082,18 +2024,6 @@ function ChatPage() {
|
||||||
<div ref={messagesEndRef} />
|
<div ref={messagesEndRef} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Drag overlay for existing messages */}
|
|
||||||
{isDragOver && messages.length > 0 && (
|
|
||||||
<div className="absolute inset-0 bg-primary/20 backdrop-blur-sm flex items-center justify-center rounded-lg">
|
|
||||||
<div className="text-center">
|
|
||||||
<Upload className="h-8 w-8 mx-auto mb-2 text-primary" />
|
|
||||||
<p className="text-primary font-medium">
|
|
||||||
Drop document to add context
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue