Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

simplify og/program/route

Steven Teyaa2a228991ea
diff --git a/apps/web/app/api/og/program/route.tsx b/apps/web/app/api/og/program/route.tsx
index 1af8b0e5fa..38be5c370a 100644
--- a/apps/web/app/api/og/program/route.tsx
+++ b/apps/web/app/api/og/program/route.tsx
@@ -16,14 +16,10 @@ const DARK_CELLS = [
];
export async function GET(req: NextRequest) {
- const [interMedium, interSemibold] = await Promise.all([
- fetch(new URL("@/styles/Inter-Medium.ttf", import.meta.url)).then((res) =>
- res.arrayBuffer(),
- ),
- fetch(new URL("@/styles/Inter-Semibold.ttf", import.meta.url)).then((res) =>
- res.arrayBuffer(),
- ),
- ]);
+ // Use only Inter-Semibold to reduce bundle size (~300KB savings)
+ const interSemibold = await fetch(
+ new URL("@/styles/Inter-Semibold.ttf", import.meta.url),
+ ).then((res) => res.arrayBuffer());
const slug = req.nextUrl.searchParams.get("slug");
@@ -68,7 +64,7 @@ export async function GET(req: NextRequest) {
(
<div
tw="flex flex-col bg-white w-full h-full"
- style={{ fontFamily: "Inter Medium" }}
+ style={{ fontFamily: "Inter Semibold" }}
>
{/* @ts-ignore */}
<svg tw="absolute inset-0 text-black/10" width="1200" height="630">
@@ -145,38 +141,17 @@ export async function GET(req: NextRequest) {
<div tw="w-full flex items-center rounded-md bg-neutral-100 border border-neutral-200 p-8 text-2xl">
{/* @ts-ignore */}
<InvoiceDollar tw="w-8 h-8 mr-4" />
- <strong
- tw="font-semibold mr-1.5"
- style={{ fontFamily: "Inter Semibold" }}
- >
- {constructRewardAmount(rewards[0])}
- {reward.event === "sale" && reward.maxDuration === 0
- ? " for the first sale"
- : ` per ${reward.event}`}
- </strong>
- {reward.maxDuration === null ? (
- <>
- for the
- <strong
- tw="font-semibold ml-1.5"
- style={{ fontFamily: "Inter Semibold" }}
- >
- customer's lifetime
- </strong>
- </>
- ) : reward.maxDuration && reward.maxDuration > 1 ? (
- <>
- for
- <strong
- tw="font-semibold ml-1.5"
- style={{ fontFamily: "Inter Semibold" }}
- >
- {reward.maxDuration % 12 === 0
- ? `${reward.maxDuration / 12} year${reward.maxDuration / 12 > 1 ? "s" : ""}`
- : `${reward.maxDuration} months`}
- </strong>
- </>
- ) : null}
+ {constructRewardAmount(rewards[0])}
+ {reward.event === "sale" && reward.maxDuration === 0
+ ? " for the first sale "
+ : ` per ${reward.event} `}
+ {reward.maxDuration === null
+ ? "for the customer's lifetime"
+ : reward.maxDuration && reward.maxDuration > 1
+ ? reward.maxDuration % 12 === 0
+ ? `for ${reward.maxDuration / 12} year${reward.maxDuration / 12 > 1 ? "s" : ""}`
+ : `for ${reward.maxDuration} months`
+ : null}
</div>
)}
</div>
@@ -196,10 +171,6 @@ export async function GET(req: NextRequest) {
width: 1200,
height: 630,
fonts: [
- {
- name: "Inter Medium",
- data: interMedium,
- },
{
name: "Inter Semibold",
data: interSemibold,