Skip to content

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

feat: add dataroom branding preview

Marc Seitzf701288f9542
diff --git a/pages/datarooms/[id]/branding/index.tsx b/pages/datarooms/[id]/branding/index.tsx
index e3806ad5..dc7a5381 100644
--- a/pages/datarooms/[id]/branding/index.tsx
+++ b/pages/datarooms/[id]/branding/index.tsx
@@ -20,11 +20,12 @@ import {
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { BadgeTooltip } from "@/components/ui/tooltip";
import { useDataroomBrand } from "@/lib/swr/use-brand";
import { useDataroom } from "@/lib/swr/use-dataroom";
-import { convertDataUrlToFile, uploadImage } from "@/lib/utils";
+import { cn, convertDataUrlToFile, uploadImage } from "@/lib/utils";
export default function DataroomBrandPage() {
const router = useRouter();
@@ -35,6 +36,8 @@ export default function DataroomBrandPage() {
const [brandColor, setBrandColor] = useState<string>("#000000");
const [logo, setLogo] = useState<string | null>(null);
const [banner, setBanner] = useState<string | null>(null);
+ const [blobUrl, setBlobUrl] = useState<string | null>(null);
+ const [bannerBlobUrl, setBannerBlobUrl] = useState<string | null>(null);
const [isLoading, setIsLoading] = useState<boolean>(false);
const [fileError, setFileError] = useState<string | null>(null);
@@ -52,7 +55,12 @@ export default function DataroomBrandPage() {
} else {
const reader = new FileReader();
reader.onload = (e) => {
- setLogo(e.target?.result as string);
+ const dataUrl = e.target?.result as string;
+ setLogo(dataUrl);
+ // create a blob url for preview
+ const blob = convertDataUrlToFile({ dataUrl });
+ const blobUrl = URL.createObjectURL(blob);
+ setBlobUrl(blobUrl);
};
reader.readAsDataURL(file);
}
@@ -73,7 +81,12 @@ export default function DataroomBrandPage() {
} else {
const reader = new FileReader();
reader.onload = (e) => {
- setBanner(e.target?.result as string);
+ const dataUrl = e.target?.result as string;
+ setBanner(dataUrl);
+ // create a blob url for preview
+ const blob = convertDataUrlToFile({ dataUrl });
+ const bannerBlobUrl = URL.createObjectURL(blob);
+ setBannerBlobUrl(bannerBlobUrl);
};
reader.readAsDataURL(file);
}
@@ -116,7 +129,7 @@ export default function DataroomBrandPage() {
const blob = convertDataUrlToFile({ dataUrl: banner });
// Upload the blob to vercel storage
bannerBlobUrl = await uploadImage(blob);
- setBanner(blobUrl);
+ setBanner(bannerBlobUrl);
}
const data = {
@@ -207,266 +220,463 @@ export default function DataroomBrandPage() {
<div className="space-y-4">
<div>
<Card className="dark:bg-secondary">
- <CardContent className="pt-6">
- <div className="grid gap-6">
- {/* Logo Input */}
- <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>
-
- {/* Banner Input */}
- <div className="flex flex-col gap-2">
- <div className="flex items-center justify-between">
- <Label htmlFor="banner">
- Banner{" "}
- <span className="text-sm italic text-muted-foreground">
- (max 5 MB, min. 1920x320)
- </span>
- </Label>
- {fileError ? (
- <p className="text-sm text-red-500">{fileError}</p>
- ) : null}
- </div>
- <label
- htmlFor="banner-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 />
+ <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) => {
+ const dataUrl = e.target?.result as string;
+ setLogo(dataUrl);
+ // create a blob url for preview
+ const blob = convertDataUrlToFile({
+ dataUrl,
+ });
+ const blobUrl = URL.createObjectURL(blob);
+ setBlobUrl(blobUrl);
+ };
+ reader.readAsDataURL(file);
+ }
+ }
+ }}
+ />
+ <div
+ className={cn(
+ "absolute z-[3] flex h-full w-full flex-col items-center justify-center rounded-md bg-white transition-all",
+ dragActive &&
+ "cursor-copy border-2 border-black bg-gray-50 opacity-100",
+ logo
+ ? "opacity-0 group-hover:opacity-100"
+ : "group-hover:bg-gray-50",
+ )}
+ >
+ <PlusIcon
+ className={cn(
+ "h-7 w-7 text-gray-500 transition-all duration-75 group-hover:scale-110 group-active:scale-95",
+ dragActive ? "scale-110" : "scale-100",
+ )}
+ />
+ <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
- 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 > 5) {
- setFileError("File size too big (max 5MB)");
- } 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) => {
- setBanner(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 ${
- banner
- ? "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>
- {banner && (
- <img
- src={banner}
- alt="Preview"
- className="h-full w-full rounded-md object-contain"
- />
- )}
- </label>
- <div className="mt-1 flex rounded-md shadow-sm">
- <input
- id="banner-image"
- name="image"
- type="file"
- accept="image/jpeg,image/png"
- className="sr-only"
- onChange={onChangeBanner}
- />
- </div>
- </div>
-
- {/* Brand Color Input */}
- <div className="flex flex-col gap-2">
- <Label htmlFor="primary-color">Brand Color</Label>
- <div className="flex space-x-1">
- <Popover>
- <PopoverTrigger>
+ {/* Banner Input */}
+ <div className="flex flex-col gap-2">
+ <div className="flex items-center justify-between">
+ <Label htmlFor="banner">
+ Banner{" "}
+ <span className="text-sm italic text-muted-foreground">
+ (max 5 MB, min. 1920x320)
+ </span>
+ </Label>
+ {fileError ? (
+ <p className="text-sm text-red-500">{fileError}</p>
+ ) : null}
+ </div>
+ <label
+ htmlFor="banner"
+ 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="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={cn(
+ "absolute z-[3] flex h-full w-full flex-col items-center justify-center rounded-md bg-white transition-all",
+ dragActive &&
+ "cursor-copy border-2 border-black bg-gray-50 opacity-100",
+ banner
+ ? "opacity-0 group-hover:opacity-100"
+ : "group-hover:bg-gray-50",
+ )}
+ >
+ <PlusIcon
+ className={cn(
+ "h-7 w-7 text-gray-500 transition-all duration-75 group-hover:scale-110 group-active:scale-95",
+ dragActive ? "scale-110" : "scale-100",
+ )}
+ />
+ <span className="sr-only">Banner image upload</span>
+ </div>
+ {banner && (
+ <img
+ src={banner}
+ alt="Preview"
+ className="h-full w-full rounded-md object-contain"
+ />
+ )}
+ </label>
+ <div className="mt-1 flex rounded-md shadow-sm">
+ <input
+ id="banner"
+ name="banner"
+ type="file"
+ accept="image/jpeg,image/png"
+ className="sr-only"
+ onChange={onChangeBanner}
/>
- </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>
- </div>
- </div>
- </CardContent>
- <CardFooter className="border-t p-6">
- <Button onClick={saveBranding} loading={isLoading}>
- Save changes
- </Button>
+ </CardContent>
+ <CardFooter className="border-t p-6">
+ <Button onClick={saveBranding} loading={isLoading}>
+ Save changes
+ </Button>
- {/* delete button */}
- <Button variant="link" onClick={handleDelete} disabled={!brand}>
- Reset branding
- </Button>
- </CardFooter>
+ {/* delete button */}
+ <Button
+ variant="link"
+ onClick={handleDelete}
+ disabled={!brand}
+ >
+ Reset branding
+ </Button>
+ </CardFooter>
+ </Card>
+ <Tabs defaultValue="dataroom-view" className="w-full">
+ <TabsList className="grid w-full grid-cols-3">
+ <TabsTrigger value="dataroom-view">
+ Dataroom View
+ </TabsTrigger>
+ <TabsTrigger value="document-view">
+ Document View
+ </TabsTrigger>
+ <TabsTrigger value="access-view">Front Page</TabsTrigger>
+ </TabsList>
+ {/* Dataroom View */}
+ <TabsContent value="dataroom-view">
+ <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-x-auto rounded-lg bg-gray-100 lg:overflow-x-hidden">
+ <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/dataroom/...
+ </span>
+ </div>
+ </div>
+ <iframe
+ key={`dataroom-view-${brandColor}`}
+ name="dataroom-view"
+ id="dataroom-view"
+ src={`/room_ppreview_demo?brandColor=${encodeURIComponent(brandColor)}&brandLogo=${blobUrl ? encodeURIComponent(blobUrl) : logo ? encodeURIComponent(logo) : ""}&brandBanner=${bannerBlobUrl ? encodeURIComponent(bannerBlobUrl) : banner ? encodeURIComponent(banner) : ""}`}
+ 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",
+ }}
+ />
+ </div>
+ </div>
+ </div>
+ </TabsContent>
+ {/* Document View */}
+ <TabsContent value="document-view">
+ <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-x-auto rounded-lg bg-gray-100 lg:overflow-x-hidden">
+ <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={`document-view-${brandColor}`}
+ name="document-view"
+ id="document-view"
+ src={`/nav_ppreview_demo?brandColor=${encodeURIComponent(brandColor)}&brandLogo=${blobUrl ? encodeURIComponent(blobUrl) : 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="access-view">
+ <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-x-auto rounded-lg bg-gray-100 lg:overflow-x-hidden">
+ <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={`access-screen-${brandColor}`}
+ name="access-screen"
+ id="access-screen"
+ src={`/entrance_ppreview_demo?brandColor=${encodeURIComponent(brandColor)}&brandLogo=${blobUrl ? encodeURIComponent(blobUrl) : 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>
+ </Tabs>
+ </div>
</Card>
</div>
</div>
diff --git a/pages/entrance_ppreview_demo.tsx b/pages/entrance_ppreview_demo.tsx
index a787657e..355117e4 100644
--- a/pages/entrance_ppreview_demo.tsx
+++ b/pages/entrance_ppreview_demo.tsx
@@ -8,114 +8,81 @@ 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;
+ const { accentColor } = router.query as {
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="bg-gray-950" style={{ backgroundColor: accentColor }}>
+ <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>
+ </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="flex justify-center">
- <Button
- type="submit"
- className="w-1/3 min-w-fit bg-white text-gray-950 hover:bg-white/90"
+ <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",
+ }}
>
- Continue
- </Button>
+ 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>
- </form>
- </div>
- </div>
- {/* </nav> */}
+ </div>
- {/* 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 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"></div>
+ </div>
+ </div>
);
}
diff --git a/pages/nav_ppreview_demo.tsx b/pages/nav_ppreview_demo.tsx
index 4e8ec51a..01e70cb4 100644
--- a/pages/nav_ppreview_demo.tsx
+++ b/pages/nav_ppreview_demo.tsx
@@ -11,77 +11,71 @@ export default function ViewPage() {
};
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 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 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 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>
- </nav>
+ </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>
+ {/* 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 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/room_ppreview_demo.tsx b/pages/room_ppreview_demo.tsx
new file mode 100644
index 00000000..f2a0af6a
--- /dev/null
+++ b/pages/room_ppreview_demo.tsx
@@ -0,0 +1,171 @@
+import { useRouter } from "next/router";
+
+import { ViewFolderTree } from "@/components/datarooms/folders";
+import DocumentCard from "@/components/view/dataroom/document-card";
+import FolderCard from "@/components/view/dataroom/folder-card";
+
+export default function ViewPage() {
+ const router = useRouter();
+ const { brandLogo, brandColor, brandBanner } = router.query as {
+ brandLogo: string;
+ brandColor: string;
+ brandBanner: string;
+ };
+
+ return (
+ <div className="bg-white">
+ {/* 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-center justify-start">
+ <div className="relative flex h-16 w-36 flex-shrink-0 items-center">
+ {brandLogo ? (
+ <img
+ className="h-16 w-36 object-contain"
+ src={brandLogo}
+ alt="Logo"
+ />
+ ) : (
+ <div className="text-2xl font-bold tracking-tighter text-white">
+ Papermark
+ </div>
+ )}
+ </div>
+ </div>
+ </div>
+ </div>
+ {brandBanner && (
+ <div className="relative h-[30vh]">
+ <img
+ className="h-[30vh] w-full object-cover"
+ src={brandBanner}
+ alt="Banner"
+ width={1920}
+ height={320}
+ />
+ <div className="absolute bottom-5 w-fit rounded-r-md bg-white/30 backdrop-blur-md">
+ <div className="px-5 py-2 sm:px-10">
+ <div className="text-3xl">Example Data Room</div>
+ <time className="text-sm">Last updated 2 hours ago</time>
+ </div>
+ </div>
+ </div>
+ )}
+ </nav>
+
+ {/* Body */}
+ <div style={{ height: "calc(100vh - 64px)" }} className="relative flex">
+ {/* Tree view */}
+ <div className="hidden h-full w-1/4 space-y-8 overflow-auto px-3 pb-4 pt-4 md:flex md:px-6 md:pt-6 lg:px-8 lg:pt-9 xl:px-14">
+ <ViewFolderTree
+ folders={[
+ {
+ id: "1",
+ name: "Marketing",
+ parentId: null,
+ dataroomId: "1",
+ orderIndex: 0,
+ path: "/",
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ },
+ {
+ id: "2",
+ name: "Sales",
+ parentId: null,
+ dataroomId: "1",
+ orderIndex: 1,
+ path: "/",
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ },
+ ]}
+ documents={[
+ {
+ id: "1",
+ name: "Q4 Report.pdf",
+ dataroomDocumentId: "1",
+ folderId: null,
+ versions: [
+ {
+ id: "1",
+ versionNumber: 1,
+ hasPages: true,
+ },
+ ],
+ },
+ ]}
+ setFolderId={() => {}}
+ folderId={null}
+ />
+ </div>
+
+ {/* Detail view */}
+ <div className="flex-grow overflow-auto">
+ <div className="h-full space-y-8 px-3 pb-4 pt-4 md:px-6 md:pt-6 lg:px-8 lg:pt-9 xl:px-14">
+ <div className="space-y-4">
+ <div className="text-sm text-muted-foreground">Home</div>
+ <ul className="grid gap-4">
+ <FolderCard
+ folder={{
+ id: "1",
+ name: "Marketing",
+ parentId: null,
+ dataroomId: "1",
+ orderIndex: 0,
+ path: "/",
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ }}
+ dataroomId="1"
+ setFolderId={() => {}}
+ />
+
+ <FolderCard
+ folder={{
+ id: "2",
+ name: "Sales",
+ parentId: null,
+ dataroomId: "1",
+ orderIndex: 1,
+ path: "/",
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ }}
+ dataroomId="1"
+ setFolderId={() => {}}
+ />
+
+ <DocumentCard
+ document={{
+ id: "1",
+ name: "Q4 Report.pdf",
+ dataroomDocumentId: "1",
+ downloadOnly: false,
+ versions: [
+ {
+ id: "1",
+ type: "pdf",
+ versionNumber: 1,
+ hasPages: true,
+ isVertical: true,
+ },
+ ],
+ }}
+ setViewType={() => {}}
+ setDocumentData={() => {}}
+ />
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+}