diff --git a/src/frontend/src/components/arrayReaderComponent/index.tsx b/src/frontend/src/components/arrayReaderComponent/index.tsx index bcbfde010..6e151d426 100644 --- a/src/frontend/src/components/arrayReaderComponent/index.tsx +++ b/src/frontend/src/components/arrayReaderComponent/index.tsx @@ -1,10 +1,12 @@ +import TableAutoCellRender from "../tableComponent/components/tableAutoCellRender"; + export default function ArrayReader({ array }: { array: any[] }): JSX.Element { //TODO check array type return (
diff --git a/src/frontend/src/components/recordsOutputComponent/index.tsx b/src/frontend/src/components/recordsOutputComponent/index.tsx index 36c3a7370..957a43cc7 100644 --- a/src/frontend/src/components/recordsOutputComponent/index.tsx +++ b/src/frontend/src/components/recordsOutputComponent/index.tsx @@ -13,7 +13,9 @@ function RecordsOutputComponent({ rows: any; columnMode?: "intersection" | "union"; }) { + console.log("rows", rows); const columns = extractColumnsFromRows(rows, columnMode); + console.log("columns", columns); const columnDefs = columns.map((col, idx) => ({ ...col, diff --git a/src/frontend/src/components/tableComponent/components/tableAutoCellRender/index.tsx b/src/frontend/src/components/tableComponent/components/tableAutoCellRender/index.tsx index 0c5c00ac9..4a6020f78 100644 --- a/src/frontend/src/components/tableComponent/components/tableAutoCellRender/index.tsx +++ b/src/frontend/src/components/tableComponent/components/tableAutoCellRender/index.tsx @@ -9,20 +9,17 @@ import { Badge } from "../../../ui/badge"; export default function TableAutoCellRender({ value, -}: CustomCellRendererProps) { +}: CustomCellRendererProps | { value: any }) { function getCellType() { switch (typeof value) { case "object": if (value === null) { return String(value); } else if (Array.isArray(value)) { - return ; - } else if (value.definitions) { - // use a custom render defined by the sender + return ; } else { return ; } - break; case "string": if (isTimeStampString(value)) { return ; diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/uploadFileButton/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/uploadFileButton/index.tsx index be2b9c7fc..e675794e0 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/uploadFileButton/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/uploadFileButton/index.tsx @@ -5,17 +5,20 @@ const UploadFileButton = ({ fileInputRef, handleFileChange, handleButtonClick, + lockChat, }) => { return (
-
+
{ setFiles((prev: FilePreviewType[]) => - prev.filter((f) => f.id !== file.id) + prev.filter((f) => f.id !== file.id), ); // TODO: delete file on backend }} diff --git a/src/frontend/src/modals/IOModal/components/chatView/fileComponent/components/downloadButton/downloadButton.tsx b/src/frontend/src/modals/IOModal/components/chatView/fileComponent/components/downloadButton/downloadButton.tsx index 8df64561b..4c1559e63 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/fileComponent/components/downloadButton/downloadButton.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/fileComponent/components/downloadButton/downloadButton.tsx @@ -1,4 +1,5 @@ import ForwardedIconComponent from "../../../../../../../components/genericIconComponent"; +import { Button } from "../../../../../../../components/ui/button"; export default function DownloadButton({ isHovered, @@ -10,14 +11,18 @@ export default function DownloadButton({ if (isHovered) { return (
- +
); } diff --git a/src/frontend/src/modals/IOModal/components/chatView/fileComponent/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/fileComponent/index.tsx index 6d013d52e..b62e0f763 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/fileComponent/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/fileComponent/index.tsx @@ -8,7 +8,7 @@ import DownloadButton from "./components/downloadButton/downloadButton"; import getClasses from "./utils/get-classes"; import handleDownload from "./utils/handle-download"; -const imgTypes = new Set(["png", "jpg"]); +const imgTypes = new Set(["png", "jpg", "jpeg", "gif", "webp", "image"]); export default function FileCard({ fileName, @@ -29,7 +29,7 @@ export default function FileCard({ const imgSrc = `${BACKEND_URL.slice( 0, - BACKEND_URL.length - 1 + BACKEND_URL.length - 1, )}${BASE_URL_API}files/images/${content}`; if (showFile) { diff --git a/src/frontend/src/modals/IOModal/components/chatView/filePreviewChat/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/filePreviewChat/index.tsx index 10b873a5c..f1ff169b0 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/filePreviewChat/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/filePreviewChat/index.tsx @@ -5,6 +5,8 @@ import IconComponent, { import { Skeleton } from "../../../../../components/ui/skeleton"; import formatFileName from "./utils/format-file-name"; +const supImgFiles = ["png", "jpg", "jpeg", "gif", "bmp", "webp", "image"]; + export default function FilePreview({ error, file, @@ -16,7 +18,8 @@ export default function FilePreview({ error: boolean; onDelete: () => void; }) { - const isImage = file.type.toLowerCase().includes("image"); + const fileType = file.type.toLowerCase(); + const isImage = supImgFiles.some((type) => fileType.includes(type)); const [isHovered, setIsHovered] = useState(false); diff --git a/src/frontend/src/utils/utils.ts b/src/frontend/src/utils/utils.ts index aecf874b7..f067f3617 100644 --- a/src/frontend/src/utils/utils.ts +++ b/src/frontend/src/utils/utils.ts @@ -1,7 +1,6 @@ import { ColDef, ColGroupDef } from "ag-grid-community"; import clsx, { ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; -import TableAutoCellRender from "../components/tableComponent/components/tableAutoCellRender"; import { APIDataType, TemplateVariableType } from "../types/api"; import { groupedObjType, @@ -10,6 +9,7 @@ import { } from "../types/components"; import { NodeType } from "../types/flow"; import { FlowState } from "../types/tabs"; +import TableAutoCellRender from "../components/tableComponent/components/tableAutoCellRender"; export function classNames(...classes: Array): string { return classes.filter(Boolean).join(" ");