From 38d2640acc6117d3daa949918d20dc9f1b50864e Mon Sep 17 00:00:00 2001 From: Ihsaan Ahmed Yasin <68300319+iyasinn@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:15:40 -0400 Subject: [PATCH] Revert "Startup modal (#96)" This reverts commit 4b944d68b9cf9d27246cd1f56d0995f8cba82990. --- components/startups/StartupProfileTile.tsx | 22 ++-- components/startups/StartupTile.tsx | 137 ++------------------- utils/types.ts | 1 - 3 files changed, 22 insertions(+), 138 deletions(-) diff --git a/components/startups/StartupProfileTile.tsx b/components/startups/StartupProfileTile.tsx index fdb0592..385f8a2 100644 --- a/components/startups/StartupProfileTile.tsx +++ b/components/startups/StartupProfileTile.tsx @@ -3,7 +3,6 @@ import { Dialog, Transition } from "@headlessui/react"; import useSupabase from "../../hooks/useSupabase"; import supabase from "../../utils/supabaseClient"; import { StartupProfile, StartupProfileMetadata } from "../../utils/types"; -import InternalLink from "../Link"; const CONNECTION_REQUEST_URL = process.env.NODE_ENV === "development" @@ -66,18 +65,15 @@ export default function StartupProfileTile({ } return ( -
- - {`${displayName} - - -

{displayName}

+
+ {`${displayName} +

{displayName}

{role}

{connectionSent ? (

diff --git a/components/startups/StartupTile.tsx b/components/startups/StartupTile.tsx index 030c219..71d739f 100644 --- a/components/startups/StartupTile.tsx +++ b/components/startups/StartupTile.tsx @@ -1,22 +1,14 @@ /* eslint-disable jsx-a11y/no-static-element-interactions */ /* eslint-disable jsx-a11y/click-events-have-key-events */ -import React, { Fragment, useState, useEffect } from "react"; +import React, { Fragment, useState } from "react"; import { InformationCircleIcon, ExternalLinkIcon, - HeartIcon as HeartOutlineIcon, } from "@heroicons/react/outline"; -import { HeartIcon as HeartFilledIcon } from "@heroicons/react/solid"; import { Dialog, Transition } from "@headlessui/react"; -import useSupabase from "../../hooks/useSupabase"; -import { Project, Startup } from "../../utils/types"; +import { Startup } from "../../utils/types"; import StartupProfileTile from "./StartupProfileTile"; -interface Favorite { - user_id: string; - startup_id: number; -} - export default function StartupTile({ startup }: { startup: Startup }) { const { name, @@ -28,69 +20,6 @@ export default function StartupTile({ startup }: { startup: Startup }) { startups_members: profileMetadata, } = startup; const [dialogOpen, setDialogOpen] = useState(false); - const [isFavorite, setIsFavorite] = useState(false); - const [projects, setProjects] = useState([]); - - const { supabase, user } = useSupabase(); - - useEffect(() => { - const checkIfFavorite = async () => { - if (!user) { - return; - } - - const { data } = await supabase - .from("favorites") - .select("*") - .eq("user_id", user.id) - .eq("startup_id", startup.id) - .single(); - - if (data) { - setIsFavorite(true); - } - }; - - const fetchProjects = async () => { - const { data } = await supabase - .from("projects") - .select("*") - .eq("startup_id", startup.id); - - if (data) { - setProjects(data); - } - }; - - checkIfFavorite(); - fetchProjects(); - }, [user, supabase, startup.id]); - - const toggleFavorite = async () => { - if (!user) { - return; - } - - if (isFavorite) { - const { error } = await supabase - .from("favorites") - .delete() - .eq("user_id", user.id) - .eq("startup_id", startup.id); - - if (!error) { - setIsFavorite(false); - } - } else { - const { error } = await supabase - .from("favorites") - .insert([{ user_id: user.id, startup_id: startup.id }]); - - if (!error) { - setIsFavorite(true); - } - } - }; return ( <> @@ -181,7 +110,7 @@ export default function StartupTile({ startup }: { startup: Startup }) { leaveTo="opacity-0 scale-95" > -

+
{`${name}
-
-

- {name} -

- -
- +

+ {name} +

-
- - People - -
- {profiles?.map((profile, i) => ( - - ))} -
-
- -
- - Projects - -
- {projects?.map((project) => ( -
-

- {project.name} -

-

- {project.description} -

-
- ))} -
+
+ {profiles?.map((profile, i) => ( + + ))}
diff --git a/utils/types.ts b/utils/types.ts index bb0155a..1da5e9d 100644 --- a/utils/types.ts +++ b/utils/types.ts @@ -35,5 +35,4 @@ export type Project = { name: string; categories: string; link: string; - startup_id: number; };