"use client"; import type { FormEvent } from "react"; import type { PublishPlatform } from "../lib/domain/types"; export interface ArticleInputPayload { title: string; body: string; image_lines: string; platform: PublishPlatform; user_instructions: string; } interface ArticleInputFormProps { value: ArticleInputPayload; isSubmitting: boolean; onChange: (value: ArticleInputPayload) => void; onSubmit: () => void; } const platforms: { value: PublishPlatform; label: string }[] = [ { value: "official_site", label: "官网文章" }, { value: "media_article", label: "媒体稿" }, { value: "comparison_review", label: "对比评测" }, { value: "recommendation_list", label: "推荐榜单" }, ]; export function ArticleInputForm({ value, isSubmitting, onChange, onSubmit, }: ArticleInputFormProps) { function update( key: K, nextValue: ArticleInputPayload[K], ) { onChange({ ...value, [key]: nextValue }); } function handleSubmit(event: FormEvent) { event.preventDefault(); onSubmit(); } return (
文章输入