Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

refactor: change meta tags for login

Marc Seitz7773c98e4852
diff --git a/app/(auth)/auth/confirm-email-change/[token]/page.tsx b/app/(auth)/auth/confirm-email-change/[token]/page.tsx
index 28f07660..431f6f25 100644
--- a/app/(auth)/auth/confirm-email-change/[token]/page.tsx
+++ b/app/(auth)/auth/confirm-email-change/[token]/page.tsx
@@ -1,11 +1,10 @@
+import { Metadata } from "next";
import { redirect } from "next/navigation";
import NotFound from "@/pages/404";
import { VerificationToken } from "@prisma/client";
import { waitUntil } from "@vercel/functions";
-import EmailUpdated from "@/components/emails/email-updated";
-
import { hashToken } from "@/lib/api/auth/token";
import prisma from "@/lib/prisma";
import { redis } from "@/lib/redis";
@@ -13,11 +12,47 @@ import { sendEmail } from "@/lib/resend";
import { CustomUser } from "@/lib/types";
import { subscribe, unsubscribe } from "@/lib/unsend";
+import EmailUpdated from "@/components/emails/email-updated";
+
import ConfirmEmailChangePageClient from "./page-client";
import { getSession } from "./utils";
export const runtime = "nodejs";
+const data = {
+ description: "Confirm email change",
+ title: "Confirm email change | Papermark",
+ url: "/auth/confirm-email-change",
+};
+
+export const metadata: Metadata = {
+ metadataBase: new URL("https://www.papermark.com"),
+ title: data.title,
+ description: data.description,
+ openGraph: {
+ title: data.title,
+ description: data.description,
+ url: data.url,
+ siteName: "Papermark",
+ images: [
+ {
+ url: "/_static/meta-image.png",
+ width: 800,
+ height: 600,
+ },
+ ],
+ locale: "en_US",
+ type: "website",
+ },
+ twitter: {
+ card: "summary_large_image",
+ title: data.title,
+ description: data.description,
+ creator: "@papermarkio",
+ images: ["/_static/meta-image.png"],
+ },
+};
+
interface PageProps {
params: { token: string };
}
diff --git a/app/(auth)/login/page-client.tsx b/app/(auth)/login/page-client.tsx
new file mode 100644
index 00000000..d885032a
--- /dev/null
+++ b/app/(auth)/login/page-client.tsx
@@ -0,0 +1,263 @@
+"use client";
+
+import { Metadata } from "next";
+import Link from "next/link";
+import { useParams } from "next/navigation";
+
+import { useState } from "react";
+
+import { signInWithPasskey } from "@teamhanko/passkeys-next-auth-provider/client";
+import { signIn } from "next-auth/react";
+import { toast } from "sonner";
+import { z } from "zod";
+
+import { cn } from "@/lib/utils";
+
+import { LastUsed, useLastUsed } from "@/components/hooks/useLastUsed";
+import Google from "@/components/shared/icons/google";
+import LinkedIn from "@/components/shared/icons/linkedin";
+import Passkey from "@/components/shared/icons/passkey";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
+
+export default function Login() {
+ const { next } = useParams as { next?: string };
+
+ const [lastUsed, setLastUsed] = useLastUsed();
+ const authMethods = ["google", "email", "linkedin", "passkey"] as const;
+ type AuthMethod = (typeof authMethods)[number];
+ const [clickedMethod, setClickedMethod] = useState<AuthMethod | undefined>(
+ undefined,
+ );
+ const [email, setEmail] = useState<string>("");
+ const [emailButtonText, setEmailButtonText] = useState<string>(
+ "Continue with Email",
+ );
+
+ const emailSchema = z
+ .string()
+ .trim()
+ .toLowerCase()
+ .min(3, { message: "Please enter a valid email." })
+ .email({ message: "Please enter a valid email." });
+
+ const emailValidation = emailSchema.safeParse(email);
+
+ return (
+ <div className="flex h-screen w-full flex-wrap">
+ {/* Left part */}
+ <div className="flex w-full justify-center bg-white md:w-1/2 lg:w-2/5">
+ <div
+ className="absolute inset-x-0 top-10 -z-10 flex transform-gpu justify-center overflow-hidden blur-3xl"
+ aria-hidden="true"
+ ></div>
+ <div className="z-10 mx-5 mt-[calc(20vh)] h-fit w-full max-w-md overflow-hidden rounded-lg sm:mx-0">
+ <div className="flex flex-col items-center justify-center space-y-3 px-4 py-6 pt-8 text-center sm:px-16">
+ <Link href="/">
+ <span className="text-balance text-2xl font-semibold text-gray-800">
+ Welcome to Papermark
+ </span>
+ </Link>
+ <h3 className="text-balance text-sm text-gray-800">
+ Share documents. Not attachments.
+ </h3>
+ </div>
+ <form
+ className="flex flex-col gap-4 px-4 pt-8 sm:px-16"
+ onSubmit={(e) => {
+ e.preventDefault();
+ if (!emailValidation.success) {
+ toast.error(emailValidation.error.errors[0].message);
+ return;
+ }
+
+ setClickedMethod("email");
+ signIn("email", {
+ email: emailValidation.data,
+ redirect: false,
+ ...(next && next.length > 0 ? { callbackUrl: next } : {}),
+ }).then((res) => {
+ if (res?.ok && !res?.error) {
+ setEmail("");
+ setLastUsed("credentials");
+ setEmailButtonText("Email sent - check your inbox!");
+ toast.success("Email sent - check your inbox!");
+ } else {
+ setEmailButtonText("Error sending email - try again?");
+ toast.error("Error sending email - try again?");
+ }
+ setClickedMethod(undefined);
+ });
+ }}
+ >
+ <Label className="sr-only" htmlFor="email">
+ Email
+ </Label>
+ <Input
+ id="email"
+ placeholder="[email protected]"
+ type="email"
+ autoCapitalize="none"
+ autoComplete="email"
+ autoCorrect="off"
+ disabled={clickedMethod === "email"}
+ // pattern={patternSimpleEmailRegex}
+ value={email}
+ onChange={(e) => setEmail(e.target.value)}
+ className={cn(
+ "flex h-10 w-full rounded-md border-0 bg-background bg-white px-3 py-2 text-sm text-gray-900 ring-1 ring-gray-200 transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 dark:bg-white",
+ email.length > 0 && !emailValidation.success
+ ? "ring-red-500"
+ : "ring-gray-200",
+ )}
+ />
+ <div className="relative">
+ <Button
+ type="submit"
+ loading={clickedMethod === "email"}
+ disabled={!emailValidation.success || !!clickedMethod}
+ className={cn(
+ "focus:shadow-outline w-full transform rounded px-4 py-2 text-white transition-colors duration-300 ease-in-out focus:outline-none",
+ clickedMethod === "email"
+ ? "bg-black"
+ : "bg-gray-800 hover:bg-gray-900",
+ )}
+ >
+ {emailButtonText}
+ </Button>
+ {lastUsed === "credentials" && <LastUsed />}
+ </div>
+ </form>
+ <p className="py-4 text-center">or</p>
+ <div className="flex flex-col space-y-2 px-4 sm:px-16">
+ <div className="relative">
+ <Button
+ onClick={() => {
+ setClickedMethod("google");
+ setLastUsed("google");
+ signIn("google", {
+ ...(next && next.length > 0 ? { callbackUrl: next } : {}),
+ }).then((res) => {
+ if (res?.status) {
+ setClickedMethod(undefined);
+ }
+ });
+ }}
+ loading={clickedMethod === "google"}
+ disabled={clickedMethod && clickedMethod !== "google"}
+ className="flex w-full items-center justify-center space-x-2 border border-gray-200 bg-gray-100 font-normal text-gray-900 hover:bg-gray-200"
+ >
+ <Google className="h-5 w-5" />
+ <span>Continue with Google</span>
+ {clickedMethod !== "google" && lastUsed === "google" && (
+ <LastUsed />
+ )}
+ </Button>
+ </div>
+ <div className="relative">
+ <Button
+ onClick={() => {
+ setClickedMethod("linkedin");
+ setLastUsed("linkedin");
+ signIn("linkedin", {
+ ...(next && next.length > 0 ? { callbackUrl: next } : {}),
+ }).then((res) => {
+ if (res?.status) {
+ setClickedMethod(undefined);
+ }
+ });
+ }}
+ loading={clickedMethod === "linkedin"}
+ disabled={clickedMethod && clickedMethod !== "linkedin"}
+ className="flex w-full items-center justify-center space-x-2 border border-gray-200 bg-gray-100 font-normal text-gray-900 hover:bg-gray-200"
+ >
+ <LinkedIn />
+ <span>Continue with LinkedIn</span>
+ {clickedMethod !== "linkedin" && lastUsed === "linkedin" && (
+ <LastUsed />
+ )}
+ </Button>
+ </div>
+ <div className="relative">
+ <Button
+ onClick={() => {
+ setLastUsed("passkey");
+ setClickedMethod("passkey");
+ signInWithPasskey({
+ tenantId: process.env.NEXT_PUBLIC_HANKO_TENANT_ID as string,
+ });
+ }}
+ variant="outline"
+ loading={clickedMethod === "passkey"}
+ disabled={clickedMethod && clickedMethod !== "passkey"}
+ className="flex w-full items-center justify-center space-x-2 border border-gray-200 bg-gray-100 font-normal text-gray-900 hover:bg-gray-200 hover:text-gray-900"
+ >
+ <Passkey className="h-4 w-4" />
+ <span>Continue with a passkey</span>
+ {lastUsed === "passkey" && <LastUsed />}
+ </Button>
+ </div>
+ </div>
+ <p className="mt-10 w-full max-w-md px-4 text-xs text-muted-foreground sm:px-16">
+ By clicking continue, you acknowledge that you have read and agree
+ to Papermark&apos;s{" "}
+ <a
+ href="https://www.papermark.com/terms"
+ target="_blank"
+ className="underline"
+ >
+ Terms of Service
+ </a>{" "}
+ and{" "}
+ <a
+ href="https://www.papermark.com/privacy"
+ target="_blank"
+ className="underline"
+ >
+ Privacy Policy
+ </a>
+ .
+ </p>
+ </div>
+ </div>
+ <div className="hidden w-full justify-center bg-gray-800 md:flex md:w-1/2 lg:w-3/5">
+ <div className="flex w-full max-w-5xl px-4 py-20 md:px-8">
+ <div
+ className="mx-auto flex w-full max-w-5xl justify-center rounded-3xl bg-gray-800 px-4 py-20 md:px-8"
+ id="features"
+ >
+ <div className="flex flex-col items-center">
+ {/* Image container */}
+ <div className="mb-4 h-64 w-64">
+ <img
+ className="h-full w-full rounded-2xl object-cover shadow-2xl"
+ src="/_static/testimonials/jaski.jpeg"
+ alt="Jaski"
+ />
+ </div>
+ {/* Text content */}
+ <div className="max-w-xl text-center">
+ <blockquote className="text-l text-balance leading-8 text-gray-100 sm:text-xl sm:leading-9">
+ <p>
+ True builders listen to their users and build what they
+ need. Thanks Papermark team for solving a big pain point.
+ DocSend monopoly will end soon!
+ </p>
+ </blockquote>
+ <figcaption className="mt-4">
+ <div className="text-balance font-semibold text-white">
+ Jaski
+ </div>
+ <div className="text-balance text-gray-400">
+ Founder, Townhall Network
+ </div>
+ </figcaption>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx
index da35c01d..12fcf874 100644
--- a/app/(auth)/login/page.tsx
+++ b/app/(auth)/login/page.tsx
@@ -1,264 +1,41 @@
-"use client";
-
-import Link from "next/link";
-import { useParams } from "next/navigation";
-
-import { useState } from "react";
-
-import { signInWithPasskey } from "@teamhanko/passkeys-next-auth-provider/client";
-import { signIn } from "next-auth/react";
-import { toast } from "sonner";
-import { z } from "zod";
-
-import { LastUsed, useLastUsed } from "@/components/hooks/useLastUsed";
-import Google from "@/components/shared/icons/google";
-import LinkedIn from "@/components/shared/icons/linkedin";
-import Passkey from "@/components/shared/icons/passkey";
-import { Button } from "@/components/ui/button";
-import { Input } from "@/components/ui/input";
-import { Label } from "@/components/ui/label";
-
-import { cn } from "@/lib/utils";
-import { validateEmail } from "@/lib/utils/validate-email";
-
-export default function Login() {
- const { next } = useParams as { next?: string };
-
- const [lastUsed, setLastUsed] = useLastUsed();
- const authMethods = ["google", "email", "linkedin", "passkey"] as const;
- type AuthMethod = (typeof authMethods)[number];
- const [clickedMethod, setClickedMethod] = useState<AuthMethod | undefined>(
- undefined,
- );
- const [email, setEmail] = useState<string>("");
- const [emailButtonText, setEmailButtonText] = useState<string>(
- "Continue with Email",
- );
-
- // const isValidEmail = email.length > 0 && validateEmail(email);
- const emailSchema = z
- .string()
- .trim()
- .toLowerCase()
- .min(3, { message: "Please enter a valid email." })
- .email({ message: "Please enter a valid email." });
-
- const emailValidation = emailSchema.safeParse(email);
-
- return (
- <div className="flex h-screen w-full flex-wrap">
- {/* Left part */}
- <div className="flex w-full justify-center bg-white md:w-1/2 lg:w-2/5">
- <div
- className="absolute inset-x-0 top-10 -z-10 flex transform-gpu justify-center overflow-hidden blur-3xl"
- aria-hidden="true"
- ></div>
- <div className="z-10 mx-5 mt-[calc(20vh)] h-fit w-full max-w-md overflow-hidden rounded-lg sm:mx-0">
- <div className="flex flex-col items-center justify-center space-y-3 px-4 py-6 pt-8 text-center sm:px-16">
- <Link href="/">
- <span className="text-balance text-2xl font-semibold text-gray-800">
- Welcome to Papermark
- </span>
- </Link>
- <h3 className="text-balance text-sm text-gray-800">
- Share documents. Not attachments.
- </h3>
- </div>
- <form
- className="flex flex-col gap-4 px-4 pt-8 sm:px-16"
- onSubmit={(e) => {
- e.preventDefault();
- if (!emailValidation.success) {
- toast.error(emailValidation.error.errors[0].message);
- return;
- }
-
- setClickedMethod("email");
- signIn("email", {
- email: emailValidation.data,
- redirect: false,
- ...(next && next.length > 0 ? { callbackUrl: next } : {}),
- }).then((res) => {
- if (res?.ok && !res?.error) {
- setEmail("");
- setLastUsed("credentials");
- setEmailButtonText("Email sent - check your inbox!");
- toast.success("Email sent - check your inbox!");
- } else {
- setEmailButtonText("Error sending email - try again?");
- toast.error("Error sending email - try again?");
- }
- setClickedMethod(undefined);
- });
- }}
- >
- <Label className="sr-only" htmlFor="email">
- Email
- </Label>
- <Input
- id="email"
- placeholder="[email protected]"
- type="email"
- autoCapitalize="none"
- autoComplete="email"
- autoCorrect="off"
- disabled={clickedMethod === "email"}
- // pattern={patternSimpleEmailRegex}
- value={email}
- onChange={(e) => setEmail(e.target.value)}
- className={cn(
- "flex h-10 w-full rounded-md border-0 bg-background bg-white px-3 py-2 text-sm text-gray-900 ring-1 ring-gray-200 transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 dark:bg-white",
- email.length > 0 && !emailValidation.success
- ? "ring-red-500"
- : "ring-gray-200",
- )}
- />
- <div className="relative">
- <Button
- type="submit"
- loading={clickedMethod === "email"}
- disabled={!emailValidation.success || !!clickedMethod}
- className={cn(
- "focus:shadow-outline w-full transform rounded px-4 py-2 text-white transition-colors duration-300 ease-in-out focus:outline-none",
- clickedMethod === "email"
- ? "bg-black"
- : "bg-gray-800 hover:bg-gray-900",
- )}
- >
- {emailButtonText}
- </Button>
- {lastUsed === "credentials" && <LastUsed />}
- </div>
- </form>
- <p className="py-4 text-center">or</p>
- <div className="flex flex-col space-y-2 px-4 sm:px-16">
- <div className="relative">
- <Button
- onClick={() => {
- setClickedMethod("google");
- setLastUsed("google");
- signIn("google", {
- ...(next && next.length > 0 ? { callbackUrl: next } : {}),
- }).then((res) => {
- if (res?.status) {
- setClickedMethod(undefined);
- }
- });
- }}
- loading={clickedMethod === "google"}
- disabled={clickedMethod && clickedMethod !== "google"}
- className="flex w-full items-center justify-center space-x-2 border border-gray-200 bg-gray-100 font-normal text-gray-900 hover:bg-gray-200"
- >
- <Google className="h-5 w-5" />
- <span>Continue with Google</span>
- {clickedMethod !== "google" && lastUsed === "google" && (
- <LastUsed />
- )}
- </Button>
- </div>
- <div className="relative">
- <Button
- onClick={() => {
- setClickedMethod("linkedin");
- setLastUsed("linkedin");
- signIn("linkedin", {
- ...(next && next.length > 0 ? { callbackUrl: next } : {}),
- }).then((res) => {
- if (res?.status) {
- setClickedMethod(undefined);
- }
- });
- }}
- loading={clickedMethod === "linkedin"}
- disabled={clickedMethod && clickedMethod !== "linkedin"}
- className="flex w-full items-center justify-center space-x-2 border border-gray-200 bg-gray-100 font-normal text-gray-900 hover:bg-gray-200"
- >
- <LinkedIn />
- <span>Continue with LinkedIn</span>
- {clickedMethod !== "linkedin" && lastUsed === "linkedin" && (
- <LastUsed />
- )}
- </Button>
- </div>
- <div className="relative">
- <Button
- onClick={() => {
- setLastUsed("passkey");
- setClickedMethod("passkey");
- signInWithPasskey({
- tenantId: process.env.NEXT_PUBLIC_HANKO_TENANT_ID as string,
- });
- }}
- variant="outline"
- loading={clickedMethod === "passkey"}
- disabled={clickedMethod && clickedMethod !== "passkey"}
- className="flex w-full items-center justify-center space-x-2 border border-gray-200 bg-gray-100 font-normal text-gray-900 hover:bg-gray-200 hover:text-gray-900"
- >
- <Passkey className="h-4 w-4" />
- <span>Continue with a passkey</span>
- {lastUsed === "passkey" && <LastUsed />}
- </Button>
- </div>
- </div>
- <p className="mt-10 w-full max-w-md px-4 text-xs text-muted-foreground sm:px-16">
- By clicking continue, you acknowledge that you have read and agree
- to Papermark&apos;s{" "}
- <a
- href="https://www.papermark.com/terms"
- target="_blank"
- className="underline"
- >
- Terms of Service
- </a>{" "}
- and{" "}
- <a
- href="https://www.papermark.com/privacy"
- target="_blank"
- className="underline"
- >
- Privacy Policy
- </a>
- .
- </p>
- </div>
- </div>
- <div className="hidden w-full justify-center bg-gray-800 md:flex md:w-1/2 lg:w-3/5">
- <div className="flex w-full max-w-5xl px-4 py-20 md:px-8">
- <div
- className="mx-auto flex w-full max-w-5xl justify-center rounded-3xl bg-gray-800 px-4 py-20 md:px-8"
- id="features"
- >
- <div className="flex flex-col items-center">
- {/* Image container */}
- <div className="mb-4 h-64 w-64">
- <img
- className="h-full w-full rounded-2xl object-cover shadow-2xl"
- src="/_static/testimonials/jaski.jpeg"
- alt="Jaski"
- />
- </div>
- {/* Text content */}
- <div className="max-w-xl text-center">
- <blockquote className="text-l text-balance leading-8 text-gray-100 sm:text-xl sm:leading-9">
- <p>
- True builders listen to their users and build what they
- need. Thanks Papermark team for solving a big pain point.
- DocSend monopoly will end soon!
- </p>
- </blockquote>
- <figcaption className="mt-4">
- <div className="text-balance font-semibold text-white">
- Jaski
- </div>
- <div className="text-balance text-gray-400">
- Founder, Townhall Network
- </div>
- </figcaption>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- );
+import { Metadata } from "next";
+
+import LoginClient from "./page-client";
+
+const data = {
+ description: "Login to Papermark",
+ title: "Login | Papermark",
+ url: "/login",
+};
+
+export const metadata: Metadata = {
+ metadataBase: new URL("https://www.papermark.com"),
+ title: data.title,
+ description: data.description,
+ openGraph: {
+ title: data.title,
+ description: data.description,
+ url: data.url,
+ siteName: "Papermark",
+ images: [
+ {
+ url: "/_static/meta-image.png",
+ width: 800,
+ height: 600,
+ },
+ ],
+ locale: "en_US",
+ type: "website",
+ },
+ twitter: {
+ card: "summary_large_image",
+ title: data.title,
+ description: data.description,
+ creator: "@papermarkio",
+ images: ["/_static/meta-image.png"],
+ },
+};
+
+export default function LoginPage() {
+ return <LoginClient />;
}
diff --git a/app/(auth)/register/page-client.tsx b/app/(auth)/register/page-client.tsx
new file mode 100644
index 00000000..74ed3887
--- /dev/null
+++ b/app/(auth)/register/page-client.tsx
@@ -0,0 +1,111 @@
+"use client";
+
+import Image from "next/image";
+import Link from "next/link";
+import { useParams } from "next/navigation";
+
+import { useState } from "react";
+
+import PapermarkLogo from "@/public/_static/papermark-logo.svg";
+import { signIn } from "next-auth/react";
+import { toast } from "sonner";
+
+import LinkedIn from "@/components/shared/icons/linkedin";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+
+export default function Register() {
+ const { next } = useParams as { next?: string };
+
+ const [email, setEmail] = useState<string>("");
+
+ return (
+ <div className="flex h-screen w-full justify-center">
+ <div
+ className="absolute inset-x-0 top-10 -z-10 flex transform-gpu justify-center overflow-hidden blur-3xl"
+ aria-hidden="true"
+ >
+ <div
+ className="aspect-[1108/632] w-[69.25rem] flex-none bg-gradient-to-r from-[#80caff] to-[#4f46e5] opacity-20"
+ style={{
+ clipPath:
+ "polygon(73.6% 51.7%, 91.7% 11.8%, 100% 46.4%, 97.4% 82.2%, 92.5% 84.9%, 75.7% 64%, 55.3% 47.5%, 46.5% 49.4%, 45% 62.9%, 50.3% 87.2%, 21.3% 64.1%, 0.1% 100%, 5.4% 51.1%, 21.4% 63.9%, 58.9% 0.2%, 73.6% 51.7%)",
+ }}
+ />
+ </div>
+ <div className="z-10 mx-5 mt-[calc(20vh)] h-fit w-full max-w-md overflow-hidden rounded-lg border border-border bg-gray-50 dark:bg-gray-900 sm:mx-0 sm:shadow-xl">
+ <div className="flex flex-col items-center justify-center space-y-3 px-4 py-6 pt-8 text-center sm:px-16">
+ <Link href="/">
+ <Image
+ src={PapermarkLogo}
+ width={119}
+ height={32}
+ alt="Papermark Logo"
+ />
+ </Link>
+ <h3 className="text-2xl font-medium text-foreground">
+ Start sharing documents
+ </h3>
+ </div>
+ <form
+ className="flex flex-col gap-4 p-4 pt-8 sm:px-16"
+ onSubmit={(e) => {
+ e.preventDefault();
+ signIn("email", {
+ email: email,
+ redirect: false,
+ ...(next && next.length > 0 ? { callbackUrl: next } : {}),
+ }).then((res) => {
+ if (res?.ok && !res?.error) {
+ setEmail("");
+ toast.success("Email sent - check your inbox!");
+ } else {
+ toast.error("Error sending email - try again?");
+ }
+ });
+ }}
+ >
+ <Input
+ className="border-4"
+ placeholder="[email protected]"
+ value={email}
+ onChange={(e) => setEmail(e.target.value)}
+ />
+ <Button type="submit">Continue with Email</Button>
+ </form>
+ <p className="text-center">or</p>
+ <div className="flex flex-col space-y-2 px-4 py-8 sm:px-16">
+ <Button
+ onClick={() => {
+ signIn("google", {
+ ...(next && next.length > 0 ? { callbackUrl: next } : {}),
+ });
+ }}
+ className="flex items-center justify-center space-x-2"
+ >
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 488 512"
+ fill="currentColor"
+ className="h-4 w-4"
+ >
+ <path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z" />
+ </svg>
+ <span>Continue with Google</span>
+ </Button>
+ <Button
+ onClick={() => {
+ signIn("linkedin", {
+ ...(next && next.length > 0 ? { callbackUrl: next } : {}),
+ });
+ }}
+ className="flex items-center justify-center space-x-2"
+ >
+ <LinkedIn />
+ <span>Continue with LinkedIn</span>
+ </Button>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/app/(auth)/register/page.tsx b/app/(auth)/register/page.tsx
index c88e69d3..d9eb15a6 100644
--- a/app/(auth)/register/page.tsx
+++ b/app/(auth)/register/page.tsx
@@ -1,111 +1,41 @@
-"use client";
+import { Metadata } from "next";
-import Image from "next/image";
-import Link from "next/link";
-import { useParams } from "next/navigation";
+import RegisterClient from "./page-client";
-import { useState } from "react";
+const data = {
+ description: "Signup to Papermark",
+ title: "Sign up | Papermark",
+ url: "/register",
+};
-import PapermarkLogo from "@/public/_static/papermark-logo.svg";
-import { signIn } from "next-auth/react";
-import { toast } from "sonner";
+export const metadata: Metadata = {
+ metadataBase: new URL("https://www.papermark.com"),
+ title: data.title,
+ description: data.description,
+ openGraph: {
+ title: data.title,
+ description: data.description,
+ url: data.url,
+ siteName: "Papermark",
+ images: [
+ {
+ url: "/_static/meta-image.png",
+ width: 800,
+ height: 600,
+ },
+ ],
+ locale: "en_US",
+ type: "website",
+ },
+ twitter: {
+ card: "summary_large_image",
+ title: data.title,
+ description: data.description,
+ creator: "@papermarkio",
+ images: ["/_static/meta-image.png"],
+ },
+};
-import LinkedIn from "@/components/shared/icons/linkedin";
-import { Button } from "@/components/ui/button";
-import { Input } from "@/components/ui/input";
-
-export default function Register() {
- const { next } = useParams as { next?: string };
-
- const [email, setEmail] = useState<string>("");
-
- return (
- <div className="flex h-screen w-full justify-center">
- <div
- className="absolute inset-x-0 top-10 -z-10 flex transform-gpu justify-center overflow-hidden blur-3xl"
- aria-hidden="true"
- >
- <div
- className="aspect-[1108/632] w-[69.25rem] flex-none bg-gradient-to-r from-[#80caff] to-[#4f46e5] opacity-20"
- style={{
- clipPath:
- "polygon(73.6% 51.7%, 91.7% 11.8%, 100% 46.4%, 97.4% 82.2%, 92.5% 84.9%, 75.7% 64%, 55.3% 47.5%, 46.5% 49.4%, 45% 62.9%, 50.3% 87.2%, 21.3% 64.1%, 0.1% 100%, 5.4% 51.1%, 21.4% 63.9%, 58.9% 0.2%, 73.6% 51.7%)",
- }}
- />
- </div>
- <div className="z-10 mx-5 mt-[calc(20vh)] h-fit w-full max-w-md overflow-hidden rounded-lg border border-border bg-gray-50 dark:bg-gray-900 sm:mx-0 sm:shadow-xl">
- <div className="flex flex-col items-center justify-center space-y-3 px-4 py-6 pt-8 text-center sm:px-16">
- <Link href="/">
- <Image
- src={PapermarkLogo}
- width={119}
- height={32}
- alt="Papermark Logo"
- />
- </Link>
- <h3 className="text-2xl font-medium text-foreground">
- Start sharing documents
- </h3>
- </div>
- <form
- className="flex flex-col gap-4 p-4 pt-8 sm:px-16"
- onSubmit={(e) => {
- e.preventDefault();
- signIn("email", {
- email: email,
- redirect: false,
- ...(next && next.length > 0 ? { callbackUrl: next } : {}),
- }).then((res) => {
- if (res?.ok && !res?.error) {
- setEmail("");
- toast.success("Email sent - check your inbox!");
- } else {
- toast.error("Error sending email - try again?");
- }
- });
- }}
- >
- <Input
- className=" border-4"
- placeholder="[email protected]"
- value={email}
- onChange={(e) => setEmail(e.target.value)}
- />
- <Button type="submit">Continue with Email</Button>
- </form>
- <p className="text-center">or</p>
- <div className="flex flex-col space-y-2 px-4 py-8 sm:px-16">
- <Button
- onClick={() => {
- signIn("google", {
- ...(next && next.length > 0 ? { callbackUrl: next } : {}),
- });
- }}
- className="flex items-center justify-center space-x-2"
- >
- <svg
- xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 488 512"
- fill="currentColor"
- className="h-4 w-4"
- >
- <path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z" />
- </svg>
- <span>Continue with Google</span>
- </Button>
- <Button
- onClick={() => {
- signIn("linkedin", {
- ...(next && next.length > 0 ? { callbackUrl: next } : {}),
- });
- }}
- className="flex items-center justify-center space-x-2"
- >
- <LinkedIn />
- <span>Continue with LinkedIn</span>
- </Button>
- </div>
- </div>
- </div>
- );
+export default function RegisterPage() {
+ return <RegisterClient />;
}
diff --git a/app/(auth)/verify/page.tsx b/app/(auth)/verify/page.tsx
index 93ad08f8..c1b38a10 100644
--- a/app/(auth)/verify/page.tsx
+++ b/app/(auth)/verify/page.tsx
@@ -1,10 +1,45 @@
+import { Metadata } from "next";
import Link from "next/link";
import NotFound from "@/pages/404";
+import { generateChecksum } from "@/lib/utils/generate-checksum";
+
import { Button } from "@/components/ui/button";
-import { generateChecksum } from "@/lib/utils/generate-checksum";
+const data = {
+ description: "Verify login to Papermark",
+ title: "Verify | Papermark",
+ url: "/verify",
+};
+
+export const metadata: Metadata = {
+ metadataBase: new URL("https://www.papermark.com"),
+ title: data.title,
+ description: data.description,
+ openGraph: {
+ title: data.title,
+ description: data.description,
+ url: data.url,
+ siteName: "Papermark",
+ images: [
+ {
+ url: "/_static/meta-image.png",
+ width: 800,
+ height: 600,
+ },
+ ],
+ locale: "en_US",
+ type: "website",
+ },
+ twitter: {
+ card: "summary_large_image",
+ title: data.title,
+ description: data.description,
+ creator: "@papermarkio",
+ images: ["/_static/meta-image.png"],
+ },
+};
export default function VerifyPage({
searchParams,