diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/Data/Image.tsx b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Image.tsx new file mode 100644 index 0000000000..7f9a608f2a --- /dev/null +++ b/webapp/src/components/App/Singlestudy/explore/Debug/Data/Image.tsx @@ -0,0 +1,11 @@ +import ViewWrapper from "../../../../../common/page/ViewWrapper"; + +function Image() { + //////////////////////////////////////////////////////////////// + // JSX + //////////////////////////////////////////////////////////////// + + return Cannot diplay image; +} + +export default Image; diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/Data/index.tsx b/webapp/src/components/App/Singlestudy/explore/Debug/Data/index.tsx index ee348d539f..3e7e2105b0 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/Data/index.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Debug/Data/index.tsx @@ -1,18 +1,25 @@ import Text from "./Text"; +import Image from "./Image"; import Json from "./Json"; import Matrix from "./Matrix"; -import type { FileInfo } from "../utils"; -import { Box } from "@mui/material"; +import type { FileInfo, FileType } from "../utils"; interface Props extends FileInfo { studyId: string; } -const componentByFileType = { +interface DataComponentProps { + studyId: string; + path: string; +} +type DataComponent = React.ComponentType; + +const componentByFileType: Record = { matrix: Matrix, json: Json, - file: Text, - folder: Box, + text: Text, + image: Image, + folder: ({ path }) => path, } as const; function Data({ studyId, fileType, filePath }: Props) { diff --git a/webapp/src/components/App/Singlestudy/explore/Debug/utils.ts b/webapp/src/components/App/Singlestudy/explore/Debug/utils.ts index 81acb49b8c..463a6bc31c 100644 --- a/webapp/src/components/App/Singlestudy/explore/Debug/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Debug/utils.ts @@ -1,5 +1,6 @@ import DataObjectIcon from "@mui/icons-material/DataObject"; import TextSnippetIcon from "@mui/icons-material/TextSnippet"; +import ImageIcon from "@mui/icons-material/Image"; import FolderIcon from "@mui/icons-material/Folder"; import DatasetIcon from "@mui/icons-material/Dataset"; import { SvgIconComponent } from "@mui/icons-material"; @@ -9,7 +10,7 @@ import * as RA from "ramda-adjunct"; // Types //////////////////////////////////////////////////////////////// -export type FileType = "json" | "matrix" | "file" | "folder"; +export type FileType = "json" | "matrix" | "text" | "image" | "folder"; export interface FileInfo { fileType: FileType; @@ -32,8 +33,9 @@ export type TreeData = TreeFolder | TreeFile; const iconByFileType: Record = { matrix: DatasetIcon, json: DataObjectIcon, + text: TextSnippetIcon, + image: ImageIcon, folder: FolderIcon, - file: TextSnippetIcon, } as const; /** @@ -67,6 +69,9 @@ export function getFileType(treeData: TreeData): FileType { if (treeData.startsWith("json://") || treeData.endsWith(".json")) { return "json"; } + if (treeData.startsWith("file://") && treeData.endsWith(".ico")) { + return "image"; + } } - return isFolder(treeData) ? "folder" : "file"; + return isFolder(treeData) ? "folder" : "text"; }