fix: misc

This commit is contained in:
Ibrahima G. Coulibaly
2025-05-13 22:48:28 +01:00
parent 8fb2656fc2
commit 93c776aa72
5 changed files with 148 additions and 157 deletions

View File

@@ -14,6 +14,7 @@ interface MultiPdfInputComponentProps {
value: MultiPdfInput[];
onChange: (file: MultiPdfInput[]) => void;
}
export interface MultiPdfInput {
file: File;
order: number;
@@ -43,20 +44,6 @@ export default function ToolMultiFileInput({
fileInputRef.current?.click();
};
const handleCopy = () => {
if (isArray(value)) {
const blob = new Blob([value[0].file], { type: value[0].file.type });
const clipboardItem = new ClipboardItem({ [value[0].file.type]: blob });
navigator.clipboard
.write([clipboardItem])
.then(() => showSnackBar('File copied', 'success'))
.catch((err) => {
showSnackBar('Failed to copy: ' + err, 'error');
});
}
};
function handleClear() {
onChange([]);
}
@@ -175,11 +162,7 @@ export default function ToolMultiFileInput({
</Box>
</Box>
<InputFooter
handleCopy={handleCopy}
handleImport={handleImportClick}
handleClear={handleClear}
/>
<InputFooter handleImport={handleImportClick} handleClear={handleClear} />
<input
ref={fileInputRef}
style={{ display: 'none' }}

View File

@@ -173,7 +173,9 @@ export default function ToolFileResult({
disabled={!value}
handleCopy={handleCopy}
handleDownload={handleDownload}
hideCopy={fileType === 'video' || fileType === 'audio'}
hideCopy={
fileType === 'video' || fileType === 'audio' || fileType === 'pdf'
}
/>
</Box>
);