add base code for fetching input data to JSON

This commit is contained in:
Naytitorn Chaovirachot 2024-10-11 23:19:20 +07:00
parent 1c9eaa8577
commit fc1dd4b4d9

View File

@ -16,10 +16,14 @@ import { useEffect, useState } from "react";
export default function Apply() { export default function Apply() {
let supabase = createSupabaseClient(); let supabase = createSupabaseClient();
const [companyName, setCompanyName] = useState("");
const [selectedIndustry, setSelectedIndustry] = useState("");
const [industry, setIndustry] = useState<string[]>([]); const [industry, setIndustry] = useState<string[]>([]);
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 [pitch, setPitch] = useState(""); const [pitch, setPitch] = useState("");
const communitySize = [ const communitySize = [
"N/A", "N/A",
@ -36,18 +40,25 @@ export default function Apply() {
.from("BusinessType") .from("BusinessType")
.select("value"); .select("value");
if (error) { if (!BusinessType) {
console.error(error); console.error(error);
} else { } else {
if (BusinessType) { setIndustry(BusinessType.map((item) => item.value));
console.table();
setIndustry(BusinessType.map((item) => item.value));
}
} }
}; };
useEffect(() => { useEffect(() => {
fetchIndustry(); fetchIndustry();
}, []); }, []);
/* temp */
let format = {
"Company Name: ": companyName,
"Industry": selectedIndustry,
}
/* TEMP log */
const submitApplication = () => alert(JSON.stringify(format));
return ( return (
<div> <div>
<div className="grid grid-flow-row auto-rows-max w-full h-52 md:h-92 bg-gray-100 dark:bg-gray-800 p-5"> <div className="grid grid-flow-row auto-rows-max w-full h-52 md:h-92 bg-gray-100 dark:bg-gray-800 p-5">
@ -57,9 +68,7 @@ export default function Apply() {
<div className="mt-5 justify-self-center"> <div className="mt-5 justify-self-center">
<p className="text-sm md:text-base text-neutral-500"> <p className="text-sm md:text-base text-neutral-500">
All information submitted in this application is for internal use All information submitted in this application is for internal use
only and is treated with the utmost{" "} only and is treated with the utmost {" "}<br />
</p>
<p className="text-sm md:text-base text-neutral-500">
confidentiality. Companies may apply to raise with B2DVentures more confidentiality. Companies may apply to raise with B2DVentures more
than once. than once.
</p> </p>
@ -68,7 +77,7 @@ export default function Apply() {
<div className="grid grid-flow-row auto-rows-max w-full ml-48"> <div className="grid grid-flow-row auto-rows-max w-full ml-48">
<h1 className="text-3xl font-bold mt-10 ml-96">About your company</h1> <h1 className="text-3xl font-bold mt-10 ml-96">About your company</h1>
<p className="ml-96 mt-5 text-neutral-500"> <p className="ml-96 mt-5 text-neutral-500">
All requested information in this section is required. All requested information in this section are required.
</p> </p>
{/* form */} {/* form */}
@ -76,10 +85,10 @@ export default function Apply() {
<div className="ml-96 mt-5 space-y-10"> <div className="ml-96 mt-5 space-y-10">
<div className="mt-10 space-y-5"> <div className="mt-10 space-y-5">
<Label htmlFor="companyName" className="font-bold text-lg"> <Label htmlFor="companyName" className="font-bold text-lg">
Company name Company Name
</Label> </Label>
<div className="flex space-x-5"> <div className="flex space-x-5">
<Input type="text" id="companyName" className="w-96" /> <Input onChange={(event) => setCompanyName(event.target.value)} type="text" id="companyName" className="w-96" />
<span className="text-[12px] text-neutral-500 self-center"> <span className="text-[12px] text-neutral-500 self-center">
This should be the name your company uses on your <br /> This should be the name your company uses on your <br />
website and in the market. website and in the market.
@ -92,7 +101,7 @@ export default function Apply() {
Industry Industry
</Label> </Label>
<div className="flex space-x-5"> <div className="flex space-x-5">
<Select> <Select onValueChange={(value) => setSelectedIndustry(value)}>
<SelectTrigger className="w-96"> <SelectTrigger className="w-96">
<SelectValue placeholder="Select an industry" /> <SelectValue placeholder="Select an industry" />
</SelectTrigger> </SelectTrigger>
@ -100,7 +109,7 @@ export default function Apply() {
<SelectGroup> <SelectGroup>
<SelectLabel>Industry</SelectLabel> <SelectLabel>Industry</SelectLabel>
{industry.map((i) => ( {industry.map((i) => (
<SelectItem value={i}>{i}</SelectItem> <SelectItem key={i} value={i}>{i}</SelectItem>
))} ))}
</SelectGroup> </SelectGroup>
</SelectContent> </SelectContent>
@ -202,14 +211,14 @@ export default function Apply() {
<div className="flex space-x-2 w-96"> <div className="flex space-x-2 w-96">
<Button <Button
variant={isGenerating === "Yes" ? "default" : "outline"} variant={isGenerating === "Yes" ? "default" : "outline"}
onClick={() => setIsGenarting("Yes")} onClick={() => setIsGenerating("Yes")}
className="w-20 h-12 text-base" className="w-20 h-12 text-base"
> >
Yes Yes
</Button> </Button>
<Button <Button
variant={isGenerating === "No" ? "default" : "outline"} variant={isGenerating === "No" ? "default" : "outline"}
onClick={() => setIsGenarting("No")} onClick={() => setIsGenerating("No")}
className="w-20 h-12 text-base" className="w-20 h-12 text-base"
> >
No No
@ -225,7 +234,7 @@ export default function Apply() {
{/* Pitch deck */} {/* Pitch deck */}
<div className="space-y-5"> <div className="space-y-5">
<Label htmlFor="companyName" className="font-bold text-lg"> <Label htmlFor="companyName" className="font-bold text-lg">
Pitch deck Pitch Deck
</Label> </Label>
<div className="flex space-x-2 w-96"> <div className="flex space-x-2 w-96">
<Button <Button
@ -264,7 +273,7 @@ export default function Apply() {
{/* What's the rough size of your community? */} {/* What's the rough size of your community? */}
<div className="mt-10 space-y-5"> <div className="mt-10 space-y-5">
<Label htmlFor="industry" className="font-bold text-lg mt-10"> <Label htmlFor="industry" className="font-bold text-lg mt-10">
What's the rough size of your <br /> community? What{"'"}s the rough size of your <br /> community?
</Label> </Label>
<div className="flex space-x-5"> <div className="flex space-x-5">
<Select> <Select>
@ -275,7 +284,7 @@ export default function Apply() {
<SelectGroup> <SelectGroup>
<SelectLabel>Select</SelectLabel> <SelectLabel>Select</SelectLabel>
{communitySize.map((i) => ( {communitySize.map((i) => (
<SelectItem value={i}>{i}</SelectItem> <SelectItem key={i} value={i}>{i}</SelectItem>
))} ))}
</SelectGroup> </SelectGroup>
</SelectContent> </SelectContent>
@ -291,8 +300,8 @@ export default function Apply() {
</div> </div>
{/* Submit */} {/* Submit */}
<center> <center>
<Button className="mt-12 mb-20 h-10 text-base font-bold py-6 px-5"> <Button onClick={submitApplication} className="mt-12 mb-20 h-10 text-base font-bold py-6 px-5">
Submit application Submit Application
</Button> </Button>
</center> </center>
</div> </div>