The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix popover issue
Steven Teyac731ab14731
diff --git a/app/ui/modals/link-qr-modal.tsx b/app/ui/modals/link-qr-modal.tsxindex 3c70b31e3c..29fb705d89 100644--- a/app/ui/modals/link-qr-modal.tsx+++ b/app/ui/modals/link-qr-modal.tsx@@ -12,7 +12,7 @@ import { HexColorInput, HexColorPicker } from "react-colorful";import BlurImage from "#/ui/blur-image";import { Clipboard, Download, Photo } from "@/components/shared/icons";import { Logo } from "#/ui/icons";-import { ChevronRight } from "lucide-react";+import { Check, ChevronRight } from "lucide-react";import Modal from "#/ui/modal";import Switch from "#/ui/switch";import Tooltip, { TooltipContent } from "#/ui/tooltip";@@ -99,6 +99,7 @@ export function QRCodePicker({ props }: { props: SimpleLinkProps }) {[props, fgColor, showLogo, qrLogoUrl],);+ const [copied, setCopied] = useState(false);const copyToClipboard = async () => {try {const canvas = await getQRAsCanvas(qrData, "image/png", true);@@ -106,6 +107,8 @@ export function QRCodePicker({ props }: { props: SimpleLinkProps }) {// @ts-ignoreconst item = new ClipboardItem({ "image/png": blob });await navigator.clipboard.write([item]);+ setCopied(true);+ setTimeout(() => setCopied(false), 2000);});} catch (e) {throw e;@@ -170,7 +173,15 @@ export function QRCodePicker({ props }: { props: SimpleLinkProps }) {}}className="flex items-center justify-center gap-2 rounded-md border border-black bg-black px-5 py-1.5 text-sm text-white transition-all hover:bg-white hover:text-black">- <Clipboard className="h-4 w-4" /> Copy+ {copied ? (+ <>+ <Check className="h-4 w-4" /> <p>Copied</p>+ </>+ ) : (+ <>+ <Clipboard className="h-4 w-4" /> <p>Copy</p>+ </>+ )}</button><QrDropdowndownload={download}diff --git a/app/ui/popover.tsx b/app/ui/popover.tsxindex a68abcddcf..7ce70e5f28 100644--- a/app/ui/popover.tsx+++ b/app/ui/popover.tsx@@ -45,13 +45,15 @@ export default function Popover({<PopoverPrimitive.Trigger className="hidden sm:inline-flex" asChild>{children}</PopoverPrimitive.Trigger>- <PopoverPrimitive.Content- sideOffset={8}- align={align}- className="z-50 hidden animate-slide-up-fade items-center rounded-md border border-gray-200 bg-white drop-shadow-lg sm:block"- >- {content}- </PopoverPrimitive.Content>+ <PopoverPrimitive.Portal>+ <PopoverPrimitive.Content+ sideOffset={8}+ align={align}+ className="z-50 hidden animate-slide-up-fade items-center rounded-md border border-gray-200 bg-white drop-shadow-lg sm:block"+ >+ {content}+ </PopoverPrimitive.Content>+ </PopoverPrimitive.Portal></PopoverPrimitive.Root>);}diff --git a/components/app/modals/link-qr-modal.tsx b/components/app/modals/link-qr-modal.tsxindex 72d077a087..d68c47ba13 100644--- a/components/app/modals/link-qr-modal.tsx+++ b/components/app/modals/link-qr-modal.tsx@@ -11,7 +11,7 @@ import { HexColorInput, HexColorPicker } from "react-colorful";import BlurImage from "#/ui/blur-image";import { Logo } from "#/ui/icons";import { Clipboard, Download, Photo } from "@/components/shared/icons";-import { ChevronRight } from "lucide-react";+import { Check, ChevronRight } from "lucide-react";import Modal from "#/ui/modal";import Switch from "#/ui/switch";import Tooltip, {@@ -102,6 +102,7 @@ function LinkQRModalHelper({[props, fgColor, showLogo, qrLogoUrl],);+ const [copied, setCopied] = useState(false);const copyToClipboard = async () => {try {const canvas = await getQRAsCanvas(qrData, "image/png", true);@@ -109,6 +110,8 @@ function LinkQRModalHelper({// @ts-ignoreconst item = new ClipboardItem({ "image/png": blob });await navigator.clipboard.write([item]);+ setCopied(true);+ setTimeout(() => setCopied(false), 2000);});} catch (e) {throw e;@@ -175,7 +178,15 @@ function LinkQRModalHelper({}}className="flex items-center justify-center gap-2 rounded-md border border-black bg-black px-5 py-1.5 text-sm text-white transition-all hover:bg-white hover:text-black">- <Clipboard className="h-4 w-4" /> Copy+ {copied ? (+ <>+ <Check className="h-4 w-4" /> <p>Copied</p>+ </>+ ) : (+ <>+ <Clipboard className="h-4 w-4" /> <p>Copy</p>+ </>+ )}</button><QrDropdowndownload={download}diff --git a/lib/constants/index.ts b/lib/constants/index.tsindex 9dd6be4489..6b90052226 100644--- a/lib/constants/index.ts+++ b/lib/constants/index.ts@@ -55,8 +55,7 @@ export const HOME_DOMAIN =process.env.NEXT_PUBLIC_VERCEL_ENV === "production"? "https://dub.co": process.env.NEXT_PUBLIC_VERCEL_ENV === "preview"- ? // ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`- "https://dub.co"+ ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`: "http://home.localhost:8888";export const APP_HOSTNAMES = new Set([