mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-19 05:54:06 +01:00
Refactor Apply page component to adjust left margin for company information section and add support for project pitch file
This commit is contained in:
parent
ec17305e16
commit
e58e954991
@ -29,6 +29,7 @@ export default function Apply() {
|
|||||||
const [applyProject, setApplyProject] = useState(false);
|
const [applyProject, setApplyProject] = useState(false);
|
||||||
const [selectedImages, setSelectedImages] = useState<File[]>([]);
|
const [selectedImages, setSelectedImages] = useState<File[]>([]);
|
||||||
const [businessPitchFile, setBusinessPitchFile] = useState("");
|
const [businessPitchFile, setBusinessPitchFile] = useState("");
|
||||||
|
const [projectPitchFile, setProjectPitchFile] = useState("");
|
||||||
const MAX_FILE_SIZE = 5000000;
|
const MAX_FILE_SIZE = 5000000;
|
||||||
const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/jpg", "image/png"];
|
const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/jpg", "image/png"];
|
||||||
const createPitchDeckSchema = (inputType: string) => {
|
const createPitchDeckSchema = (inputType: string) => {
|
||||||
@ -535,6 +536,7 @@ export default function Apply() {
|
|||||||
: "https:// "
|
: "https:// "
|
||||||
}
|
}
|
||||||
accept={businessPitch === "file" ? ".md" : undefined}
|
accept={businessPitch === "file" ? ".md" : undefined}
|
||||||
|
// if text use normal register
|
||||||
{...(businessPitch === "text"
|
{...(businessPitch === "text"
|
||||||
? register("businessPitchDeck", { required: true })
|
? register("businessPitchDeck", { required: true })
|
||||||
: {
|
: {
|
||||||
@ -737,9 +739,17 @@ export default function Apply() {
|
|||||||
: "https:// "
|
: "https:// "
|
||||||
}
|
}
|
||||||
accept={projectPitch === "file" ? ".md" : undefined}
|
accept={projectPitch === "file" ? ".md" : undefined}
|
||||||
{...registerSecondForm("projectPitchDeck", {
|
{...(projectPitch === "text"
|
||||||
required: true,
|
? registerSecondForm("businessPitchDeck", {
|
||||||
})}
|
required: true,
|
||||||
|
})
|
||||||
|
: {
|
||||||
|
onChange: (e) => {
|
||||||
|
const file = e.target.files?.[0];
|
||||||
|
setValueProject("businessPitchDeck", file);
|
||||||
|
setProjectPitchFile(file?.name || "");
|
||||||
|
},
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
<span className="text-[12px] text-neutral-500 self-center">
|
<span className="text-[12px] text-neutral-500 self-center">
|
||||||
Please upload a file or paste a link to your pitch, which
|
Please upload a file or paste a link to your pitch, which
|
||||||
@ -749,6 +759,20 @@ export default function Apply() {
|
|||||||
make it stand out.
|
make it stand out.
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
{projectPitchFile && (
|
||||||
|
<div className="flex justify-between items-center border p-2 rounded w-96 text-sm text-foreground">
|
||||||
|
<span>1. {projectPitchFile}</span>
|
||||||
|
<Button
|
||||||
|
className="ml-4"
|
||||||
|
onClick={() => {
|
||||||
|
setValueProject("businessPitchDeck", null);
|
||||||
|
setProjectPitchFile("");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Remove
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{errorsProject.projectPitchDeck && (
|
{errorsProject.projectPitchDeck && (
|
||||||
<p className="text-red-500 text-sm">
|
<p className="text-red-500 text-sm">
|
||||||
@ -774,10 +798,6 @@ export default function Apply() {
|
|||||||
registerSecondForm("projectLogo").onChange({
|
registerSecondForm("projectLogo").onChange({
|
||||||
target: { name: "projectLogo", value: file },
|
target: { name: "projectLogo", value: file },
|
||||||
});
|
});
|
||||||
// Set the file value directly in the form
|
|
||||||
registerSecondForm("projectLogo").onChange({
|
|
||||||
target: { name: "projectLogo", value: file },
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<span className="text-[12px] text-neutral-500 self-center">
|
<span className="text-[12px] text-neutral-500 self-center">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user