"use client"; import type { Dispatch, FormEvent, SetStateAction } from "react"; import { AyanamsaPreferenceField } from "@/components/ayanamsa-preference-field"; import { ProfileFields } from "@/components/profile-fields"; import { resolveAyanamsa } from "@/lib/ayanamsa"; import type { ChartRelationship, Profile } from "@/lib/home-types"; export type ChartProfileFormProps = { readonly title: string; readonly description: string; readonly value: Profile; readonly onChange: Dispatch>; readonly nameInputId: string; readonly showAyanamsa?: boolean; readonly relationship?: Exclude; readonly onRelationshipChange?: (value: Exclude) => void; readonly onSubmit: (event: FormEvent) => void; readonly onCancel?: () => void; readonly cancelLabel?: string; readonly submitLabel: string; readonly submitDisabled: boolean; readonly notice?: string; }; export function ChartProfileForm({ title, description, value, onChange, nameInputId, showAyanamsa = false, relationship, onRelationshipChange, onSubmit, onCancel, cancelLabel = "取消", submitLabel, submitDisabled, notice, }: ChartProfileFormProps) { return (
{title}{description}
{relationship !== undefined && onRelationshipChange ? ( ) : null} {showAyanamsa ? ( onChange((current) => ({ ...current, ayanamsa }))} /> ) : null} {notice ?

{notice}

: null}
{onCancel ? : null}
); }