Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
design updates
Iuliia Shnai3e59c2fd7b35
diff --git a/components/view/access-form/agreement-section.tsx b/components/view/access-form/agreement-section.tsxindex b6c7fbf3..01710e38 100644--- a/components/view/access-form/agreement-section.tsx+++ b/components/view/access-form/agreement-section.tsx@@ -1,17 +1,23 @@import { Dispatch, SetStateAction, useEffect } from "react";+import { Brand, DataroomBrand } from "@prisma/client";+import { Checkbox } from "@/components/ui/checkbox";+import { determineTextColor } from "@/lib/utils/determine-text-color";+import { DEFAULT_ACCESS_FORM_TYPE } from ".";export default function AgreementSection({data,setData,agreementContent,+ brand,}: {data: DEFAULT_ACCESS_FORM_TYPE;setData: Dispatch<SetStateAction<DEFAULT_ACCESS_FORM_TYPE>>;agreementContent: string;+ brand?: Partial<Brand> | Partial<DataroomBrand> | null;}) {const handleCheckChange = (checked: boolean) => {setData((prevData) => ({ ...prevData, hasConfirmedAgreement: checked }));@@ -23,15 +29,29 @@ export default function AgreementSection({<Checkboxid="agreement"onCheckedChange={handleCheckChange}- className="mt-0.5 border border-gray-400 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-gray-300 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-white data-[state=checked]:bg-black data-[state=checked]:text-white"+ className="mt-0.5 border border-gray-400 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-gray-300 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-white data-[state=checked]:bg-black data-[state=checked]:text-white"/>- <label className="text-sm font-normal leading-5 text-white peer-disabled:cursor-not-allowed peer-disabled:opacity-70">+ <label+ className="text-sm font-normal leading-5 text-white peer-disabled:cursor-not-allowed peer-disabled:opacity-70"+ style={{+ color:+ brand && brand.accentColor+ ? determineTextColor(brand.accentColor)+ : "white",+ }}+ >I have reviewed and agree to the terms of this{" "}<ahref={`${agreementContent}`}target="_blank"rel="noreferrer noopener"- className=" underline hover:text-gray-200"+ className="underline hover:text-gray-200"+ style={{+ color:+ brand && brand.accentColor+ ? determineTextColor(brand.accentColor)+ : "white",+ }}>Non-Disclosure Agreement</a>diff --git a/components/view/access-form/email-section.tsx b/components/view/access-form/email-section.tsxindex fe1b3354..98d0fda2 100644--- a/components/view/access-form/email-section.tsx+++ b/components/view/access-form/email-section.tsx@@ -1,13 +1,19 @@import { Dispatch, SetStateAction, useEffect } from "react";+import { Brand, DataroomBrand } from "@prisma/client";++import { determineTextColor } from "@/lib/utils/determine-text-color";+import { DEFAULT_ACCESS_FORM_TYPE } from ".";export default function EmailSection({data,setData,+ brand,}: {data: DEFAULT_ACCESS_FORM_TYPE;setData: Dispatch<SetStateAction<DEFAULT_ACCESS_FORM_TYPE>>;+ brand?: Partial<Brand> | Partial<DataroomBrand> | null;}) {const { email } = data;@@ -30,12 +36,20 @@ export default function EmailSection({setData({ ...data, email: newEmail });};+ console.log("brand", brand);+return (<div className="pb-5"><div className="relative space-y-2 rounded-md shadow-sm"><labelhtmlFor="email"className="block text-sm font-medium leading-6 text-white"+ style={{+ color:+ brand && brand.accentColor+ ? determineTextColor(brand.accentColor)+ : "white",+ }}>Email address</label>@@ -46,14 +60,22 @@ export default function EmailSection({autoCorrect="off"autoComplete="email"autoFocus- className="flex w-full rounded-md border-0 bg-black py-1.5 text-white shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6"+ className="flex w-full rounded-md border-0 bg-black py-1.5 text-gray-500 shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6"+ style={{+ backgroundColor:+ brand && brand.accentColor ? brand.accentColor : "black",+ color:+ brand && brand.accentColor+ ? determineTextColor(brand.accentColor)+ : "white",+ }}value={email || ""}placeholder="Enter email"onChange={handleEmailChange}aria-invalid="true"data-1p-ignore/>- <p className="text-sm text-gray-600">+ <p className="text-sm text-gray-500">This data will be shared with the sender.</p></div>diff --git a/components/view/access-form/index.tsx b/components/view/access-form/index.tsxindex e727738a..d90f6251 100644--- a/components/view/access-form/index.tsx+++ b/components/view/access-form/index.tsx@@ -1,7 +1,14 @@+import Image from "next/image";+import Link from "next/link";+import { useEffect } from "react";+import { Brand, DataroomBrand } from "@prisma/client";+import { Button } from "@/components/ui/button";+import { determineTextColor } from "@/lib/utils/determine-text-color";+import AgreementSection from "./agreement-section";import EmailSection from "./email-section";import NameSection from "./name-section";@@ -22,6 +29,7 @@ export type DEFAULT_ACCESS_FORM_TYPE = {export default function AccessForm({data,email,+ brand,setData,onSubmitHandler,requireEmail,@@ -29,16 +37,19 @@ export default function AccessForm({requireAgreement,agreementContent,isLoading,+ linkId,}: {data: DEFAULT_ACCESS_FORM_TYPE;email: string | null | undefined;setData: React.Dispatch<React.SetStateAction<DEFAULT_ACCESS_FORM_TYPE>>;onSubmitHandler: React.FormEventHandler<HTMLFormElement>;+ brand?: Partial<Brand> | Partial<DataroomBrand> | null;requireEmail: boolean;requirePassword: boolean;requireAgreement?: boolean;agreementContent?: string;isLoading: boolean;+ linkId?: string;}) {useEffect(() => {const userEmail = email;@@ -50,11 +61,49 @@ export default function AccessForm({}}, [email]);+ console.log("brand", brand);return (<>- <div className="flex h-screen flex-1 flex-col bg-black px-6 py-12 lg:px-8">+ <div+ className="bg-gray-95 flex h-screen flex-1 flex-col px-6 py-12 lg:px-8"+ style={{+ backgroundColor:+ brand && brand.accentColor ? brand.accentColor : "black",+ }}+ >+ {/* <div className="bg-gray-950" style={{ backgroundColor: accentColor }}> */}++ {/* <div className="relative flex h-16 w-full flex-shrink-0 items-center justify-center">+ {brand && brand.logo ? (+ <Image+ className="object-contain"+ src={brand.logo}+ alt="Logo"+ fill+ quality={100}+ priority+ />+ ) : (+ <Link+ href={`https://www.papermark.io?utm_campaign=navbar&utm_medium=navbar&utm_source=papermark-${linkId}`}+ target="_blank"+ className="text-2xl font-bold tracking-tighter text-white"+ >+ Papermark+ </Link>+ )}+ </div> */}+<div className="sm:mx-auto sm:w-full sm:max-w-md">- <h1 className="mt-10 text-2xl font-bold leading-9 tracking-tight text-white">+ <h1+ className="mt-10 text-2xl font-bold leading-9 tracking-tight text-white"+ style={{+ color:+ brand && brand.accentColor+ ? determineTextColor(brand.accentColor)+ : "white",+ }}+ >Your action is requested to continue</h1></div>@@ -62,15 +111,17 @@ export default function AccessForm({<div className="mt-10 sm:mx-auto sm:w-full sm:max-w-md"><form className="space-y-4" onSubmit={onSubmitHandler}>{requireAgreement && agreementContent ? (- <NameSection {...{ data, setData }} />+ <NameSection {...{ data, setData, brand }} />+ ) : null}+ {requireEmail ? (+ <EmailSection {...{ data, setData, brand }} />) : null}- {requireEmail ? <EmailSection {...{ data, setData }} /> : null}{requirePassword ? (- <PasswordSection {...{ data, setData }} />+ <PasswordSection {...{ data, setData, brand }} />) : null}{requireAgreement && agreementContent ? (<AgreementSection- {...{ data, setData }}+ {...{ data, setData, brand }}agreementContent={agreementContent}/>) : null}@@ -86,12 +137,29 @@ export default function AccessForm({}className="w-1/3 min-w-fit bg-white text-gray-950 hover:bg-white/90"loading={isLoading}+ style={{+ backgroundColor:+ brand && brand.accentColor+ ? determineTextColor(brand.accentColor)+ : "white",++ color:+ brand && brand.accentColor ? brand.accentColor : "black",+ }}>Continue</Button></div></form></div>+ <div className="mt-auto text-center">+ <p className="mt-10 text-sm leading-9 tracking-tight text-gray-500">+ <a href="/" target="_blank" rel="noopener noreferrer">+ This document is securely shared with you using{" "}+ <span className="font-semibold">Papermark</span>+ </a>+ </p>+ </div></div></>);diff --git a/components/view/access-form/name-section.tsx b/components/view/access-form/name-section.tsxindex 98dfd1cd..a138b4d0 100644--- a/components/view/access-form/name-section.tsx+++ b/components/view/access-form/name-section.tsx@@ -1,13 +1,19 @@import { Dispatch, SetStateAction, useEffect } from "react";+import { Brand, DataroomBrand } from "@prisma/client";++import { determineTextColor } from "@/lib/utils/determine-text-color";+import { DEFAULT_ACCESS_FORM_TYPE } from ".";export default function NameSection({data,setData,+ brand,}: {data: DEFAULT_ACCESS_FORM_TYPE;setData: Dispatch<SetStateAction<DEFAULT_ACCESS_FORM_TYPE>>;+ brand?: Partial<Brand> | Partial<DataroomBrand> | null;}) {const { name } = data;@@ -36,6 +42,12 @@ export default function NameSection({<labelhtmlFor="name"className="block text-sm font-medium leading-6 text-white"+ style={{+ color:+ brand && brand.accentColor+ ? determineTextColor(brand.accentColor)+ : "white",+ }}>Name</label>@@ -47,6 +59,14 @@ export default function NameSection({autoComplete="off"autoFocusclassName="flex w-full rounded-md border-0 bg-black py-1.5 text-white shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6"+ style={{+ backgroundColor:+ brand && brand.accentColor ? brand.accentColor : "black",+ color:+ brand && brand.accentColor+ ? determineTextColor(brand.accentColor)+ : "white",+ }}value={name || ""}placeholder="Enter your full name"onChange={handleNameChange}diff --git a/components/view/access-form/password-section.tsx b/components/view/access-form/password-section.tsxindex 802f0abb..a90319c2 100644--- a/components/view/access-form/password-section.tsx+++ b/components/view/access-form/password-section.tsx@@ -1,16 +1,22 @@import { Dispatch, SetStateAction, useState } from "react";+import { Brand, DataroomBrand } from "@prisma/client";+import Eye from "@/components/shared/icons/eye";import EyeOff from "@/components/shared/icons/eye-off";+import { determineTextColor } from "@/lib/utils/determine-text-color";+import { DEFAULT_ACCESS_FORM_TYPE } from ".";export default function PasswordSection({data,setData,+ brand,}: {data: DEFAULT_ACCESS_FORM_TYPE;setData: Dispatch<SetStateAction<DEFAULT_ACCESS_FORM_TYPE>>;+ brand?: Partial<Brand> | Partial<DataroomBrand> | null;}) {const { password } = data;const [showPassword, setShowPassword] = useState<boolean>(false);@@ -21,6 +27,12 @@ export default function PasswordSection({<labelhtmlFor="password"className="block text-sm font-medium leading-6 text-white"+ style={{+ color:+ brand && brand.accentColor+ ? determineTextColor(brand.accentColor)+ : "white",+ }}>Passcode</label>@@ -32,6 +44,14 @@ export default function PasswordSection({autoCorrect="off"autoComplete="off"className="flex w-full rounded-md border-0 bg-black py-1.5 text-white shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6"+ style={{+ backgroundColor:+ brand && brand.accentColor ? brand.accentColor : "black",+ color:+ brand && brand.accentColor+ ? determineTextColor(brand.accentColor)+ : "white",+ }}value={password || ""}placeholder="Enter passcode"onChange={(e) => {diff --git a/components/view/document-view.tsx b/components/view/document-view.tsxindex 270562e4..ad5e1fbf 100644--- a/components/view/document-view.tsx+++ b/components/view/document-view.tsx@@ -193,6 +193,7 @@ export default function DocumentView({requireAgreement={enableAgreement!}agreementContent={link.agreement?.content}isLoading={isLoading}+ brand={brand}/>);}@@ -205,7 +206,13 @@ export default function DocumentView({);}return (- <div className="bg-gray-950">+ <div+ className="bg-gray-950"+ style={{+ backgroundColor:+ brand && brand.accentColor ? brand.accentColor : "rgb(3, 7, 18)",+ }}+ >{submitted ? (<ViewDatalink={link}diff --git a/pages/api/links/[id]/index.ts b/pages/api/links/[id]/index.tsindex 06f43a74..2a5e6f8a 100644--- a/pages/api/links/[id]/index.ts+++ b/pages/api/links/[id]/index.ts@@ -105,6 +105,7 @@ export default async function handle(select: {logo: true,brandColor: true,+ accentColor: true,},});} else if (linkType === "DATAROOM_LINK") {diff --git a/pages/entrance_ppreview_demo.tsx b/pages/entrance_ppreview_demo.tsxnew file mode 100644index 00000000..a787657e--- /dev/null+++ b/pages/entrance_ppreview_demo.tsx@@ -0,0 +1,121 @@+import { useRouter } from "next/router";++import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";++import { Button } from "@/components/ui/button";++import { determineTextColor } from "@/lib/utils/determine-text-color";++export default function ViewPage() {+ const router = useRouter();+ const { brandLogo, brandColor, accentColor } = router.query as {+ brandLogo: string;+ brandColor: string;+ accentColor: string;+ };++ return (+ <>+ <div className="bg-gray-950" style={{ backgroundColor: accentColor }}>+ {/* <nav+ className="bg-black"+ style={{+ backgroundColor: brandColor,+ }}+ > */}+ <div className="mx-auto px-2 sm:px-6 lg:px-8">+ <div className="relative flex h-16 items-center justify-between">+ <div className="mt-20 flex flex-1 items-stretch justify-center">+ {/* <div className="relative flex h-8 w-36 flex-shrink-0 items-center">+ {brandLogo ? (+ <img className="object-contain" src={brandLogo} alt="Logo" />+ ) : (+ <div+ className="text-2xl font-bold tracking-tighter text-white"+ style={{+ color: accentColor+ ? determineTextColor(accentColor)+ : "white",+ }}+ >+ Papermark+ </div>+ )}+ </div> */}+ </div>+ </div>+ <div className="sm:mx-auto sm:w-full sm:max-w-md">+ <h1+ className="mt-16 text-2xl font-bold leading-9 tracking-tight text-white"+ style={{+ color: accentColor ? determineTextColor(accentColor) : "white",+ }}+ >+ Your action is requested to continue+ </h1>+ </div>++ <div className="mt-10 sm:mx-auto sm:w-full sm:max-w-md">+ <form className="space-y-4">+ <div className="pb-5">+ <div className="relative space-y-2 rounded-md shadow-sm">+ <label+ htmlFor="email"+ className="block text-sm font-medium leading-6 text-white"+ style={{+ color: accentColor+ ? determineTextColor(accentColor)+ : "white",+ }}+ >+ Email address+ </label>+ <input+ name="email"+ id="email"+ type="email"+ autoCorrect="off"+ autoComplete="email"+ autoFocus+ className="flex w-full rounded-md border-0 bg-black py-1.5 text-white shadow-sm ring-1 ring-inset ring-gray-600 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-300 sm:text-sm sm:leading-6"+ style={{ backgroundColor: accentColor }}+ placeholder="Enter email"+ aria-invalid="true"+ data-1p-ignore+ />+ <p className="text-sm text-gray-500">+ This data will be shared with the sender.+ </p>+ </div>+ </div>++ <div className="flex justify-center">+ <Button+ type="submit"+ className="w-1/3 min-w-fit bg-white text-gray-950 hover:bg-white/90"+ >+ Continue+ </Button>+ </div>+ </form>+ </div>+ </div>+ {/* </nav> */}++ {/* Body */}+ <div+ style={{ height: "calc(100vh - 64px)" }}+ className="relative flex items-center"+ >+ <div className="relative mx-auto flex h-full w-full justify-center">+ {/* <img+ className="mx-auto block object-contain"+ src={"/_example/papermark-example-entrance.png"}+ alt={`Demo Page 1`}+ /> */}+ </div>+ </div>+ </div>+ </>+ );+}diff --git a/pages/nav_ppreview_demo.tsx b/pages/nav_ppreview_demo.tsxnew file mode 100644index 00000000..4e8ec51a--- /dev/null+++ b/pages/nav_ppreview_demo.tsx@@ -0,0 +1,87 @@+import { useRouter } from "next/router";++import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";++export default function ViewPage() {+ const router = useRouter();+ const { brandLogo, brandColor, accentColor } = router.query as {+ brandLogo: string;+ brandColor: string;+ accentColor: string;+ };++ return (+ <>+ <div className="bg-gray-950" style={{ backgroundColor: accentColor }}>+ {/* Nav */}+ <nav+ className="bg-black"+ style={{+ backgroundColor: brandColor,+ }}+ >+ <div className="mx-auto px-2 sm:px-6 lg:px-8">+ <div className="relative flex h-16 items-center justify-between">+ <div className="flex flex-1 items-stretch justify-start">+ <div className="relative flex h-8 w-36 flex-shrink-0 items-center">+ {brandLogo ? (+ <img+ className="object-contain"+ src={brandLogo}+ alt="Logo"+ />+ ) : (+ <div className="text-2xl font-bold tracking-tighter text-white">+ Papermark+ </div>+ )}+ </div>+ </div>+ <div className="absolute inset-y-0 right-0 flex items-center space-x-4 pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">+ <div className="flex h-10 items-center rounded-md bg-gray-900 px-4 py-2 text-sm font-medium text-white">+ <span>1</span>+ <span className="text-gray-400"> / 13</span>+ </div>+ </div>+ </div>+ </div>+ </nav>++ {/* Body */}+ <div+ style={{ height: "calc(100vh - 64px)" }}+ className="relative flex items-center"+ >+ <div className="absolute z-10 flex w-full items-center justify-between px-2">+ <button className="h-[calc(100vh - 64px)] relative px-2 py-24 focus:z-20">+ <span className="sr-only">Previous</span>+ <div className="relative flex items-center justify-center rounded-full bg-gray-950/50 p-1 hover:bg-gray-950/75">+ <ChevronLeftIcon+ className="h-10 w-10 text-white"+ aria-hidden="true"+ />+ </div>+ </button>+ <button className="h-[calc(100vh - 64px)] relative px-2 py-24 focus:z-20">+ <span className="sr-only">Next</span>+ <div className="relative flex items-center justify-center rounded-full bg-gray-950/50 p-1 hover:bg-gray-950/75">+ <ChevronRightIcon+ className="h-10 w-10 text-white"+ aria-hidden="true"+ />+ </div>+ </button>+ </div>++ <div className="relative mx-auto flex h-full w-full justify-center">+ <img+ className="mx-auto block object-contain"+ src={"/_example/papermark-example-page.png"}+ alt={`Demo Page 1`}+ />+ </div>+ </div>+ </div>+ </>+ );+}diff --git a/pages/settings/branding.tsx b/pages/settings/branding.tsxindex a8c7a35b..cd07457a 100644--- a/pages/settings/branding.tsx+++ b/pages/settings/branding.tsx@@ -1,3 +1,287 @@+// import { useRouter } from "next/router";+// import { useCallback, useEffect, useState } from "react";+// import { useTeam } from "@/context/team-context";+// import { PlusIcon } from "lucide-react";+// import { HexColorInput, HexColorPicker } from "react-colorful";+// import { toast } from "sonner";+// import { mutate } from "swr";+// import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";+// import AppLayout from "@/components/layouts/app";+// import Navbar from "@/components/settings/navbar";+// import { Button } from "@/components/ui/button";+// import { Card, CardContent, CardFooter } from "@/components/ui/card";+// import { Label } from "@/components/ui/label";+// import LoadingSpinner from "@/components/ui/loading-spinner";+// import {+// Popover,+// PopoverContent,+// PopoverTrigger,+// } from "@/components/ui/popover";+// import { usePlan } from "@/lib/swr/use-billing";+// import { useBrand } from "@/lib/swr/use-brand";+// import { convertDataUrlToFile, uploadImage } from "@/lib/utils";+// export default function Branding() {+// const { brand } = useBrand();+// const teamInfo = useTeam();+// const router = useRouter();+// const { plan } = usePlan();+// const [brandColor, setBrandColor] = useState<string>("#000000");+// const [logo, setLogo] = useState<string | null>(null);+// const [isLoading, setIsLoading] = useState<boolean>(false);+// const [fileError, setFileError] = useState<string | null>(null);+// const [dragActive, setDragActive] = useState(false);+// const onChangeLogo = useCallback(+// (e: any) => {+// setFileError(null);+// const file = e.target.files[0];+// if (file) {+// if (file.size / 1024 / 1024 > 2) {+// setFileError("File size too big (max 2MB)");+// } else if (file.type !== "image/png" && file.type !== "image/jpeg") {+// setFileError("File type not supported (.png or .jpg only)");+// } else {+// const reader = new FileReader();+// reader.onload = (e) => {+// setLogo(e.target?.result as string);+// };+// reader.readAsDataURL(file);+// }+// }+// },+// [setLogo],+// );+// useEffect(() => {+// if (brand) {+// setBrandColor(brand.brandColor || "#000000");+// setLogo(brand.logo || null);+// }+// }, [brand]);+// const saveBranding = async (e: any) => {+// e.preventDefault();+// setIsLoading(true);+// // Upload the image if it's a data URL+// let blobUrl: string | null = logo && logo.startsWith("data:") ? null : logo;+// if (logo && logo.startsWith("data:")) {+// // Convert the data URL to a blob+// const blob = convertDataUrlToFile({ dataUrl: logo });+// // Upload the blob to vercel storage+// blobUrl = await uploadImage(blob);+// setLogo(blobUrl);+// }+// const data = {+// brandColor: brandColor,+// logo: blobUrl,+// };+// const res = await fetch(+// `/api/teams/${teamInfo?.currentTeam?.id}/branding`,+// {+// method: brand ? "PUT" : "POST",+// body: JSON.stringify(data),+// headers: {+// "Content-Type": "application/json",+// },+// },+// );+// if (res.ok) {+// mutate(`/api/teams/${teamInfo?.currentTeam?.id}/branding`);+// setIsLoading(false);+// toast.success("Branding updated successfully");+// }+// };+// const handleDelete = async () => {+// setIsLoading(true);+// const res = await fetch(+// `/api/teams/${teamInfo?.currentTeam?.id}/branding`,+// {+// method: "DELETE",+// headers: {+// "Content-Type": "application/json",+// },+// },+// );+// if (res.ok) {+// setLogo(null);+// setBrandColor("#000000");+// setIsLoading(false);+// toast.success("Branding reset successfully");+// router.reload();+// }+// };+// return (+// <AppLayout>+// <Navbar current="Branding" />+// <div className="p-4 sm:m-4 sm:p-4">+// <div className="mb-4 flex items-center justify-between md:mb-8 lg:mb-12">+// <div className="space-y-1">+// <h3 className="text-2xl font-semibold tracking-tight text-foreground">+// Branding+// </h3>+// <p className="text-sm text-muted-foreground">+// Customize how your brand appears globally across Papermark+// documents your visitors see.+// </p>+// </div>+// </div>+// <div>+// <Card className="dark:bg-secondary">+// <CardContent className="pt-6">+// <div className="grid gap-6">+// <div className="flex flex-col gap-2">+// <div className="flex items-center justify-between">+// <Label htmlFor="logo">+// Logo{" "}+// <span className="text-sm italic text-muted-foreground">+// (max 2 MB)+// </span>+// </Label>+// {fileError ? (+// <p className="text-sm text-red-500">{fileError}</p>+// ) : null}+// </div>+// <label+// htmlFor="image"+// className="group relative mt-1 flex h-[4rem] w-[12rem] cursor-pointer flex-col items-center justify-center rounded-md border border-gray-300 bg-white shadow-sm transition-all hover:bg-gray-50"+// style={{+// backgroundImage:+// "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(135deg, transparent 75%, #ccc 75%)",+// backgroundSize: "20px 20px",+// backgroundPosition: "0 0, 10px 0, 10px -10px, 0px 10px",+// }}+// >+// {false && (+// <div className="absolute z-[5] flex h-full w-full items-center justify-center rounded-md bg-white">+// <LoadingSpinner />+// </div>+// )}+// <div+// className="absolute z-[5] h-full w-full rounded-md"+// onDragOver={(e) => {+// e.preventDefault();+// e.stopPropagation();+// setDragActive(true);+// }}+// onDragEnter={(e) => {+// e.preventDefault();+// e.stopPropagation();+// setDragActive(true);+// }}+// onDragLeave={(e) => {+// e.preventDefault();+// e.stopPropagation();+// setDragActive(false);+// }}+// onDrop={(e) => {+// e.preventDefault();+// e.stopPropagation();+// setDragActive(false);+// setFileError(null);+// const file =+// e.dataTransfer.files && e.dataTransfer.files[0];+// if (file) {+// if (file.size / 1024 / 1024 > 2) {+// setFileError("File size too big (max 2MB)");+// } else if (+// file.type !== "image/png" &&+// file.type !== "image/jpeg"+// ) {+// setFileError(+// "File type not supported (.png or .jpg only)",+// );+// } else {+// const reader = new FileReader();+// reader.onload = (e) => {+// setLogo(e.target?.result as string);+// };+// reader.readAsDataURL(file);+// }+// }+// }}+// />+// <div+// className={`${+// dragActive+// ? "cursor-copy border-2 border-black bg-gray-50 opacity-100"+// : ""+// } absolute z-[3] flex h-full w-full flex-col items-center justify-center rounded-md bg-white transition-all ${+// logo+// ? "opacity-0 group-hover:opacity-100"+// : "group-hover:bg-gray-50"+// }`}+// >+// <PlusIcon+// className={`${+// dragActive ? "scale-110" : "scale-100"+// } h-7 w-7 text-gray-500 transition-all duration-75 group-hover:scale-110 group-active:scale-95`}+// />+// <span className="sr-only">OG image upload</span>+// </div>+// {logo && (+// <img+// src={logo}+// alt="Preview"+// className="h-full w-full rounded-md object-contain"+// />+// )}+// </label>+// <div className="mt-1 flex rounded-md shadow-sm">+// <input+// id="image"+// name="image"+// type="file"+// accept="image/jpeg,image/png"+// className="sr-only"+// onChange={onChangeLogo}+// />+// </div>+// </div>+// <div className="flex flex-col gap-2">+// <Label htmlFor="primary-color">Brand Color</Label>+// <div className="flex space-x-1">+// <Popover>+// <PopoverTrigger>+// <div+// className="h-9 w-9 cursor-pointer rounded-md shadow-sm ring-1 ring-muted-foreground hover:ring-1 hover:ring-gray-300"+// style={{ backgroundColor: brandColor }}+// />+// </PopoverTrigger>+// <PopoverContent>+// <HexColorPicker+// color={brandColor}+// onChange={setBrandColor}+// />+// </PopoverContent>+// </Popover>+// <HexColorInput+// className="flex h-9 w-full rounded-md border-0 bg-background px-3 py-2 text-sm shadow-sm ring-1 ring-muted-foreground placeholder:text-muted-foreground focus:border-0 focus:ring-1 focus:ring-gray-300"+// color={brandColor}+// onChange={setBrandColor}+// prefixed+// />+// </div>+// </div>+// </div>+// </CardContent>+// <CardFooter className="border-t p-6">+// {plan === "free" ? (+// <UpgradePlanModal clickedPlan="Pro" trigger={"branding_page"}>+// <Button>Upgrade to Save Branding</Button>+// </UpgradePlanModal>+// ) : (+// <Button onClick={saveBranding} loading={isLoading}>+// Save changes+// </Button>+// )}+// {/* delete button */}+// <Button variant="link" onClick={handleDelete} disabled={!brand}>+// Reset branding+// </Button>+// </CardFooter>+// </Card>+// </div>+// </div>+// </AppLayout>+// );+// }import { useRouter } from "next/router";import { useCallback, useEffect, useState } from "react";@@ -20,6 +304,7 @@ import {PopoverContent,PopoverTrigger,} from "@/components/ui/popover";+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";import { usePlan } from "@/lib/swr/use-billing";import { useBrand } from "@/lib/swr/use-brand";@@ -32,6 +317,7 @@ export default function Branding() {const { plan } = usePlan();const [brandColor, setBrandColor] = useState<string>("#000000");+ const [accentColor, setAccentColor] = useState<string>("#030712");const [logo, setLogo] = useState<string | null>(null);const [isLoading, setIsLoading] = useState<boolean>(false);@@ -62,27 +348,25 @@ export default function Branding() {useEffect(() => {if (brand) {setBrandColor(brand.brandColor || "#000000");+ setAccentColor(brand.accentColor || "#FFFFFF");setLogo(brand.logo || null);}}, [brand]);const saveBranding = async (e: any) => {e.preventDefault();-setIsLoading(true);-- // Upload the image if it's a data URLlet blobUrl: string | null = logo && logo.startsWith("data:") ? null : logo;if (logo && logo.startsWith("data:")) {- // Convert the data URL to a blobconst blob = convertDataUrlToFile({ dataUrl: logo });- // Upload the blob to vercel storageblobUrl = await uploadImage(blob);setLogo(blobUrl);}const data = {brandColor: brandColor,+ accentColor: accentColor,+logo: blobUrl,};@@ -96,6 +380,7 @@ export default function Branding() {},},);+if (res.ok) {mutate(`/api/teams/${teamInfo?.currentTeam?.id}/branding`);setIsLoading(false);@@ -105,7 +390,6 @@ export default function Branding() {const handleDelete = async () => {setIsLoading(true);-const res = await fetch(`/api/teams/${teamInfo?.currentTeam?.id}/branding`,{@@ -115,9 +399,11 @@ export default function Branding() {},},);+if (res.ok) {setLogo(null);setBrandColor("#000000");+ setAccentColor("#030712");setIsLoading(false);toast.success("Branding reset successfully");router.reload();@@ -141,158 +427,346 @@ export default function Branding() {</div><div><Card className="dark:bg-secondary">- <CardContent className="pt-6">- <div className="grid gap-6">- <div className="flex flex-col gap-2">- <div className="flex items-center justify-between">- <Label htmlFor="logo">- Logo{" "}- <span className="text-sm italic text-muted-foreground">- (max 2 MB)- </span>- </Label>- {fileError ? (- <p className="text-sm text-red-500">{fileError}</p>- ) : null}- </div>- <label- htmlFor="image"- className="group relative mt-1 flex h-[4rem] w-[12rem] cursor-pointer flex-col items-center justify-center rounded-md border border-gray-300 bg-white shadow-sm transition-all hover:bg-gray-50"- style={{- backgroundImage:- "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(135deg, transparent 75%, #ccc 75%)",- backgroundSize: "20px 20px",- backgroundPosition: "0 0, 10px 0, 10px -10px, 0px 10px",- }}- >- {false && (- <div className="absolute z-[5] flex h-full w-full items-center justify-center rounded-md bg-white">- <LoadingSpinner />+ <div className="flex w-full flex-col justify-between gap-y-4 md:flex-row md:gap-x-4 md:gap-y-0">+ <Card className="min-w-max dark:bg-secondary">+ <CardContent className="pt-6">+ <div className="grid gap-6">+ <div className="flex flex-col gap-2">+ <div className="flex items-center justify-between">+ <Label htmlFor="logo">+ Logo{" "}+ <span className="text-sm italic text-muted-foreground">+ (max 2 MB)+ </span>+ </Label>+ {fileError ? (+ <p className="text-sm text-red-500">{fileError}</p>+ ) : null}</div>- )}- <div- className="absolute z-[5] h-full w-full rounded-md"- onDragOver={(e) => {- e.preventDefault();- e.stopPropagation();- setDragActive(true);- }}- onDragEnter={(e) => {- e.preventDefault();- e.stopPropagation();- setDragActive(true);- }}- onDragLeave={(e) => {- e.preventDefault();- e.stopPropagation();- setDragActive(false);- }}- onDrop={(e) => {- e.preventDefault();- e.stopPropagation();- setDragActive(false);- setFileError(null);- const file =- e.dataTransfer.files && e.dataTransfer.files[0];- if (file) {- if (file.size / 1024 / 1024 > 2) {- setFileError("File size too big (max 2MB)");- } else if (- file.type !== "image/png" &&- file.type !== "image/jpeg"- ) {- setFileError(- "File type not supported (.png or .jpg only)",- );- } else {- const reader = new FileReader();- reader.onload = (e) => {- setLogo(e.target?.result as string);- };- reader.readAsDataURL(file);- }- }- }}- />- <div- className={`${- dragActive- ? "cursor-copy border-2 border-black bg-gray-50 opacity-100"- : ""- } absolute z-[3] flex h-full w-full flex-col items-center justify-center rounded-md bg-white transition-all ${- logo- ? "opacity-0 group-hover:opacity-100"- : "group-hover:bg-gray-50"- }`}- >- <PlusIcon- className={`${- dragActive ? "scale-110" : "scale-100"- } h-7 w-7 text-gray-500 transition-all duration-75 group-hover:scale-110 group-active:scale-95`}- />- <span className="sr-only">OG image upload</span>- </div>- {logo && (- <img- src={logo}- alt="Preview"- className="h-full w-full rounded-md object-contain"- />- )}- </label>- <div className="mt-1 flex rounded-md shadow-sm">- <input- id="image"- name="image"- type="file"- accept="image/jpeg,image/png"- className="sr-only"- onChange={onChangeLogo}- />- </div>- </div>- <div className="flex flex-col gap-2">- <Label htmlFor="primary-color">Brand Color</Label>- <div className="flex space-x-1">- <Popover>- <PopoverTrigger>+ <label+ htmlFor="image"+ className="group relative mt-1 flex h-[4rem] w-[12rem] cursor-pointer flex-col items-center justify-center rounded-md border border-gray-300 bg-white shadow-sm transition-all hover:bg-gray-50"+ >+ {false && (+ <div className="absolute z-[5] flex h-full w-full items-center justify-center rounded-md bg-white">+ <LoadingSpinner />+ </div>+ )}+ <div+ className="absolute z-[5] h-full w-full rounded-md"+ onDragOver={(e) => {+ e.preventDefault();+ e.stopPropagation();+ setDragActive(true);+ }}+ onDragEnter={(e) => {+ e.preventDefault();+ e.stopPropagation();+ setDragActive(true);+ }}+ onDragLeave={(e) => {+ e.preventDefault();+ e.stopPropagation();+ setDragActive(false);+ }}+ onDrop={(e) => {+ e.preventDefault();+ e.stopPropagation();+ setDragActive(false);+ setFileError(null);+ const file =+ e.dataTransfer.files && e.dataTransfer.files[0];+ if (file) {+ if (file.size / 1024 / 1024 > 2) {+ setFileError("File size too big (max 2MB)");+ } else if (+ file.type !== "image/png" &&+ file.type !== "image/jpeg"+ ) {+ setFileError(+ "File type not supported (.png or .jpg only)",+ );+ } else {+ const reader = new FileReader();+ reader.onload = (e) => {+ setLogo(e.target?.result as string);+ };+ reader.readAsDataURL(file);+ }+ }+ }}+ /><div- className="h-9 w-9 cursor-pointer rounded-md shadow-sm ring-1 ring-muted-foreground hover:ring-1 hover:ring-gray-300"- style={{ backgroundColor: brandColor }}+ className={`${+ dragActive+ ? "cursor-copy border-2 border-black bg-gray-50 opacity-100"+ : ""+ } absolute z-[3] flex h-full w-full flex-col items-center justify-center rounded-md bg-white transition-all ${+ logo+ ? "opacity-0 group-hover:opacity-100"+ : "group-hover:bg-gray-50"+ }`}+ >+ <PlusIcon+ className={`${+ dragActive ? "scale-110" : "scale-100"+ } h-7 w-7 text-gray-500 transition-all duration-75 group-hover:scale-110 group-active:scale-95`}+ />+ <span className="sr-only">OG image upload</span>+ </div>+ {logo && (+ <img+ src={logo}+ alt="Preview"+ className="h-full w-full rounded-md object-contain"+ />+ )}+ </label>+ <div className="mt-1 flex rounded-md shadow-sm">+ <input+ id="image"+ name="image"+ type="file"+ accept="image/jpeg,image/png"+ className="sr-only"+ onChange={onChangeLogo}/>- </PopoverTrigger>- <PopoverContent>- <HexColorPicker+ </div>+ </div>+ <div className="flex flex-col gap-2">+ <Label htmlFor="primary-color">Brand Color</Label>+ <div className="flex space-x-1">+ <Popover>+ <PopoverTrigger>+ <div+ className="h-9 w-9 cursor-pointer rounded-md shadow-sm ring-1 ring-muted-foreground hover:ring-1 hover:ring-gray-300"+ style={{ backgroundColor: brandColor }}+ />+ </PopoverTrigger>+ <PopoverContent>+ <HexColorPicker+ color={brandColor}+ onChange={setBrandColor}+ />+ </PopoverContent>+ </Popover>+ <HexColorInput+ className="flex h-9 w-full rounded-md border-0 bg-background px-3 py-2 text-sm shadow-sm ring-1 ring-muted-foreground placeholder:text-muted-foreground focus:border-0 focus:ring-1 focus:ring-gray-300"color={brandColor}onChange={setBrandColor}+ prefixed/>- </PopoverContent>- </Popover>- <HexColorInput- className="flex h-9 w-full rounded-md border-0 bg-background px-3 py-2 text-sm shadow-sm ring-1 ring-muted-foreground placeholder:text-muted-foreground focus:border-0 focus:ring-1 focus:ring-gray-300"- color={brandColor}- onChange={setBrandColor}- prefixed- />+ </div>+ </div>+ <div className="flex flex-col gap-2">+ <Label htmlFor="accent-color">Background Color</Label>+ <div className="flex space-x-1">+ <div+ className="h-9 w-9 cursor-pointer rounded-md bg-white shadow-sm ring-1 ring-muted-foreground hover:ring-1 hover:ring-gray-300"+ onClick={() => setAccentColor("#ffffff")}+ />+ <div+ className="h-9 w-9 cursor-pointer rounded-md bg-gray-50 shadow-sm ring-1 ring-muted-foreground hover:ring-1 hover:ring-gray-300"+ onClick={() => setAccentColor("#f9fafb")}+ />+ <div+ className="h-9 w-9 cursor-pointer rounded-md bg-gray-200 shadow-sm ring-1 ring-muted-foreground hover:ring-1 hover:ring-gray-300"+ onClick={() => setAccentColor("#e5e7eb")}+ />+ <div+ className="h-9 w-9 cursor-pointer rounded-md bg-gray-400 shadow-sm ring-1 ring-muted-foreground hover:ring-1 hover:ring-gray-300"+ onClick={() => setAccentColor("#9ca3af")}+ />+ <div+ className="h-9 w-9 cursor-pointer rounded-md bg-gray-800 shadow-sm ring-1 ring-muted-foreground hover:ring-1 hover:ring-gray-300"+ onClick={() => setAccentColor("#1f2937")}+ />+ <div+ className="h-9 w-9 cursor-pointer rounded-md bg-gray-950 shadow-sm ring-1 ring-muted-foreground hover:ring-1 hover:ring-gray-300"+ onClick={() => setAccentColor("#030712")}+ />+ </div>+ </div>+ </div>+ </CardContent>+ <CardFooter className="border-t p-6">+ {plan === "free" ? (+ <UpgradePlanModal+ clickedPlan="Pro"+ trigger={"branding_page"}+ >+ <Button>Upgrade to Save Branding</Button>+ </UpgradePlanModal>+ ) : (+ <Button onClick={saveBranding} loading={isLoading}>+ Save changes+ </Button>+ )}+ {/* delete button */}+ <Button+ variant="link"+ onClick={handleDelete}+ disabled={!brand}+ >+ Reset branding+ </Button>+ </CardFooter>+ </Card>+ <Tabs defaultValue="account" className="w-full">+ <TabsList className="grid w-full grid-cols-2">+ <TabsTrigger value="account">Navbar</TabsTrigger>+ <TabsTrigger value="password">Front page</TabsTrigger>+ </TabsList>+ <TabsContent value="account">+ <div className="flex justify-center">+ <div className="relative h-[450px] w-[698px] rounded-lg bg-gray-200 p-1 shadow-lg">+ <div className="relative h-[442px] overflow-hidden rounded-lg bg-gray-100">+ <div className="mx-auto flex h-7 items-center justify-center">+ <div className="pointer-events-none absolute left-3">+ <div className="flex flex-row flex-nowrap justify-start">+ <div className="pointer-events-auto">+ <div className="mr-1 inline-block size-2 rounded-full bg-gray-300"></div>+ </div>+ <div className="pointer-events-auto">+ <div className="mr-1 inline-block size-2 rounded-full bg-gray-300"></div>+ </div>+ <div className="pointer-events-auto">+ <div className="mr-1 inline-block size-2 rounded-full bg-gray-300"></div>+ </div>+ </div>+ </div>+ <div className="flex w-[70%] items-center justify-center rounded-xl bg-white p-1 opacity-70">+ <div+ aria-hidden="true"+ className="mr-1 mt-0.5 flex text-muted-foreground"+ >+ <svg+ aria-hidden="true"+ height="8"+ width="8"+ viewBox="0 0 16 16"+ fill="currentColor"+ xmlns="http://www.w3.org/2000/svg"+ >+ <path d="M8.75 11.25a1.25 1.25 0 1 0-1.5 0v1a.75.75 0 0 0 1.5 0v-1Z"></path>+ <path+ fillRule="evenodd"+ clipRule="evenodd"+ d="M3.5 4v2h-1a1 1 0 0 0-1 1v6a3 3 0 0 0 3 3h7a3 3 0 0 0 3-3V7a1 1 0 0 0-1-1h-1V4a4 4 0 0 0-4-4h-1a4 4 0 0 0-4 4ZM11 6V4a2.5 2.5 0 0 0-2.5-2.5h-1A2.5 2.5 0 0 0 5 4v2h6Zm-8 7V7.5h10V13a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 13Z"+ ></path>+ </svg>+ </div>+ <span className="whitespace-normal text-xs text-muted-foreground">+ papermark.io/view/...+ </span>+ </div>+ </div>+ <iframe+ key={`branding-${brandColor}-${accentColor}`}+ name="checkout-demo"+ id="checkout-demo"+ src={`/nav_ppreview_demo?brandColor=${encodeURIComponent(brandColor)}&accentColor=${encodeURIComponent(accentColor)}&brandLogo=${logo ? encodeURIComponent(logo) : ""}`}+ style={{+ width: "1390px",+ height: "831px",+ transform: "scale(0.497)",+ transformOrigin: "left top",+ background: "rgb(255, 255, 255)",+ position: "absolute",+ top: "0px",+ left: "0px",+ borderTop: "none",+ borderRight: "0px",+ borderBottom: "0px",+ borderLeft: "0px",+ borderImage: "initial",+ overflow: "hidden",+ pointerEvents: "none",+ borderBottomLeftRadius: "8px",+ borderBottomRightRadius: "8px",+ marginTop: "29px",+ }}+ ></iframe>+ </div>+ </div>+ </div>+ </TabsContent>+ <TabsContent value="password">+ <div className="flex justify-center">+ <div className="relative h-[450px] w-[698px] rounded-lg bg-gray-200 p-1 shadow-lg">+ <div className="relative h-[442px] overflow-hidden rounded-lg bg-gray-100">+ <div className="mx-auto flex h-7 items-center justify-center">+ <div className="pointer-events-none absolute left-3">+ <div className="flex flex-row flex-nowrap justify-start">+ <div className="pointer-events-auto">+ <div className="mr-1 inline-block size-2 rounded-full bg-gray-300"></div>+ </div>+ <div className="pointer-events-auto">+ <div className="mr-1 inline-block size-2 rounded-full bg-gray-300"></div>+ </div>+ <div className="pointer-events-auto">+ <div className="mr-1 inline-block size-2 rounded-full bg-gray-300"></div>+ </div>+ </div>+ </div>+ <div className="flex w-[70%] items-center justify-center rounded-xl bg-white p-1 opacity-70">+ <div+ aria-hidden="true"+ className="mr-1 mt-0.5 flex text-muted-foreground"+ >+ <svg+ aria-hidden="true"+ height="8"+ width="8"+ viewBox="0 0 16 16"+ fill="currentColor"+ xmlns="http://www.w3.org/2000/svg"+ >+ <path d="M8.75 11.25a1.25 1.25 0 1 0-1.5 0v1a.75.75 0 0 0 1.5 0v-1Z"></path>+ <path+ fillRule="evenodd"+ clipRule="evenodd"+ d="M3.5 4v2h-1a1 1 0 0 0-1 1v6a3 3 0 0 0 3 3h7a3 3 0 0 0 3-3V7a1 1 0 0 0-1-1h-1V4a4 4 0 0 0-4-4h-1a4 4 0 0 0-4 4ZM11 6V4a2.5 2.5 0 0 0-2.5-2.5h-1A2.5 2.5 0 0 0 5 4v2h6Zm-8 7V7.5h10V13a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 13Z"+ ></path>+ </svg>+ </div>+ <span className="whitespace-normal text-xs text-muted-foreground">+ papermark.io/view/...+ </span>+ </div>+ </div>+ <iframe+ key={`branding-${brandColor}-${accentColor}`}+ name="checkout-demo"+ id="checkout-demo"+ src={`/entrance_ppreview_demo?brandColor=${encodeURIComponent(brandColor)}&accentColor=${encodeURIComponent(accentColor)}&brandLogo=${logo ? encodeURIComponent(logo) : ""}`}+ style={{+ width: "1390px",+ height: "831px",+ transform: "scale(0.497)",+ transformOrigin: "left top",+ background: "rgb(255, 255, 255)",+ position: "absolute",+ top: "0px",+ left: "0px",+ borderTop: "none",+ borderRight: "0px",+ borderBottom: "0px",+ borderLeft: "0px",+ borderImage: "initial",+ overflow: "hidden",+ pointerEvents: "none",+ borderBottomLeftRadius: "8px",+ borderBottomRightRadius: "8px",+ marginTop: "29px",+ }}+ ></iframe>+ </div>+ </div></div>- </div>- </div>- </CardContent>- <CardFooter className="border-t p-6">- {plan === "free" ? (- <UpgradePlanModal clickedPlan="Pro" trigger={"branding_page"}>- <Button>Upgrade to Save Branding</Button>- </UpgradePlanModal>- ) : (- <Button onClick={saveBranding} loading={isLoading}>- Save changes- </Button>- )}- {/* delete button */}- <Button variant="link" onClick={handleDelete} disabled={!brand}>- Reset branding- </Button>- </CardFooter>+ </TabsContent>+ </Tabs>+ </div></Card></div></div>diff --git a/public/_example/papermark-example-page.png b/public/_example/papermark-example-page.pngnew file mode 100644index 00000000..23b45c58Binary files /dev/null and b/public/_example/papermark-example-page.png differ