mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-19 05:54:06 +01:00
Refactor Apply page component to simplify pitchDeckSchema validation
This commit is contained in:
parent
e9ce0714b3
commit
6a69edf57e
@ -28,16 +28,10 @@ import { DualOptionSelector } from "@/components/dualSelector";
|
|||||||
import { MultipleOptionSelector } from "@/components/multipleSelector";
|
import { MultipleOptionSelector } from "@/components/multipleSelector";
|
||||||
|
|
||||||
export default function Apply() {
|
export default function Apply() {
|
||||||
const pitchDeckSchema = z
|
const pitchDeckSchema = z.union([
|
||||||
.union([
|
|
||||||
z.string().url("Pitch deck must be a valid URL."),
|
z.string().url("Pitch deck must be a valid URL."),
|
||||||
z.instanceof(File).refine((file) => file.size > 0, {
|
z.object({}),
|
||||||
message: "A file must be selected.",
|
]);
|
||||||
}),
|
|
||||||
])
|
|
||||||
.refine((value) => typeof value === "string" || value instanceof File, {
|
|
||||||
message: "Pitch deck must be either a file or a URL.",
|
|
||||||
});
|
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
companyName: z.string().min(5, {
|
companyName: z.string().min(5, {
|
||||||
@ -155,6 +149,7 @@ export default function Apply() {
|
|||||||
} else {
|
} else {
|
||||||
console.log("URL Provided:", data.pitchDeck);
|
console.log("URL Provided:", data.pitchDeck);
|
||||||
}
|
}
|
||||||
|
console.table(transformedData);
|
||||||
alert(JSON.stringify(transformedData));
|
alert(JSON.stringify(transformedData));
|
||||||
};
|
};
|
||||||
const handleBusinessPitchChange = (type: string) => {
|
const handleBusinessPitchChange = (type: string) => {
|
||||||
@ -281,12 +276,6 @@ export default function Apply() {
|
|||||||
{errors.industry.message as string}
|
{errors.industry.message as string}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{/* <input
|
|
||||||
type="hidden"
|
|
||||||
{...register("industry")}
|
|
||||||
value={selectedIndustry}
|
|
||||||
/> */}
|
|
||||||
{/* {selectedIndustry} */}
|
|
||||||
{/* How much money has your company raised to date? */}
|
{/* How much money has your company raised to date? */}
|
||||||
<div className="space-y-5">
|
<div className="space-y-5">
|
||||||
<Label htmlFor="totalRaised" className="font-bold text-lg">
|
<Label htmlFor="totalRaised" className="font-bold text-lg">
|
||||||
@ -414,7 +403,6 @@ export default function Apply() {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex space-x-5">
|
<div className="flex space-x-5">
|
||||||
{businessPitch}
|
|
||||||
<Input
|
<Input
|
||||||
type={businessPitch === "file" ? "file" : "text"}
|
type={businessPitch === "file" ? "file" : "text"}
|
||||||
id="pitchDeck"
|
id="pitchDeck"
|
||||||
@ -443,30 +431,6 @@ export default function Apply() {
|
|||||||
{errors.pitchDeck.message as string}
|
{errors.pitchDeck.message as string}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{/* What's the rough size of your community? */}
|
|
||||||
{/* <div className="mt-10 space-y-5">
|
|
||||||
<Label
|
|
||||||
htmlFor="companySize"
|
|
||||||
className="font-bold text-lg mt-10"
|
|
||||||
></Label>
|
|
||||||
<div className="flex space-x-5">
|
|
||||||
<Select>
|
|
||||||
<SelectTrigger className="w-96">
|
|
||||||
<SelectValue placeholder="Select" />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
<SelectGroup>
|
|
||||||
<SelectLabel>Select</SelectLabel>
|
|
||||||
{communitySize.map((i) => (
|
|
||||||
<SelectItem value={i}>{i}</SelectItem>
|
|
||||||
))}
|
|
||||||
</SelectGroup>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
<span className="text-[12px] text-neutral-500 self-center"></span>
|
|
||||||
</div>
|
|
||||||
</div> */}
|
|
||||||
|
|
||||||
<MultipleOptionSelector
|
<MultipleOptionSelector
|
||||||
header={
|
header={
|
||||||
<>
|
<>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user