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.

Refactor to use static pages (#3629)

Steven Teyedc72067ae64
diff --git a/apps/web/app/[domain]/browser-graphic.tsx b/apps/web/app/(external)/[domain]/browser-graphic.tsx
similarity index 100%
rename from apps/web/app/[domain]/browser-graphic.tsx
rename to apps/web/app/(external)/[domain]/browser-graphic.tsx
diff --git a/apps/web/app/(external)/[domain]/expired/page.tsx b/apps/web/app/(external)/[domain]/expired/page.tsx
new file mode 100644
index 0000000000..afd94a554e
--- /dev/null
+++ b/apps/web/app/(external)/[domain]/expired/page.tsx
@@ -0,0 +1,86 @@
+import { BubbleIcon } from "@/ui/placeholders/bubble-icon";
+import { ButtonLink } from "@/ui/placeholders/button-link";
+import { CTA } from "@/ui/placeholders/cta";
+import { FeaturesSection } from "@/ui/placeholders/features-section";
+import { Hero } from "@/ui/placeholders/hero";
+import { LearnMoreButton } from "@/ui/placeholders/learn-more-button";
+import { prisma } from "@dub/prisma";
+import { CircleHalfDottedClock } from "@dub/ui";
+import { cn, constructMetadata } from "@dub/utils";
+import { redirect } from "next/navigation";
+
+export const revalidate = false; // cache indefinitely
+
+export const metadata = constructMetadata({
+ title: "Expired Link",
+ description:
+ "This link has expired. Please contact the owner of this link to get a new one.",
+ noIndex: true,
+});
+
+const UTM_PARAMS = {
+ utm_source: "Expired Link",
+ utm_medium: "Expired Link Page",
+};
+
+export default async function ExpiredLinkPage(props: {
+ params: Promise<{ domain: string }>;
+}) {
+ const { domain } = await props.params;
+ const domainData = await prisma.domain.findUnique({
+ where: {
+ slug: domain,
+ },
+ });
+
+ if (domainData?.expiredUrl) {
+ redirect(domainData.expiredUrl);
+ }
+
+ return (
+ <div>
+ <Hero>
+ <div className="relative mx-auto flex w-full max-w-md flex-col items-center">
+ <BubbleIcon>
+ <CircleHalfDottedClock className="size-12" />
+ </BubbleIcon>
+ <h1
+ className={cn(
+ "font-display mt-10 text-center text-4xl font-medium text-neutral-900 sm:text-5xl sm:leading-[1.15]",
+ "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:20px] [animation-duration:1s] [animation-fill-mode:both]",
+ )}
+ >
+ Expired link
+ </h1>
+ <p
+ className={cn(
+ "mt-5 text-pretty text-base text-neutral-700 sm:text-xl",
+ "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:10px] [animation-delay:200ms] [animation-duration:1s] [animation-fill-mode:both]",
+ )}
+ >
+ This link has expired. Please contact the owner of this link to get
+ a new one.
+ </p>
+ </div>
+
+ <div
+ className={cn(
+ "xs:flex-row relative mx-auto mt-8 flex max-w-fit flex-col items-center gap-4",
+ "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:5px] [animation-delay:300ms] [animation-duration:1s] [animation-fill-mode:both]",
+ )}
+ >
+ <ButtonLink variant="primary" href="https://app.dub.co/register">
+ Try Dub today
+ </ButtonLink>
+ <LearnMoreButton utmParams={UTM_PARAMS} />
+ </div>
+ </Hero>
+ <div className="mt-20">
+ <FeaturesSection utmParams={UTM_PARAMS} />
+ </div>
+ <div className="mt-32">
+ <CTA utmParams={UTM_PARAMS} />
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/app/[domain]/page.tsx b/apps/web/app/(external)/[domain]/page.tsx
similarity index 100%
rename from apps/web/app/[domain]/page.tsx
rename to apps/web/app/(external)/[domain]/page.tsx
diff --git a/apps/web/app/[domain]/placeholder.tsx b/apps/web/app/(external)/[domain]/placeholder.tsx
similarity index 81%
rename from apps/web/app/[domain]/placeholder.tsx
rename to apps/web/app/(external)/[domain]/placeholder.tsx
index a53a0470ab..f609fd9f5f 100644
--- a/apps/web/app/[domain]/placeholder.tsx
+++ b/apps/web/app/(external)/[domain]/placeholder.tsx
@@ -4,10 +4,11 @@ import { ButtonLink } from "@/ui/placeholders/button-link";
import { CTA } from "@/ui/placeholders/cta";
import { FeaturesSection } from "@/ui/placeholders/features-section";
import { Hero } from "@/ui/placeholders/hero";
+import { LearnMoreButton } from "@/ui/placeholders/learn-more-button";
import { Logo } from "@dub/ui";
-import { cn, createHref } from "@dub/utils";
+import { cn } from "@dub/utils";
import { useParams } from "next/navigation";
-import { BubbleIcon } from "../../ui/placeholders/bubble-icon";
+import { BubbleIcon } from "../../../ui/placeholders/bubble-icon";
import { BrowserGraphic } from "./browser-graphic";
const UTM_PARAMS = {
@@ -56,23 +57,14 @@ export default function PlaceholderContent() {
<ButtonLink variant="primary" href="https://app.dub.co/register">
Try Dub today
</ButtonLink>
- <ButtonLink
- variant="secondary"
- href={createHref("/links", domain, {
- ...UTM_PARAMS,
- utm_campaign: domain,
- utm_content: "Learn more",
- })}
- >
- Learn more
- </ButtonLink>
+ <LearnMoreButton utmParams={UTM_PARAMS} />
</div>
</Hero>
<div className="mt-20">
- <FeaturesSection domain={domain} utmParams={UTM_PARAMS} />
+ <FeaturesSection utmParams={UTM_PARAMS} />
</div>
<div className="mt-32">
- <CTA domain={domain} utmParams={UTM_PARAMS} />
+ <CTA utmParams={UTM_PARAMS} />
</div>
</div>
);
diff --git a/apps/web/app/[domain]/stats/[key]/page.tsx b/apps/web/app/(external)/[domain]/stats/[key]/page.tsx
similarity index 100%
rename from apps/web/app/[domain]/stats/[key]/page.tsx
rename to apps/web/app/(external)/[domain]/stats/[key]/page.tsx
diff --git a/apps/web/app/[domain]/layout.tsx b/apps/web/app/(external)/layout.tsx
similarity index 100%
rename from apps/web/app/[domain]/layout.tsx
rename to apps/web/app/(external)/layout.tsx
diff --git a/apps/web/app/(external)/static/banned/page.tsx b/apps/web/app/(external)/static/banned/page.tsx
new file mode 100644
index 0000000000..23e6363198
--- /dev/null
+++ b/apps/web/app/(external)/static/banned/page.tsx
@@ -0,0 +1,69 @@
+import { BubbleIcon } from "@/ui/placeholders/bubble-icon";
+import { ButtonLink } from "@/ui/placeholders/button-link";
+import { CTA } from "@/ui/placeholders/cta";
+import { FeaturesSection } from "@/ui/placeholders/features-section";
+import { Hero } from "@/ui/placeholders/hero";
+import { LearnMoreButton } from "@/ui/placeholders/learn-more-button";
+import { ShieldSlash } from "@dub/ui";
+import { cn, constructMetadata } from "@dub/utils";
+
+export const revalidate = false; // cache indefinitely
+
+export const metadata = constructMetadata({
+ title: "Banned Link",
+ description: "This link has been banned for violating our terms of service.",
+ noIndex: true,
+});
+
+const UTM_PARAMS = {
+ utm_source: "Banned Link",
+ utm_medium: "Banned Link Page",
+};
+
+export default async function BannedPage() {
+ return (
+ <div>
+ <Hero>
+ <div className="relative mx-auto flex w-full max-w-sm flex-col items-center">
+ <BubbleIcon>
+ <ShieldSlash className="size-12" />
+ </BubbleIcon>
+ <h1
+ className={cn(
+ "font-display mt-10 text-center text-4xl font-medium text-neutral-900 sm:text-5xl sm:leading-[1.15]",
+ "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:20px] [animation-duration:1s] [animation-fill-mode:both]",
+ )}
+ >
+ Banned link
+ </h1>
+ <p
+ className={cn(
+ "mt-5 text-pretty text-base text-neutral-700 sm:text-xl",
+ "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:10px] [animation-delay:200ms] [animation-duration:1s] [animation-fill-mode:both]",
+ )}
+ >
+ This link has been banned for violating our terms of service.
+ </p>
+ </div>
+
+ <div
+ className={cn(
+ "xs:flex-row relative mx-auto mt-8 flex max-w-fit flex-col items-center gap-4",
+ "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:5px] [animation-delay:300ms] [animation-duration:1s] [animation-fill-mode:both]",
+ )}
+ >
+ <ButtonLink variant="primary" href="https://app.dub.co/register">
+ Try Dub today
+ </ButtonLink>
+ <LearnMoreButton utmParams={UTM_PARAMS} />
+ </div>
+ </Hero>
+ <div className="mt-20">
+ <FeaturesSection utmParams={UTM_PARAMS} />
+ </div>
+ <div className="mt-32">
+ <CTA utmParams={UTM_PARAMS} />
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/app/[domain]/not-found/page.tsx b/apps/web/app/(external)/static/notfound/page.tsx
similarity index 78%
rename from apps/web/app/[domain]/not-found/page.tsx
rename to apps/web/app/(external)/static/notfound/page.tsx
index 9292ab9fa9..26c593431e 100644
--- a/apps/web/app/[domain]/not-found/page.tsx
+++ b/apps/web/app/(external)/static/notfound/page.tsx
@@ -3,8 +3,9 @@ import { ButtonLink } from "@/ui/placeholders/button-link";
import { CTA } from "@/ui/placeholders/cta";
import { FeaturesSection } from "@/ui/placeholders/features-section";
import { Hero } from "@/ui/placeholders/hero";
+import { LearnMoreButton } from "@/ui/placeholders/learn-more-button";
import { GlobeSearch } from "@dub/ui";
-import { cn, constructMetadata, createHref } from "@dub/utils";
+import { cn, constructMetadata } from "@dub/utils";
export const revalidate = false; // cache indefinitely
@@ -21,10 +22,7 @@ const UTM_PARAMS = {
utm_medium: "Link Not Found Page",
};
-export default async function NotFoundLinkPage(props: {
- params: Promise<{ domain: string }>;
-}) {
- const params = await props.params;
+export default async function NotFoundLinkPage() {
return (
<main className="flex min-h-screen flex-col justify-between">
<Hero>
@@ -59,23 +57,14 @@ export default async function NotFoundLinkPage(props: {
<ButtonLink variant="primary" href="https://app.dub.co/register">
Try Dub today
</ButtonLink>
- <ButtonLink
- variant="secondary"
- href={createHref("/", params.domain, {
- ...UTM_PARAMS,
- utm_campaign: params.domain,
- utm_content: "Learn more",
- })}
- >
- Learn more
- </ButtonLink>
+ <LearnMoreButton utmParams={UTM_PARAMS} />
</div>
</Hero>
<div className="mt-20">
- <FeaturesSection domain={params.domain} utmParams={UTM_PARAMS} />
+ <FeaturesSection utmParams={UTM_PARAMS} />
</div>
<div className="mt-32">
- <CTA domain={params.domain} utmParams={UTM_PARAMS} />
+ <CTA utmParams={UTM_PARAMS} />
</div>
</main>
);
diff --git a/apps/web/app/app.dub.co/(share)/share/[dashboardId]/page.tsx b/apps/web/app/app.dub.co/(share)/share/[dashboardId]/page.tsx
index 08603c5c69..0841ce9eed 100644
--- a/apps/web/app/app.dub.co/(share)/share/[dashboardId]/page.tsx
+++ b/apps/web/app/app.dub.co/(share)/share/[dashboardId]/page.tsx
@@ -62,10 +62,12 @@ export default async function DashboardPage(props: {
);
}
+ const domain = data.link?.domain || "app.dub.co";
+
return (
<div className="flex min-h-screen flex-col justify-between bg-neutral-50/80">
- <NavMobile staticDomain="app.dub.co" />
- <Nav staticDomain="app.dub.co" />
+ <NavMobile staticDomain={domain} />
+ <Nav staticDomain={domain} />
<Suspense fallback={<div className="h-screen w-full bg-neutral-50" />}>
<Analytics
dashboardProps={{
@@ -84,7 +86,7 @@ export default async function DashboardPage(props: {
}}
/>
</Suspense>
- <Footer staticDomain="app.dub.co" />
+ <Footer staticDomain={domain} />
</div>
);
}
diff --git a/apps/web/app/banned/page.tsx b/apps/web/app/banned/page.tsx
deleted file mode 100644
index a5d0fa1810..0000000000
--- a/apps/web/app/banned/page.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-import { BubbleIcon } from "@/ui/placeholders/bubble-icon";
-import { ButtonLink } from "@/ui/placeholders/button-link";
-import { CTA } from "@/ui/placeholders/cta";
-import { FeaturesSection } from "@/ui/placeholders/features-section";
-import { Hero } from "@/ui/placeholders/hero";
-import { Footer, Nav, NavMobile, ShieldSlash } from "@dub/ui";
-import { cn, constructMetadata, createHref } from "@dub/utils";
-
-export const revalidate = false; // cache indefinitely
-
-export const metadata = constructMetadata({
- title: "Banned Link",
- description: "This link has been banned for violating our terms of service.",
- noIndex: true,
-});
-
-const UTM_PARAMS = {
- utm_source: "Expired Link",
- utm_medium: "Expired Link Page",
-};
-
-export default async function BannedPage(props: {
- params: Promise<{ domain: string }>;
-}) {
- const { domain } = await props.params;
- return (
- <main className="flex min-h-screen flex-col justify-between">
- <NavMobile />
- <Nav maxWidthWrapperClassName="max-w-screen-lg lg:px-4 xl:px-0" />
- <div>
- <Hero>
- <div className="relative mx-auto flex w-full max-w-sm flex-col items-center">
- <BubbleIcon>
- <ShieldSlash className="size-12" />
- </BubbleIcon>
- <h1
- className={cn(
- "font-display mt-10 text-center text-4xl font-medium text-neutral-900 sm:text-5xl sm:leading-[1.15]",
- "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:20px] [animation-duration:1s] [animation-fill-mode:both]",
- )}
- >
- Banned link
- </h1>
- <p
- className={cn(
- "mt-5 text-pretty text-base text-neutral-700 sm:text-xl",
- "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:10px] [animation-delay:200ms] [animation-duration:1s] [animation-fill-mode:both]",
- )}
- >
- This link has been banned for violating our terms of service.
- </p>
- </div>
-
- <div
- className={cn(
- "xs:flex-row relative mx-auto mt-8 flex max-w-fit flex-col items-center gap-4",
- "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:5px] [animation-delay:300ms] [animation-duration:1s] [animation-fill-mode:both]",
- )}
- >
- <ButtonLink variant="primary" href="https://app.dub.co/register">
- Try Dub today
- </ButtonLink>
- <ButtonLink
- variant="secondary"
- href={createHref("/links", domain, {
- ...UTM_PARAMS,
- utm_campaign: domain,
- utm_content: "Learn more",
- })}
- >
- Learn more
- </ButtonLink>
- </div>
- </Hero>
- <div className="mt-20">
- <FeaturesSection domain={domain} utmParams={UTM_PARAMS} />
- </div>
- <div className="mt-32">
- <CTA domain={domain} utmParams={UTM_PARAMS} />
- </div>
- </div>
- <Footer className="max-w-screen-lg border-0 bg-transparent lg:px-4 xl:px-0" />
- </main>
- );
-}
diff --git a/apps/web/app/expired/[domain]/page.tsx b/apps/web/app/expired/[domain]/page.tsx
deleted file mode 100644
index 199f144799..0000000000
--- a/apps/web/app/expired/[domain]/page.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-import { BubbleIcon } from "@/ui/placeholders/bubble-icon";
-import { ButtonLink } from "@/ui/placeholders/button-link";
-import { CTA } from "@/ui/placeholders/cta";
-import { FeaturesSection } from "@/ui/placeholders/features-section";
-import { Hero } from "@/ui/placeholders/hero";
-import { prisma } from "@dub/prisma";
-import { CircleHalfDottedClock, Footer, Nav, NavMobile } from "@dub/ui";
-import { cn, constructMetadata, createHref } from "@dub/utils";
-import { redirect } from "next/navigation";
-
-export const revalidate = false; // cache indefinitely
-
-export const metadata = constructMetadata({
- title: "Expired Link",
- description:
- "This link has expired. Please contact the owner of this link to get a new one.",
- noIndex: true,
-});
-
-const UTM_PARAMS = {
- utm_source: "Expired Link",
- utm_medium: "Expired Link Page",
-};
-
-export default async function ExpiredLinkPage(props: {
- params: Promise<{ domain: string }>;
-}) {
- const { domain } = await props.params;
- const domainData = await prisma.domain.findUnique({
- where: {
- slug: domain,
- },
- });
-
- if (domainData?.expiredUrl) {
- redirect(domainData.expiredUrl);
- }
-
- return (
- <main className="flex min-h-screen flex-col justify-between">
- <NavMobile />
- <Nav maxWidthWrapperClassName="max-w-screen-lg lg:px-4 xl:px-0" />
- <div>
- <Hero>
- <div className="relative mx-auto flex w-full max-w-md flex-col items-center">
- <BubbleIcon>
- <CircleHalfDottedClock className="size-12" />
- </BubbleIcon>
- <h1
- className={cn(
- "font-display mt-10 text-center text-4xl font-medium text-neutral-900 sm:text-5xl sm:leading-[1.15]",
- "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:20px] [animation-duration:1s] [animation-fill-mode:both]",
- )}
- >
- Expired link
- </h1>
- <p
- className={cn(
- "mt-5 text-pretty text-base text-neutral-700 sm:text-xl",
- "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:10px] [animation-delay:200ms] [animation-duration:1s] [animation-fill-mode:both]",
- )}
- >
- This link has expired. Please contact the owner of this link to
- get a new one.
- </p>
- </div>
-
- <div
- className={cn(
- "xs:flex-row relative mx-auto mt-8 flex max-w-fit flex-col items-center gap-4",
- "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:5px] [animation-delay:300ms] [animation-duration:1s] [animation-fill-mode:both]",
- )}
- >
- <ButtonLink variant="primary" href="https://app.dub.co/register">
- Try Dub today
- </ButtonLink>
- <ButtonLink
- variant="secondary"
- href={createHref("/links", domain, {
- ...UTM_PARAMS,
- utm_campaign: domain,
- utm_content: "Learn more",
- })}
- >
- Learn more
- </ButtonLink>
- </div>
- </Hero>
- <div className="mt-20">
- <FeaturesSection domain={domain} utmParams={UTM_PARAMS} />
- </div>
- <div className="mt-32">
- <CTA domain={domain} utmParams={UTM_PARAMS} />
- </div>
- </div>
- <Footer className="max-w-screen-lg border-0 bg-transparent lg:px-4 xl:px-0" />
- </main>
- );
-}
diff --git a/apps/web/lib/api/links/cache.ts b/apps/web/lib/api/links/cache.ts
index 4506792107..59710c93ec 100644
--- a/apps/web/lib/api/links/cache.ts
+++ b/apps/web/lib/api/links/cache.ts
@@ -111,7 +111,7 @@ class LinkCache {
key,
});
if (!linkData) {
- // if no link found (and Redis fails), throw a 404 error (don't rewrite to /not-found since it's expensive)
+ // if no link found (and Redis fails), throw a 404 error (don't rewrite to /static/notfound since it's expensive)
throw new Error("Link not found.");
}
// else, format the link and cache it both in LRU cache and Vercel cache
diff --git a/apps/web/lib/middleware/link.ts b/apps/web/lib/middleware/link.ts
index 91c0b3bae1..236c63023d 100644
--- a/apps/web/lib/middleware/link.ts
+++ b/apps/web/lib/middleware/link.ts
@@ -195,7 +195,7 @@ export async function LinkMiddleware(req: NextRequest, ev: NextFetchEvent) {
// if the link is banned
if (workspaceId === LEGAL_WORKSPACE_ID) {
- return NextResponse.rewrite(new URL("/banned", req.url), {
+ return NextResponse.rewrite(new URL("/static/banned", req.url), {
headers: {
...DUB_HEADERS,
...(!shouldIndex && { "X-Robots-Tag": "googlebot: noindex" }),
@@ -219,7 +219,7 @@ export async function LinkMiddleware(req: NextRequest, ev: NextFetchEvent) {
status: 302,
});
} else {
- return NextResponse.rewrite(new URL(`/expired/${domain}`, req.url), {
+ return NextResponse.rewrite(new URL(`/${domain}/expired`, req.url), {
headers: {
...DUB_HEADERS,
...(!shouldIndex && { "X-Robots-Tag": "googlebot: noindex" }),
diff --git a/apps/web/lib/middleware/utils/handle-not-found-link.ts b/apps/web/lib/middleware/utils/handle-not-found-link.ts
index d904f66eb9..2bfb8bb27d 100644
--- a/apps/web/lib/middleware/utils/handle-not-found-link.ts
+++ b/apps/web/lib/middleware/utils/handle-not-found-link.ts
@@ -21,7 +21,7 @@ export const handleNotFoundLink = async (req: NextRequest) => {
status: 302,
});
} else {
- response = NextResponse.rewrite(new URL(`/${domain}/not-found`, req.url), {
+ response = NextResponse.rewrite(new URL("/static/notfound", req.url), {
headers: DUB_HEADERS,
});
}
diff --git a/apps/web/ui/placeholders/cta.tsx b/apps/web/ui/placeholders/cta.tsx
index 2ba71de2d4..4635d28986 100644
--- a/apps/web/ui/placeholders/cta.tsx
+++ b/apps/web/ui/placeholders/cta.tsx
@@ -1,7 +1,9 @@
+"use client";
+
import { Grid } from "@dub/ui";
import { cn, createHref, UTMTags } from "@dub/utils";
import { Star, StarHalf } from "lucide-react";
-import { ReactNode } from "react";
+import { ReactNode, useEffect, useState } from "react";
import { ButtonLink } from "./button-link";
import Logos from "./logos";
@@ -27,18 +29,20 @@ const RATINGS = [
];
export function CTA({
- domain,
utmParams,
title = "Supercharge your marketing efforts",
subtitle = "See why Dub is the link management platform of choice for modern marketing teams.",
className,
}: {
- domain: string;
utmParams?: Partial<Record<(typeof UTMTags)[number], string>>;
title?: ReactNode;
subtitle?: ReactNode;
className?: string;
}) {
+ const [domain, setDomain] = useState("");
+ useEffect(() => {
+ setDomain(window.location.hostname);
+ }, []);
return (
<div
className={cn(
diff --git a/apps/web/ui/placeholders/features-section.tsx b/apps/web/ui/placeholders/features-section.tsx
index 277947f902..d43f1ddbeb 100644
--- a/apps/web/ui/placeholders/features-section.tsx
+++ b/apps/web/ui/placeholders/features-section.tsx
@@ -1,7 +1,9 @@
+"use client";
+
import { ExpandingArrow } from "@dub/ui";
import { cn, createHref, UTMTags } from "@dub/utils";
import Link from "next/link";
-import { PropsWithChildren } from "react";
+import { PropsWithChildren, useEffect, useState } from "react";
import Markdown from "react-markdown";
import { Analytics } from "./feature-graphics/analytics";
import { Collaboration } from "./feature-graphics/collaboration";
@@ -10,12 +12,14 @@ import { Personalization } from "./feature-graphics/personalization";
import { QR } from "./feature-graphics/qr";
export function FeaturesSection({
- domain,
utmParams,
}: {
- domain: string;
utmParams: Partial<Record<(typeof UTMTags)[number], string>>;
}) {
+ const [domain, setDomain] = useState("");
+ useEffect(() => {
+ setDomain(window.location.hostname);
+ }, []);
return (
<div className="mt-20">
<div className="mx-auto w-full max-w-xl px-4 text-center">
diff --git a/apps/web/ui/placeholders/learn-more-button.tsx b/apps/web/ui/placeholders/learn-more-button.tsx
new file mode 100644
index 0000000000..b379fa2610
--- /dev/null
+++ b/apps/web/ui/placeholders/learn-more-button.tsx
@@ -0,0 +1,28 @@
+"use client";
+
+import { createHref } from "@dub/utils";
+import { useEffect, useState } from "react";
+import { ButtonLink } from "./button-link";
+
+export function LearnMoreButton({
+ utmParams,
+}: {
+ utmParams: Record<string, string>;
+}) {
+ const [domain, setDomain] = useState("");
+ useEffect(() => {
+ setDomain(window.location.hostname);
+ }, []);
+ return (
+ <ButtonLink
+ variant="secondary"
+ href={createHref("/links", domain, {
+ ...utmParams,
+ utm_campaign: domain,
+ utm_content: "Learn more",
+ })}
+ >
+ Learn more
+ </ButtonLink>
+ );
+}