Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

refactor: move client side components behind suspense with fallback

Marc Seitzfaf3b9b61fca
diff --git a/app/(static)/investors/ClientPage.tsx b/app/(static)/investors/ClientPage.tsx
index c48a19ac..b4390c74 100644
--- a/app/(static)/investors/ClientPage.tsx
+++ b/app/(static)/investors/ClientPage.tsx
@@ -110,191 +110,177 @@ export default function Dashboard({ data }: any) {
return (
<>
- <div className="mx-auto max-w-6xl pt-4 mb-10">
- <div className="max-w-6xl mx-auto px-4 md:px-8 sm:pt-16 pt-8 text-gray-600">
- <div className="space-y-5 max-w-4xl mx-auto text-center mb-10">
- <h1 className="text-3xl text-gray-800 font-extrabold mx-auto sm:text-6xl max-w-3xl tracking-tighter">
- Open Investor Database
- </h1>
- <p>
- Find investors based on stage, sector, or location. <br />
- Powered by Papermark.
- </p>
- </div>
- </div>
- {/* <Stats angelsLength={angels.length} /> */}
- <div className="sm:flex flex-col md:flex-row justify-between mt-4">
- <span className="isolate mt-5 inline-flex rounded-md shadow-sm w-fit px-2 lg:px-2 ">
- {stages.map((stage) => (
- <Link
- href={
- stage.id !== "7"
- ? `/investors?category=${stage.id}`
- : "/investors"
- }
- key={stage.id}
- className={classNames(
- category === stage.id || (!category && stage.id === "7")
- ? "bg-gray-200"
- : "bg-white hover:bg-gray-50",
- "relative inline-flex items-center first-of-type:rounded-l-md last-of-type:rounded-r-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 focus:z-10 focus:outline-none focus:ring-gray-500 -ml-px first-of-type:-ml-0",
- )}
- >
- {stage.label}
- </Link>
- ))}
- </span>
- <div className="relative mt-5 px-2 ">
- <SearchIcon
- className="h-5 w-5 absolute z-20 left-3 bottom-2"
- aria-hidden="true"
- />
- <input
- type="text"
- id="search"
- name="search"
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- className="w-full rounded-xl shadow-sm inline-flex relative items-center border border-gray-300 px-4 py-2 text-sm text-gray-700 placeholder:text-gray-400 focus:z-10 focus:outline-none focus:ring-gray-500 md:w-72 pl-10 xs:pl-12"
- placeholder="Search by name or country"
- />
- </div>
+ <div className="sm:flex flex-col md:flex-row justify-between mt-4">
+ <span className="isolate mt-5 inline-flex rounded-md shadow-sm w-fit px-2 md:px-0">
+ {stages.map((stage) => (
+ <Link
+ href={
+ stage.id !== "7"
+ ? `/investors?category=${stage.id}`
+ : "/investors"
+ }
+ key={stage.id}
+ className={classNames(
+ category === stage.id || (!category && stage.id === "7")
+ ? "bg-gray-200"
+ : "bg-white hover:bg-gray-50",
+ "relative inline-flex items-center first-of-type:rounded-l-md last-of-type:rounded-r-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 focus:z-10 focus:outline-none focus:ring-gray-500 -ml-px first-of-type:-ml-0",
+ )}
+ >
+ {stage.label}
+ </Link>
+ ))}
+ </span>
+ <div className="relative mt-5 px-2 md:px-0">
+ <SearchIcon
+ className="h-5 w-5 absolute z-20 left-3 bottom-2 ml-1 md:ml-0"
+ aria-hidden="true"
+ />
+ <input
+ type="text"
+ id="search"
+ name="search"
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ className="w-full rounded-xl shadow-sm inline-flex relative items-center border border-gray-300 px-4 py-2 text-sm text-gray-700 placeholder:text-gray-400 focus:z-10 focus:outline-none focus:ring-gray-500 md:w-72 pl-10 xs:pl-12"
+ placeholder="Search by name or country"
+ />
</div>
- <div className="mt-8 flex flex-col">
- <div className="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
- <div className="inline-block min-w-full py-2 align-middle px-6 lg:px-8">
- <div className="py-2">
- <span className="font-bold">{currentInvestors.length}</span>{" "}
- investors
- </div>
- <div className="overflow-hidden md:shadow md:ring-1 md:ring-black md:ring-opacity-5 rounded-lg">
- <table className="min-w-full md:divide-y bg-gray-100 md:bg-transparent divide-gray-300 rounded-lg overflow-hidden md:rounded-none">
- <thead className="bg-gray-50 hidden md:table-header-group">
- <tr>
- <th
- scope="col"
- className="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6"
- >
- Name
- </th>
- <th
- scope="col"
- className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
- >
- Stage
- </th>
- <th
- scope="col"
- className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
- >
- Location
- </th>
- <th
- scope="col"
- className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
- >
- Sector
- </th>
- </tr>
- </thead>
- <tbody className="md:divide-y divide-gray-200 md:bg-white grid grid-cols-1 gap-3 sm:grid-cols-2 md:table-row-group">
- {paginatedInvestors.map((investor: any) => (
- <tr
- key={investor.id}
- className="group grid grid-cols-3 gap-1 md:table-row bg-white rounded-lg md:rounded-none md:bg-transparent shadow md:shadow-none border border-gray-200 md:border-x-0 py-3 px-2 md:p-0"
- >
- <td className="col-span-3 whitespace-nowrap pl-3 md:py-2 md:pl-6 text-sm sm:pl-6 md:h-24">
- <div className="flex items-center space-x-2">
- <div className="h-10 w-10 flex-shrink-0">
- {investor.imageUrl ? (
- <img
- className="rounded-full h-10 w-10 object-contain"
- width={40}
- height={40}
- src={
- investor.imageUrl !== ""
- ? investor.imageUrl
- : PlaceholderImg
- }
- alt={investor.name}
- />
- ) : (
- <Image
- className="rounded-full h-10 w-10 object-contain"
- width={40}
- height={40}
- src={PlaceholderImg}
- alt={investor.name}
- />
- )}
+ </div>
+ <div className="mt-8 flex flex-col">
+ <div className="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
+ <div className="inline-block min-w-full py-2 align-middle px-6 lg:px-8">
+ <div className="py-2">
+ <span className="font-bold">{currentInvestors.length}</span>{" "}
+ investors
+ </div>
+ <div className="overflow-hidden md:shadow md:ring-1 md:ring-black md:ring-opacity-5 rounded-lg">
+ <table className="min-w-full md:divide-y bg-gray-100 md:bg-transparent divide-gray-300 rounded-lg overflow-hidden md:rounded-none">
+ <thead className="bg-gray-50 hidden md:table-header-group">
+ <tr>
+ <th
+ scope="col"
+ className="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6"
+ >
+ Name
+ </th>
+ <th
+ scope="col"
+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
+ >
+ Stage
+ </th>
+ <th
+ scope="col"
+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
+ >
+ Location
+ </th>
+ <th
+ scope="col"
+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
+ >
+ Sector
+ </th>
+ </tr>
+ </thead>
+ <tbody className="md:divide-y divide-gray-200 md:bg-white grid grid-cols-1 gap-3 sm:grid-cols-2 md:table-row-group">
+ {paginatedInvestors.map((investor: any) => (
+ <tr
+ key={investor.id}
+ className="group grid grid-cols-3 gap-1 md:table-row bg-white rounded-lg md:rounded-none md:bg-transparent shadow md:shadow-none border border-gray-200 md:border-x-0 py-3 px-2 md:p-0"
+ >
+ <td className="col-span-3 whitespace-nowrap pl-3 md:py-2 md:pl-6 text-sm sm:pl-6 md:h-24">
+ <div className="flex items-center space-x-2">
+ <div className="h-10 w-10 flex-shrink-0">
+ {investor.imageUrl ? (
+ <img
+ className="rounded-full h-10 w-10 object-contain"
+ width={40}
+ height={40}
+ src={
+ investor.imageUrl !== ""
+ ? investor.imageUrl
+ : PlaceholderImg
+ }
+ alt={investor.name}
+ />
+ ) : (
+ <Image
+ className="rounded-full h-10 w-10 object-contain"
+ width={40}
+ height={40}
+ src={PlaceholderImg}
+ alt={investor.name}
+ />
+ )}
+ </div>
+ <div className="flex items-center space-x-3">
+ <div className="font-medium text-gray-900">
+ {investor.name}
</div>
- <div className="flex items-center space-x-3">
- <div className="font-medium text-gray-900">
- {investor.name}
- </div>
- <div className="flex space-x-2 items-center">
- {investor.website && (
- <a
- className="text-black"
- href={`${investor.website}?ref=papermark.io`}
- target="_blank"
- rel="noopener"
- >
- <span className="sr-only">Website</span>
- <GlobeIcon className="w-4 h-4" />
- </a>
- )}
- <Link
- href={`https://www.papermark.io?ref=investors-list`}
+ <div className="flex space-x-2 items-center">
+ {investor.website && (
+ <a
+ className="text-black"
+ href={`${investor.website}?ref=papermark.io`}
+ target="_blank"
+ rel="noopener"
>
- <Image
- src={PapermarkPImg}
- width={18}
- height={18}
- alt="Papermark"
- className="block ring-1 ring-gray-300 rounded-full"
- />
- </Link>
- </div>
+ <span className="sr-only">Website</span>
+ <GlobeIcon className="w-4 h-4" />
+ </a>
+ )}
+ <Link
+ href={`https://www.papermark.io?ref=investors-list`}
+ >
+ <Image
+ src={PapermarkPImg}
+ width={18}
+ height={18}
+ alt="Papermark"
+ className="block ring-1 ring-gray-300 rounded-full"
+ />
+ </Link>
</div>
</div>
- </td>
- <td className="col-span-1 row-start-2 whitespace-nowrap px-3 md:px-2 md:py-3 text-sm text-gray-500 font-bold md:font-normal">
- {investor.round ? investor.round : "Unknown"}
- </td>
- <td className="col-span-3 whitespace-nowrap px-3 md:px-2 md:py-3 text-sm text-gray-500 md:mt-0">
- {investor.location ? investor.location : "Unknown"}
- </td>
- <td className="col-span-3 md:max-w-xs px-3 md:px-2 md:py-3 text-sm text-gray-500 truncate w-40">
- {investor.sector ? investor.sector : "Unknown"}
- </td>
- </tr>
- ))}
- </tbody>
- </table>
- <div className="flex justify-between items-center w-full my-4 px-4">
- <button
- onClick={() => goToPage(currentPage - 1)}
- disabled={currentPage === 1}
- className="px-2 py-2 rounded border text-xs"
- >
- Previous
- </button>
- <div className="px-2 py-2 rounded text-xs">
- Page {currentPage} of {totalPages}
- </div>
- <button
- onClick={() => goToPage(currentPage + 1)}
- disabled={currentPage === totalPages}
- className="px-2 py-2 rounded border text-xs"
- >
- Next
- </button>
+ </div>
+ </td>
+ <td className="col-span-1 row-start-2 whitespace-nowrap px-3 md:px-2 md:py-3 text-sm text-gray-500 font-bold md:font-normal">
+ {investor.round ? investor.round : "Unknown"}
+ </td>
+ <td className="col-span-3 whitespace-nowrap px-3 md:px-2 md:py-3 text-sm text-gray-500 md:mt-0">
+ {investor.location ? investor.location : "Unknown"}
+ </td>
+ <td className="col-span-3 md:max-w-xs px-3 md:px-2 md:py-3 text-sm text-gray-500 truncate w-40">
+ {investor.sector ? investor.sector : "Unknown"}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ <div className="flex justify-between items-center w-full my-4 px-4">
+ <button
+ onClick={() => goToPage(currentPage - 1)}
+ disabled={currentPage === 1}
+ className="px-2 py-2 rounded border text-xs"
+ >
+ Previous
+ </button>
+ <div className="px-2 py-2 rounded text-xs">
+ Page {currentPage} of {totalPages}
</div>
- {currentInvestors.length === 0 && (
- <div className="text-center my-10">No results found</div>
- )}
+ <button
+ onClick={() => goToPage(currentPage + 1)}
+ disabled={currentPage === totalPages}
+ className="px-2 py-2 rounded border text-xs"
+ >
+ Next
+ </button>
</div>
+ {currentInvestors.length === 0 && (
+ <div className="text-center my-10">No results found</div>
+ )}
</div>
</div>
</div>
diff --git a/app/(static)/investors/Fallback.tsx b/app/(static)/investors/Fallback.tsx
new file mode 100644
index 00000000..3279cd13
--- /dev/null
+++ b/app/(static)/investors/Fallback.tsx
@@ -0,0 +1,195 @@
+import Link from "next/link";
+import { cn } from "@/lib/utils";
+import Image from "next/image";
+import PlaceholderImg from "@/public/_static/placeholder.png";
+import PapermarkPImg from "@/public/_static/papermark-p.svg";
+import { GlobeIcon } from "lucide-react";
+
+const stages = [
+ { id: "7", label: "All" },
+ { id: "5", label: "Pre-Seed" },
+ { id: "1", label: "Seed" },
+ { id: "2", label: "Series A" },
+ { id: "3", label: "Series B" },
+ { id: "4", label: "Series C" },
+];
+
+export const FallbackInvestors = async ({allInvestors}: {allInvestors: any[]}) => {
+
+ const category = "7";
+
+ const pageSize = 10; // Showing 10 investors per page
+ const totalPages = Math.ceil(allInvestors.length / pageSize);
+
+ const currentPage = 1;
+
+ const indexOfLastInvestor = 10;
+ const indexOfFirstInvestor = indexOfLastInvestor - 10;
+ const paginatedInvestors = allInvestors.slice(
+ indexOfFirstInvestor,
+ indexOfLastInvestor,
+ );
+
+ return (
+ <>
+ <div className="sm:flex flex-col md:flex-row justify-between mt-4">
+ <span className="isolate mt-5 inline-flex rounded-md shadow-sm w-fit px-2 lg:px-2 ">
+ {stages.map((stage) => (
+ <Link
+ href={
+ stage.id !== "7"
+ ? `/investors?category=${stage.id}`
+ : "/investors"
+ }
+ key={stage.id}
+ className={cn(
+ category === stage.id || (!category && stage.id === "7")
+ ? "bg-gray-200"
+ : "bg-white hover:bg-gray-50",
+ "relative inline-flex items-center first-of-type:rounded-l-md last-of-type:rounded-r-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 focus:z-10 focus:outline-none focus:ring-gray-500 -ml-px first-of-type:-ml-0",
+ )}
+ >
+ {stage.label}
+ </Link>
+ ))}
+ </span>
+ </div>
+ <div className="mt-8 flex flex-col">
+ <div className="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
+ <div className="inline-block min-w-full py-2 align-middle px-6 lg:px-8">
+ <div className="py-2">
+ <span className="font-bold">{allInvestors.length}</span>{" "}
+ investors
+ </div>
+ <div className="overflow-hidden md:shadow md:ring-1 md:ring-black md:ring-opacity-5 rounded-lg">
+ <table className="min-w-full md:divide-y bg-gray-100 md:bg-transparent divide-gray-300 rounded-lg overflow-hidden md:rounded-none">
+ <thead className="bg-gray-50 hidden md:table-header-group">
+ <tr>
+ <th
+ scope="col"
+ className="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6"
+ >
+ Name
+ </th>
+ <th
+ scope="col"
+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
+ >
+ Stage
+ </th>
+ <th
+ scope="col"
+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
+ >
+ Location
+ </th>
+ <th
+ scope="col"
+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
+ >
+ Sector
+ </th>
+ </tr>
+ </thead>
+ <tbody className="md:divide-y divide-gray-200 md:bg-white grid grid-cols-1 gap-3 sm:grid-cols-2 md:table-row-group">
+ {paginatedInvestors.map((investor: any) => (
+ <tr
+ key={investor.id}
+ className="group grid grid-cols-3 gap-1 md:table-row bg-white rounded-lg md:rounded-none md:bg-transparent shadow md:shadow-none border border-gray-200 md:border-x-0 py-3 px-2 md:p-0"
+ >
+ <td className="col-span-3 whitespace-nowrap pl-3 md:py-2 md:pl-6 text-sm sm:pl-6 md:h-24">
+ <div className="flex items-center space-x-2">
+ <div className="h-10 w-10 flex-shrink-0">
+ {investor.imageUrl ? (
+ <img
+ className="rounded-full h-10 w-10 object-contain"
+ width={40}
+ height={40}
+ src={
+ investor.imageUrl !== ""
+ ? investor.imageUrl
+ : PlaceholderImg
+ }
+ alt={investor.name}
+ />
+ ) : (
+ <Image
+ className="rounded-full h-10 w-10 object-contain"
+ width={40}
+ height={40}
+ src={PlaceholderImg}
+ alt={investor.name}
+ />
+ )}
+ </div>
+ <div className="flex items-center space-x-3">
+ <div className="font-medium text-gray-900">
+ {investor.name}
+ </div>
+ <div className="flex space-x-2 items-center">
+ {investor.website && (
+ <a
+ className="text-black"
+ href={`${investor.website}?ref=papermark.io`}
+ target="_blank"
+ rel="noopener"
+ >
+ <span className="sr-only">Website</span>
+ <GlobeIcon className="w-4 h-4" />
+ </a>
+ )}
+ <Link
+ href={`https://www.papermark.io?ref=investors-list`}
+ >
+ <Image
+ src={PapermarkPImg}
+ width={18}
+ height={18}
+ alt="Papermark"
+ className="block ring-1 ring-gray-300 rounded-full"
+ />
+ </Link>
+ </div>
+ </div>
+ </div>
+ </td>
+ <td className="col-span-1 row-start-2 whitespace-nowrap px-3 md:px-2 md:py-3 text-sm text-gray-500 font-bold md:font-normal">
+ {investor.round ? investor.round : "Unknown"}
+ </td>
+ <td className="col-span-3 whitespace-nowrap px-3 md:px-2 md:py-3 text-sm text-gray-500 md:mt-0">
+ {investor.location ? investor.location : "Unknown"}
+ </td>
+ <td className="col-span-3 md:max-w-xs px-3 md:px-2 md:py-3 text-sm text-gray-500 truncate w-40">
+ {investor.sector ? investor.sector : "Unknown"}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ <div className="flex justify-between items-center w-full my-4 px-4">
+ <button
+ disabled={currentPage === 1}
+ className="px-2 py-2 rounded border text-xs"
+ >
+ Previous
+ </button>
+ <div className="px-2 py-2 rounded text-xs">
+ Page {currentPage} of {totalPages}
+ </div>
+ <button
+ disabled={currentPage === totalPages}
+ className="px-2 py-2 rounded border text-xs"
+ >
+ Next
+ </button>
+ </div>
+ {allInvestors.length === 0 && (
+ <div className="text-center my-10">No results found</div>
+ )}
+ </div>
+ </div>
+ </div>
+ </div>
+ </>
+ );
+}
\ No newline at end of file
diff --git a/app/(static)/investors/page.tsx b/app/(static)/investors/page.tsx
index a404e1fb..6b11fa92 100644
--- a/app/(static)/investors/page.tsx
+++ b/app/(static)/investors/page.tsx
@@ -1,4 +1,6 @@
+import { Suspense } from "react";
import Dashboard from "./ClientPage";
+import { FallbackInvestors } from "./Fallback";
export const revalidate = 3600; // revalidate the data at most every 24 hours
@@ -17,12 +19,28 @@ const getInvestors = async () => {
return data;
};
+
export default async function HomePage() {
- const data = await getInvestors();
- // const data = [
- // {id: 1,
- // name: "test"}
- // ]
+ const allInvestors = await getInvestors();
- return <Dashboard data={data} />;
+ return (
+ <>
+ <div className="mx-auto max-w-6xl pt-4 mb-10">
+ <div className="max-w-6xl mx-auto px-4 md:px-8 sm:pt-16 pt-8 text-gray-600">
+ <div className="space-y-5 max-w-4xl mx-auto text-center mb-10">
+ <h1 className="text-3xl text-gray-800 font-extrabold mx-auto sm:text-6xl max-w-3xl tracking-tighter">
+ Open Investor Database
+ </h1>
+ <p>
+ Find investors based on stage, sector, or location. <br />
+ Powered by Papermark.
+ </p>
+ </div>
+ </div>
+ <Suspense fallback={<FallbackInvestors allInvestors={allInvestors} />}>
+ <Dashboard data={allInvestors} />
+ </Suspense>
+ </div>
+ </>
+ );
}
diff --git a/app/(static)/open-source-investors/ClientPage.tsx b/app/(static)/open-source-investors/ClientPage.tsx
index 0b2777dc..ff9cd8d7 100644
--- a/app/(static)/open-source-investors/ClientPage.tsx
+++ b/app/(static)/open-source-investors/ClientPage.tsx
@@ -87,45 +87,36 @@ export default function Dashboard({ data }: any) {
return (
<>
- <div className="mx-auto max-w-6xl pt-4 mb-10">
- <div className="max-w-6xl mx-auto px-4 md:px-8 sm:pt-16 pt-8 text-gray-600">
- <div className="space-y-5 max-w-4xl mx-auto text-center">
- <h1 className="text-3xl text-gray-800 font-extrabold mx-auto sm:text-6xl max-w-3xl tracking-tighter">
- Find the next angel investor for your open-source project
- </h1>
- </div>
- </div>
- <Stats angelsLength={angels.length} />
- <div className="sm:flex flex-col md:flex-row justify-between mt-4">
- <span className="isolate mt-5 inline-flex rounded-md shadow-sm w-fit">
- {checkSizes.map((checkSize) => (
- <Link
- href={
- checkSize.id !== "7"
- ? `/open-source-investors/?category=${checkSize.id}`
- : "/open-source-investors"
- }
- key={checkSize.id}
- className={cn(
- category === checkSize.id ||
- (!category && checkSize.id === "7")
- ? "bg-gray-200"
- : "bg-white hover:bg-gray-50",
- "relative inline-flex items-center first-of-type:rounded-l-md last-of-type:rounded-r-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 focus:z-10 focus:outline-none focus:ring-gray-500 -ml-px first-of-type:-ml-0",
- )}
- >
- {checkSize.label}
- </Link>
- ))}
- </span>
- <SearchBar search={search} setSearch={setSearch} />
- </div>
- <div className="mt-8 flex flex-col">
- <div className="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
- <div className="inline-block min-w-full py-2 align-middle px-6 lg:px-8">
- <div className="overflow-hidden md:shadow md:ring-1 md:ring-black md:ring-opacity-5 rounded-lg">
- <InvestorTable investors={angels} />
- </div>
+ <Stats angelsLength={angels.length} />
+ <div className="sm:flex flex-col md:flex-row justify-between mt-4">
+ <span className="isolate mt-5 inline-flex rounded-md shadow-sm w-fit">
+ {checkSizes.map((checkSize) => (
+ <Link
+ href={
+ checkSize.id !== "7"
+ ? `/open-source-investors/?category=${checkSize.id}`
+ : "/open-source-investors"
+ }
+ key={checkSize.id}
+ className={cn(
+ category === checkSize.id ||
+ (!category && checkSize.id === "7")
+ ? "bg-gray-200"
+ : "bg-white hover:bg-gray-50",
+ "relative inline-flex items-center first-of-type:rounded-l-md last-of-type:rounded-r-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 focus:z-10 focus:outline-none focus:ring-gray-500 -ml-px first-of-type:-ml-0",
+ )}
+ >
+ {checkSize.label}
+ </Link>
+ ))}
+ </span>
+ <SearchBar search={search} setSearch={setSearch} />
+ </div>
+ <div className="mt-8 flex flex-col">
+ <div className="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
+ <div className="inline-block min-w-full py-2 align-middle px-6 lg:px-8">
+ <div className="overflow-hidden md:shadow md:ring-1 md:ring-black md:ring-opacity-5 rounded-lg">
+ <InvestorTable investors={angels} />
</div>
</div>
</div>
diff --git a/app/(static)/open-source-investors/page.tsx b/app/(static)/open-source-investors/page.tsx
index f1507907..33b57ed8 100644
--- a/app/(static)/open-source-investors/page.tsx
+++ b/app/(static)/open-source-investors/page.tsx
@@ -1,5 +1,10 @@
import { Metadata } from "next";
import Dashboard from "./ClientPage";
+import Stats from "@/components/investors/stats";
+import InvestorTable from "@/components/investors/table";
+import Link from "next/link";
+import { cn } from "@/lib/utils";
+import { Suspense } from "react";
export const revalidate = 3600; // revalidate the data at most every 24 hours
@@ -38,6 +43,25 @@ export const metadata: Metadata = {
},
};
+
+export type Investor = {
+ id: string;
+ createdTime: string;
+ fields: Fields;
+}
+
+export type Fields = {
+ name: string;
+ type: string;
+ title: string;
+ company: string;
+ twitterUrl: string;
+ websiteUrl: string;
+ twitterImageUrl: string;
+ openSourceInvestments: string;
+ checkSize: "Unknown" | "$5k - $50k" | "$50k+" | "$100k+" | "$250k+";
+}
+
const getInvestors = async () => {
const response = await fetch(
"https://api.airtable.com/v0/appAxYMTCbZ1hGTmg/tblvBs5aqTt8qkb6h?fields%5B%5D=name&fields%5B%5D=title&fields%5B%5D=company&fields%5B%5D=checkSize&fields%5B%5D=openSourceInvestments&fields%5B%5D=twitterUrl&fields%5B%5D=websiteUrl&fields%5B%5D=twitterImageUrl&filterByFormula=AND(%7Bpublished%7D%3D1%2C%7Btype%7D%3D%22Angel%22)",
@@ -54,8 +78,73 @@ const getInvestors = async () => {
return data;
};
+const checkSizes = [
+ { id: "7", label: "All" },
+ { id: "1", label: "$5k - $50k" },
+ { id: "2", label: "$50k+" },
+ { id: "3", label: "$100k+" },
+ { id: "4", label: "$250k+" },
+ ];
+
+const InvestorFallback = ({ allInvestors } : { allInvestors: Investor[] }) => {
+ const category = "7";
+ return (
+ <>
+ <Stats angelsLength={allInvestors.length} />
+ <div className="sm:flex flex-col md:flex-row justify-between mt-4">
+ <span className="isolate mt-5 inline-flex rounded-md shadow-sm w-fit">
+ {checkSizes.map((checkSize) => (
+ <Link
+ href={
+ checkSize.id !== "7"
+ ? `/open-source-investors/?category=${checkSize.id}`
+ : "/open-source-investors"
+ }
+ key={checkSize.id}
+ className={cn(
+ category === checkSize.id ||
+ (!category && checkSize.id === "7")
+ ? "bg-gray-200"
+ : "bg-white hover:bg-gray-50",
+ "relative inline-flex items-center first-of-type:rounded-l-md last-of-type:rounded-r-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 focus:z-10 focus:outline-none focus:ring-gray-500 -ml-px first-of-type:-ml-0",
+ )}
+ >
+ {checkSize.label}
+ </Link>
+ ))}
+ </span>
+ </div>
+ <div className="mt-8 flex flex-col">
+ <div className="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
+ <div className="inline-block min-w-full py-2 align-middle px-6 lg:px-8">
+ <div className="overflow-hidden md:shadow md:ring-1 md:ring-black md:ring-opacity-5 rounded-lg">
+ <InvestorTable investors={allInvestors} />
+ </div>
+ </div>
+ </div>
+ </div>
+ </>
+ );
+}
+
export default async function HomePage() {
const data = await getInvestors();
+ const { records: allInvestors } = data as { records: Investor[] };
- return <Dashboard data={data} />;
+ return (
+ <>
+ <div className="mx-auto max-w-6xl pt-4 mb-10">
+ <div className="max-w-6xl mx-auto px-4 md:px-8 sm:pt-16 pt-8 text-gray-600">
+ <div className="space-y-5 max-w-4xl mx-auto text-center">
+ <h1 className="text-3xl text-gray-800 font-extrabold mx-auto sm:text-6xl max-w-3xl tracking-tighter">
+ Find the next angel investor for your open-source project
+ </h1>
+ </div>
+ </div>
+ <Suspense fallback={<InvestorFallback allInvestors={allInvestors} />}>
+ <Dashboard data={data} />
+ </Suspense>
+ </div>
+ </>
+ );
}
diff --git a/components/investors/table.tsx b/components/investors/table.tsx
index 1e6f2396..f3af48ca 100644
--- a/components/investors/table.tsx
+++ b/components/investors/table.tsx
@@ -2,24 +2,8 @@ import Image from "next/image";
import TwitterIcon from "@/components/shared/icons/twitter";
import WebsiteIcon from "@/components/shared/icons/globe";
import { cn } from "@/lib/utils";
+import { type Investor } from "@/app/(static)/open-source-investors/page";
-interface Investor {
- id: string;
- createdTime: string;
- fields: Fields;
-}
-
-interface Fields {
- name: string;
- type: string;
- title: string;
- company: string;
- twitterUrl: string;
- websiteUrl: string;
- twitterImageUrl: string;
- openSourceInvestments: string;
- checkSize: "Unknown" | "$5k - $50k" | "$50k+" | "$100k+" | "$250k+";
-}
export default function Table({ investors }: { investors: Investor[] }) {
return (