Skip to content

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

Refactor: Simplify banner logic to use only "no-banner"

Cursor Agent8d9ccd2c2914
diff --git a/components/view/dataroom/nav-dataroom.tsx b/components/view/dataroom/nav-dataroom.tsx
index 58e8f8bb..fe884793 100644
--- a/components/view/dataroom/nav-dataroom.tsx
+++ b/components/view/dataroom/nav-dataroom.tsx
@@ -193,7 +193,7 @@ export default function DataroomNav({
</div>
{/* Banner section */}
- {brand?.banner !== "hide-banner" && brand?.banner !== "no-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"
diff --git a/pages/datarooms/[id]/branding/index.tsx b/pages/datarooms/[id]/branding/index.tsx
index 6b066388..b1a07ec0 100644
--- a/pages/datarooms/[id]/branding/index.tsx
+++ b/pages/datarooms/[id]/branding/index.tsx
@@ -193,9 +193,9 @@ export default function DataroomBrandPage() {
// Upload the blob to vercel storage
bannerBlobUrl = await uploadImage(blob);
setBanner(bannerBlobUrl);
- } else if (banner === "hide-banner" || banner === "no-banner") {
+ } else if (banner === "no-banner") {
// Use the special value to hide the banner
- bannerBlobUrl = "hide-banner";
+ bannerBlobUrl = "no-banner";
}
const data = {
@@ -464,7 +464,7 @@ export default function DataroomBrandPage() {
aria-hidden="true"
/>
</div>
- ) : banner === "hide-banner" || banner === "no-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>
@@ -491,15 +491,15 @@ export default function DataroomBrandPage() {
type="button"
variant="outline"
size="sm"
- onClick={() => setBanner("hide-banner")}
+ onClick={() => setBanner("no-banner")}
className={cn(
"text-xs",
- (banner === "hide-banner" || banner === "no-banner") && "border-black"
+ banner === "no-banner" && "border-black"
)}
>
Hide Banner
</Button>
- {(banner === "hide-banner" || banner === "no-banner" || (banner && banner !== DEFAULT_BANNER_IMAGE && !banner.startsWith("data:"))) && (
+ {(banner === "no-banner" || (banner && banner !== DEFAULT_BANNER_IMAGE && !banner.startsWith("data:"))) && (
<Button
type="button"
variant="outline"
@@ -758,7 +758,7 @@ export default function DataroomBrandPage() {
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=${(banner === "hide-banner" || banner === "no-banner") ? encodeURIComponent("hide-banner") : 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 === "no-banner" ? encodeURIComponent("no-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.tsx
index 913e0bb4..e316bfd8 100644
--- a/pages/room_ppreview_demo.tsx
+++ b/pages/room_ppreview_demo.tsx
@@ -44,7 +44,7 @@ export default function ViewPage() {
</div>
{/* Banner section */}
- {brandBanner !== "hide-banner" && brandBanner !== "no-banner" && (
+ {brandBanner !== "no-banner" && (
<div className="relative h-[30vh]">
<img
className="h-[30vh] w-full object-cover"