The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
QR code isOGContext fallback (#3793)
Pedro Ladeira38641acef359
diff --git a/apps/web/lib/qr/utils.tsx b/apps/web/lib/qr/utils.tsxindex db5242dda1..d5cdd86b6e 100644--- a/apps/web/lib/qr/utils.tsx+++ b/apps/web/lib/qr/utils.tsx@@ -530,6 +530,26 @@ export function QRCodeSVG(props: QRPropsSVG) {}}+ if (isOGContext) {+ const fgPath = generatePath(cells, margin);+ return (+ <svg+ height={size}+ width={size}+ viewBox={`0 0 ${numCells} ${numCells}`}+ {...otherProps}+ >+ <path+ fill={bgColor}+ d={`M0,0 h${numCells}v${numCells}H0z`}+ shapeRendering="crispEdges"+ />+ <path fill={fgColor} d={fgPath} shapeRendering="crispEdges" />+ {image}+ </svg>+ );+ }+const fgPath =dotStyle === "rounded"? generateRoundedDotPath(cells, margin)@@ -537,7 +557,6 @@ export function QRCodeSVG(props: QRPropsSVG) {? generateExtraRoundedDotPath(cells, margin): generateSquareDotPath(cells, margin);- // The three finder pattern top-left corners in module coordinates (+ margin)const numModules = cells.length;const finderPositions = [{ x: margin, y: margin }, // top-leftdiff --git a/apps/web/ui/modals/link-qr-modal.tsx b/apps/web/ui/modals/link-qr-modal.tsxindex e22a0280ef..b398c4aa5f 100644--- a/apps/web/ui/modals/link-qr-modal.tsx+++ b/apps/web/ui/modals/link-qr-modal.tsx@@ -210,7 +210,7 @@ export function useLinkQRModal(props: LinkQRModalProps) {{...props}/>),- [showLinkQRModal, setShowLinkQRModal, props],+ [showLinkQRModal, setShowLinkQRModal],);return useMemo(diff --git a/apps/web/ui/modals/partner-link-qr-modal.tsx b/apps/web/ui/modals/partner-link-qr-modal.tsxindex de16fca740..b11721a977 100644--- a/apps/web/ui/modals/partner-link-qr-modal.tsx+++ b/apps/web/ui/modals/partner-link-qr-modal.tsx@@ -120,7 +120,7 @@ export function usePartnerLinkQRModal(props: PartnerLinkQRModalProps) {{...props}/>),- [showLinkQRModal, setShowLinkQRModal, props],+ [showLinkQRModal, setShowLinkQRModal],);return useMemo(diff --git a/apps/web/ui/modals/qr-code-design-fields.tsx b/apps/web/ui/modals/qr-code-design-fields.tsxindex 5eba4cdf23..f50a015836 100644--- a/apps/web/ui/modals/qr-code-design-fields.tsx+++ b/apps/web/ui/modals/qr-code-design-fields.tsx@@ -788,11 +788,13 @@ export function CopyPopover({<buttontype="button"onClick={() => {- const url = `${API_DOMAIN}/qr?url=${linkConstructor({- key: linkProps.key,- domain: linkProps.domain,- searchParams: { qr: "1" },- })}${qrData.hideLogo ? "&hideLogo=true" : ""}`;+ const url = `${API_DOMAIN}/qr?url=${encodeURIComponent(+ linkConstructor({+ key: linkProps.key,+ domain: linkProps.domain,+ searchParams: { qr: "1" },+ }),+ )}${qrData.hideLogo ? "&hideLogo=true" : ""}`;toast.promise(copyUrlToClipboard(url), {success: "Copied QR code URL to clipboard!",});