The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
improved design
Steven Teyb506c86fc46f
diff --git a/apps/web/app/app.dub.co/(auth)/login/form.tsx b/apps/web/app/app.dub.co/(auth)/login/form.tsxindex 2239a386f8..1181cebb1e 100644--- a/apps/web/app/app.dub.co/(auth)/login/form.tsx+++ b/apps/web/app/app.dub.co/(auth)/login/form.tsx@@ -2,6 +2,7 @@import { emailSchema } from "@/lib/zod/schemas/auth";import {+ AnimatedSizeContainer,Button,Github,Google,@@ -14,7 +15,6 @@ import { InputPassword, LoadingSpinner } from "@dub/ui/src/icons";import { cn } from "@dub/utils";import { Lock, Mail } from "lucide-react";import { signIn } from "next-auth/react";-import Link from "next/link";import { useRouter, useSearchParams } from "next/navigation";import { useEffect, useRef, useState } from "react";import { toast } from "sonner";@@ -86,7 +86,7 @@ export default function LoginForm() {}}loading={clickedMethod === "google"}disabled={clickedMethod && clickedMethod !== "google"}- icon={<Google className="h-5 w-5" />}+ icon={<Google className="size-4" />}/>);};@@ -105,7 +105,7 @@ export default function LoginForm() {}}loading={clickedMethod === "github"}disabled={clickedMethod && clickedMethod !== "github"}- icon={<Github className="h-5 w-5 text-black" />}+ icon={<Github className="size-4 text-black" />}/>);};@@ -239,9 +239,9 @@ export default function LoginForm() {variant="secondary"icon={password ? (- <InputPassword className="size-4" />+ <InputPassword className="size-4 text-gray-600" />) : (- <Mail className="size-4" />+ <Mail className="size-4 text-gray-600" />)}{...(authMethod !== "email" && {@@ -353,71 +353,53 @@ export default function LoginForm() {return (<>- <div className="flex flex-col gap-3">- {authMethod && (- <div className="flex flex-col gap-2">- {authMethodComponent}+ <AnimatedSizeContainer height>+ <div className="flex flex-col gap-3">+ {authMethod && (+ <div className="flex flex-col gap-2">+ {authMethodComponent}- {!showEmailPasswordOnly && authMethod === lastUsedAuthMethod && (- <div className="text-center text-xs">- <span className="text-gray-500">- You signed in with{" "}- {lastUsedAuthMethod.charAt(0).toUpperCase() +- lastUsedAuthMethod.slice(1)}{" "}- last time+ {!showEmailPasswordOnly && authMethod === lastUsedAuthMethod && (+ <div className="text-center text-xs">+ <span className="text-gray-500">+ You signed in with{" "}+ {lastUsedAuthMethod.charAt(0).toUpperCase() ++ lastUsedAuthMethod.slice(1)}{" "}+ last time+ </span>+ </div>+ )}+ <div className="my-2 flex flex-shrink items-center justify-center gap-2">+ <div className="grow basis-0 border-b border-gray-300" />+ <span className="text-xs font-normal uppercase leading-none text-gray-500">+ or</span>+ <div className="grow basis-0 border-b border-gray-300" /></div>- )}- <div className="my-2 flex flex-shrink items-center justify-center gap-2">- <div className="grow basis-0 border-b border-gray-300" />- <span className="text-xs font-normal uppercase leading-none text-gray-500">- or- </span>- <div className="grow basis-0 border-b border-gray-300" /></div>- </div>- )}- {showEmailPasswordOnly ? (- <p className="text-center text-sm text-gray-500">- <button- type="button"- onClick={() => {- setEmail("");- setShowPasswordField(false);- }}- className="font-semibold text-gray-500 transition-colors hover:text-black"- >- Continue with another method- </button>- </p>- ) : (- authProviders- .filter((provider) => provider.method !== authMethod)- .map((provider) => (- <div key={provider.method}>{provider.component}</div>- ))- )}- </div>-- {noSuchAccount ? (- <p className="text-center text-sm text-red-500">- No such account.{" "}- <Link href="/register" className="font-semibold text-red-600">- Sign up- </Link>{" "}- instead?- </p>- ) : (- <p className="text-center text-sm text-gray-500">- Don't have an account?{" "}- <Link- href="/register"- className="font-semibold text-gray-500 transition-colors hover:text-black"- >- Sign up- </Link>- </p>- )}+ )}+ {showEmailPasswordOnly ? (+ <div className="mt-2 text-center text-sm text-gray-500">+ <button+ type="button"+ onClick={() => {+ setEmail("");+ setShowPasswordField(false);+ }}+ className="font-semibold text-gray-500 transition-colors hover:text-black"+ >+ Continue with another method+ </button>+ </div>+ ) : (+ authProviders+ .filter((provider) => provider.method !== authMethod)+ .map((provider) => (+ <div key={provider.method}>{provider.component}</div>+ ))+ )}+ </div>+ </AnimatedSizeContainer></>);}diff --git a/apps/web/app/app.dub.co/(auth)/login/page.tsx b/apps/web/app/app.dub.co/(auth)/login/page.tsxindex f1e34c0411..4a412eff2d 100644--- a/apps/web/app/app.dub.co/(auth)/login/page.tsx+++ b/apps/web/app/app.dub.co/(auth)/login/page.tsx@@ -1,6 +1,5 @@-import { Button, ClientOnly, Wordmark } from "@dub/ui";-import { HOME_DOMAIN, constructMetadata } from "@dub/utils";-import { Suspense } from "react";+import AuthLayout from "@/ui/layout/auth-layout";+import { constructMetadata } from "@dub/utils";import LoginForm from "./form";export const metadata = constructMetadata({@@ -8,33 +7,9 @@ export const metadata = constructMetadata({});export default function LoginPage() {- // Use ClientOnly because the login form relies on local storage for its initial renderreturn (- <ClientOnly className="relative z-10 my-10 flex min-h-full w-full flex-col items-center justify-center">- <a href={HOME_DOMAIN}>- <Wordmark className="h-12" />- </a>- <div className="mt-5 w-full max-w-md overflow-hidden border-y border-gray-200 sm:rounded-2xl sm:border sm:shadow-xl">- <div className="flex flex-col items-center justify-center gap-4 border-b border-gray-200 bg-white px-4 py-6 pt-8 text-center sm:px-16">- <h3 className="text-lg font-semibold">Sign in to your Dub account</h3>- </div>- <div className="flex flex-col bg-gray-50 px-4 py-8 sm:px-16">- <div className="space-y-3">- <Suspense- fallback={- <>- <Button disabled={true} variant="secondary" />- <Button disabled={true} variant="secondary" />- <Button disabled={true} variant="secondary" />- <div className="mx-auto h-5 w-3/4 rounded-lg bg-gray-100" />- </>- }- >- <LoginForm />- </Suspense>- </div>- </div>- </div>- </ClientOnly>+ <AuthLayout variant="login">+ <LoginForm />+ </AuthLayout>);}diff --git a/apps/web/app/app.dub.co/(auth)/register/form.tsx b/apps/web/app/app.dub.co/(auth)/register/form.tsxindex 4e6c515b01..bed40d5318 100644--- a/apps/web/app/app.dub.co/(auth)/register/form.tsx+++ b/apps/web/app/app.dub.co/(auth)/register/form.tsx@@ -2,7 +2,6 @@import { Button, Github, Google } from "@dub/ui";import { signIn } from "next-auth/react";-import Link from "next/link";import { useSearchParams } from "next/navigation";import { useEffect, useState } from "react";@@ -35,6 +34,7 @@ export default function RegisterForm() {icon={<Google className="h-4 w-4" />}/><Button+ variant="secondary"text="Continue with GitHub"onClick={() => {setClickedGithub(true);@@ -45,15 +45,6 @@ export default function RegisterForm() {loading={clickedGithub}icon={<Github className="h-4 w-4" />}/>- <p className="text-center text-sm text-gray-500">- Already have an account?{" "}- <Link- href="/login"- className="font-semibold text-gray-500 transition-colors hover:text-black"- >- Sign in- </Link>- </p></>);}diff --git a/apps/web/app/app.dub.co/(auth)/register/page.tsx b/apps/web/app/app.dub.co/(auth)/register/page.tsxindex b63ffb7b59..70b7eeff01 100644--- a/apps/web/app/app.dub.co/(auth)/register/page.tsx+++ b/apps/web/app/app.dub.co/(auth)/register/page.tsx@@ -1,103 +1,15 @@-import { BlurImage, Button, Logo } from "@dub/ui";-import { HOME_DOMAIN, constructMetadata } from "@dub/utils";-import { Suspense } from "react";+import AuthLayout from "@/ui/layout/auth-layout";+import { constructMetadata } from "@dub/utils";import RegisterForm from "./form";export const metadata = constructMetadata({title: `Create your ${process.env.NEXT_PUBLIC_APP_NAME} account`,});-const logos = [- "vercel",- "perplexity",- "prisma",- "tinybird",- "hashnode",- "cal",- "vercel",- "perplexity",- "prisma",- "tinybird",- "hashnode",- "cal",-];-export default function RegisterPage() {return (- <div className="grid w-full grid-cols-1 md:grid-cols-5">- <div className="col-span-1 flex items-center justify-center md:col-span-3">- <div className="w-full max-w-md overflow-hidden border-y border-gray-200 sm:rounded-2xl sm:border sm: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">- <a href={HOME_DOMAIN}>- <Logo className="h-10 w-10" />- </a>- <h3 className="text-xl font-semibold">- Create your {process.env.NEXT_PUBLIC_APP_NAME} account- </h3>- <p className="text-sm text-gray-500">- By signing up, you agree to our <br />- <a- href="https://dub.co/terms"- target="_blank"- className="font-medium underline underline-offset-4 hover:text-gray-700"- >- Terms of Service- </a>{" "}- and{" "}- <a- href="https://dub.co/privacy"- target="_blank"- className="font-medium underline underline-offset-4 hover:text-gray-700"- >- Privacy Policy- </a>- </p>- </div>- <div className="flex flex-col space-y-3 bg-gray-50 px-4 py-8 sm:px-16">- <Suspense- fallback={- <>- <Button disabled={true} text="" variant="secondary" />- <div className="mx-auto h-5 w-3/4 rounded-lg bg-gray-100" />- </>- }- >- <RegisterForm />- </Suspense>- </div>- </div>- </div>- <div className="hidden h-full flex-col justify-center space-y-12 overflow-hidden border-l border-gray-200 bg-white/10 shadow-[inset_10px_-50px_94px_0_rgb(199,199,199,0.2)] backdrop-blur md:col-span-2 md:flex">- <a- href="https://dub.co/features/analytics"- target="_blank"- className="ml-12 h-1/2 w-[112%] rounded-xl border border-gray-200 p-2 shadow-xl"- >- <BlurImage- alt="Dub.co Analytics"- src="https://assets.dub.co/features/analytics.png"- width={1735}- height={990}- className="h-full rounded-lg border border-gray-200 object-cover"- />- </a>- <a- href="https://dub.co/customers"- target="_blank"- className="animate-infinite-scroll flex items-center space-x-4"- >- {logos.map((logo, idx) => (- <BlurImage- alt={`${logo} logo`}- key={idx}- src={`https://dub.co/_static/clients/${logo}.svg`}- width={520}- height={182}- className="h-12 grayscale transition-all hover:grayscale-0"- />- ))}- </a>- </div>- </div>+ <AuthLayout variant="register">+ <RegisterForm />+ </AuthLayout>);}diff --git a/apps/web/ui/layout/auth-layout.tsx b/apps/web/ui/layout/auth-layout.tsxnew file mode 100644index 0000000000..9097f3591b--- /dev/null+++ b/apps/web/ui/layout/auth-layout.tsx@@ -0,0 +1,127 @@+import { BlurImage, Button, ClientOnly, Wordmark } from "@dub/ui";+import Link from "next/link";+import { Suspense } from "react";++const logos = [+ "vercel",+ "perplexity",+ "prisma",+ "tinybird",+ "hashnode",+ "cal",+ "vercel",+ "perplexity",+ "prisma",+ "tinybird",+ "hashnode",+ "cal",+];++export default function AuthLayout({+ variant,+ children,+}: {+ variant: "login" | "register";+ children: React.ReactNode;+}) {+ return (+ <div className="grid w-full grid-cols-1 md:grid-cols-5">+ <div className="col-span-1 flex min-h-screen flex-col items-center justify-between border-r border-gray-200 bg-white/10 shadow-[inset_10px_-50px_94px_0_rgb(199,199,199,0.2)] backdrop-blur sm:col-span-3">+ <div className="flex h-full w-full flex-col items-center justify-center">+ {/* Use ClientOnly because the login form relies on local storage for its initial render */}+ <ClientOnly className="relative flex w-full flex-col items-center justify-center">+ <Wordmark className="mb-8 h-12" />+ <div className="w-full max-w-md overflow-hidden border-y border-gray-200 sm:rounded-2xl sm:border sm:shadow-sm">+ <div className="border-b border-gray-200 bg-white pb-6 pt-8 text-center">+ <h3 className="text-lg font-semibold">+ {variant === "login"+ ? "Sign in to your Dub account"+ : "Get started with Dub"}+ </h3>+ </div>+ <div className="flex flex-col bg-gray-50 px-4 py-8 sm:px-16">+ <div className="space-y-3">+ <Suspense+ fallback={+ <>+ <Button disabled={true} variant="secondary" />+ <Button disabled={true} variant="secondary" />+ <Button disabled={true} variant="secondary" />+ <div className="mx-auto h-5 w-3/4 rounded-lg bg-gray-100" />+ </>+ }+ >+ {children}+ </Suspense>+ </div>+ </div>+ </div>+ <p className="mt-4 text-center text-sm text-gray-500">+ {variant === "login"+ ? "Don't have an account?"+ : "Already have an account?"}{" "}+ <Link+ href={`/${variant === "login" ? "register" : "login"}`}+ className="font-semibold text-gray-500 underline underline-offset-2 transition-colors hover:text-black"+ >+ {variant === "login" ? "Sign up" : "Sign in"}+ </Link>+ </p>+ </ClientOnly>+ </div>+ <div className="grid gap-2 pb-8 pt-4">+ <p className="text-xs text-gray-600">+ © {new Date().getFullYear()} Dub Technologies, Inc.+ </p>+ <div className="flex gap-3 text-center text-xs text-gray-500 underline underline-offset-2">+ <a+ href="https://dub.co/privacy"+ target="_blank"+ className="hover:text-gray-800"+ >+ Privacy Policy+ </a>+ <a+ href="https://dub.co/terms"+ target="_blank"+ className="hover:text-gray-800"+ >+ Terms of Service+ </a>+ </div>+ </div>+ </div>+ <div className="hidden h-full flex-col justify-center space-y-12 overflow-hidden md:col-span-2 md:flex">+ <a+ href="https://dub.co/features/analytics"+ target="_blank"+ className="ml-12 h-1/2 w-[112%] rounded-xl border border-gray-200 p-2 shadow-xl"+ >+ <BlurImage+ alt="Dub.co Analytics"+ src="https://assets.dub.co/compare/dub-analytics.png"+ width={3236}+ height={1618}+ className="h-full rounded-lg border border-gray-200 object-cover"+ />+ </a>+ <a+ href="https://dub.co/customers"+ target="_blank"+ className="animate-infinite-scroll flex items-center space-x-4"+ >+ {logos.map((logo, idx) => (+ <BlurImage+ alt={`${logo} logo`}+ key={idx}+ src={`https://dub.co/_static/clients/${logo}.svg`}+ width={520}+ height={182}+ className="h-12 grayscale transition-all hover:grayscale-0"+ />+ ))}+ </a>+ </div>+ </div>+ );+}