diff --git a/src/app/business/apply/page.tsx b/src/app/business/apply/page.tsx index d39381c..2b4fd0c 100644 --- a/src/app/business/apply/page.tsx +++ b/src/app/business/apply/page.tsx @@ -29,6 +29,7 @@ export default function Apply() { const [applyProject, setApplyProject] = useState(false); const [selectedImages, setSelectedImages] = useState([]); const [businessPitchFile, setBusinessPitchFile] = useState(""); + const [projectPitchFile, setProjectPitchFile] = useState(""); const MAX_FILE_SIZE = 5000000; const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/jpg", "image/png"]; const createPitchDeckSchema = (inputType: string) => { @@ -535,6 +536,7 @@ export default function Apply() { : "https:// " } accept={businessPitch === "file" ? ".md" : undefined} + // if text use normal register {...(businessPitch === "text" ? register("businessPitchDeck", { required: true }) : { @@ -737,9 +739,17 @@ export default function Apply() { : "https:// " } accept={projectPitch === "file" ? ".md" : undefined} - {...registerSecondForm("projectPitchDeck", { - required: true, - })} + {...(projectPitch === "text" + ? registerSecondForm("businessPitchDeck", { + required: true, + }) + : { + onChange: (e) => { + const file = e.target.files?.[0]; + setValueProject("businessPitchDeck", file); + setProjectPitchFile(file?.name || ""); + }, + })} /> Please upload a file or paste a link to your pitch, which @@ -749,6 +759,20 @@ export default function Apply() { make it stand out. + {projectPitchFile && ( +
+ 1. {projectPitchFile} + +
+ )} {errorsProject.projectPitchDeck && (

@@ -774,10 +798,6 @@ export default function Apply() { registerSecondForm("projectLogo").onChange({ target: { name: "projectLogo", value: file }, }); - // Set the file value directly in the form - registerSecondForm("projectLogo").onChange({ - target: { name: "projectLogo", value: file }, - }); }} />