From 7c3917a2ff043b79f02d443545de7a6149c0e05b Mon Sep 17 00:00:00 2001 From: Nimit Haria Date: Fri, 29 Mar 2024 01:28:09 +0530 Subject: [PATCH 1/2] feat: printing notion notes --- src/app/pdf/[contentId]/page.tsx | 21 +++++++++++ src/components/Appbar.tsx | 7 ++-- src/components/NotionRenderer.tsx | 20 ++++++++++- src/components/landing/footer/footer.tsx | 5 ++- src/components/print/Print.tsx | 45 +++++++++++++++++++++++ src/components/print/PrintNotes.tsx | 46 ++++++++++++++++++++++++ src/hooks/useMountStatus.ts | 13 +++++++ 7 files changed, 153 insertions(+), 4 deletions(-) create mode 100644 src/app/pdf/[contentId]/page.tsx create mode 100644 src/components/print/Print.tsx create mode 100644 src/components/print/PrintNotes.tsx create mode 100644 src/hooks/useMountStatus.ts diff --git a/src/app/pdf/[contentId]/page.tsx b/src/app/pdf/[contentId]/page.tsx new file mode 100644 index 000000000..a80245598 --- /dev/null +++ b/src/app/pdf/[contentId]/page.tsx @@ -0,0 +1,21 @@ +import { NotionAPI } from 'notion-client'; +import db from '@/db'; +const notion = new NotionAPI(); +import PrintNotes from '@/components/print/PrintNotes'; + +export default async function PrintNotion({ + params: { contentId }, +}: { + params: { contentId: string }; +}) { + const notionMetadata = await db.notionMetadata.findFirst({ + where: { + contentId: parseInt(contentId, 10), + }, + }); + + if (notionMetadata?.notionId) { + const recordMap = await notion.getPage(notionMetadata?.notionId); + return ; + } +} diff --git a/src/components/Appbar.tsx b/src/components/Appbar.tsx index 369e7863b..368620be3 100644 --- a/src/components/Appbar.tsx +++ b/src/components/Appbar.tsx @@ -21,7 +21,10 @@ export const Appbar = () => { const currentPath = usePathname(); return ( <> - -
+
); }; diff --git a/src/components/landing/footer/footer.tsx b/src/components/landing/footer/footer.tsx index 3468ed435..a998ed697 100644 --- a/src/components/landing/footer/footer.tsx +++ b/src/components/landing/footer/footer.tsx @@ -6,10 +6,7 @@ import Logo from '../logo/logo'; const Footer = () => { return ( -