The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update link password page
Tim Wilson8364a79a0e08
diff --git a/apps/web/app/password/[linkId]/form.tsx b/apps/web/app/password/[linkId]/form.tsxindex 7e2763d829..b937fc77bc 100644--- a/apps/web/app/password/[linkId]/form.tsx+++ b/apps/web/app/password/[linkId]/form.tsx@@ -22,11 +22,11 @@ export default function PasswordForm() {<formdata-testid="password-form"action={formAction}- className="flex flex-col space-y-4 bg-gray-50 px-4 py-8 sm:px-16"+ className="flex flex-col gap-4 bg-neutral-50 p-4 sm:p-8 sm:pt-6"><div>- <label htmlFor="password" className="block text-xs text-gray-600">- PASSWORD+ <label htmlFor="password" className="block text-sm text-neutral-800">+ Password</label><div className="relative mt-1 rounded-md shadow-sm"><input type="hidden" name="linkId" value={linkId} />@@ -39,7 +39,7 @@ export default function PasswordForm() {className={`${state.error? "border-red-300 pr-10 text-red-500 placeholder-red-300 focus:border-red-500 focus:ring-red-500"- : "border-gray-300 text-gray-900 placeholder-gray-400 focus:border-gray-500 focus:ring-gray-500"+ : "border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:ring-neutral-500"} block w-full rounded-md focus:outline-none sm:text-sm`}/>{state.error && (@@ -65,5 +65,5 @@ export default function PasswordForm() {const FormButton = () => {const { pending } = useFormStatus();- return <Button text="Log in" loading={pending} />;+ return <Button text="View page" loading={pending} />;};diff --git a/apps/web/app/password/[linkId]/page.tsx b/apps/web/app/password/[linkId]/page.tsxindex 8a8b49cf49..29c3ad5433 100644--- a/apps/web/app/password/[linkId]/page.tsx+++ b/apps/web/app/password/[linkId]/page.tsx@@ -1,8 +1,10 @@+import { Lock } from "@/ui/shared/icons";import { NewBackground } from "@/ui/shared/new-background";import { prismaEdge } from "@dub/prisma/edge";-import { BlurImage, Logo } from "@dub/ui";-import { constructMetadata, isDubDomain } from "@dub/utils";+import { BlurImage, Wordmark } from "@dub/ui";+import { constructMetadata, createHref, isDubDomain } from "@dub/utils";import { cookies } from "next/headers";+import Link from "next/link";import { notFound, redirect } from "next/navigation";import PasswordForm from "./form";@@ -11,7 +13,7 @@ export const runtime = "edge";const title = "Password Required";const description =- "This link is password protected. Please enter the password to view it.";+ "This link is password protected. Enter the password to view it.";const image = "https://assets.dub.co/misc/password-protected.png";export async function generateMetadata({@@ -91,30 +93,44 @@ export default async function PasswordProtectedLinkPage({}return (- <main className="flex h-screen w-screen items-center justify-center">+ <><NewBackground />- <div className="z-10 w-full max-w-md overflow-hidden rounded-2xl border border-gray-100 shadow-xl">- <div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 bg-white px-4 py-6 pt-8 text-center sm:px-16">- {!isDubDomain(link.domain) &&- link.project?.plan !== "free" &&- link.project?.logo ? (- <BlurImage- src={link.project.logo}- alt={link.project.name}- width={20}- height={20}- className="h-10 w-10 rounded-full"- />- ) : (- <a href="https://dub.co" target="_blank" rel="noreferrer">- <Logo />- </a>- )}- <h3 className="text-xl font-semibold">{title}</h3>- <p className="text-sm text-gray-500">{description}</p>+ <main className="relative mb-10 flex w-screen flex-col items-center">+ <Wordmark className="mt-6 h-8" />+ <div className="z-10 mt-8 w-full max-w-[400px] overflow-hidden rounded-2xl border border-neutral-200 shadow-sm md:mt-24">+ <div className="flex flex-col items-center justify-center gap-3 border-b border-neutral-200 bg-white px-4 py-6 text-center">+ {link.project?.logo ? (+ <BlurImage+ src={link.project.logo}+ alt={link.project.name}+ width={48}+ height={48}+ className="size-12 rounded-full"+ />+ ) : (+ <div className="flex size-12 items-center justify-center rounded-full bg-neutral-100">+ <Lock className="size-4 text-neutral-600" />+ </div>+ )}+ <h3 className="mt-1 text-lg font-semibold">Password required</h3>+ <p className="w-full max-w-xs text-pretty text-sm text-neutral-500">+ {description}+ </p>+ </div>+ <PasswordForm /></div>- <PasswordForm />- </div>- </main>+ <Link+ href={createHref("/home", link.domain, {+ utm_source: "Password Protected Link",+ utm_medium: "Link Password Page",+ utm_campaign: link.domain,+ utm_content: "What is Dub?",+ })}+ className="mt-4 block text-sm font-medium text-neutral-600 underline transition-colors duration-75 hover:text-neutral-800"+ >+ What is Dub?+ </Link>+ </main>+ </>);}diff --git a/apps/web/ui/shared/new-background.tsx b/apps/web/ui/shared/new-background.tsxindex bec945b800..26826e2573 100644--- a/apps/web/ui/shared/new-background.tsx+++ b/apps/web/ui/shared/new-background.tsx@@ -17,7 +17,7 @@ export function NewBackground(props: { showAnimation?: boolean }) {return (<divclassName={cn(- "fixed inset-0 overflow-hidden bg-white transition-opacity duration-300",+ "pointer-events-none fixed inset-0 overflow-hidden bg-white transition-opacity duration-300",showAnimation ? (isLoaded ? "opacity-100" : "opacity-0") : "opacity-60",)}>