diff --git a/.eslintignore b/.eslintignore index 9d73525..eb49799 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,5 @@ src/app/(investment)/deals/[id]/followShareButton.tsx src/components/ui/* -src/types/database.types.ts \ No newline at end of file +src/types/database.types.ts +src/components/BusinessForm.tsx +src/components/ProjectForm.tsx \ No newline at end of file diff --git a/src/app/overview/page.tsx b/src/app/overview/page.tsx deleted file mode 100644 index cd07319..0000000 --- a/src/app/overview/page.tsx +++ /dev/null @@ -1,191 +0,0 @@ -"use client"; - -import React, { useState, useEffect } from "react"; -import Image from "next/image"; -import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel"; -import { Card, CardContent } from "@/components/ui/card"; -import CountUp from "react-countup"; -import { Progress } from "@/components/ui/progress"; -import { Separator } from "@/components/ui/separator"; -import { Button } from "@/components/ui/button"; -import { ShareIcon, StarIcon } from "lucide-react"; -import { Toaster, toast } from "react-hot-toast"; -import useSession from "@/lib/supabase/useSession"; -import { redirect } from "next/navigation"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; -import Link from "next/link"; - -export default function Invest() { - const [progress, setProgress] = useState(0); - const [tab, setTab] = useState("Pitch"); - const { session, loading } = useSession(); - const user = session?.user; - const [sessionLoaded, setSessionLoaded] = useState(false); - const [isFollow, setIsFollow] = useState(false); - - useEffect(() => { - // set sessionLoaded to true once session is confirmed - if (!loading) { - setSessionLoaded(true); - } - }, [loading]); - const handleClick = (item: string) => { - setTab(item); - }; - - const handleShare = () => { - const currentUrl = window.location.href; - if (document.hasFocus()) { - navigator.clipboard.writeText(currentUrl).then(() => { - toast.success("URL copied to clipboard!"); - }); - } - }; - const handleFollow = () => { - if (user) { - setIsFollow((prevState) => !prevState); - // save follow to database - } else { - redirect("/login"); - } - }; - useEffect(() => { - // percent success - const timer = setTimeout(() => setProgress(66), 500); - return () => clearTimeout(timer); - }, []); - return ( -
-
- -
-
-
- {/* Name, star and share button packed */} -
-
- logo -
NVIDIA
-
-
-
- - - - - - -

Follow NIVIDIA

-
-
-
-
-
- -
-
-
- {/* end of pack */} -

World's first non-metal sustainable battery

-
- {["Technology", "Gaming"].map((tag) => ( - - {tag} - - ))} -
-
- {/* image carousel */} -
- - - {Array.from({ length: 5 }).map((_, index) => ( - - - - ))} - {" "} - - - - - - {/* boiler plate for an actual pictures */} - - - - - - - - - - - - - - - - - -
-
-
-

- -

-

5% raised of $5M max goal

- -

- {" "} - -

-

Investors

-
- -

- hours -

-

Left to invest

