Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
chore: merge investors to papermark
Marc Seitze627bfcb195f
diff --git a/app/(static)/investors/ClientPage.tsx b/app/(static)/investors/ClientPage.tsxnew file mode 100644index 00000000..b07c73d6--- /dev/null+++ b/app/(static)/investors/ClientPage.tsx@@ -0,0 +1,303 @@+"use client";++import Fuse from "fuse.js";+import { useSearchParams } from "next/navigation";+import { useMemo, useState } from "react";+import { GlobeIcon, SearchIcon } from "lucide-react";+import classNames from "classnames";+import Link from "next/link";+import Image from "next/image";+import PlaceholderImg from "@/public/_static/placeholder.png";+import PapermarkPImg from "@/public/_static/papermark-p.svg";++const searchOptions = {+ threshold: 0.3,+ location: 0,+ distance: 100,+ minMatchCharLength: 2,+ keys: ["name", "round", "sector", "website", "location"],+};++const statuses = {+ Active: "text-green-700 bg-green-50 ring-green-600/20",+ Withdraw: "text-gray-600 bg-gray-50 ring-gray-500/10",+ Overdue: "text-red-700 bg-red-50 ring-red-600/10",+};++// function compare(a: any, b: any) {+// // Define the order of the checkSize labels+// const checkSizesOrder = [+// "$5k - $50k",+// "$50k+",+// "$100k+",+// "$250k+",+// "Unknown",+// ];++// const orderA = checkSizesOrder.indexOf(a.fields.checkSize);+// const orderB = checkSizesOrder.indexOf(b.fields.checkSize);++// // Ensure that the checkSize exists in our order array. If not, place it at the end.+// if (orderA === -1) return 1;+// if (orderB === -1) return -1;++// // Sort according to the checkSize order+// return orderA - orderB;+// }++export default function Dashboard({ data }: any) {+ const allInvestors = data;++ const [search, setSearch] = useState<string>("");+ const [currentPage, setCurrentPage] = useState<number>(1);++ const pageSize = 10; // Showing 10 investors per page+ const totalPages = Math.ceil(allInvestors.length / pageSize);++ const searchParams = useSearchParams();+ const category = searchParams!.get("category");++ // const page = searchParams?.get("page") ?? '1'+ // const per_page = searchParams?.get("per_page") ?? '20'++ // const start = (Number(page) - 1) * Number(per_page) // 0, 5, 10 ...+ // const end = start + Number(per_page) // 5, 10, 15 ...++ const stages = [+ { id: "7", label: "All" },+ { id: "1", label: "Seed" },+ { id: "2", label: "Series A" },+ { id: "3", label: "Series B" },+ { id: "4", label: "Series C" },+ ];++ const selectedStage = stages.find((round) => round.id === category);+ const labelForSelectedCategory = selectedStage ? selectedStage.label : null;++ // Define filtered & sorted investor array+ const ALL_INVESTORS = allInvestors+ // .filter((angel: any) => !angel.hidden)+ // .sort(compare)+ .filter((investor: any) => {+ if (!labelForSelectedCategory || labelForSelectedCategory === "All")+ return true;+ return investor.round.includes(labelForSelectedCategory);+ });++ // Fuzzy search with highlighting+ const fuse = new Fuse(ALL_INVESTORS, searchOptions);+ const currentInvestors = useMemo(() => {+ if (search.length > 0) {+ return fuse.search(search).map((match) => match.item);+ }+ return ALL_INVESTORS;+ }, [search, ALL_INVESTORS]);++ // Pagination+ // Function to handle page change+ const goToPage = (pageNumber: React.SetStateAction<number>) => {+ setCurrentPage(pageNumber);+ };++ // Calculate the investors to display on the current page+ const indexOfLastInvestor = currentPage * pageSize;+ const indexOfFirstInvestor = indexOfLastInvestor - pageSize;+ const paginatedInvestors = currentInvestors.slice(+ indexOfFirstInvestor,+ indexOfLastInvestor,+ );++ 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">+ {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">+ <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>+ <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 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+ 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>+ {currentInvestors.length === 0 && (+ <div className="text-center my-10">No results found</div>+ )}+ </div>+ </div>+ </div>+ </div>+ </div>+ </>+ );+}diff --git a/app/(static)/investors/page.tsx b/app/(static)/investors/page.tsxnew file mode 100644index 00000000..5d27eee6--- /dev/null+++ b/app/(static)/investors/page.tsx@@ -0,0 +1,63 @@+import { Metadata } from "next";+import Dashboard from "./ClientPage";++export const revalidate = 3600; // revalidate the data at most every 24 hours++const data = {+ description:+ "Find over 10,000 investors based on stage, sector, or location. Powered by Papermark.",+ title: "Investor Search | Papermark",+ url: "https://www.papermark.io/investors",+};++export const metadata: Metadata = {+ title: data.title,+ description: data.description,+ openGraph: {+ title: data.title,+ description: data.description,+ url: data.url,+ siteName: "Papermark",+ images: [+ {+ url: "https://www.papermark.io/_static/investor-meta.png",+ width: 800,+ height: 600,+ },+ ],+ locale: "en_US",+ type: "website",+ },+ twitter: {+ card: "summary_large_image",+ title: data.title,+ description: data.description,+ creator: "@papermarkio",+ images: ["https://www.papermark.io/_static/investor-meta.png"],+ },+};++const getInvestors = async () => {+ const response = await fetch(`https://investors.papermark.io/api/investors`, {+ method: "GET",+ headers: {+ "Content-Type": "application/json",+ Authorization: `Bearer ${process.env.INVESTORS_API_KEY}`,+ },+ });+ if (!response.ok) {+ throw new Error("Network response was not ok " + response.statusText);+ }+ const data = await response.json();+ return data;+};++export default async function HomePage() {+ const data = await getInvestors();+ // const data = [+ // {id: 1,+ // name: "test"}+ // ]++ return <Dashboard data={data} />;+}diff --git a/app/(static)/open-source-investors/page.tsx b/app/(static)/open-source-investors/page.tsxindex b6b15884..c0e6b0b5 100644--- a/app/(static)/open-source-investors/page.tsx+++ b/app/(static)/open-source-investors/page.tsx@@ -1,6 +1,5 @@import { Metadata } from "next";import Dashboard from "./ClientPage";-import { cache } from "react";export const revalidate = 3600; // revalidate the data at most every 24 hoursdiff --git a/app/sitemap.ts b/app/sitemap.tsindex 42539b05..15eb4124 100644--- a/app/sitemap.ts+++ b/app/sitemap.ts@@ -47,7 +47,7 @@ export default function sitemap(): MetadataRoute.Sitemap {lastModified: new Date(),},{- url: "https://investors.papermark.io",+ url: "https://www.papermark.io/investors",lastModified: new Date(),},];diff --git a/components/web/footer.tsx b/components/web/footer.tsxindex edc02b90..fc2e8397 100644--- a/components/web/footer.tsx+++ b/components/web/footer.tsx@@ -64,10 +64,7 @@ const navigation = {{ name: "VC-generator", href: "https://vc.papermark.io" },{ name: "Open Source Friends", href: "/oss-friends" },{ name: "Open Source Investors", href: "/open-source-investors" },- {- name: "Open Investor Database",- href: "https://investors.papermark.io",- },+ { name: "Open Investor Database", href: "/investors" },{name: "YC Application GPT",href: "https://chat.openai.com/g/g-LYDRCiZB9-yc-application-gpt",diff --git a/public/_static/investor-meta.png b/public/_static/investor-meta.pngnew file mode 100644index 00000000..65c0b817Binary files /dev/null and b/public/_static/investor-meta.png differdiff --git a/public/_static/papermark-p.svg b/public/_static/papermark-p.svgnew file mode 100644index 00000000..bb43f718--- /dev/null+++ b/public/_static/papermark-p.svg@@ -0,0 +1,4 @@+<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">+<rect width="40" height="40" fill="white"/>+<path d="M12 30.8182V9H20.608C22.2628 9 23.6726 9.31605 24.8374 9.94815C26.0021 10.5732 26.8899 11.4432 27.5007 12.5582C28.1186 13.6662 28.4276 14.9446 28.4276 16.3935C28.4276 17.8423 28.1151 19.1207 27.4901 20.2287C26.8651 21.3366 25.9595 22.1996 24.7734 22.8175C23.5945 23.4354 22.1669 23.7443 20.4908 23.7443H15.0043V20.0476H19.745C20.6328 20.0476 21.3643 19.8949 21.9396 19.5895C22.522 19.277 22.9553 18.8473 23.2393 18.3004C23.5305 17.7464 23.6761 17.1108 23.6761 16.3935C23.6761 15.669 23.5305 15.0369 23.2393 14.4972C22.9553 13.9503 22.522 13.5277 21.9396 13.2294C21.3572 12.924 20.6186 12.7713 19.7237 12.7713H16.6129V30.8182H12Z" fill="black"/>+</svg>diff --git a/public/_static/placeholder.png b/public/_static/placeholder.pngnew file mode 100644index 00000000..fce28e8bBinary files /dev/null and b/public/_static/placeholder.png differ