fix(chart): show correct chart type in previews
- Use NoteChart directly with props instead of NoteChartFromCode - Remove markdown ticks from chartSuggestionToMarkdown output - Export NoteChart component for direct use in previews Now the 3 suggestions correctly show different chart types. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { NoteChartFromCode } from './note-chart'
|
||||
import { NoteChart } from './note-chart'
|
||||
import { suggestCharts, chartSuggestionToMarkdown, type ChartSuggestion, type SuggestChartsResponse } from '@/lib/ai/services/chart-suggestion.service'
|
||||
import { BarChart3, X, Search, AlertCircle, Sparkles } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
@@ -240,7 +240,13 @@ export function ChartSuggestionsDialog({
|
||||
{/* Mini thumbnail */}
|
||||
<div className="aspect-video bg-card rounded-lg mb-3 overflow-hidden flex items-center justify-center p-2">
|
||||
<div className="w-full scale-75 origin-center">
|
||||
<NoteChartFromCode code={markdown} />
|
||||
<NoteChart
|
||||
type={suggestion.type}
|
||||
title={suggestion.title}
|
||||
data={suggestion.data}
|
||||
height={100}
|
||||
showLegend={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user