From 5dfb59e1ee98c10d535d8eb18b413bdd7a9e4a43 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Sat, 15 Feb 2025 14:10:34 +0530 Subject: [PATCH] Show more references in teaser ref section of chat response on web app --- .../referencePanel/referencePanel.tsx | 167 ++++++++---------- 1 file changed, 78 insertions(+), 89 deletions(-) diff --git a/src/interface/web/app/components/referencePanel/referencePanel.tsx b/src/interface/web/app/components/referencePanel/referencePanel.tsx index d77a0bfa..8711809f 100644 --- a/src/interface/web/app/components/referencePanel/referencePanel.tsx +++ b/src/interface/web/app/components/referencePanel/referencePanel.tsx @@ -71,23 +71,22 @@ function NotesContextReferenceCard(props: NotesContextReferenceCardProps) { onMouseLeave={() => setIsHovering(false)} className={`${props.showFullContent ? "w-auto bg-muted" : "w-auto"} overflow-hidden break-words text-balance rounded-lg border-none p-2 shadow-none`} > - { - !props.showFullContent ? - - : - <> -

- {fileIcon} - {props.showFullContent ? props.title : fileName} -

-

- - } + {!props.showFullContent ? ( + + ) : ( + <> +

+ {fileIcon} + {props.showFullContent ? props.title : fileName} +

+

+ + )} @@ -214,28 +213,27 @@ function CodeContextReferenceCard(props: CodeContextReferenceCardProps) { onMouseLeave={() => setIsHovering(false)} className={`${props.showFullContent ? "w-auto bg-muted" : "w-auto"} overflow-hidden break-words text-balance rounded-lg border-none p-2 shadow-none`} > - { - !props.showFullContent ? - - : -
-
- {fileIcon} -

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

-
-
 0 ? "hidden" : "overflow-hidden line-clamp-3"}`}
+                        {!props.showFullContent ? (
+                            
+                        ) : (
+                            
+
+ {fileIcon} +

- {sanitizedCodeSnippet} -

- {props.output_files?.length > 0 && - renderOutputFiles(props.output_files, false)} + code {props.output_files?.length > 0 ? "artifacts" : ""} +
- } +
 0 ? "hidden" : "overflow-hidden line-clamp-3"}`}
+                                >
+                                    {sanitizedCodeSnippet}
+                                
+ {props.output_files?.length > 0 && + renderOutputFiles(props.output_files, false)} + + )} @@ -252,10 +250,10 @@ function CodeContextReferenceCard(props: CodeContextReferenceCardProps) { {(props.output_files?.length > 0 && renderOutputFiles(props.output_files?.slice(0, 1), true)) || ( -
-                                    {sanitizedCodeSnippet}
-                                
- )} +
+                                {sanitizedCodeSnippet}
+                            
+ )}
@@ -314,35 +312,38 @@ function GenericOnlineReferenceCard(props: OnlineReferenceCardProps) { onMouseLeave={handleMouseLeave} className={`${props.showFullContent ? "w-auto bg-muted" : "w-auto"} overflow-hidden break-words text-balance rounded-lg border-none p-2 shadow-none`} > - { - !props.showFullContent ? - - : -
- { - -
- -

- {domain} -

-
- - } -

- {props.title} -

-

- {props.description} -

-
- } + {!props.showFullContent ? ( + + ) : ( +
+ { + +
+ +

+ {domain} +

+
+ + } +

+ {props.title} +

+

+ {props.description} +

+
+ )} @@ -496,7 +497,6 @@ interface SimpleIconProps { } function SimpleIcon(props: SimpleIconProps) { - let favicon = ``; let domain = "unknown"; @@ -519,16 +519,10 @@ function SimpleIcon(props: SimpleIconProps) { symbol = ; break; case "online": - symbol = - ; + symbol = ; break; case "notes": - symbol = - ; + symbol = ; break; default: symbol = null; @@ -538,11 +532,7 @@ function SimpleIcon(props: SimpleIconProps) { return null; } - return ( -
- {symbol} -
- ); + return
{symbol}
; } export interface TeaserReferenceSectionProps { @@ -597,7 +587,7 @@ export default function ReferencePanel(props: ReferencePanelDataProps) { const [numTeaserSlots, setNumTeaserSlots] = useState(3); useEffect(() => { - setNumTeaserSlots(props.isMobileWidth ? 1 : 3); + setNumTeaserSlots(props.isMobileWidth ? 3 : 5); }, [props.isMobileWidth]); if (!props.notesReferenceCardData && !props.onlineReferenceCardData) { @@ -611,10 +601,9 @@ export default function ReferencePanel(props: ReferencePanelDataProps) { ); const onlineDataToShow = notesDataToShow.length + codeDataToShow.length < numTeaserSlots - ? props.onlineReferenceCardData.filter((online) => online.link).slice( - 0, - numTeaserSlots - codeDataToShow.length - notesDataToShow.length, - ) + ? props.onlineReferenceCardData + .filter((online) => online.link) + .slice(0, numTeaserSlots - codeDataToShow.length - notesDataToShow.length) : []; return (