The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fixed punycode
Steven Teyd45b52cf1fa3
diff --git a/app/ui/stats/toggle.tsx b/app/ui/stats/toggle.tsxindex 60eab45414..00f5bcc338 100644--- a/app/ui/stats/toggle.tsx+++ b/app/ui/stats/toggle.tsx@@ -17,6 +17,7 @@ import Tooltip, { TooltipContent } from "../tooltip";import useProject from "#/lib/hooks/use-project";import { useParams } from "next/navigation";import { APP_DOMAIN } from "#/lib/constants";+import punycode from "punycode/";export default function Toggle() {const { slug: projectSlug } = useParams() as { slug?: string };@@ -48,7 +49,11 @@ export default function Toggle() {target="_blank"rel="noreferrer">- {linkConstructor({ key, domain, pretty: true })}+ {linkConstructor({+ key,+ domain: punycode.toUnicode(domain),+ pretty: true,+ })}<ExpandingArrow className="h-5 w-5" /></a><div className="flex items-center">diff --git a/components/stats/toggle.tsx b/components/stats/toggle.tsxindex d4665753ed..080c59e4fc 100644--- a/components/stats/toggle.tsx+++ b/components/stats/toggle.tsx@@ -16,6 +16,7 @@ import { StatsContext } from ".";import useProject from "#/lib/swr/use-project";import Tooltip, { TooltipContent } from "#/ui/tooltip";import { ModalContext } from "#/ui/modal-provider";+import punycode from "punycode/";export default function Toggle({ atModalTop }: { atModalTop?: boolean }) {const router = useRouter();@@ -47,7 +48,11 @@ export default function Toggle({ atModalTop }: { atModalTop?: boolean }) {target="_blank"rel="noreferrer">- {linkConstructor({ key, domain, pretty: true })}+ {linkConstructor({+ key,+ domain: punycode.toUnicode(domain),+ pretty: true,+ })}<ExpandingArrow className="h-5 w-5" /></a><div className="flex items-center">diff --git a/lib/utils.ts b/lib/utils.tsindex aca065306a..96c79f4d9b 100644--- a/lib/utils.ts+++ b/lib/utils.ts@@ -12,7 +12,6 @@ import {HOME_HOSTNAMES,HOME_DOMAIN,} from "./constants";-import punycode from "punycode/";export function cn(...inputs: ClassValue[]) {return twMerge(clsx(inputs));@@ -134,11 +133,9 @@ export function linkConstructor({pretty?: boolean;noDomain?: boolean;}) {- const link = `${- localhost- ? "http://localhost:3000"- : `https://${punycode.toUnicode(domain)}`- }${key !== "_root" ? `/${key}` : ""}`;+ const link = `${localhost ? "http://localhost:3000" : `https://${domain}`}${+ key !== "_root" ? `/${key}` : ""+ }`;if (noDomain) return `/${key}`;return pretty ? link.replace(/^https?:\/\//, "") : link;