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.

wip

Kiran K3b0e4f8c7f63
diff --git a/apps/web/app/app.dub.co/(auth)/register/form.tsx b/apps/web/app/app.dub.co/(auth)/register/form.tsx
new file mode 100644
index 0000000000..e6ca11557d
--- /dev/null
+++ b/apps/web/app/app.dub.co/(auth)/register/form.tsx
@@ -0,0 +1,20 @@
+"use client";
+
+import SignUpEmail from "./signup-email";
+import SignupOAuth from "./signup-oauth";
+
+export default function RegisterForm() {
+ return (
+ <>
+ <SignUpEmail />
+ <div className="relative flex items-center py-2">
+ <div className="border-subtle flex-grow border-t" />
+ <span className="text-subtle leadning-none mx-2 flex-shrink text-sm font-normal text-gray-700">
+ Or continue with
+ </span>
+ <div className="border-subtle flex-grow border-t" />
+ </div>
+ <SignupOAuth />
+ </>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(auth)/register/verify-otp.tsx b/apps/web/app/app.dub.co/(auth)/register/otp/form.tsx
similarity index 98%
rename from apps/web/app/app.dub.co/(auth)/register/verify-otp.tsx
rename to apps/web/app/app.dub.co/(auth)/register/otp/form.tsx
index f24aaf4fc2..32367753af 100644
--- a/apps/web/app/app.dub.co/(auth)/register/verify-otp.tsx
+++ b/apps/web/app/app.dub.co/(auth)/register/otp/form.tsx
@@ -7,7 +7,7 @@ import { useAction } from "next-safe-action/hooks";
import { useRouter } from "next/navigation";
import { useState } from "react";
-export const VerifyOTP = () => {
+export default function VerifyOTPForm() {
const router = useRouter();
const [code, setCode] = useState("");
const { executeAsync, result, status, isExecuting } =
@@ -72,4 +72,4 @@ export const VerifyOTP = () => {
</div>
</div>
);
-};
+}
diff --git a/apps/web/app/app.dub.co/(auth)/register/otp/page.tsx b/apps/web/app/app.dub.co/(auth)/register/otp/page.tsx
new file mode 100644
index 0000000000..98b60c3a30
--- /dev/null
+++ b/apps/web/app/app.dub.co/(auth)/register/otp/page.tsx
@@ -0,0 +1,10 @@
+import { constructMetadata } from "@dub/utils";
+import VerifyOTPForm from "./form";
+
+export const metadata = constructMetadata({
+ title: `Create your ${process.env.NEXT_PUBLIC_APP_NAME} account`,
+});
+
+export default function VerifyOTPPage() {
+ return <VerifyOTPForm />;
+}
diff --git a/apps/web/app/app.dub.co/(auth)/register/page-client.tsx b/apps/web/app/app.dub.co/(auth)/register/page-client.tsx
deleted file mode 100644
index 3b68d21e70..0000000000
--- a/apps/web/app/app.dub.co/(auth)/register/page-client.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-"use client";
-
-import { BlurImage } from "@dub/ui";
-import { useState } from "react";
-import SignUpForm from "./signup";
-import { VerifyOTP } from "./verify-otp";
-
-const logos = [
- "vercel",
- "perplexity",
- "prisma",
- "tinybird",
- "hashnode",
- "cal",
- "vercel",
- "perplexity",
- "prisma",
- "tinybird",
- "hashnode",
- "cal",
-];
-
-export default function RegisterPageClient() {
- const [authView, setAuthView] = useState<"signup" | "otp">("signup");
-
- console.log({ authView });
-
- return (
- <div className="grid w-full grid-cols-1 md:grid-cols-5">
- {authView === "signup" && <SignUpForm setAuthView={setAuthView} />}
- {authView === "otp" && <VerifyOTP />}
-
- <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>
- );
-}
diff --git a/apps/web/app/app.dub.co/(auth)/register/page.tsx b/apps/web/app/app.dub.co/(auth)/register/page.tsx
index cb7630f2b7..b63ffb7b59 100644
--- a/apps/web/app/app.dub.co/(auth)/register/page.tsx
+++ b/apps/web/app/app.dub.co/(auth)/register/page.tsx
@@ -1,12 +1,103 @@
-import { constructMetadata } from "@dub/utils";
-import RegisterPageClient from "./page-client";
+import { BlurImage, Button, Logo } from "@dub/ui";
+import { HOME_DOMAIN, constructMetadata } from "@dub/utils";
+import { Suspense } from "react";
+import RegisterForm from "./form";
export const metadata = constructMetadata({
title: `Create your ${process.env.NEXT_PUBLIC_APP_NAME} account`,
});
-export const runtime = "nodejs";
+const logos = [
+ "vercel",
+ "perplexity",
+ "prisma",
+ "tinybird",
+ "hashnode",
+ "cal",
+ "vercel",
+ "perplexity",
+ "prisma",
+ "tinybird",
+ "hashnode",
+ "cal",
+];
export default function RegisterPage() {
- return <RegisterPageClient />;
+ 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>
+ );
}
diff --git a/apps/web/app/app.dub.co/(auth)/register/signup-email.tsx b/apps/web/app/app.dub.co/(auth)/register/signup-email.tsx
index 1f71bd475c..b36381087c 100644
--- a/apps/web/app/app.dub.co/(auth)/register/signup-email.tsx
+++ b/apps/web/app/app.dub.co/(auth)/register/signup-email.tsx
@@ -7,14 +7,9 @@ import { Button, Input } from "@dub/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useAction } from "next-safe-action/hooks";
import { useRouter } from "next/navigation";
-import { useEffect } from "react";
import { useForm } from "react-hook-form";
-export default function SignUpEmail({
- setAuthView,
-}: {
- setAuthView: (view: "signup" | "otp") => void;
-}) {
+export default function SignUpEmail() {
const router = useRouter();
const { executeAsync, result, status, isExecuting } =
useAction(createNewAccount);
@@ -32,12 +27,6 @@ export default function SignUpEmail({
},
});
- useEffect(() => {
- if (status === "hasSucceeded") {
- setAuthView("otp");
- }
- }, [status]);
-
const onSubmit = handleSubmit(async (data) => {
await executeAsync(data);
diff --git a/apps/web/app/app.dub.co/(auth)/register/signup.tsx b/apps/web/app/app.dub.co/(auth)/register/signup.tsx
deleted file mode 100644
index de6fb1a8c5..0000000000
--- a/apps/web/app/app.dub.co/(auth)/register/signup.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-"use client";
-
-import { Button, Logo } from "@dub/ui";
-import { HOME_DOMAIN } from "@dub/utils";
-import { Suspense } from "react";
-import SignUpEmail from "./signup-email";
-import SignupOAuth from "./signup-oauth";
-
-export default function SignUpForm({
- setAuthView,
-}: {
- setAuthView: (view: "signup" | "otp") => void;
-}) {
- return (
- <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 gap-5 bg-gray-50 px-4 py-8 sm:px-16">
- <SignUpEmail setAuthView={setAuthView} />
-
- <div className="relative flex items-center">
- <div className="border-subtle flex-grow border-t" />
- <span className="text-subtle leadning-none mx-2 flex-shrink text-sm font-normal text-gray-700">
- Or continue with
- </span>
- <div className="border-subtle flex-grow border-t" />
- </div>
-
- <div className="space-y-3">
- <Suspense
- fallback={
- <>
- <Button disabled={true} text="" variant="secondary" />
- <div className="mx-auto h-5 w-3/4 rounded-lg bg-gray-100" />
- </>
- }
- >
- <SignupOAuth />
- </Suspense>
- </div>
- </div>
- </div>
- </div>
- );
-}