Skip to content

Commit 23346c1

Browse files
SaxonFjoshenlim
andauthored
Small advisor refinements (supabase#41150)
* small advisor refinements * copy * Nit --------- Co-authored-by: Joshen Lim <[email protected]>
1 parent 29e68cc commit 23346c1

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

apps/studio/components/interfaces/HomeNew/AdvisorSection.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { useSidebarManagerSnapshot } from 'state/sidebar-manager-state'
1414
import { AiIconAnimation, Button, Card, CardContent, CardHeader, CardTitle } from 'ui'
1515
import { Row } from 'ui-patterns'
1616
import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'
17+
import { Markdown } from '../Markdown'
1718

1819
export const AdvisorSection = ({ showEmptyState = false }: { showEmptyState?: boolean }) => {
1920
const { ref: projectRef } = useParams()
@@ -37,12 +38,12 @@ export const AdvisorSection = ({ showEmptyState = false }: { showEmptyState?: bo
3738
const totalErrors = errorLints.length
3839

3940
const titleContent = useMemo(() => {
40-
if (totalErrors === 0) return <h2>Assistant found no issues</h2>
41+
if (totalErrors === 0) return <h2>Advisor found no issues</h2>
4142
const issuesText = totalErrors === 1 ? 'issue' : 'issues'
4243
const numberDisplay = totalErrors.toString()
4344
return (
4445
<h2>
45-
Assistant found {numberDisplay} {issuesText}
46+
Advisor found {numberDisplay} {issuesText}
4647
</h2>
4748
)
4849
}, [totalErrors])
@@ -138,8 +139,10 @@ export const AdvisorSection = ({ showEmptyState = false }: { showEmptyState?: bo
138139
/>
139140
</CardHeader>
140141
<CardContent className="p-6 pt-16 flex flex-col justify-end flex-1 overflow-auto">
141-
{lint.detail ? lint.detail.substring(0, 100) : lint.title}
142-
{lint.detail && lint.detail.length > 100 && '...'}
142+
<h3 className="mb-1">{lint.title}</h3>
143+
<Markdown className="leading-6 text-sm text-foreground-light">
144+
{lint.detail && lint.detail.replace(/\\`/g, '`')}
145+
</Markdown>
143146
</CardContent>
144147
</Card>
145148
)
@@ -155,8 +158,8 @@ export const AdvisorSection = ({ showEmptyState = false }: { showEmptyState?: bo
155158

156159
function EmptyState() {
157160
return (
158-
<Card className="bg-transparent">
159-
<CardContent className="flex flex-col items-center justify-center gap-2 p-16">
161+
<Card className="bg-transparent h-64">
162+
<CardContent className="flex flex-col items-center justify-center gap-2 p-16 h-full">
160163
<Shield size={20} strokeWidth={1.5} className="text-foreground-muted" />
161164
<p className="text-sm text-foreground-light text-center">
162165
No security or performance errors found
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11
import { InlineLink } from 'components/ui/InlineLink'
2+
import { PropsWithChildren } from 'react'
23
import { ReactMarkdown, ReactMarkdownOptions } from 'react-markdown/lib/react-markdown'
34
import remarkGfm from 'remark-gfm'
45

56
import { cn } from 'ui'
67

7-
interface Props extends Omit<ReactMarkdownOptions, 'children' | 'node'> {
8+
interface MarkdownProps extends Omit<ReactMarkdownOptions, 'children' | 'node'> {
89
className?: string
9-
content: string
10+
/** @deprecated Should remove this and just take `children` instead */
11+
content?: string
1012
extLinks?: boolean
1113
}
1214

13-
export const Markdown = ({ className, content = '', extLinks = false, ...props }: Props) => {
15+
export const Markdown = ({
16+
children,
17+
className,
18+
content = '',
19+
extLinks = false,
20+
...props
21+
}: PropsWithChildren<MarkdownProps>) => {
1422
return (
1523
<ReactMarkdown
1624
remarkPlugins={[remarkGfm]}
1725
components={{
1826
h3: ({ children }) => <h3 className="mb-1">{children}</h3>,
27+
code: ({ children }) => <code className="text-code-inline">{children}</code>,
1928
a: ({ href, children }) => <InlineLink href={href ?? '/'}>{children}</InlineLink>,
2029
}}
2130
{...props}
22-
className={cn('prose text-sm', className)}
31+
className={cn('text-sm', className)}
2332
>
24-
{content}
33+
{(children as string) ?? content}
2534
</ReactMarkdown>
2635
)
2736
}

0 commit comments

Comments
 (0)