Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: Allow hiding dataroom banner via branding
Cursor Agentbc721ba4f560
diff --git a/components/view/dataroom/nav-dataroom.tsx b/components/view/dataroom/nav-dataroom.tsxindex 5f92fbe8..58e8f8bb 100644--- a/components/view/dataroom/nav-dataroom.tsx+++ b/components/view/dataroom/nav-dataroom.tsx@@ -193,26 +193,28 @@ export default function DataroomNav({</div>{/* Banner section */}- <div className="relative h-[20vh] sm:h-auto sm:max-h-80">- <img- className="h-full w-full object-cover sm:max-h-80 sm:object-contain xl:object-cover"- src={brand?.banner || DEFAULT_BANNER_IMAGE}- 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">{dataroom.name}</div>- <time- className="text-sm"- dateTime={new Date(dataroom.lastUpdatedAt).toISOString()}- >- {`Last updated ${formatDate(dataroom.lastUpdatedAt)}`}- </time>+ {brand?.banner !== "hide-banner" && brand?.banner !== "no-banner" && (+ <div className="relative h-[20vh] sm:h-auto sm:max-h-80">+ <img+ className="h-full w-full object-cover sm:max-h-80 sm:object-contain xl:object-cover"+ src={brand?.banner || DEFAULT_BANNER_IMAGE}+ 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">{dataroom.name}</div>+ <time+ className="text-sm"+ dateTime={new Date(dataroom.lastUpdatedAt).toISOString()}+ >+ {`Last updated ${formatDate(dataroom.lastUpdatedAt)}`}+ </time>+ </div></div></div>- </div>+ )}{conversationsEnabled && showConversations ? (<ConversationSidebardiff --git a/pages/datarooms/[id]/branding/index.tsx b/pages/datarooms/[id]/branding/index.tsxindex d7c17d7a..6b066388 100644--- a/pages/datarooms/[id]/branding/index.tsx+++ b/pages/datarooms/[id]/branding/index.tsx@@ -186,12 +186,16 @@ export default function DataroomBrandPage() {let bannerBlobUrl: string | null =banner && banner.startsWith("data:") ? null : banner;+ // Don't upload if banner is set to hideif (banner && banner.startsWith("data:")) {// Convert the data URL to a blobconst blob = convertDataUrlToFile({ dataUrl: banner });// Upload the blob to vercel storagebannerBlobUrl = await uploadImage(blob);setBanner(bannerBlobUrl);+ } else if (banner === "hide-banner" || banner === "no-banner") {+ // Use the special value to hide the banner+ bannerBlobUrl = "hide-banner";}const data = {@@ -460,6 +464,10 @@ export default function DataroomBrandPage() {aria-hidden="true"/></div>+ ) : banner === "hide-banner" || banner === "no-banner" ? (+ <div className="flex flex-col items-center justify-center gap-2">+ <p className="text-sm font-medium text-gray-600">Banner Hidden</p>+ </div>) : (<div className="relative flex h-full w-full items-center justify-center p-4"><img@@ -478,6 +486,31 @@ export default function DataroomBrandPage() {className="sr-only"onChange={onChangeBanner}/>+ <div className="flex items-center gap-2">+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => setBanner("hide-banner")}+ className={cn(+ "text-xs",+ (banner === "hide-banner" || banner === "no-banner") && "border-black"+ )}+ >+ Hide Banner+ </Button>+ {(banner === "hide-banner" || banner === "no-banner" || (banner && banner !== DEFAULT_BANNER_IMAGE && !banner.startsWith("data:"))) && (+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => setBanner(DEFAULT_BANNER_IMAGE)}+ className="text-xs"+ >+ Use Default Banner+ </Button>+ )}+ </div>{fileError && (<p className="text-sm text-red-500">{fileError}</p>)}@@ -722,10 +755,10 @@ export default function DataroomBrandPage() {</div></div><iframe- key={`dataroom-view-${debouncedBrandColor}-${debouncedAccentColor}`}+ key={`dataroom-view-${debouncedBrandColor}-${debouncedAccentColor}-${banner}`}name="dataroom-view"id="dataroom-view"- src={`/room_ppreview_demo?brandColor=${encodeURIComponent(debouncedBrandColor)}&accentColor=${encodeURIComponent(debouncedAccentColor)}&brandLogo=${blobUrl ? encodeURIComponent(blobUrl) : logo ? encodeURIComponent(logo) : ""}&brandBanner=${bannerBlobUrl ? encodeURIComponent(bannerBlobUrl) : banner ? encodeURIComponent(banner) : ""}`}+ src={`/room_ppreview_demo?brandColor=${encodeURIComponent(debouncedBrandColor)}&accentColor=${encodeURIComponent(debouncedAccentColor)}&brandLogo=${blobUrl ? encodeURIComponent(blobUrl) : logo ? encodeURIComponent(logo) : ""}&brandBanner=${(banner === "hide-banner" || banner === "no-banner") ? encodeURIComponent("hide-banner") : bannerBlobUrl ? encodeURIComponent(bannerBlobUrl) : banner ? encodeURIComponent(banner) : ""}`}style={{width: "1390px",height: "831px",diff --git a/pages/room_ppreview_demo.tsx b/pages/room_ppreview_demo.tsxindex 2f30caa0..913e0bb4 100644--- a/pages/room_ppreview_demo.tsx+++ b/pages/room_ppreview_demo.tsx@@ -44,21 +44,23 @@ export default function ViewPage() {</div>{/* Banner section */}- <div className="relative h-[30vh]">- <img- className="h-[30vh] w-full object-cover"- src={brandBanner || DEFAULT_BANNER_IMAGE}- 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>+ {brandBanner !== "hide-banner" && brandBanner !== "no-banner" && (+ <div className="relative h-[30vh]">+ <img+ className="h-[30vh] w-full object-cover"+ src={brandBanner || DEFAULT_BANNER_IMAGE}+ 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>- </div>+ )}</nav>{/* Body */}