"use client" import { useTheme } from "next-themes" import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Cell } from "@/components/ui/chart" interface Feature { name: string importance: number value: string impact: "positive" | "negative" | "neutral" } interface FeatureImportanceChartProps { features: Feature[] } export function FeatureImportanceChart({ features }: FeatureImportanceChartProps) { const { theme } = useTheme() const isDark = theme === "dark" // Sort features by importance const sortedFeatures = [...features].sort((a, b) => b.importance - a.importance) const getBarColor = (impact: string) => { if (impact === "positive") return "#10b981" if (impact === "negative") return "#ef4444" return "#f59e0b" } return ( `${value}%`} stroke={isDark ? "#9ca3af" : "#6b7280"} /> [`${value}%`, "Importance"]} contentStyle={{ backgroundColor: isDark ? "#1f2937" : "white", borderRadius: "0.375rem", border: isDark ? "1px solid #374151" : "1px solid #e2e8f0", fontSize: "0.75rem", color: isDark ? "#e5e7eb" : "#1f2937", }} /> {sortedFeatures.map((entry, index) => ( ))} ) }