From ad6844a39c3c5635d60bb073090cdd2e3924c54f Mon Sep 17 00:00:00 2001 From: jainarayanan Date: Fri, 6 Sep 2024 10:36:49 -0700 Subject: [PATCH] add more data --- components/DirectoryLayout.tsx | 30 ++++++++--- components/NavBar.tsx | 71 +++++++------------------- components/startups/StartupTile.tsx | 78 +++++++---------------------- 3 files changed, 57 insertions(+), 122 deletions(-) diff --git a/components/DirectoryLayout.tsx b/components/DirectoryLayout.tsx index eadb34e..20c38ae 100644 --- a/components/DirectoryLayout.tsx +++ b/components/DirectoryLayout.tsx @@ -61,9 +61,7 @@ const DirectoryLayout = (props: LayoutProps) => { if (!projectsQuery.data) return []; // eslint-disable-next-line @typescript-eslint/no-unsafe-return return projectsQuery.data.filter((project: Project) => { - const matchesName = project.name - .toLowerCase() - .includes(projectSearchText.toLowerCase()); + const matchesName = project.name.toLowerCase().includes(projectSearchText.toLowerCase()); // const matchesCategory = selectedProjectCategory === "" || project.category === selectedProjectCategory; @@ -74,11 +72,27 @@ const DirectoryLayout = (props: LayoutProps) => { return (
-

- The Directory -

+

The Directory

- +
+ + setProjectSearchText(e.target.value)} + className="flex h-10 w-64 rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground" + /> +
+
+ {startupsQuery.data?.map((startup: Startup) => ( + + + + ))} +
+ {/* @@ -145,7 +159,7 @@ const DirectoryLayout = (props: LayoutProps) => {
- + */}
diff --git a/components/NavBar.tsx b/components/NavBar.tsx index 8c6f9e4..75ec9c4 100644 --- a/components/NavBar.tsx +++ b/components/NavBar.tsx @@ -32,11 +32,11 @@ const NAVIGATION = [ href: "/events", right: false, }, - // { - // name: "Startups", - // href: "/startups", - // right: false, - // }, + { + name: "Community Projects", + href: "/startups", + right: false, + }, { name: "Dashboard", href: "/dashboard", @@ -74,15 +74,8 @@ const NAVIGATION = [ // } const ProfilePic = ({ user, username }: { user: User; username: string }) => { - const { - file: avatar, - loading, - error, - } = useSupabaseDownload("avatars", user.id, `${username} avatar`); - const avatarUrl = useMemo( - () => avatar && URL.createObjectURL(avatar), - [avatar] - ); + const { file: avatar, loading, error } = useSupabaseDownload("avatars", user.id, `${username} avatar`); + const avatarUrl = useMemo(() => avatar && URL.createObjectURL(avatar), [avatar]); if (loading || error || !avatarUrl) { return null; } @@ -101,10 +94,7 @@ export default function NavbarBuilder() { const [inSafari, setInSafari] = useState(false); useEffect(() => { - if ( - navigator.userAgent.includes("Safari") && - !navigator.userAgent.includes("Chrome") - ) { + if (navigator.userAgent.includes("Safari") && !navigator.userAgent.includes("Chrome")) { setInSafari(true); } }, []); @@ -134,15 +124,8 @@ export default function NavbarBuilder() {
- - V1 logo + + V1 logo
@@ -157,11 +140,7 @@ export default function NavbarBuilder() { } px-3 py-2 rounded-md text-sm font-medium ${ // eslint-disable-next-line no-nested-ternary, prettier/prettier - inSafari - ? !user - ? "relative top-nav-nouser" - : "relative top-nav-user" - : "" + inSafari ? (!user ? "relative top-nav-nouser" : "relative top-nav-user") : "" } ${item?.login && !user ? "hidden" : ""} ${item?.noauth && user ? "hidden" : ""} @@ -170,26 +149,14 @@ export default function NavbarBuilder() { item?.signup ? "bg-gradient-to-r from-yellow-600 to-yellow-700 hover:bg-blue-500 hover:opacity-75 !text-gray-100" : "" - } ${ - item?.minRank && rank !== null && rank < item.minRank - ? "hidden" - : "" - }`} - aria-current={ - router.pathname === item.href ? "page" : undefined - } - style={ - item.right - ? { marginLeft: "auto", marginRight: "0" } - : {} - } + } ${item?.minRank && rank !== null && rank < item.minRank ? "hidden" : ""}`} + aria-current={router.pathname === item.href ? "page" : undefined} + style={item.right ? { marginLeft: "auto", marginRight: "0" } : {}} > {item.name} {item?.signup && <>›} ))} - {user && username && ( - - )} + {user && username && }
@@ -208,13 +175,9 @@ export default function NavbarBuilder() { : "text-gray-300 hover:bg-gray-700 hover:text-white" } block px-3 py-2 rounded-md text-base font-medium ${ - item?.minRank && rank !== null && rank < item.minRank - ? "hidden" - : "" + item?.minRank && rank !== null && rank < item.minRank ? "hidden" : "" }`} - aria-current={ - router.pathname === item.href ? "page" : undefined - } + aria-current={router.pathname === item.href ? "page" : undefined} > {item.name} diff --git a/components/startups/StartupTile.tsx b/components/startups/StartupTile.tsx index bd798e3..3f46fa3 100644 --- a/components/startups/StartupTile.tsx +++ b/components/startups/StartupTile.tsx @@ -1,11 +1,7 @@ /* 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 { - InformationCircleIcon, - ExternalLinkIcon, - HeartIcon as HeartOutlineIcon, -} from "@heroicons/react/outline"; +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"; @@ -18,15 +14,7 @@ interface Favorite { } export default function StartupTile({ startup }: { startup: Startup }) { - const { - name, - description, - logo, - website, - industries, - profiles, - startups_members: profileMetadata, - } = startup; + const { name, description, logo, website, industries, profiles, startups_members: profileMetadata } = startup; const [dialogOpen, setDialogOpen] = useState(false); const [isFavorite, setIsFavorite] = useState(false); @@ -57,19 +45,13 @@ export default function StartupTile({ startup }: { startup: Startup }) { } if (isFavorite) { - const { error } = await supabase - .from("favorites") - .delete() - .eq("user_id", user.id) - .eq("startup_id", startup.id); + 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 }]); + const { error } = await supabase.from("favorites").insert([{ user_id: user.id, startup_id: startup.id }]); if (!error) { setIsFavorite(true); @@ -80,24 +62,19 @@ export default function StartupTile({ startup }: { startup: Startup }) { return ( <> {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */} -
  • setDialogOpen(true)} - className="m-0 p-0 list-none rounded-md" - > -
    +
  • setDialogOpen(true)} className="m-0 p-0 list-none rounded-md"> +
    {`${name}
    -
    +
    -

    - {name} -

    +

    {name}

    - {industries.map((industry) => ( + {industries?.map((industry) => ( -

    +

    {industry}

    @@ -125,9 +102,7 @@ export default function StartupTile({ startup }: { startup: Startup }) {
    -

    - {name} -

    +

    {name}

  • - setDialogOpen(false)} - > + setDialogOpen(false)}>
    - {`${name} + {`${name}
    -

    - {name} -

    +

    {name}

    - - People - + People
    {profiles?.map((profile, i) => ( - + ))}