Skip to content

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

feat: add agreement statement to access screen

Marc Seitz638da2196fec
diff --git a/components/view/access-form/agreement-section.tsx b/components/view/access-form/agreement-section.tsx
index b5a90005..555622b2 100644
--- a/components/view/access-form/agreement-section.tsx
+++ b/components/view/access-form/agreement-section.tsx
@@ -2,10 +2,10 @@ import { Dispatch, SetStateAction } from "react";
import { Brand, DataroomBrand } from "@prisma/client";
-import { Checkbox } from "@/components/ui/checkbox";
-
import { determineTextColor } from "@/lib/utils/determine-text-color";
+import { Checkbox } from "@/components/ui/checkbox";
+
import { DEFAULT_ACCESS_FORM_TYPE } from ".";
export default function AgreementSection({
@@ -32,54 +32,38 @@ export default function AgreementSection({
const isTextContent = agreementContentType === "TEXT";
return (
- <div className="space-y-4 pt-5">
- {/* Display text content if available */}
- {isTextContent && (
- <div
- className="rounded-md border border-gray-600 bg-gray-900/50 p-4 text-sm leading-relaxed"
- style={{
- color: determineTextColor(brand?.accentColor),
- borderColor: brand?.accentColor ? `${brand.accentColor}40` : "#4b5563"
- }}
- >
- <div className="font-medium mb-2">{agreementName}</div>
- <div className="whitespace-pre-line">{agreementContent}</div>
- </div>
- )}
-
- <div className="relative flex items-start space-x-2">
- <Checkbox
- id="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"
- />
- <label
- className="text-sm font-normal leading-5 text-white peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
- style={{
- color: determineTextColor(brand?.accentColor),
- }}
- >
- {isTextContent ? (
- <>I have reviewed and agree to the terms outlined above.</>
- ) : (
- <>
- I have reviewed and agree to the terms of this{" "}
- <a
- href={`${agreementContent}`}
- target="_blank"
- rel="noreferrer noopener"
- className="underline hover:text-gray-200"
- style={{
- color: determineTextColor(brand?.accentColor),
- }}
- >
- {agreementName}
- </a>
- .
- </>
- )}
- </label>
- </div>
+ <div className="relative flex items-start space-x-2 pt-5">
+ <Checkbox
+ id="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"
+ />
+ <label
+ className="text-sm font-normal leading-5 text-white peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+ style={{
+ color: determineTextColor(brand?.accentColor),
+ }}
+ >
+ {isTextContent ? (
+ <span className="whitespace-pre-line">{agreementContent}</span>
+ ) : (
+ <>
+ I have reviewed and agree to the terms of this{" "}
+ <a
+ href={`${agreementContent}`}
+ target="_blank"
+ rel="noreferrer noopener"
+ className="underline hover:text-gray-200"
+ style={{
+ color: determineTextColor(brand?.accentColor),
+ }}
+ >
+ {agreementName}
+ </a>
+ .
+ </>
+ )}
+ </label>
</div>
);
}
diff --git a/prisma/migrations/20250102000000_add_agreement_content_type/migration.sql b/prisma/migrations/20250102000000_add_agreement_content_type/migration.sql
deleted file mode 100644
index b22243c7..00000000
--- a/prisma/migrations/20250102000000_add_agreement_content_type/migration.sql
+++ /dev/null
@@ -1,6 +0,0 @@
--- Add contentType field to Agreement table
--- This field determines whether content is a LINK (URL) or TEXT (paragraph)
-ALTER TABLE "Agreement" ADD COLUMN "contentType" TEXT NOT NULL DEFAULT 'LINK';
-
--- Update existing agreements to have contentType as LINK since they currently store URLs
-UPDATE "Agreement" SET "contentType" = 'LINK' WHERE "contentType" IS NULL OR "contentType" = '';
\ No newline at end of file
diff --git a/prisma/migrations/20250903000000_add_agreement_contenttype/migration.sql b/prisma/migrations/20250903000000_add_agreement_contenttype/migration.sql
new file mode 100644
index 00000000..5833ec98
--- /dev/null
+++ b/prisma/migrations/20250903000000_add_agreement_contenttype/migration.sql
@@ -0,0 +1,3 @@
+-- AlterTable
+ALTER TABLE "Agreement" ADD COLUMN "contentType" TEXT NOT NULL DEFAULT 'LINK';
+