File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
apps/postgres-new/components Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -12,29 +12,42 @@ export type CodeAccordionProps = {
12
12
title : string
13
13
language : 'sql'
14
14
code : string
15
+ error ?: string
16
+ className ?: string
15
17
}
16
18
17
- export default function CodeAccordion ( { title, language, code } : CodeAccordionProps ) {
19
+ export default function CodeAccordion ( {
20
+ title,
21
+ language,
22
+ code,
23
+ error,
24
+ className,
25
+ } : CodeAccordionProps ) {
18
26
return (
19
27
< Accordion type = "single" collapsible >
20
28
< AccordionItem
21
29
value = "item-1"
22
- className = "border-2 border-neutral-100 bg-neutral-50 px-3 py-2 rounded-md"
30
+ className = { cn (
31
+ 'border-2 border-neutral-100 bg-neutral-50 px-3 py-2 rounded-md' ,
32
+ error ? 'bg-destructive-300' : undefined ,
33
+ className
34
+ ) }
23
35
>
24
36
< AccordionTrigger className = "p-0 gap-2" >
25
37
< div className = "flex gap-2 items-center font-normal text-lighter text-sm" >
26
38
< DatabaseZap size = { 14 } />
27
39
{ title }
28
40
</ div >
29
41
</ AccordionTrigger >
30
- < AccordionContent className = "py-2 [&_>div]:pb-0" >
42
+ < AccordionContent className = "py-2 [&_>div]:pb-0 flex flex-col gap-2 " >
31
43
< CodeBlock
32
44
className = { cn ( `language-${ language } ` , 'border-none px-0 pb-4 !bg-inherit' ) }
33
45
hideLineNumbers
34
46
hideCopy
35
47
>
36
48
{ code }
37
49
</ CodeBlock >
50
+ { error && < div className = "text-destructive-600 text-xs" > { error } </ div > }
38
51
</ AccordionContent >
39
52
</ AccordionItem >
40
53
</ Accordion >
Original file line number Diff line number Diff line change @@ -27,7 +27,14 @@ export default function ExecutedSql({ toolInvocation }: ExecutedSqlProps) {
27
27
}
28
28
29
29
if ( ! toolInvocation . result . success ) {
30
- return < div className = "bg-destructive-300 px-6 py-4 rounded-md" > Error executing SQL</ div >
30
+ return (
31
+ < CodeAccordion
32
+ title = "Error executing SQL"
33
+ language = "sql"
34
+ code = { formattedSql }
35
+ error = { toolInvocation . result . error }
36
+ />
37
+ )
31
38
}
32
39
33
40
return < CodeAccordion title = "Executed SQL" language = "sql" code = { formattedSql } />
You can’t perform that action at this time.
0 commit comments