mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
fix: address lint issues and type errors
This commit is contained in:
@@ -288,8 +288,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
||||
const handleFileUpload = () => {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
input.accept =
|
||||
'image/*,.pdf,.docx,.txt,.md,.js,.ts,.tsx,.html,.css,.json';
|
||||
input.accept = 'image/*,.pdf,.docx,.txt,.md,.js,.ts,.tsx,.html,.css,.json';
|
||||
|
||||
input.onchange = async (e) => {
|
||||
const file = (e.target as HTMLInputElement).files?.[0];
|
||||
@@ -297,6 +296,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
||||
if (file) {
|
||||
if (file.type.startsWith('image/')) {
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = (ev) => {
|
||||
const base64Image = ev.target?.result as string;
|
||||
setUploadedFiles?.([...uploadedFiles, file]);
|
||||
@@ -326,11 +326,16 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
||||
for (const item of items) {
|
||||
if (item.kind === 'file') {
|
||||
const file = item.getAsFile();
|
||||
if (!file) continue;
|
||||
|
||||
if (!file) {
|
||||
continue;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
if (file.type.startsWith('image/')) {
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = (ev) => {
|
||||
const base64Image = ev.target?.result as string;
|
||||
setUploadedFiles?.([...uploadedFiles, file]);
|
||||
|
||||
@@ -449,6 +449,7 @@ function FileContextMenu({
|
||||
}
|
||||
|
||||
const success = workbenchStore.targetFile(fullPath);
|
||||
|
||||
if (success) {
|
||||
toast.success(`File targeted`);
|
||||
}
|
||||
@@ -465,6 +466,7 @@ function FileContextMenu({
|
||||
}
|
||||
|
||||
const success = workbenchStore.unTargetFile(fullPath);
|
||||
|
||||
if (success) {
|
||||
toast.success(`File un-targeted`);
|
||||
}
|
||||
@@ -761,9 +763,7 @@ function File({
|
||||
title={'File is locked'}
|
||||
/>
|
||||
)}
|
||||
{isTargeted && (
|
||||
<span className="shrink-0 i-ph:crosshair text-green-500 scale-80" title="Targeted file" />
|
||||
)}
|
||||
{isTargeted && <span className="shrink-0 i-ph:crosshair text-green-500 scale-80" title="Targeted file" />}
|
||||
{unsavedChanges && <span className="i-ph:circle-fill scale-68 shrink-0 text-orange-500" />}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user