forked from miurla/morphic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copilot-display.tsx
33 lines (29 loc) · 902 Bytes
/
copilot-display.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use client'
import React from 'react'
import { Check } from 'lucide-react'
import { Card } from './ui/card'
import { IconLogo } from './ui/icons'
interface CopilotDisplayProps {
content: string
}
export function CopilotDisplay({ content }: CopilotDisplayProps) {
try {
const json = JSON.parse(content)
const formDataEntries = Object.entries(json)
const query = formDataEntries
.filter(
([key, value]) =>
value === 'on' || (key === 'additional_query' && value !== '')
)
.map(([key, value]) => (key === 'additional_query' ? value : key))
.join(', ')
return (
<Card className="p-3 md:p-4 w-full flex justify-between items-center">
<h5 className="text-muted-foreground text-xs truncate">{query}</h5>
<Check size={16} className="text-green-500 w-4 h-4" />
</Card>
)
} catch (error) {
return null
}
}