import { useEffect, useState } from 'react' import { Input, Modal, Select, Space, Switch, Typography } from '@arco-design/web-react' const { Text } = Typography const { TextArea } = Input export type ProjectActionModal = 'project' | 'task' | 'source' | 'cron' | null export type ProjectDraft = { name: string identifier: string icon: string background: string description: string } export type TaskDraft = { title: string description: string dueAt: string tag: string } export type SourceDraft = { title: string file: File | null } export type CronDraft = { title: string schedule: string enabled: boolean nextRunAt: string } export function ProjectActionModals({ activeModal, loading, onClose, onCreateProject, onCreateTask, onUploadSource, onCreateCronPlan, tagOptions, }: { activeModal: ProjectActionModal loading: boolean onClose: () => void onCreateProject: (draft: ProjectDraft) => void onCreateTask: (draft: TaskDraft) => void onUploadSource: (draft: SourceDraft) => void onCreateCronPlan: (draft: CronDraft) => void tagOptions: string[] }) { const [project, setProject] = useState({ name: '', identifier: '', icon: '', background: '', description: '' }) const [task, setTask] = useState({ title: '', description: '', dueAt: '', tag: '' }) const [source, setSource] = useState({ title: '', file: null }) const [cron, setCron] = useState({ title: '', schedule: '0 9 * * *', enabled: true, nextRunAt: '' }) useEffect(() => { if (activeModal === null) { setProject({ name: '', identifier: '', icon: '', background: '', description: '' }) setTask({ title: '', description: '', dueAt: '', tag: '' }) setSource({ title: '', file: null }) setCron({ title: '', schedule: '0 9 * * *', enabled: true, nextRunAt: '' }) } }, [activeModal]) return ( <> onCreateProject(project)} >