mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
fix: update og card
This commit is contained in:
@ -1,12 +1,13 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
export default function Redirect() {
|
export default function Redirect() {
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
window.location.href = 'https://www.documenso.com';
|
window.location.href = 'https://www.documenso.com';
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@ -38,10 +38,10 @@ export default async function SigningPage({ params: { token } }: SigningPageProp
|
|||||||
}).catch(() => null),
|
}).catch(() => null),
|
||||||
getFieldsForToken({ token }),
|
getFieldsForToken({ token }),
|
||||||
getRecipientByToken({ token }).catch(() => null),
|
getRecipientByToken({ token }).catch(() => null),
|
||||||
viewedDocument({ token }),
|
viewedDocument({ token }).catch(() => null),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!document || !document.documentData || !recipient) {
|
if (!document || !recipient) {
|
||||||
return notFound();
|
return notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
apps/web/src/assets/inter-bold.ttf
Normal file
BIN
apps/web/src/assets/inter-bold.ttf
Normal file
Binary file not shown.
BIN
apps/web/src/assets/inter-semibold.ttf
Normal file
BIN
apps/web/src/assets/inter-semibold.ttf
Normal file
Binary file not shown.
BIN
apps/web/src/assets/og-share-frame.png
Normal file
BIN
apps/web/src/assets/og-share-frame.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 743 KiB |
@ -1,47 +1,71 @@
|
|||||||
import { ImageResponse, NextRequest } from 'next/server';
|
import { ImageResponse, NextRequest } from 'next/server';
|
||||||
|
|
||||||
|
import { cn } from '@documenso/ui/lib/utils';
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
runtime: 'edge',
|
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) {
|
export default async function handler(req: NextRequest) {
|
||||||
const { searchParams } = new URL(req.url);
|
const { searchParams } = new URL(req.url);
|
||||||
|
|
||||||
const signature = searchParams.get('signature') || 'Timur';
|
const signature = searchParams.get('signature') || 'Timur';
|
||||||
|
|
||||||
const [imageData, CaveatFontData, InterFontData] = await Promise.all([
|
const [interSemiBold, interRegular, caveatRegular, shareFrameImage] = await Promise.all([
|
||||||
fetch(new URL('../../../assets/background-pattern-og.png', import.meta.url)).then((res) =>
|
fetch(new URL('./../../../assets/inter-semibold.ttf', import.meta.url)).then(async (res) =>
|
||||||
res.arrayBuffer(),
|
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(),
|
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(),
|
res.arrayBuffer(),
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return new ImageResponse(
|
return new ImageResponse(
|
||||||
(
|
(
|
||||||
<div
|
<div tw="relative flex h-full w-full">
|
||||||
style={{
|
{/* @ts-expect-error Lack of typing from ImageResponse */}
|
||||||
height: '100%',
|
<img src={shareFrameImage} alt="og-share-frame" tw="absolute inset-0 w-full h-full" />
|
||||||
width: '100%',
|
|
||||||
display: 'flex',
|
<p
|
||||||
flexDirection: 'column',
|
tw="absolute py-6 px-12 -mt-2 flex items-center justify-center text-center"
|
||||||
alignItems: 'center',
|
style={{
|
||||||
justifyContent: 'center',
|
fontFamily: 'Caveat',
|
||||||
background: `url('data:image/png;base64,${Buffer.from(
|
fontSize: `${Math.max(Math.min((CARD_WIDTH * 1.5) / signature.length, 80), 36)}px`,
|
||||||
imageData as unknown as string,
|
top: `${CARD_OFFSET_TOP}px`,
|
||||||
).toString('base64')}')`,
|
left: `${CARD_OFFSET_LEFT}px`,
|
||||||
backgroundSize: '1200px 630px',
|
width: `${CARD_WIDTH}px`,
|
||||||
backgroundPositionY: '0%',
|
height: `${CARD_HEIGHT}px`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div tw="flex px-20 py-12 bg-gray-100 rounded-md border-solid border-4 border-zinc-200 shadow-md">
|
{signature}
|
||||||
<div tw="text-[#64748B99] text-7xl">{signature}</div>
|
</p>
|
||||||
</div>
|
|
||||||
<div tw="text-black text-3xl my-8 text-gray-600" style={{ fontFamily: 'Inter' }}>
|
<div
|
||||||
You signed with Documenso
|
tw="absolute absolute flex flex-col items-center justify-center pt-2.5 w-full"
|
||||||
|
style={{
|
||||||
|
top: `${CARD_OFFSET_TOP + CARD_HEIGHT}px`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<h2
|
||||||
|
tw="text-2xl text-slate-900/60"
|
||||||
|
style={{
|
||||||
|
fontFamily: 'Inter',
|
||||||
|
fontWeight: 600,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
I just signed with Documenso
|
||||||
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
@ -51,13 +75,20 @@ export default async function handler(req: NextRequest) {
|
|||||||
fonts: [
|
fonts: [
|
||||||
{
|
{
|
||||||
name: 'Caveat',
|
name: 'Caveat',
|
||||||
data: CaveatFontData,
|
data: caveatRegular,
|
||||||
style: 'italic',
|
style: 'italic',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Inter',
|
name: 'Inter',
|
||||||
data: InterFontData,
|
data: interRegular,
|
||||||
style: 'normal',
|
style: 'normal',
|
||||||
|
weight: 400,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Inter',
|
||||||
|
data: interSemiBold,
|
||||||
|
style: 'normal',
|
||||||
|
weight: 600,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user