mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-19 05:54:06 +01:00
Refactor Apply page component for responsiveness, fix typo in setIsGenerating state variable, and update form field change handling
This commit is contained in:
parent
551dcfe470
commit
9e82721b54
@ -30,7 +30,7 @@ export default function Apply() {
|
|||||||
const [selectedIndustry, setSelectedIndustry] = useState("");
|
const [selectedIndustry, setSelectedIndustry] = useState("");
|
||||||
const [isInUS, setIsInUS] = useState("");
|
const [isInUS, setIsInUS] = useState("");
|
||||||
const [isForSale, setIsForSale] = useState("");
|
const [isForSale, setIsForSale] = useState("");
|
||||||
const [isGenerating, setIsGenarting] = useState("");
|
const [isGenerating, setIsGenerating] = useState("");
|
||||||
const [businessPitch, setBusinessPitch] = useState("");
|
const [businessPitch, setBusinessPitch] = useState("");
|
||||||
const [projectType, setProjectType] = useState<string[]>([]);
|
const [projectType, setProjectType] = useState<string[]>([]);
|
||||||
const [projectPitch, setProjectPitch] = useState("");
|
const [projectPitch, setProjectPitch] = useState("");
|
||||||
@ -59,11 +59,24 @@ export default function Apply() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = (data: any) => {
|
const onSubmit = (data: any) => {
|
||||||
alert(JSON.stringify(data));
|
console.table(data);
|
||||||
};
|
};
|
||||||
const handleSelectChange = (value: string) => {
|
const handleFieldChange = (fieldName: string, value: string) => {
|
||||||
|
switch (fieldName) {
|
||||||
|
case "industry":
|
||||||
setSelectedIndustry(value);
|
setSelectedIndustry(value);
|
||||||
setValue("industry", value);
|
break;
|
||||||
|
case "isInUS":
|
||||||
|
setIsInUS(value);
|
||||||
|
break;
|
||||||
|
case "isForSale":
|
||||||
|
setIsForSale(value);
|
||||||
|
break;
|
||||||
|
case "isGenerating":
|
||||||
|
setIsGenerating(value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
setValue(fieldName, value);
|
||||||
};
|
};
|
||||||
const fetchIndustry = async () => {
|
const fetchIndustry = async () => {
|
||||||
let { data: BusinessType, error } = await supabase
|
let { data: BusinessType, error } = await supabase
|
||||||
@ -147,7 +160,11 @@ export default function Apply() {
|
|||||||
Industry
|
Industry
|
||||||
</Label>
|
</Label>
|
||||||
<div className="flex space-x-5">
|
<div className="flex space-x-5">
|
||||||
<Select onValueChange={(value) => handleSelectChange(value)}>
|
<Select
|
||||||
|
onValueChange={(value) =>
|
||||||
|
handleFieldChange("industry", value)
|
||||||
|
}
|
||||||
|
>
|
||||||
<SelectTrigger className="w-96">
|
<SelectTrigger className="w-96">
|
||||||
<SelectValue placeholder="Select an industry" />
|
<SelectValue placeholder="Select an industry" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
@ -184,7 +201,7 @@ export default function Apply() {
|
|||||||
id="totalRaised"
|
id="totalRaised"
|
||||||
className="w-96"
|
className="w-96"
|
||||||
placeholder="$ 1,000,000"
|
placeholder="$ 1,000,000"
|
||||||
{...register}
|
{...register("totalRaised")}
|
||||||
/>
|
/>
|
||||||
<span className="text-[12px] text-neutral-500 self-center">
|
<span className="text-[12px] text-neutral-500 self-center">
|
||||||
The sum total of past financing, including angel or venture{" "}
|
The sum total of past financing, including angel or venture{" "}
|
||||||
@ -204,7 +221,7 @@ export default function Apply() {
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant={isInUS === "Yes" ? "default" : "outline"}
|
variant={isInUS === "Yes" ? "default" : "outline"}
|
||||||
onClick={() => setIsInUS("Yes")}
|
onClick={() => handleFieldChange("isInUS", "Yes")}
|
||||||
className="w-20 h-12 text-base"
|
className="w-20 h-12 text-base"
|
||||||
>
|
>
|
||||||
Yes
|
Yes
|
||||||
@ -212,11 +229,12 @@ export default function Apply() {
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant={isInUS === "No" ? "default" : "outline"}
|
variant={isInUS === "No" ? "default" : "outline"}
|
||||||
onClick={() => setIsInUS("No")}
|
onClick={() => handleFieldChange("isInUS", "No")}
|
||||||
className="w-20 h-12 text-base"
|
className="w-20 h-12 text-base"
|
||||||
>
|
>
|
||||||
No
|
No
|
||||||
</Button>
|
</Button>
|
||||||
|
<input type="hidden" value={isInUS} {...register("isInUS")} />
|
||||||
</div>
|
</div>
|
||||||
<span className="text-[12px] text-neutral-500 self-center">
|
<span className="text-[12px] text-neutral-500 self-center">
|
||||||
Only companies that are incorporated or formed in the US are{" "}
|
Only companies that are incorporated or formed in the US are{" "}
|
||||||
@ -239,7 +257,7 @@ export default function Apply() {
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant={isForSale === "Yes" ? "default" : "outline"}
|
variant={isForSale === "Yes" ? "default" : "outline"}
|
||||||
onClick={() => setIsForSale("Yes")}
|
onClick={() => handleFieldChange("isForSale", "Yes")}
|
||||||
className="w-20 h-12 text-base"
|
className="w-20 h-12 text-base"
|
||||||
>
|
>
|
||||||
Yes
|
Yes
|
||||||
@ -247,7 +265,7 @@ export default function Apply() {
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant={isForSale === "No" ? "default" : "outline"}
|
variant={isForSale === "No" ? "default" : "outline"}
|
||||||
onClick={() => setIsForSale("No")}
|
onClick={() => handleFieldChange("isForSale", "No")}
|
||||||
className="w-20 h-12 text-base"
|
className="w-20 h-12 text-base"
|
||||||
>
|
>
|
||||||
No
|
No
|
||||||
@ -271,7 +289,7 @@ export default function Apply() {
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant={isGenerating === "Yes" ? "default" : "outline"}
|
variant={isGenerating === "Yes" ? "default" : "outline"}
|
||||||
onClick={() => setIsGenarting("Yes")}
|
onClick={() => handleFieldChange("isGenerating", "Yes")}
|
||||||
className="w-20 h-12 text-base"
|
className="w-20 h-12 text-base"
|
||||||
>
|
>
|
||||||
Yes
|
Yes
|
||||||
@ -279,7 +297,7 @@ export default function Apply() {
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant={isGenerating === "No" ? "default" : "outline"}
|
variant={isGenerating === "No" ? "default" : "outline"}
|
||||||
onClick={() => setIsGenarting("No")}
|
onClick={() => handleFieldChange("isGenerating", "No")}
|
||||||
className="w-20 h-12 text-base"
|
className="w-20 h-12 text-base"
|
||||||
>
|
>
|
||||||
No
|
No
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user