"use client"; import { memo } from "react"; import { useTranslation } from "react-i18next"; import { summarizeVisualizeConfig, type VisualizeFormConfig, } from "@/lib/visualize-types"; import { CollapsibleConfigSection, Field, INPUT_CLS, } from "@/components/chat/home/composer-field"; interface VisualizeConfigPanelProps { value: VisualizeFormConfig; onChange: (next: VisualizeFormConfig) => void; /** * When provided, the panel is wrapped in a `CollapsibleConfigSection`. * Omit both to render bare for the chat Activity panel. */ collapsed?: boolean; onToggleCollapsed?: () => void; } export default memo(function VisualizeConfigPanel({ value, onChange, collapsed, onToggleCollapsed, }: VisualizeConfigPanelProps) { const { t } = useTranslation(); const update = ( key: K, val: VisualizeFormConfig[K], ) => onChange({ ...value, [key]: val }); // Manim modes need extra knobs (render quality, style hint) — match what // the legacy Animator panel exposed so users don't lose granularity when // they pick "Animation" / "Storyboard" here. const isManim = value.render_mode === "manim_video" || value.render_mode === "manim_image"; const body = ( <> {isManim ? ( <> update("style_hint", e.target.value)} placeholder={t("Style, pacing, color...")} className={`${INPUT_CLS} w-full`} /> ) : null} ); if (collapsed === undefined) { return (
{body}
); } return ( undefined)} bodyClassName="flex flex-wrap items-end gap-x-3 gap-y-2 px-3.5 pb-2.5" > {body} ); });