From ecd2b009851d031f03a65a61ad615b88b3e5357d Mon Sep 17 00:00:00 2001 From: Gerhard Scheikl Date: Sat, 9 May 2026 17:45:56 +0200 Subject: [PATCH] feat(pdf): make footer email and website clickable --- app/services/invoice/pdf/InvoiceDocument.tsx | 24 ++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/app/services/invoice/pdf/InvoiceDocument.tsx b/app/services/invoice/pdf/InvoiceDocument.tsx index a8fb1a5..cb25d7f 100644 --- a/app/services/invoice/pdf/InvoiceDocument.tsx +++ b/app/services/invoice/pdf/InvoiceDocument.tsx @@ -2,6 +2,7 @@ import { Document, Image, + Link, Page, StyleSheet, Text, @@ -479,8 +480,16 @@ function Footer({ issuer, language }: { issuer: IssuerData; language: InvoiceLan {t.contactHeading} {issuer.phone ? {t.phoneLabel}: {issuer.phone} : null} - {issuer.email ? {t.emailLabel}: {issuer.email} : null} - {issuer.website ? {t.webLabel}: {issuer.website} : null} + {issuer.email ? ( + + {t.emailLabel}: {issuer.email} + + ) : null} + {issuer.website ? ( + + {t.webLabel}: {issuer.website} + + ) : null} {t.legalHeading} @@ -514,3 +523,14 @@ function pickFooterNote(issuer: { footerNote: string; footerNoteEn: string }, la } return issuer.footerNote || ""; } + +/** + * Make a website URL safe for `` — adds an `https://` scheme + * when the user typed something like `linumiq.com` or `www.linumiq.com`. + */ +function normaliseWebUrl(url: string): string { + const trimmed = url.trim(); + if (!trimmed) return trimmed; + if (/^https?:\/\//i.test(trimmed)) return trimmed; + return `https://${trimmed.replace(/^\/\//, "")}`; +}