Skip to content

Commit

Permalink
Merge branch 'main' into feat/investor-slug
Browse files Browse the repository at this point in the history
  • Loading branch information
mfts authored Feb 20, 2024
2 parents df09eb3 + 7759598 commit c5a1750
Show file tree
Hide file tree
Showing 15 changed files with 728 additions and 493 deletions.
2 changes: 1 addition & 1 deletion app/(static)/investors/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Script from "next/script";

const data = {
description:
"Open investor and vc funds list of over 10,000 investors based on stage, sector, or location. Powered by Papermark.",
"The largest investors database. This list of investors includes ten thousand of different venture funds based on stage, sector and location.",
title: "Investor Search | Papermark",
url: "/investors",
};
Expand Down
6 changes: 3 additions & 3 deletions app/(static)/investors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export default async function HomePage() {
<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
Investors Database
</h1>
<p>
Find investors based on stage, sector, or location. <br />
Powered by Papermark.
List of investors where you can search by stage, sector, or
location.
</p>
</div>
</div>
Expand Down
26 changes: 12 additions & 14 deletions app/(static)/open-source-investors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const revalidate = 3600; // revalidate the data at most every 24 hours

const data = {
description:
"List of 100 open-source investors. Open-source VC, open-source angel investors. Share pitchdecks with your investors using Papermark, an open-source document infrastructure.",
"List of 100 open-source investors. Open-source VC, open-source angel investors, created and powered by Papermark",
title: "Open Source Investors | Papermark",
url: "/open-source-investors",
};
Expand Down Expand Up @@ -43,12 +43,11 @@ export const metadata: Metadata = {
},
};


export type Investor = {
id: string;
createdTime: string;
fields: Fields;
}
};

export type Fields = {
name: string;
Expand All @@ -60,7 +59,7 @@ export type Fields = {
twitterImageUrl: string;
openSourceInvestments: string;
checkSize: "Unknown" | "$5k - $50k" | "$50k+" | "$100k+" | "$250k+";
}
};

const getInvestors = async () => {
const response = await fetch(
Expand All @@ -79,14 +78,14 @@ const getInvestors = async () => {
};

const checkSizes = [
{ id: "7", label: "All" },
{ id: "1", label: "$5k - $50k" },
{ id: "2", label: "$50k+" },
{ id: "3", label: "$100k+" },
{ id: "4", label: "$250k+" },
];
{ 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 InvestorFallback = ({ allInvestors }: { allInvestors: Investor[] }) => {
const category = "7";
return (
<>
Expand All @@ -102,8 +101,7 @@ const InvestorFallback = ({ allInvestors } : { allInvestors: Investor[] }) => {
}
key={checkSize.id}
className={cn(
category === checkSize.id ||
(!category && checkSize.id === "7")
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",
Expand All @@ -125,7 +123,7 @@ const InvestorFallback = ({ allInvestors } : { allInvestors: Investor[] }) => {
</div>
</>
);
}
};

export default async function HomePage() {
const data = await getInvestors();
Expand Down
4 changes: 1 addition & 3 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ export default function Home() {
</Button>
</Link>
<Link href="/login">
<Button className="text-base rounded-3xl">
Start for free
</Button>
<Button className="text-base rounded-3xl">Send document</Button>
</Link>
</div>
<div className="mt-24 mx-auto w-full">
Expand Down
12 changes: 9 additions & 3 deletions components/document-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
Presentation as PresentationChartBarIcon,
Image as PhotoIcon,
} from "lucide-react";
import { useTeam } from "@/context/team-context";
import { usePlan } from "@/lib/swr/use-billing";

function fileIcon(fileType: string) {
switch (fileType) {
Expand Down Expand Up @@ -37,20 +39,22 @@ export default function DocumentUpload({
currentFile: File | null;
setCurrentFile: React.Dispatch<React.SetStateAction<File | null>>;
}) {
const { plan, loading } = usePlan();
const maxSize = plan?.plan === "pro" ? 100 : 30;
const { getRootProps, getInputProps } = useDropzone({
accept: {
"application/pdf": [], // ".pdf"
},
multiple: false,
maxSize: 30 * 1024 * 1024, // 30 MB
maxSize: maxSize * 1024 * 1024, // 30 MB
onDropAccepted: (acceptedFiles) => {
setCurrentFile(acceptedFiles[0]);
},
onDropRejected: (fileRejections) => {
const { errors } = fileRejections[0];
let message;
if (errors[0].code === "file-too-large") {
message = "File size too big (max. 30 MB)";
message = `File size too big (max. ${maxSize} MB)`;
} else if (errors[0].code === "file-invalid-type") {
message = "File type not supported (.pdf only)";
} else {
Expand Down Expand Up @@ -103,7 +107,9 @@ export default function DocumentUpload({
</span>
</div>
<p className="text-xs leading-5 text-gray-500">
{currentFile ? "Replace file?" : "Only *.pdf & 30 MB limit"}
{currentFile
? "Replace file?"
: `Only *.pdf & ${maxSize} MB limit`}
</p>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions components/links/link-sheet/domain-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ export default function DomainSection({
name="key"
required
value={data.slug || ""}
pattern="[\p{L}\p{N}\p{Pd}\/]+"
pattern="[\p{L}\p{N}\p{Pd}]+"
onInvalid={(e) => {
e.currentTarget.setCustomValidity(
"Only letters, numbers, '-', and '/' are allowed.",
"Only letters, numbers, and '-' are allowed.",
);
}}
autoComplete="off"
Expand Down
8 changes: 8 additions & 0 deletions lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ export const REACTIONS = [
label: "down",
},
];

// growing list of blocked pathnames that lead to 404s
export const BLOCKED_PATHNAMES = [
"/phpmyadmin",
"/server-status",
"/wordpress",
"/_all_dbs",
];
7 changes: 5 additions & 2 deletions lib/middleware/domain.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NextRequest, NextResponse } from "next/server";
import { getToken } from "next-auth/jwt";
import { PAPERMARK_HEADERS } from "../constants";
import { BLOCKED_PATHNAMES, PAPERMARK_HEADERS } from "@/lib/constants";

export default async function DomainMiddleware(req: NextRequest) {
const path = req.nextUrl.pathname;
Expand All @@ -11,6 +10,10 @@ export default async function DomainMiddleware(req: NextRequest) {

// if there's a path and it's not "/" then we need to check if it's a custom domain
if (path !== "/") {
if (BLOCKED_PATHNAMES.includes(path) || path.includes(".")) {
url.pathname = "/404";
return NextResponse.rewrite(url);
}
// Subdomain available, rewriting
// >>> Rewriting: ${path} to /view/domains/${host}${path}`
url.pathname = `/view/domains/${host}${path}`;
Expand Down
Loading

0 comments on commit c5a1750

Please sign in to comment.