The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Initial UTM modal updates
Tim Wilsondc719e591077
diff --git a/apps/web/ui/modals/link-builder/utm-modal.tsx b/apps/web/ui/modals/link-builder/utm-modal.tsxindex 971455718e..753110acb7 100644--- a/apps/web/ui/modals/link-builder/utm-modal.tsx+++ b/apps/web/ui/modals/link-builder/utm-modal.tsx@@ -1,4 +1,3 @@-import { TagProps } from "@/lib/types";import {Button,InfoTooltip,@@ -9,6 +8,7 @@ import {useMediaQuery,} from "@dub/ui";import {+ DiamondTurnRight,Flag6,Gift,GlobePointer,@@ -17,6 +17,7 @@ import {SatelliteDish,} from "@dub/ui/src";import {+ cn,constructURLFromUTMParams,getParamsFromURL,isValidUrl,@@ -33,7 +34,6 @@ import {} from "react";import { useFormContext } from "react-hook-form";import { LinkFormData } from ".";-import { MultiTagsIcon } from "./multi-tags-icon";const UTM_PARAMETERS = [{@@ -106,6 +106,9 @@ function UTMModal({}}, []);+ // Whether to display actual URL parameters instead of labels+ const [showParams, setShowParams] = useState(false);+return (<ModalshowModal={showUTMModal}@@ -148,12 +151,36 @@ function UTMModal({return (<div key={key} className="group relative"><div className="relative z-10 flex">- <div className="flex items-center gap-1.5 rounded-l-md border-y border-l border-gray-300 bg-gray-50 px-3 py-1.5 text-gray-700 sm:min-w-28">- <Icon className="size-4 shrink-0" />- <label htmlFor={`${id}-${key}`} className="text-sm">- {label}- </label>- </div>+ <Tooltip+ content={+ <div className="p-3 text-center text-xs">+ <p className="text-gray-600">{description}</p>+ <span className="font-mono text-gray-400">{key}</span>+ </div>+ }+ sideOffset={4}+ disableHoverableContent+ >+ <div+ className={cn(+ "flex items-center gap-1.5 rounded-l-md border-y border-l border-gray-300 bg-gray-50 px-3 py-1.5 text-gray-700",+ showParams ? "sm:min-w-36" : "sm:min-w-28",+ )}+ onClick={() => setShowParams((s) => !s)}+ >+ <Icon className="size-4 shrink-0" />+ <label+ htmlFor={`${id}-${key}`}+ className="select-none text-sm"+ >+ {showParams ? (+ <span className="font-mono text-xs">{key}</span>+ ) : (+ label+ )}+ </label>+ </div>+ </Tooltip><inputtype="text"id={`${id}-${key}`}@@ -172,14 +199,6 @@ function UTMModal({}}/></div>- <div className="relative mt-1 cursor-default text-xs text-gray-500">- <span className="ml-2 rounded-b-md border border-t-0 border-gray-300 bg-gray-50 px-1.5 pb-1 pt-2 font-mono">- {key}- </span>- <p className="ml-2 inline-flex opacity-0 transition-opacity duration-300 group-hover:opacity-100">- → {description}- </p>- </div></div>);},@@ -189,7 +208,7 @@ function UTMModal({{isValidUrl(url) && (<div className="mt-4 grid gap-y-1"><p className="text-sm text-gray-700">Current URL</p>- <div className="overflow-scroll break-words rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 font-mono text-xs text-gray-500">+ <div className="scrollbar-hide overflow-scroll break-words rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 font-mono text-xs text-gray-500">{url}</div></div>@@ -214,20 +233,8 @@ function UTMButton({return (<Buttonvariant="secondary"- text="UTM Builder"- icon={- <MultiTagsIcon- tags={- [- enabledParams.utm_source && { color: "blue" },- enabledParams.utm_medium && { color: "green" },- enabledParams.utm_campaign && { color: "red" },- enabledParams.utm_term && { color: "yellow" },- enabledParams.utm_content && { color: "purple" },- ].filter(Boolean) as { color: TagProps["color"] }[]- }- />- }+ text="UTM"+ icon={<DiamondTurnRight className="size-4" />}className="h-9 w-fit px-2.5 font-medium text-gray-700"onClick={() => setShowUTMModal(true)}/>diff --git a/packages/ui/src/icons/nucleo/diamond-turn-right.tsx b/packages/ui/src/icons/nucleo/diamond-turn-right.tsxnew file mode 100644index 0000000000..8508e8f4c9--- /dev/null+++ b/packages/ui/src/icons/nucleo/diamond-turn-right.tsx@@ -0,0 +1,46 @@+import { SVGProps } from "react";++export function DiamondTurnRight(props: SVGProps<SVGSVGElement>) {+ return (+ <svg+ height="18"+ width="18"+ viewBox="0 0 18 18"+ xmlns="http://www.w3.org/2000/svg"+ {...props}+ >+ <g fill="currentColor">+ <polyline+ fill="none"+ points="10 6.5 12.25 8.75 10 11"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ />+ <path+ d="M12.25,8.75h-3.5c-1.105,0-2,.895-2,2v.5"+ fill="none"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ />+ <rect+ height="11.313"+ width="11.313"+ fill="none"+ rx="2"+ ry="2"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ transform="translate(21.728 9) rotate(135)"+ x="3.343"+ y="3.343"+ />+ </g>+ </svg>+ );+}diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.tsindex 1f693c7e57..4da0c8279b 100644--- a/packages/ui/src/icons/nucleo/index.ts+++ b/packages/ui/src/icons/nucleo/index.ts@@ -33,6 +33,7 @@ export * from "./cube";export * from "./cube-settings";export * from "./cursor-rays";export * from "./desktop";+export * from "./diamond-turn-right";export * from "./dots";export * from "./download";export * from "./earth-position";diff --git a/packages/ui/src/tooltip.tsx b/packages/ui/src/tooltip.tsxindex 013875beb8..ef738c920d 100644--- a/packages/ui/src/tooltip.tsx+++ b/packages/ui/src/tooltip.tsx@@ -23,13 +23,25 @@ export interface TooltipProps| ReactNode| string| ((props: { setOpen: (open: boolean) => void }) => ReactNode);+ disableHoverableContent?: TooltipPrimitive.TooltipProps["disableHoverableContent"];}-export function Tooltip({ children, content, side = "top" }: TooltipProps) {+export function Tooltip({+ children,+ content,+ side = "top",+ disableHoverableContent,+ ...rest+}: TooltipProps) {const [open, setOpen] = useState(false);return (- <TooltipPrimitive.Root open={open} onOpenChange={setOpen} delayDuration={0}>+ <TooltipPrimitive.Root+ open={open}+ onOpenChange={setOpen}+ delayDuration={0}+ disableHoverableContent={disableHoverableContent}+ ><TooltipPrimitive.TriggerasChildonClick={() => {@@ -47,6 +59,7 @@ export function Tooltip({ children, content, side = "top" }: TooltipProps) {side={side}className="animate-slide-up-fade z-[99] items-center overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm"collisionPadding={0}+ {...rest}>{typeof content === "string" ? (<span className="block max-w-xs text-pretty px-4 py-2 text-center text-sm text-gray-700">