"use client"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import type { ExtraField } from "../edit-panel.atom"; import { DateTimePickerField } from "./calendar-field"; import { EmailsTagField } from "./email-tags-field"; /** * Renders ``ExtraField[]`` as a labelled vertical stack. Picks the * input control from ``field.type``; unknown types fall back to a * plain ```` (covers "text" and "email"). * * Pure presentational component — owns no state, just maps values to * controls and propagates changes through ``onFieldChange(key, value)``. */ export function ExtraFieldsSection({ fields, values, onFieldChange, }: { fields: ExtraField[]; values: Record; onFieldChange: (key: string, value: string) => void; }) { if (fields.length === 0) return null; return (
{fields.map((field) => { const fieldId = `extra-field-${field.key}`; const currentValue = values[field.key] ?? ""; return (
{field.type === "emails" ? ( onFieldChange(field.key, v)} placeholder={`Add ${field.label.toLowerCase()}`} /> ) : field.type === "datetime-local" ? ( onFieldChange(field.key, v)} /> ) : field.type === "textarea" ? (