- -
-
-
-
- {/* menu */} -
- -
-
- {/* Card section */} -
- {/* Cards */} - - - - {tab} - - - -
-
- ); -} \ No newline at end of file diff --git a/src/app/project/apply/page.tsx b/src/app/project/apply/page.tsx index 204164b..b14b662 100644 --- a/src/app/project/apply/page.tsx +++ b/src/app/project/apply/page.tsx @@ -1,4 +1,5 @@ "use client"; + import { createSupabaseClient } from "@/lib/supabase/clientComponentClient"; import ProjectForm from "@/components/ProjectForm"; import { projectFormSchema } from "@/types/schemas/application.schema"; @@ -29,8 +30,7 @@ export default function ApplyProject() { .insert([ { user_id: userId, - pitch_deck_url: - pitchType === "string" ? recvData["projectPitchDeck"] : "", + pitch_deck_url: pitchType === "string" ? recvData["projectPitchDeck"] : "", target_investment: recvData["targetInvest"], deadline: recvData["deadline"], project_name: recvData["projectName"], @@ -58,36 +58,21 @@ export default function ApplyProject() { const results = await Promise.all(tagPromises); // Collect errors - const errors = results - .filter((result) => result.error) - .map((result) => result.error); + const errors = results.filter((result) => result.error).map((result) => result.error); return { errors }; }; - const uploadPitchFile = async ( - file: File, - userId: string, - projectId: string - ) => { + const uploadPitchFile = async (file: File, userId: string, projectId: string) => { if (!file || !userId) { console.error("Pitch file or user ID is undefined."); return false; } - return await uploadFile( - file, - BUCKET_PITCH_APPLICATION_NAME, - `${userId}/${projectId}/pitches/${file.name}` - ); + return await uploadFile(file, BUCKET_PITCH_APPLICATION_NAME, `${userId}/${projectId}/pitches/${file.name}`); }; - const uploadLogoAndPhotos = async ( - logoFile: File, - photos: File[], - userId: string, - projectId: string - ) => { + const uploadLogoAndPhotos = async (logoFile: File, photos: File[], userId: string, projectId: string) => { const uploadResults: { logo?: any; photos: any[] } = { photos: [] }; // upload logo @@ -108,11 +93,7 @@ export default function ApplyProject() { // upload each photo const uploadPhotoPromises = photos.map((image) => - uploadFile( - image, - BUCKET_PITCH_APPLICATION_NAME, - `${userId}/${projectId}/photos/${image.name}` - ) + uploadFile(image, BUCKET_PITCH_APPLICATION_NAME, `${userId}/${projectId}/photos/${image.name}`) ); const photoResults = await Promise.all(uploadPhotoPromises); @@ -132,8 +113,7 @@ export default function ApplyProject() { Swal.fire({ icon: error == null ? "success" : "error", title: error == null ? "Success" : `Error: ${error.code}`, - text: - error == null ? "Your application has been submitted" : error.message, + text: error == null ? "Your application has been submitted" : error.message, confirmButtonColor: error == null ? "green" : "red", }).then((result) => { if (result.isConfirmed) { @@ -168,11 +148,7 @@ export default function ApplyProject() { // upload pitch file if it’s a file if (typeof recvData["projectPitchDeck"] === "object") { - const uploadPitchSuccess = await uploadPitchFile( - recvData["projectPitchDeck"], - user.id, - projectId - ); + const uploadPitchSuccess = await uploadPitchFile(recvData["projectPitchDeck"], user.id, projectId); if (!uploadPitchSuccess) { console.error("Error uploading pitch file."); @@ -196,21 +172,11 @@ export default function ApplyProject() { // console.log("Logo Path:", logo.data.path); // console.table(photos); - const logoURL = await getPrivateURL( - logo.data.path, - BUCKET_PITCH_APPLICATION_NAME - ); + const logoURL = await getPrivateURL(logo.data.path, BUCKET_PITCH_APPLICATION_NAME); let photoURLsArray: string[] = []; const photoURLPromises = photos.map( - async (item: { - success: boolean; - errors: typeof errors; - data: { path: string }; - }) => { - const photoURL = await getPrivateURL( - item.data.path, - BUCKET_PITCH_APPLICATION_NAME - ); + async (item: { success: boolean; errors: typeof errors; data: { path: string } }) => { + const photoURL = await getPrivateURL(item.data.path, BUCKET_PITCH_APPLICATION_NAME); if (photoURL?.signedUrl) { photoURLsArray.push(photoURL.signedUrl); } else { @@ -233,11 +199,7 @@ export default function ApplyProject() { setIsSuccess(true); displayAlert(error); }; - const updateImageURL = async ( - url: string | string[], - columnName: string, - projectId: number - ) => { + const updateImageURL = async (url: string | string[], columnName: string, projectId: number) => { const { error } = await supabase .from("project_application") .update({ [columnName]: url }) @@ -250,9 +212,7 @@ export default function ApplyProject() { } }; const getPrivateURL = async (path: string, bucketName: string) => { - const { data } = await supabase.storage - .from(bucketName) - .createSignedUrl(path, 9999999999999999999999999999); + const { data } = await supabase.storage.from(bucketName).createSignedUrl(path, 9999999999999999999999999999); // console.table(data); return data; }; @@ -265,12 +225,10 @@ export default function ApplyProject() {

- Begin Your First Fundraising Project. Starting a fundraising project - is mandatory for all businesses. + Begin Your First Fundraising Project. Starting a fundraising project is mandatory for all businesses.

- This step is crucial to begin your journey and unlock the necessary - tools for raising funds. + This step is crucial to begin your journey and unlock the necessary tools for raising funds.

diff --git a/src/components/BusinessForm.tsx b/src/components/BusinessForm.tsx index ced01a8..5e9dac8 100644 --- a/src/components/BusinessForm.tsx +++ b/src/components/BusinessForm.tsx @@ -3,27 +3,14 @@ import { SubmitHandler, useForm } from "react-hook-form"; import { Button } from "@/components/ui/button"; import { DualOptionSelector } from "@/components/dualSelector"; import { MultipleOptionSelector } from "@/components/multipleSelector"; -import { - Form, - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, -} from "@/components/ui/form"; +import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { businessFormSchema } from "@/types/schemas/application.schema"; import { z } from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; import { Label } from "@/components/ui/label"; import { Switch } from "@/components/ui/switch"; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@radix-ui/react-tooltip"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@radix-ui/react-tooltip"; import { createSupabaseClient } from "@/lib/supabase/clientComponentClient"; type businessSchema = z.infer; @@ -54,14 +41,10 @@ const BusinessForm = ({ let supabase = createSupabaseClient(); const [businessPitch, setBusinessPitch] = useState("text"); const [businessPitchFile, setBusinessPitchFile] = useState(""); - const [countries, setCountries] = useState<{ id: number; name: string }[]>( - [] - ); + const [countries, setCountries] = useState<{ id: number; name: string }[]>([]); const [industry, setIndustry] = useState<{ id: number; name: string }[]>([]); const fetchIndustry = async () => { - let { data: BusinessType, error } = await supabase - .from("business_type") - .select("id, value"); + let { data: BusinessType, error } = await supabase.from("business_type").select("id, value"); if (error) { console.error(error); @@ -84,18 +67,12 @@ const BusinessForm = ({ throw new Error("Network response was not ok"); } const data = await response.json(); - const countryList = data.map( - (country: { name: { common: string } }, index: number) => ({ - id: index + 1, - name: country.name.common, - }) - ); + const countryList = data.map((country: { name: { common: string } }, index: number) => ({ + id: index + 1, + name: country.name.common, + })); - setCountries( - countryList.sort((a: { name: string }, b: { name: any }) => - a.name.localeCompare(b.name) - ) - ); + setCountries(countryList.sort((a: { name: string }, b: { name: any }) => a.name.localeCompare(b.name))); } catch (error) { console.error("Error fetching countries:", error); } @@ -106,15 +83,11 @@ const BusinessForm = ({ }, []); return (
- )} - className="space-y-8" - > + )} className="space-y-8">

About your company

- **All requested - information in this section is required. + **All requested information in this section is required.

{/* Company Name */} @@ -123,21 +96,13 @@ const BusinessForm = ({ name="companyName" render={({ field }: { field: any }) => ( - - Company name - + Company name
- + - This should be the name your company uses on your{" "} -
+ This should be the name your company uses on your
website and in the market.
@@ -162,9 +127,7 @@ const BusinessForm = ({ // console.log("Country selected: " + selectedValues.name); field.onChange(selectedValues.name); }} - description={ - <>Select the country where your business is based. - } + description={<>Select the country where your business is based.} placeholder="Select a country" selectLabel="Country" /> @@ -189,12 +152,7 @@ const BusinessForm = ({ // console.log("Type of selected value:", selectedValues.id); field.onChange(selectedValues.id); }} - description={ - <> - Choose the industry that best aligns with your - business. - - } + description={<>Choose the industry that best aligns with your business.} placeholder="Select an industry" selectLabel="Industry" /> @@ -229,8 +187,7 @@ const BusinessForm = ({ value={field.value} /> - The sum total of past financing, including angel or - venture
+ The sum total of past financing, including angel or venture
capital, loans, grants, or token sales.
@@ -251,11 +208,7 @@ const BusinessForm = ({
- Is your company incorporated in the United States? - - } + label={<>Is your company incorporated in the United States?} choice1="Yes" choice2="No" handleFunction={(selectedValues: string) => { @@ -266,8 +219,7 @@ const BusinessForm = ({ value={field.value} /> - Only companies that are incorporated or formed in the US - are eligible to raise via Reg CF. + Only companies that are incorporated or formed in the US are eligible to raise via Reg CF.
@@ -287,21 +239,14 @@ const BusinessForm = ({ Is your product available (for sale) in market? - } + label={<>Is your product available (for sale) in market?} choice1="Yes" choice2="No" handleFunction={(selectedValues: string) => { // setIsForSale; field.onChange(selectedValues); }} - description={ - <> - Only check this box if customers can access, use, or - buy your product today. - - } + description={<>Only check this box if customers can access, use, or buy your product today.} />
@@ -328,10 +273,7 @@ const BusinessForm = ({ field.onChange(selectedValues); }} description={ - <> - Only check this box if your company is making money. - Please elaborate on revenue below. - + <>Only check this box if your company is making money. Please elaborate on revenue below. } />
@@ -356,9 +298,7 @@ const BusinessForm = ({
diff --git a/src/components/paymentMethod.tsx b/src/components/paymentMethod.tsx index 16b294e..aad84e9 100644 --- a/src/components/paymentMethod.tsx +++ b/src/components/paymentMethod.tsx @@ -1,25 +1,11 @@ "use client"; import { Icons } from "./ui/icons"; -import { Button } from "./ui/button"; -import { - Card, - CardContent, - CardDescription, - CardFooter, - CardHeader, - CardTitle, -} from "./ui/card"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./ui/card"; import { Input } from "./ui/input"; import { Label } from "./ui/label"; import { RadioGroup, RadioGroupItem } from "./ui/radio-group"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "./ui/select"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./ui/select"; export function CardsPaymentMethod() { return ( @@ -33,12 +19,7 @@ export function CardsPaymentMethod() {
- +