refactor: remove unused variable and import

This commit is contained in:
sirin 2024-10-28 21:11:21 +07:00
parent 441a344d03
commit 376071a9c3
5 changed files with 26 additions and 44 deletions

View File

@ -68,6 +68,7 @@ export default function EditProfilePage({ params }: { params: { uid: string } })
<FormField
control={profileForm.control}
name="avatars"
// eslint-disable-next-line no-unused-vars
render={({ field: { value, onChange, ...fieldProps } }) => (
<FormItem>
<FormLabel>Avatar</FormLabel>

View File

@ -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;

View File

@ -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 (
<div
className="bg-cover bg-center min-h-screen flex items-center justify-center"
style={{ backgroundImage: "url(/login.png)" }}>
style={{ backgroundImage: "url(/login.png)" }}
>
<Card>
<CardHeader className="items-center">
<CardTitle className="text-2xl font-bold">Empower Your Vision</CardTitle>

View File

@ -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 (
<div
className="bg-cover bg-center min-h-screen flex items-center justify-center"
style={{ backgroundImage: "url(/signup.png)" }}>
style={{ backgroundImage: "url(/signup.png)" }}
>
<Card>
<CardHeader className="items-center">
<CardTitle className="text-2xl font-bold">Join Our Community</CardTitle>

View File

@ -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<any, any>, [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<any, any>, [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() {
</h1>
<div className="mt-5 justify-self-center">
<p className="text-sm md:text-base text-neutral-500">
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{" "}
</p>
<p className="text-sm md:text-base text-neutral-500">
confidentiality. Companies may apply to raise with B2DVentures more
than once.
confidentiality. Companies may apply to raise with B2DVentures more than once.
</p>
</div>
</div>
{/* form */}
{/* <form action="" onSubmit={handleSubmit(handleSubmitForms)}> */}
<BusinessForm
onSubmit={onSubmit}
applyProject={applyProject}
setApplyProject={setApplyProject}
/>
<BusinessForm onSubmit={onSubmit} applyProject={applyProject} setApplyProject={setApplyProject} />
</div>
);
}