diff --git a/apps/web/src/app/(share)/share/[shareId]/redirect.tsx b/apps/web/src/app/(share)/share/[shareId]/redirect.tsx index 593d5b1cc..6846975cb 100644 --- a/apps/web/src/app/(share)/share/[shareId]/redirect.tsx +++ b/apps/web/src/app/(share)/share/[shareId]/redirect.tsx @@ -1,12 +1,13 @@ 'use client'; -import React from 'react'; +import { useEffect } from 'react'; export default function Redirect() { - React.useEffect(() => { + useEffect(() => { const timer = setTimeout(() => { window.location.href = 'https://www.documenso.com'; }, 3000); + return () => clearTimeout(timer); }, []); diff --git a/apps/web/src/app/(signing)/sign/[token]/page.tsx b/apps/web/src/app/(signing)/sign/[token]/page.tsx index d2c14a524..f3d69b403 100644 --- a/apps/web/src/app/(signing)/sign/[token]/page.tsx +++ b/apps/web/src/app/(signing)/sign/[token]/page.tsx @@ -38,10 +38,10 @@ export default async function SigningPage({ params: { token } }: SigningPageProp }).catch(() => null), getFieldsForToken({ token }), getRecipientByToken({ token }).catch(() => null), - viewedDocument({ token }), + viewedDocument({ token }).catch(() => null), ]); - if (!document || !document.documentData || !recipient) { + if (!document || !recipient) { return notFound(); } diff --git a/apps/web/src/assets/Caveat-Regular.ttf b/apps/web/src/assets/caveat-regular.ttf similarity index 100% rename from apps/web/src/assets/Caveat-Regular.ttf rename to apps/web/src/assets/caveat-regular.ttf diff --git a/apps/web/src/assets/inter-bold.ttf b/apps/web/src/assets/inter-bold.ttf new file mode 100644 index 000000000..8e82c70d1 Binary files /dev/null and b/apps/web/src/assets/inter-bold.ttf differ diff --git a/apps/web/src/assets/Inter-Regular.ttf b/apps/web/src/assets/inter-regular.ttf similarity index 100% rename from apps/web/src/assets/Inter-Regular.ttf rename to apps/web/src/assets/inter-regular.ttf diff --git a/apps/web/src/assets/inter-semibold.ttf b/apps/web/src/assets/inter-semibold.ttf new file mode 100644 index 000000000..c6aeeb16a Binary files /dev/null and b/apps/web/src/assets/inter-semibold.ttf differ diff --git a/apps/web/src/assets/og-share-frame.png b/apps/web/src/assets/og-share-frame.png new file mode 100644 index 000000000..72bf7dd96 Binary files /dev/null and b/apps/web/src/assets/og-share-frame.png differ diff --git a/apps/web/src/pages/api/share-og/index.tsx b/apps/web/src/pages/api/share-og/index.tsx index 28abbce36..772196fbd 100644 --- a/apps/web/src/pages/api/share-og/index.tsx +++ b/apps/web/src/pages/api/share-og/index.tsx @@ -1,47 +1,71 @@ import { ImageResponse, NextRequest } from 'next/server'; +import { cn } from '@documenso/ui/lib/utils'; + export const config = { runtime: 'edge', }; +const CARD_OFFSET_TOP = 152; +const CARD_OFFSET_LEFT = 350; +const CARD_WIDTH = 500; +const CARD_HEIGHT = 250; + export default async function handler(req: NextRequest) { const { searchParams } = new URL(req.url); + const signature = searchParams.get('signature') || 'Timur'; - const [imageData, CaveatFontData, InterFontData] = await Promise.all([ - fetch(new URL('../../../assets/background-pattern-og.png', import.meta.url)).then((res) => + const [interSemiBold, interRegular, caveatRegular, shareFrameImage] = await Promise.all([ + fetch(new URL('./../../../assets/inter-semibold.ttf', import.meta.url)).then(async (res) => res.arrayBuffer(), ), - fetch(new URL('../../../assets/Caveat-Regular.ttf', import.meta.url)).then((res) => + fetch(new URL('./../../../assets/inter-regular.ttf', import.meta.url)).then(async (res) => res.arrayBuffer(), ), - fetch(new URL('../../../assets/Inter-Regular.ttf', import.meta.url)).then((res) => + fetch(new URL('./../../../assets/caveat-regular.ttf', import.meta.url)).then(async (res) => + res.arrayBuffer(), + ), + fetch(new URL('./../../../assets/og-share-frame.png', import.meta.url)).then(async (res) => res.arrayBuffer(), ), ]); return new ImageResponse( ( -
+ {signature} +
+ +