From 5311457b4b8648dbcfdf53b3b3c167397294977c Mon Sep 17 00:00:00 2001 From: Lucas Smith Date: Sat, 3 Oct 2026 17:04:35 +1000 Subject: [PATCH] fix: update legal links on recipient routes (#3419) --- .../document-signing-page-view-v2.tsx | 3 + .../envelope-signer-header.tsx | 15 ++-- .../components/general/public-legal-links.tsx | 85 ++++++++++++------- apps/remix/app/routes/_recipient+/_layout.tsx | 28 ++---- 4 files changed, 75 insertions(+), 56 deletions(-) diff --git a/apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx b/apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx index 46ff0d89f..f2339dfd6 100644 --- a/apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx +++ b/apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx @@ -31,6 +31,7 @@ import { SignFieldTextDialog } from '~/components/dialogs/sign-field-text-dialog import { useEmbedSigningContext } from '~/components/embed/embed-signing-context'; import { EnvelopeSignerPageRenderer } from '~/components/general/envelope-signing/envelope-signer-page-renderer'; import { EnvelopePdfViewer } from '~/components/general/pdf-viewer/envelope-pdf-viewer'; +import { PublicLegalLinks } from '~/components/general/public-legal-links'; import { BrandingLogo } from '../branding-logo'; import { DocumentSigningAttachmentsPopover } from '../document-signing/document-signing-attachments-popover'; @@ -231,6 +232,8 @@ export const DocumentSigningPageViewV2 = () => { )} + + {!isEmbed && } diff --git a/apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx b/apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx index 946eb6ae4..d4cddf151 100644 --- a/apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx +++ b/apps/remix/app/components/general/envelope-signing/envelope-signer-header.tsx @@ -17,7 +17,7 @@ import { match } from 'ts-pattern'; import { EnvelopeDownloadDialog } from '~/components/dialogs/envelope-download-dialog'; import { useEmbedSigningContext } from '~/components/embed/embed-signing-context'; import { BrandingLogo } from '~/components/general/branding-logo'; -import { PublicLegalLinks } from '~/components/general/public-legal-links'; +import { PublicLegalLinksDropdownMenuItems } from '~/components/general/public-legal-links'; import { BrandingLogoIcon } from '../branding-logo-icon'; import { DocumentSigningRejectDialog } from '../document-signing/document-signing-reject-dialog'; @@ -69,10 +69,8 @@ export const EnvelopeSignerHeader = () => { {/* Right side - Desktop content */} -
- - -

+

+

@@ -90,7 +88,10 @@ export const EnvelopeSignerHeader = () => { const MobileDropdownMenu = () => { const { envelope, recipient } = useRequiredEnvelopeSigningContext(); - const { allowDocumentRejection } = useEmbedSigningContext() || {}; + const embedSigningContext = useEmbedSigningContext(); + + const isEmbedSigning = embedSigningContext !== null; + const { allowDocumentRejection } = embedSigningContext || {}; return ( @@ -130,6 +131,8 @@ const MobileDropdownMenu = () => { } /> )} + + {!isEmbedSigning && } ); diff --git a/apps/remix/app/components/general/public-legal-links.tsx b/apps/remix/app/components/general/public-legal-links.tsx index d21c81949..1bdc0e96c 100644 --- a/apps/remix/app/components/general/public-legal-links.tsx +++ b/apps/remix/app/components/general/public-legal-links.tsx @@ -4,7 +4,9 @@ import { NEXT_PUBLIC_TERMS_OF_SERVICE_URL, } from '@documenso/lib/constants/app'; import { cn } from '@documenso/ui/lib/utils'; -import { Trans } from '@lingui/react/macro'; +import { DropdownMenuItem, DropdownMenuSeparator } from '@documenso/ui/primitives/dropdown-menu'; +import { msg } from '@lingui/core/macro'; +import { useLingui } from '@lingui/react'; import { Link } from 'react-router'; export type PublicLegalLinksProps = { @@ -12,49 +14,70 @@ export type PublicLegalLinksProps = { }; export const PublicLegalLinks = ({ className }: PublicLegalLinksProps) => { - const termsUrl = NEXT_PUBLIC_TERMS_OF_SERVICE_URL(); - const privacyUrl = NEXT_PUBLIC_PRIVACY_POLICY_URL(); - const imprintUrl = NEXT_PUBLIC_IMPRINT_URL(); + const { _ } = useLingui(); + + const links = getPublicLegalLinks(); + + if (links.length === 0) { + return null; + } return (
- {termsUrl && ( + {links.map((link) => ( - Terms of Service + {_(link.label)} - )} - - {privacyUrl && ( - - Privacy Policy - - )} - - {imprintUrl && ( - - Imprint - - )} + ))}
); }; + +export const PublicLegalLinksDropdownMenuItems = () => { + const { _ } = useLingui(); + + const links = getPublicLegalLinks(); + + if (links.length === 0) { + return null; + } + + return ( + <> + + + {links.map((link) => ( + + + {_(link.label)} + + + ))} + + ); +}; + +const getPublicLegalLinks = () => { + const termsUrl = NEXT_PUBLIC_TERMS_OF_SERVICE_URL(); + const privacyUrl = NEXT_PUBLIC_PRIVACY_POLICY_URL(); + const imprintUrl = NEXT_PUBLIC_IMPRINT_URL(); + + const links = [ + termsUrl ? { label: msg`Terms of Service`, href: termsUrl } : null, + privacyUrl ? { label: msg`Privacy Policy`, href: privacyUrl } : null, + imprintUrl ? { label: msg`Imprint`, href: imprintUrl } : null, + ]; + + return links.filter((link) => link !== null); +}; diff --git a/apps/remix/app/routes/_recipient+/_layout.tsx b/apps/remix/app/routes/_recipient+/_layout.tsx index b074e4462..fde4a7998 100644 --- a/apps/remix/app/routes/_recipient+/_layout.tsx +++ b/apps/remix/app/routes/_recipient+/_layout.tsx @@ -10,8 +10,6 @@ import { useEffect } from 'react'; import { isRouteErrorResponse, Link, Outlet } from 'react-router'; import { Header as AuthenticatedHeader } from '~/components/general/app-header'; import { GenericErrorLayout } from '~/components/general/generic-error-layout'; -import { PublicLegalLinks } from '~/components/general/public-legal-links'; - import type { Route } from './+types/_layout'; export function meta() { @@ -37,24 +35,16 @@ export default function RecipientLayout({ matches }: Route.ComponentProps) { ); return ( -
-
- {!hideHeader && sessionData?.user && } +
+ {!hideHeader && sessionData?.user && } -
- -
-
- - {!hideHeader && ( -
- -
- )} +
+ +
); }