Fix: block file clip input when chat input are blocked
This commit is contained in:
parent
7f616aec8b
commit
0d3780826d
2 changed files with 9 additions and 3 deletions
|
|
@ -5,17 +5,20 @@ const UploadFileButton = ({
|
|||
fileInputRef,
|
||||
handleFileChange,
|
||||
handleButtonClick,
|
||||
lockChat,
|
||||
}) => {
|
||||
return (
|
||||
<div>
|
||||
<input
|
||||
disabled={lockChat}
|
||||
type="file"
|
||||
ref={fileInputRef}
|
||||
style={{ display: "none" }}
|
||||
onChange={handleFileChange}
|
||||
/>
|
||||
<Button
|
||||
className="font-bold text-white transition-all hover:text-muted-foreground"
|
||||
disabled={lockChat}
|
||||
className={`font-bold text-white transition-all ${lockChat ? "cursor-not-allowed" : "hover:text-muted-foreground"}`}
|
||||
onClick={handleButtonClick}
|
||||
variant="none"
|
||||
size="none"
|
||||
|
|
|
|||
|
|
@ -92,8 +92,11 @@ export default function ChatInput({
|
|||
/>
|
||||
</div>
|
||||
|
||||
<div className="absolute bottom-2 left-4">
|
||||
<div
|
||||
className={`absolute bottom-2 left-4 ${lockChat || saveLoading ? "cursor-not-allowed" : ""}`}
|
||||
>
|
||||
<UploadFileButton
|
||||
lockChat={lockChat || saveLoading}
|
||||
fileInputRef={fileInputRef}
|
||||
handleFileChange={handleFileChange}
|
||||
handleButtonClick={handleButtonClick}
|
||||
|
|
@ -110,7 +113,7 @@ export default function ChatInput({
|
|||
key={file.id}
|
||||
onDelete={() => {
|
||||
setFiles((prev: FilePreviewType[]) =>
|
||||
prev.filter((f) => f.id !== file.id)
|
||||
prev.filter((f) => f.id !== file.id),
|
||||
);
|
||||
// TODO: delete file on backend
|
||||
}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue