From 376071a9c30c42d3af79f9974fcd2731b1fbd5ee Mon Sep 17 00:00:00 2001 From: sirin Date: Mon, 28 Oct 2024 21:11:21 +0700 Subject: [PATCH] refactor: remove unused variable and import --- src/app/(user)/profile/[uid]/edit/page.tsx | 1 + src/app/(user)/profile/[uid]/page.tsx | 3 -- src/app/auth/page.tsx | 5 +- src/app/auth/signup/page.tsx | 5 +- src/app/business/apply/page.tsx | 56 ++++++++-------------- 5 files changed, 26 insertions(+), 44 deletions(-) diff --git a/src/app/(user)/profile/[uid]/edit/page.tsx b/src/app/(user)/profile/[uid]/edit/page.tsx index e9fdf21..6fe86a5 100644 --- a/src/app/(user)/profile/[uid]/edit/page.tsx +++ b/src/app/(user)/profile/[uid]/edit/page.tsx @@ -68,6 +68,7 @@ export default function EditProfilePage({ params }: { params: { uid: string } }) ( Avatar diff --git a/src/app/(user)/profile/[uid]/page.tsx b/src/app/(user)/profile/[uid]/page.tsx index 73cdcaf..962723f 100644 --- a/src/app/(user)/profile/[uid]/page.tsx +++ b/src/app/(user)/profile/[uid]/page.tsx @@ -2,13 +2,10 @@ import React from "react"; import Image from "next/image"; import { createSupabaseClient } from "@/lib/supabase/serverComponentClient"; import { getUserProfile } from "@/lib/data/userQuery"; -import { Tables } from "@/types/database.types"; import { format } from "date-fns"; import ReactMarkdown from "react-markdown"; import Link from "next/link"; -interface Profile extends Tables<"Profiles"> {} - export default async function ProfilePage({ params }: { params: { uid: string } }) { const supabase = createSupabaseClient(); const uid = params.uid; diff --git a/src/app/auth/page.tsx b/src/app/auth/page.tsx index 254c835..9ef133a 100644 --- a/src/app/auth/page.tsx +++ b/src/app/auth/page.tsx @@ -1,5 +1,3 @@ -import Image from "next/image"; -import { Button } from "@/components/ui/button"; import { Card, CardContent, CardFooter, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { LoginButton } from "@/components/auth/loginButton"; @@ -9,7 +7,8 @@ export default function Login() { return (
+ style={{ backgroundImage: "url(/login.png)" }} + > Empower Your Vision diff --git a/src/app/auth/signup/page.tsx b/src/app/auth/signup/page.tsx index b280f2b..cca3993 100644 --- a/src/app/auth/signup/page.tsx +++ b/src/app/auth/signup/page.tsx @@ -1,5 +1,3 @@ -import Image from "next/image"; -import { Button } from "@/components/ui/button"; import { Card, CardContent, CardFooter, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { SignupButton } from "@/components/auth/signupButton"; @@ -9,7 +7,8 @@ export default function Signup() { return (
+ style={{ backgroundImage: "url(/signup.png)" }} + > Join Our Community diff --git a/src/app/business/apply/page.tsx b/src/app/business/apply/page.tsx index 1e18c81..e61a801 100644 --- a/src/app/business/apply/page.tsx +++ b/src/app/business/apply/page.tsx @@ -49,7 +49,7 @@ export default function ApplyBusiness() { } } - const { data, error } = await supabase + const { error } = await supabase .from("business_application") .insert([ { @@ -60,20 +60,18 @@ export default function ApplyBusiness() { is_for_sale: recvData["isForSale"], is_generating_revenue: recvData["isGenerating"], is_in_us: recvData["isInUS"], - pitch_deck_url: - pitchType === "string" ? recvData["businessPitchDeck"] : "", + pitch_deck_url: pitchType === "string" ? recvData["businessPitchDeck"] : "", money_raised_to_date: recvData["totalRaised"], community_size: recvData["communitySize"], }, ]) .select(); setSucess(true); - // console.table(data); + 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 && applyProject) { @@ -85,10 +83,7 @@ export default function ApplyBusiness() { }; const hasUserApplied = async (userID: string) => { - let { data: business, error } = await supabase - .from("business") - .select("*") - .eq("user_id", userID); + let { data: business, error } = await supabase.from("business").select("*").eq("user_id", userID); console.table(business); if (error) { console.error(error); @@ -100,24 +95,21 @@ export default function ApplyBusiness() { }; const transformChoice = (data: any) => { // convert any yes and no to true or false - const transformedData = Object.entries(data).reduce( - (acc: Record, [key, value]) => { - if (typeof value === "string") { - const lowerValue = value.toLowerCase(); - if (lowerValue === "yes") { - acc[key] = true; - } else if (lowerValue === "no") { - acc[key] = false; - } else { - acc[key] = value; // keep other string values unchanged - } + const transformedData = Object.entries(data).reduce((acc: Record, [key, value]) => { + if (typeof value === "string") { + const lowerValue = value.toLowerCase(); + if (lowerValue === "yes") { + acc[key] = true; + } else if (lowerValue === "no") { + acc[key] = false; } else { - acc[key] = value; // keep other types unchanged + acc[key] = value; // keep other string values unchanged } - return acc; - }, - {} - ); + } else { + acc[key] = value; // keep other types unchanged + } + return acc; + }, {}); return transformedData; }; useEffect(() => { @@ -164,22 +156,16 @@ export default function ApplyBusiness() {

- All information submitted in this application is for internal use - only and is treated with the utmost{" "} + All information submitted in this application is for internal use only and is treated with the utmost{" "}

- confidentiality. Companies may apply to raise with B2DVentures more - than once. + confidentiality. Companies may apply to raise with B2DVentures more than once.

{/* form */} {/*
*/} - +
); }