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.

3.0 KB
Raw Blame
import { prisma } from "@/lib/prisma";
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 { GlobeSearch } 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: "Link Not Found",
  description:
    "This link does not exist on Dub. Please check the URL and try again.",
  image: "https://assets.dub.co/misc/notfoundlink.jpg",
  noIndex: true,
});

const UTM_PARAMS = {
  utm_source: "Link Not Found",
  utm_medium: "Link Not Found Page",
};

export function generateStaticParams() {
  return [];
}

export default async function NotFoundLinkPage(props: {
  params: Promise<{ domain: string }>;
}) {
  const { domain } = await props.params;
  const domainData = await prisma.domain.findUnique({
    where: {
      slug: domain,
    },
  });

  if (domainData?.notFoundUrl) {
    redirect(domainData.notFoundUrl);
  }

  return (
    <main className="flex min-h-screen flex-col justify-between">
      <Hero>
        <div className="relative mx-auto flex w-full max-w-md flex-col items-center">
          <BubbleIcon>
            <GlobeSearch 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]",
            )}
          >
            Link not found
          </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 does not exist on Dub. Please check the URL and try again.
          </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>
    </main>
  );
}