@@ -4,6 +4,7 @@ import { toast } from "react-toastify";
44import { fetchStream } from "@/shared/api/rest/fetch" ;
55import { Svg } from "@/shared/components/display/svg" ;
66import { CodeViewer } from "@/shared/components/editor/code/code-viewer" ;
7+ import { CsvTable } from "@/shared/components/editor/csv-table" ;
78import { MarkdownViewer } from "@/shared/components/editor/markdown/markdown-viewer" ;
89import NoDataFound from "@/shared/components/errors/no-data-found" ;
910import { LoadingIndicator } from "@/shared/components/loading/loading-indicator" ;
@@ -30,7 +31,9 @@ const CONTENT_TYPE_CONFIG: Record<
3031 "application/hcl" : { extension : "hcl" , language : "hcl" , label : "HCL" } ,
3132 "image/svg+xml" : { extension : "svg" , language : "svg" , label : "SVG" } ,
3233 "text/plain" : { extension : "txt" , language : "text" , label : "text" } ,
33- } ;
34+ "application/xml" : { extension : "xml" , language : "xml" , label : "XML" } ,
35+ "text/csv" : { extension : "csv" , language : "csv" , label : "CSV" } ,
36+ } as const ;
3437
3538function FileLayout ( { className, ...props } : HTMLAttributes < HTMLDivElement > ) {
3639 return (
@@ -59,7 +62,7 @@ function FileHeader({
5962 className,
6063 ...props
6164} : FileHeaderProps ) {
62- const config = CONTENT_TYPE_CONFIG [ contentType ] ;
65+ const config = CONTENT_TYPE_CONFIG [ contentType ] ?? CONTENT_TYPE_CONFIG [ "text/plain" ] ;
6366
6467 return (
6568 < div className = { classNames ( "flex items-center gap-1" , className ) } { ...props } >
@@ -84,7 +87,7 @@ function FileContent({
8487 contentType : ArtifactContentType ;
8588 fileContent : string ;
8689} ) {
87- const config = CONTENT_TYPE_CONFIG [ contentType ] ;
90+ const config = CONTENT_TYPE_CONFIG [ contentType ] ?? CONTENT_TYPE_CONFIG [ "text/plain" ] ;
8891
8992 switch ( contentType ) {
9093 case "text/markdown" : {
@@ -95,6 +98,13 @@ function FileContent({
9598 < Svg value = { fileContent } className = "grow rounded-lg border border-neutral-700 shadow-sm" />
9699 ) ;
97100 }
101+ case "text/csv" : {
102+ return (
103+ < ScrollArea scrollX scrollBarClassName = "bg-transparent" >
104+ < CsvTable content = { fileContent } />
105+ </ ScrollArea >
106+ ) ;
107+ }
98108 default : {
99109 return (
100110 < ScrollArea
0 commit comments