Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: add notion icon to document page
Marc Seitzc3d507fea293
diff --git a/components/documents/document-card.tsx b/components/documents/document-card.tsxindex c310a97d..daf8f6d5 100644--- a/components/documents/document-card.tsx+++ b/components/documents/document-card.tsx@@ -1,33 +1,43 @@-import { copyToClipboard, getExtension, nFormatter, timeAgo } from "@/lib/utils";+import {+ copyToClipboard,+ getExtension,+ nFormatter,+ timeAgo,+} from "@/lib/utils";import Link from "next/link";import { DocumentWithLinksAndLinkCountAndViewCount } from "@/lib/types";import Copy from "@/components/shared/icons/copy";import BarChart from "@/components/shared/icons/bar-chart";import Image from "next/image";+import NotionIcon from "@/components/shared/icons/notion";export default function DocumentsCard({document,}: {document: DocumentWithLinksAndLinkCountAndViewCount;}) {-function handleCopyToClipboard(id: string) {- copyToClipboard(`${process.env.NEXT_PUBLIC_BASE_URL}/view/${id}`, "Link copied to clipboard.");+ copyToClipboard(+ `${process.env.NEXT_PUBLIC_BASE_URL}/view/${id}`,+ "Link copied to clipboard.",+ );}--return (<li className="relative rounded-lg p-3 border-0 dark:bg-secondary ring-1 ring-gray-200 dark:ring-gray-700 transition-all hover:ring-gray-400 hover:dark:ring-gray-500 hover:bg-secondary sm:p-4 flex justify-between items-center"><div className="min-w-0 flex shrink items-center space-x-4"><div className="w-8 mx-1 text-center flex justify-center items-center">- <Image- src={`/_icons/${document.type}.svg`}- alt="File icon"- width={50}- height={50}- className=""- />+ {document.type === "notion" ? (+ <NotionIcon className="w-8 h-8" />+ ) : (+ <Image+ src={`/_icons/${document.type}.svg`}+ alt="File icon"+ width={50}+ height={50}+ className=""+ />+ )}</div><div className="flex-col"><div className="flex items-center">@@ -56,7 +66,7 @@ export default function DocumentsCard({<p className="truncate">{`${document._count.links} ${document._count.links === 1 ? "Link" : "Links"}`}</p>- { document._count.versions > 1 ? (+ {document._count.versions > 1 ? (<><p>•</p><p className="truncate">{`${document._count.versions} Versions`}</p>@@ -81,4 +91,4 @@ export default function DocumentsCard({</Link></li>);-}\ No newline at end of file+}diff --git a/pages/documents/[id].tsx b/pages/documents/[id].tsxindex 70b92e99..ac6c3d7b 100644--- a/pages/documents/[id].tsx+++ b/pages/documents/[id].tsx@@ -25,6 +25,7 @@ import { useRouter } from "next/router";import MoreVertical from "@/components/shared/icons/more-vertical";import { useTeam } from "@/context/team-context";import ProcessStatusBar from "@/components/documents/process-status-bar";+import NotionIcon from "@/components/shared/icons/notion";export default function DocumentPage() {const { document: prismaDocument, primaryVersion, error } = useDocument();@@ -62,7 +63,7 @@ export default function DocumentPage() {body: JSON.stringify({name: newName,}),- }+ },);if (response.ok) {@@ -102,7 +103,7 @@ export default function DocumentPage() {`/api/teams/${teamInfo?.currentTeam?.id}/documents/${documentId}`,{method: "DELETE",- }+ },);if (response.ok) {@@ -145,7 +146,7 @@ export default function DocumentPage() {};const preventEnterAndSubmit = (- event: React.KeyboardEvent<HTMLHeadingElement>+ event: React.KeyboardEvent<HTMLHeadingElement>,) => {if (event.key === "Enter") {event.preventDefault(); // Prevent the default line break@@ -172,13 +173,17 @@ export default function DocumentPage() {<div className="space-y-2"><div className="flex space-x-4 items-center"><div className="w-8">- <Image- src={`/_icons/${getExtension(primaryVersion.file)}.svg`}- alt="File icon"- width={50}- height={50}- className=""- />+ {primaryVersion.type === "notion" ? (+ <NotionIcon className="w-8 h-8" />+ ) : (+ <Image+ src={`/_icons/${getExtension(primaryVersion.file)}.svg`}+ alt="File icon"+ width={50}+ height={50}+ className=""+ />+ )}</div><div className="flex flex-col"><h2@@ -233,7 +238,7 @@ export default function DocumentPage() {</div></div>{/* Progress bar */}- {!primaryVersion.hasPages ? (+ {primaryVersion.type !== "notion" && !primaryVersion.hasPages ? (<div className="flex flex-col items-start justify-between gap-x-8 gap-y-4 p-4 sm:flex-row sm:items-center sm:m-4"><ProcessStatusBar documentVersionId={primaryVersion.id} /></div>