Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
fix: wip
Marc Seitzc7c834e5fd25
diff --git a/components/view/document-view.tsx b/components/view/document-view.tsxindex aded6bdb..5cac0de3 100644--- a/components/view/document-view.tsx+++ b/components/view/document-view.tsx@@ -29,7 +29,7 @@ export default function DocumentView({userEmail: string | null | undefined;userId: string | null | undefined;isProtected: boolean;- notionData: {+ notionData?: {rootNotionPageId: string | null;recordMap: ExtendedRecordMap | null;};@@ -127,7 +127,7 @@ export default function DocumentView({return (<div className="bg-gray-950">{submitted ? (- notionData.recordMap ? (+ notionData && notionData.recordMap ? (<NotionPagerecordMap={notionData.recordMap}// rootPageId={notionData.rootNotionPageId}diff --git a/pages/view/[linkId]/index.tsx b/pages/view/[linkId]/index.tsxindex 33efe1dc..6b57f90f 100644--- a/pages/view/[linkId]/index.tsx+++ b/pages/view/[linkId]/index.tsx@@ -59,7 +59,6 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {recordMap,},},- revalidate: 10,};};diff --git a/pages/view/domains/[domain]/[slug]/index.tsx b/pages/view/domains/[domain]/[slug]/index.tsxindex 56d3bdac..cdf763c7 100644--- a/pages/view/domains/[domain]/[slug]/index.tsx+++ b/pages/view/domains/[domain]/[slug]/index.tsx@@ -12,77 +12,72 @@ import { ExtendedRecordMap } from "notion-types";import notion from "@/lib/notion";import { parsePageId } from "notion-utils";-export const getStaticProps = async (context: GetStaticPropsContext) => {- const { domain, slug } = context.params as { domain: string; slug: string };-- // Fetch the link- const res = await fetch(- `${process.env.NEXTAUTH_URL}/api/links/domains/${encodeURIComponent(- domain,- )}/${encodeURIComponent(slug)}`,- );- if (!res.ok) {- return { notFound: true };- }- const link = (await res.json()) as LinkWithDocument;-- let pageId = null;- let recordMap = null;-- const { type, file, ...versionWithoutTypeAndFile } =- link.document.versions[0];-- if (type === "notion") {- // regex match to get the page id from the notion url- const notionPageId = parsePageId(file, { uuid: false });- if (!notionPageId) {- return {- notFound: true,- };- }+// export const getStaticProps = async (context: GetStaticPropsContext) => {+// const { domain, slug } = context.params as { domain: string; slug: string };++// // Fetch the link+// const res = await fetch(+// `${process.env.NEXTAUTH_URL}/api/links/domains/${encodeURIComponent(+// domain,+// )}/${encodeURIComponent(slug)}`,+// );+// if (!res.ok) {+// return { notFound: true };+// }+// const link = (await res.json()) as LinkWithDocument;++// let pageId = null;+// let recordMap = null;++// const { type, file, ...versionWithoutTypeAndFile } =+// link.document.versions[0];++// if (type === "notion") {+// // regex match to get the page id from the notion url+// const notionPageId = parsePageId(file, { uuid: false });+// if (!notionPageId) {+// return {+// notFound: true,+// };+// }++// pageId = notionPageId;+// recordMap = await notion.getPage(pageId);+// }++// return {+// props: {+// // return link without file and type to avoid sending the file to the client+// link: {+// ...link,+// document: {+// ...link.document,+// versions: [versionWithoutTypeAndFile],+// },+// },+// notionData: {+// rootNotionPageId: pageId,+// recordMap,+// },+// },+// };+// };++// export async function getStaticPaths() {+// return {+// paths: [],+// fallback: true,+// };+// }++export default function ViewPage() {+ const { link, error } = useDomainLink();+ const { data: session, status } = useSession();- pageId = notionPageId;- recordMap = await notion.getPage(pageId);+ if (error && error.status === 404) {+ return <NotFound />;}- return {- props: {- // return link without file and type to avoid sending the file to the client- link: {- ...link,- document: {- ...link.document,- versions: [versionWithoutTypeAndFile],- },- },- notionData: {- rootNotionPageId: pageId,- recordMap,- },- },- revalidate: 10,- };-};--export async function getStaticPaths() {- return {- paths: [],- fallback: true,- };-}--export default function ViewPage({- link,- notionData,-}: {- link: LinkWithDocument;- notionData: {- rootNotionPageId: string | null;- recordMap: ExtendedRecordMap | null;- };-}) {- const { data: session, status } = useSession();-if (!link || status === "loading") {return (<div className="h-screen flex items-center justify-center">@@ -120,7 +115,7 @@ export default function ViewPage({userEmail={userEmail}userId={userId}isProtected={true}- notionData={notionData}+ // notionData={notionData}/>);}@@ -131,7 +126,7 @@ export default function ViewPage({userEmail={userEmail}userId={userId}isProtected={false}- notionData={notionData}+ // notionData={notionData}/>);}