From 8268352dbec7062f9ad39a50987e5a2cba4ba9bc Mon Sep 17 00:00:00 2001 From: Marc Seitz Date: Mon, 13 Jan 2025 17:05:58 +0100 Subject: [PATCH 1/8] fix: tooltip video analytics shows correct data --- components/documents/video-analytics.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/documents/video-analytics.tsx b/components/documents/video-analytics.tsx index 985424b9..e13d882e 100644 --- a/components/documents/video-analytics.tsx +++ b/components/documents/video-analytics.tsx @@ -105,8 +105,8 @@ export default function VideoAnalytics({ const CustomTooltip = ({ active, payload, label }: any) => { if (active && payload && payload.length) { - const uniqueViews = payload[0].value; - const playbackCount = payload[1].value; + const uniqueViews = payload[1].value; + const playbackCount = payload[0].value; const intensity = playbackCount / uniqueViews || 1; return ( From 5dab5d652043dc958d2a58e5a638acb8c9206101 Mon Sep 17 00:00:00 2001 From: Marc Seitz Date: Mon, 13 Jan 2025 17:06:37 +0100 Subject: [PATCH 2/8] chore: cleanup logs --- pages/api/teams/[teamId]/documents/[id]/video-analytics.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/pages/api/teams/[teamId]/documents/[id]/video-analytics.ts b/pages/api/teams/[teamId]/documents/[id]/video-analytics.ts index 19be7f7a..1ab84416 100644 --- a/pages/api/teams/[teamId]/documents/[id]/video-analytics.ts +++ b/pages/api/teams/[teamId]/documents/[id]/video-analytics.ts @@ -189,13 +189,10 @@ export default async function handle( try { // Fetch video events from Tinybird - console.log("Fetching video events for document:", documentId); const response = await getVideoEventsByDocument({ document_id: documentId, }); - console.log("Tinybird response:", JSON.stringify(response, null, 2)); - if (!response || !response.data) { console.error("Invalid response from Tinybird:", response); return res From 35ec34547fb9155e3d6fb6bc5e45fb145fff74e7 Mon Sep 17 00:00:00 2001 From: Marc Seitz Date: Mon, 13 Jan 2025 17:47:29 +0100 Subject: [PATCH 3/8] chore: cleanup spacing of access screen --- .../view/access-form/agreement-section.tsx | 52 ++++---- .../access-form/custom-fields-section.tsx | 80 ++++++++++++ components/view/access-form/email-section.tsx | 120 +++++++++--------- components/view/access-form/name-section.tsx | 72 +++++------ .../view/access-form/password-section.tsx | 84 ++++++------ 5 files changed, 240 insertions(+), 168 deletions(-) create mode 100644 components/view/access-form/custom-fields-section.tsx diff --git a/components/view/access-form/agreement-section.tsx b/components/view/access-form/agreement-section.tsx index 503acd8b..ca608118 100644 --- a/components/view/access-form/agreement-section.tsx +++ b/components/view/access-form/agreement-section.tsx @@ -28,15 +28,27 @@ export default function AgreementSection({ }; return ( -
-
- -
+ {agreementName} + + . +
); } diff --git a/components/view/access-form/custom-fields-section.tsx b/components/view/access-form/custom-fields-section.tsx new file mode 100644 index 00000000..45c0fbfc --- /dev/null +++ b/components/view/access-form/custom-fields-section.tsx @@ -0,0 +1,80 @@ +import { Brand, CustomField, DataroomBrand } from "@prisma/client"; + +import { Input } from "@/components/ui/input"; +import { Textarea } from "@/components/ui/textarea"; + +import { cn } from "@/lib/utils"; +import { determineTextColor } from "@/lib/utils/determine-text-color"; + +export default function CustomFieldsSection({ + fields, + data, + setData, + brand, +}: { + fields: Partial[]; + data: { [key: string]: string }; + setData: (data: { [key: string]: string }) => void; + brand?: Partial | Partial | null; +}) { + const handleInputChange = ( + e: React.ChangeEvent, + identifier: string, + ) => { + setData({ ...data, [identifier]: e.target.value }); + }; + + if (!fields?.length) return null; + + return ( +
+ {fields.map((field, index) => { + if (!field.identifier) return null; + + const value = data[field.identifier] || ""; + const isLongText = field.type === "LONG_TEXT"; + const InputComponent = isLongText ? Textarea : Input; + + return ( +
+ + handleInputChange(e, field.identifier!)} + /> +
+ ); + })} +
+ ); +} diff --git a/components/view/access-form/email-section.tsx b/components/view/access-form/email-section.tsx index b6b10133..0997fa15 100644 --- a/components/view/access-form/email-section.tsx +++ b/components/view/access-form/email-section.tsx @@ -91,71 +91,69 @@ export default function EmailSection({ }; return ( -
-
-
+ )} +

+ {useCustomAccessForm + ? "This data will be shared with the content provider." + : "This data will be shared with the sender."} +

); } diff --git a/components/view/access-form/name-section.tsx b/components/view/access-form/name-section.tsx index a138b4d0..b6ea5197 100644 --- a/components/view/access-form/name-section.tsx +++ b/components/view/access-form/name-section.tsx @@ -37,43 +37,41 @@ export default function NameSection({ }; return ( -
-
- - -
+
+ +
); } diff --git a/components/view/access-form/password-section.tsx b/components/view/access-form/password-section.tsx index a90319c2..273b003e 100644 --- a/components/view/access-form/password-section.tsx +++ b/components/view/access-form/password-section.tsx @@ -22,56 +22,54 @@ export default function PasswordSection({ const [showPassword, setShowPassword] = useState(false); return ( -
-
-
); From b22acd2befc91e9f56723575dbea97bb64bb441a Mon Sep 17 00:00:00 2001 From: Marc Seitz Date: Mon, 13 Jan 2025 17:54:58 +0100 Subject: [PATCH 4/8] refactor: cleanup find colors from accentcolor --- components/NotionPage.tsx | 10 ++-------- components/view/access-form/agreement-section.tsx | 10 ++-------- .../view/access-form/custom-fields-section.tsx | 10 ++-------- components/view/access-form/email-section.tsx | 13 +++---------- components/view/access-form/name-section.tsx | 10 ++-------- components/view/access-form/password-section.tsx | 10 ++-------- components/view/nav.tsx | 10 ++-------- pages/entrance_ppreview_demo.tsx | 6 ++---- 8 files changed, 17 insertions(+), 62 deletions(-) diff --git a/components/NotionPage.tsx b/components/NotionPage.tsx index 737678a6..2431273f 100644 --- a/components/NotionPage.tsx +++ b/components/NotionPage.tsx @@ -311,10 +311,7 @@ export const NotionPage = ({ className="cursor-pointer underline underline-offset-4 hover:font-medium" onClick={() => setSubPageId(null)} style={{ - color: - brand && brand.brandColor - ? determineTextColor(brand.brandColor) - : "white", + color: determineTextColor(brand?.brandColor), }} > {title} @@ -327,10 +324,7 @@ export const NotionPage = ({ {subTitle} diff --git a/components/view/access-form/agreement-section.tsx b/components/view/access-form/agreement-section.tsx index ca608118..c82d1792 100644 --- a/components/view/access-form/agreement-section.tsx +++ b/components/view/access-form/agreement-section.tsx @@ -37,10 +37,7 @@ export default function AgreementSection({