"use client"; import { Label } from "@/components/ui/label"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Slider } from "@/components/ui/slider"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { cn } from "@/lib/utils"; import { useSafeTranslation } from "@/lib/i18n"; export type ConfigValue = string | number | boolean | undefined; export interface ConfigOption { id: string; type: "slider" | "select" | "toggle" | "radio"; label: string; description?: string; value: ConfigValue; options?: { label: string; value: ConfigValue }[]; min?: number; max?: number; step?: number; suffix?: string; icon?: React.ReactNode; } interface ConfigPanelProps { title: string; description?: string; options: ConfigOption[]; onChange: (id: string, value: ConfigValue) => void; onReset?: () => void; className?: string; } export function ConfigPanel({ title, description, options, onChange, onReset, className, }: ConfigPanelProps) { const { t } = useSafeTranslation(); return (
{title} {description && (

{description}

)}
{onReset && ( )}
{options.map((option) => (
{option.icon &&
{option.icon}
}
{option.type === "slider" && ( {option.value} {option.suffix} )}
{option.description && (

{option.description}

)} {option.type === "slider" && ( onChange(option.id, values[0])} className="mt-2" /> )} {option.type === "select" && option.options && (
{option.options.map((opt) => ( ))}
)} {option.type === "radio" && option.options && (
{option.options.map((opt) => ( ))}
)}
))}
); }