import type { Dispatch, SetStateAction } from "react"; import type { TaskCustomFieldDefinitionRead } from "@/api/generated/model"; import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { Textarea } from "@/components/ui/textarea"; import { customFieldInputText, isCustomFieldVisible, parseCustomFieldInputValue, type TaskCustomFieldValues, } from "./custom-field-utils"; type TaskCustomFieldsEditorProps = { definitions: TaskCustomFieldDefinitionRead[]; values: TaskCustomFieldValues; setValues: Dispatch>; isLoading: boolean; disabled: boolean; loadingMessage?: string; emptyMessage?: string; }; export function TaskCustomFieldsEditor({ definitions, values, setValues, isLoading, disabled, loadingMessage = "Loading custom fields…", emptyMessage = "No custom fields configured for this board.", }: TaskCustomFieldsEditorProps) { if (isLoading) return

{loadingMessage}

; if (definitions.length === 0) { return

{emptyMessage}

; } return (
{definitions.map((definition) => { const fieldValue = values[definition.field_key]; if (!isCustomFieldVisible(definition, fieldValue)) return null; return (
{definition.field_type === "boolean" ? ( ) : definition.field_type === "text_long" || definition.field_type === "json" ? (