From eda977b203232ec6db58d63c4b4cbe4d1d56ee1a Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Sat, 28 Jan 2023 23:57:35 -0800 Subject: [PATCH] ts fixes --- src/app/(posts)/components/tabs/index.tsx | 8 +++++--- .../[id]/components/post-files/view-document/index.tsx | 7 ++++--- src/pages/api/admin/index.ts | 2 +- src/pages/api/og.tsx | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/app/(posts)/components/tabs/index.tsx b/src/app/(posts)/components/tabs/index.tsx index b1d753b2..8270d52d 100644 --- a/src/app/(posts)/components/tabs/index.tsx +++ b/src/app/(posts)/components/tabs/index.tsx @@ -14,7 +14,7 @@ type Props = RadixTabs.TabsProps & { onPaste?: (e: ClipboardEvent) => void title?: string staticPreview?: string - children: string; + children: string } export default function DocumentTabs({ @@ -83,9 +83,11 @@ export default function DocumentTabs({ {isEditing ? ( - {children} + + {children} + ) : ( - {preview} + {preview || ""} )} diff --git a/src/app/(posts)/post/[id]/components/post-files/view-document/index.tsx b/src/app/(posts)/post/[id]/components/post-files/view-document/index.tsx index 45e7a96d..d25be19b 100644 --- a/src/app/(posts)/post/[id]/components/post-files/view-document/index.tsx +++ b/src/app/(posts)/post/[id]/components/post-files/view-document/index.tsx @@ -106,16 +106,17 @@ const Document = ({ skeleton, ...props }: Props) => { > {title} + {/* Not /api/ because of rewrites defined in next.config.mjs */}
- {/* Not /api/ because of rewrites defined in next.config.mjs */} + > + {content || ""} +
diff --git a/src/pages/api/admin/index.ts b/src/pages/api/admin/index.ts index 115a4738..7b03aab9 100644 --- a/src/pages/api/admin/index.ts +++ b/src/pages/api/admin/index.ts @@ -17,7 +17,7 @@ const actions = [ const handler = async (req: NextApiRequest, res: NextApiResponse) => { const { action: requestedAction } = req.query - const action = parseQueryParam(requestedAction) as typeof actions[number] + const action = parseQueryParam(requestedAction) as (typeof actions)[number] if (!action || !actions.includes(action)) { res.status(400).json({ error: "Invalid action" }) diff --git a/src/pages/api/og.tsx b/src/pages/api/og.tsx index 8f20190d..7a2bd05d 100644 --- a/src/pages/api/og.tsx +++ b/src/pages/api/og.tsx @@ -135,7 +135,8 @@ export default async function handler(req: NextRequest) { ), { width: WIDTH, - height: HEIGHT, + height: HEIGHT + // debug: true } )