From 218eed83cd9e8b22fad995aadb3d26bad87f96e5 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Mon, 11 Nov 2024 16:59:53 -0800 Subject: [PATCH] Show output file not code on hover. Remove reference card title border --- .../referencePanel/referencePanel.tsx | 129 +++++++++--------- 1 file changed, 63 insertions(+), 66 deletions(-) diff --git a/src/interface/web/app/components/referencePanel/referencePanel.tsx b/src/interface/web/app/components/referencePanel/referencePanel.tsx index dc6d8360..2f7650b3 100644 --- a/src/interface/web/app/components/referencePanel/referencePanel.tsx +++ b/src/interface/web/app/components/referencePanel/referencePanel.tsx @@ -77,7 +77,7 @@ function NotesContextReferenceCard(props: NotesContextReferenceCardProps) { {props.showFullContent ? props.title : fileName}

@@ -146,6 +146,57 @@ function CodeContextReferenceCard(props: CodeContextReferenceCardProps) { URL.revokeObjectURL(url); }; + const renderOutputFiles = (files: CodeContextFile[], hoverCard: boolean) => { + if (files?.length == 0) return null; + return ( +
+ {files.slice(0, props.showFullContent ? undefined : 1).map((file, index) => { + return ( +
+

+ + {file.filename} + + +

+ {file.filename.match(/\.(txt|org|md|csv|json)$/) ? ( +
+                                    {file.b64_data}
+                                
+ ) : file.filename.match(/\.(png|jpg|jpeg|webp)$/) ? ( + {file.filename} + ) : null} +
+ ); + })} +
+ ); + }; + return ( <> @@ -161,72 +212,15 @@ function CodeContextReferenceCard(props: CodeContextReferenceCardProps) {

- code artifacts + code {props.output_files?.length > 0 ? "artifacts" : ""}

 0 ? "hidden" : "overflow-hidden line-clamp-3"}`}
+                                className={`text-xs pb-2 ${props.showFullContent ? "block overflow-x-auto" : props.output_files?.length > 0 ? "hidden" : "overflow-hidden line-clamp-3"}`}
                             >
                                 {sanitizedCodeSnippet}
                             
- {props.output_files?.length > 0 && ( -
- {props.output_files - .slice(0, props.showFullContent ? undefined : 1) - .map((file, index) => { - return ( -
-

- - {file.filename} - - -

- {file.filename.match( - /\.(txt|org|md|csv|json)$/, - ) ? ( -
-                                                            {file.b64_data}
-                                                        
- ) : file.filename.match( - /\.(png|jpg|jpeg|webp)$/, - ) ? ( - {file.filename} - ) : null} -
- ); - })} -
- )} + {renderOutputFiles(props.output_files, false)} @@ -239,12 +233,15 @@ function CodeContextReferenceCard(props: CodeContextReferenceCardProps) {

- code + code {props.output_files?.length > 0 ? "artifact" : ""}

-
-                            {sanitizedCodeSnippet}
-                        
+ {(props.output_files.length > 0 && + renderOutputFiles(props.output_files?.slice(0, 1), true)) || ( +
+                                {sanitizedCodeSnippet}
+                            
+ )}
@@ -319,7 +316,7 @@ function GenericOnlineReferenceCard(props: OnlineReferenceCardProps) {

{props.title}