import { Alert, Button, Col, Divider, Form, Row, Space } from "antd"; import type { FormInstance } from "antd"; import { useNavigate } from "react-router-dom"; import type { TemplateAdminSection } from "@personal-brand/api-client"; import { TemplateFieldRenderer } from "../../components/TemplateFieldRenderer.js"; import { TemplateListField } from "../../components/TemplateListField.js"; import { MutationError } from "../../components/QueryState.js"; import { presentationFieldName, type PresentationValues, } from "../../lib/presentation/presentation-bindings.js"; import { fieldTargetTitle } from "./presentation-editor-helpers.js"; import type { PreviewTarget } from "./preview-selection.js"; import { getFullFormValues } from "../../lib/form-values.js"; interface PresentationFormPanelProps { form: FormInstance; initialValues: PresentationValues; editableSections: TemplateAdminSection[]; relevantPageLinks: { target: string; label: string | undefined }[]; selectedTarget: PreviewTarget | undefined; save: { error: unknown; isPending: boolean; mutate: (values: PresentationValues) => void; }; onValuesChange: (changed: PresentationValues, allValues: PresentationValues) => void; } export function PresentationFormPanel({ form, initialValues, editableSections, relevantPageLinks, selectedTarget, save, onValuesChange, }: PresentationFormPanelProps) { const navigate = useNavigate(); const hasEditableFields = editableSections.some((section) => section.fields.length); return (
save.mutate(getFullFormValues(form))} className="presentation-editor__form" >
{editableSections.map((section, index) => (
{selectedTarget && index > 0 ? : null}

{selectedTarget ? fieldTargetTitle(section, selectedTarget.label) : section.title}

{!selectedTarget ? (

{section.description}

) : null} {section.fields.map((field) => ( {field.input === "list" ? ( ) : ( )} ))}
))} {relevantPageLinks.length ? ( {relevantPageLinks.map((item) => ( ))} } /> ) : null} {!hasEditableFields && !relevantPageLinks.length ? (

这个页面没有单独的品牌文案配置。

) : null} {selectedTarget && !hasEditableFields && relevantPageLinks.length ? (

此区域内容由对应的业务管理页面维护。

) : null}
); }