Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

configure tracking ui improvements

Pedro Ladeira48045e1c1780
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/configure-tracking-section.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/configure-tracking-section.tsx
index 7142f4e2f1..f9b63f5644 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/configure-tracking-section.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/configure-tracking-section.tsx
@@ -344,7 +344,7 @@ export function ConfigureTrackingSection() {
</TrackingSettingsRow>
</div>
- <div className="flex items-center justify-end border-t border-neutral-200 px-5 py-4">
+ <div className="flex h-16 items-center justify-end border-t border-neutral-200 bg-neutral-50 px-5 py-4">
<Button
text="Save changes"
className="h-8 w-fit px-3"
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/empty-tracking-card.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/empty-tracking-card.tsx
new file mode 100644
index 0000000000..9a5c6ff7d5
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/empty-tracking-card.tsx
@@ -0,0 +1,31 @@
+import { cn } from "@dub/utils";
+import { ReactNode } from "react";
+
+export const emptyTrackingActionClassName =
+ "h-8 w-fit shrink-0 gap-2 rounded-lg px-3 py-2";
+
+export function EmptyTrackingCard({
+ icon,
+ text,
+ action,
+}: {
+ icon: ReactNode;
+ text: string;
+ action: ReactNode;
+}) {
+ return (
+ <div className="flex h-16 w-full items-center justify-between gap-4 rounded-xl bg-neutral-50 py-4 pl-6 pr-4">
+ <div className="flex min-w-0 items-center gap-2">
+ {icon}
+ <span
+ className={cn(
+ "text-content-subtle truncate text-center text-sm font-medium leading-5 tracking-[-0.02em]",
+ )}
+ >
+ {text}
+ </span>
+ </div>
+ {action}
+ </div>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/hostname-field.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/hostname-field.tsx
index 1b9a82dcd8..2be905b18c 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/hostname-field.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/hostname-field.tsx
@@ -4,6 +4,10 @@ import { useConfirmModal } from "@/ui/modals/confirm-modal";
import { Button, Globe } from "@dub/ui";
import { cn } from "@dub/utils";
import { useAddHostnameModal } from "./add-hostname-modal";
+import {
+ EmptyTrackingCard,
+ emptyTrackingActionClassName,
+} from "./empty-tracking-card";
import HostnameMenu from "./hostname-menu";
export function HostnameField({
@@ -28,22 +32,21 @@ export function HostnameField({
<>
<div className="flex flex-col gap-2">
{hostnames.length === 0 ? (
- <div className="flex items-center justify-between gap-3 rounded-xl border border-neutral-200 bg-neutral-100 px-3 py-2.5">
- <div className="flex min-w-0 items-center gap-2.5">
- <Globe className="size-4 shrink-0 text-neutral-600" />
- <span className="text-content-subtle text-sm font-medium">
- No hostnames added
- </span>
- </div>
- <Button
- text="Add hostname"
- variant="secondary"
- className="h-8 w-fit px-2.5"
- onClick={() => setShowAddHostnameModal(true)}
- disabled={disabled}
- disabledTooltip={disabledTooltip}
- />
- </div>
+ <EmptyTrackingCard
+ icon={<Globe className="size-[18px] shrink-0 text-neutral-600" />}
+ text="No hostnames added"
+ action={
+ <Button
+ text="Add hostname"
+ variant="secondary"
+ className={emptyTrackingActionClassName}
+ textWrapperClassName="overflow-visible"
+ onClick={() => setShowAddHostnameModal(true)}
+ disabled={disabled}
+ disabledTooltip={disabledTooltip}
+ />
+ }
+ />
) : (
<>
<div className="flex flex-col gap-2">
@@ -61,7 +64,8 @@ export function HostnameField({
<Button
text="Add hostname"
variant="secondary"
- className="h-8 w-fit px-2.5"
+ className="h-8 w-fit shrink-0 px-3"
+ textWrapperClassName="overflow-visible"
onClick={() => setShowAddHostnameModal(true)}
disabled={disabled}
disabledTooltip={disabledTooltip}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/hostname-menu.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/hostname-menu.tsx
index 2a3a1ffa64..92512bbd03 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/hostname-menu.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/hostname-menu.tsx
@@ -36,14 +36,13 @@ function HostnameMenu({
setOpenPopover={setOpenPopover}
>
<Button
- variant="plain"
- color="secondary"
- className="h-9 border-none p-2"
+ variant="outline"
+ className="h-8 w-fit shrink-0 px-1.5 outline-none transition-all duration-200 border-transparent data-[state=open]:border-neutral-500"
icon={
loading ? (
<LoadingSpinner className="size-4 shrink-0" />
) : (
- <ThreeDots className="h-5 w-5 shrink-0 rotate-90" />
+ <ThreeDots className="size-5 shrink-0 rotate-90" />
)
}
onClick={() => {
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/publishable-key-field.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/publishable-key-field.tsx
index 6c08037719..2195e0b401 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/publishable-key-field.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/publishable-key-field.tsx
@@ -3,6 +3,10 @@
import { useConfirmModal } from "@/ui/modals/confirm-modal";
import { Button, CopyButton, Key } from "@dub/ui";
import { nanoid } from "@dub/utils";
+import {
+ EmptyTrackingCard,
+ emptyTrackingActionClassName,
+} from "./empty-tracking-card";
import PublishableKeyMenu from "./publishable-key-menu";
export function PublishableKeyField({
@@ -68,21 +72,20 @@ export function PublishableKeyField({
</div>
</div>
) : (
- <div className="flex items-center justify-between gap-3 rounded-xl border border-neutral-200 bg-neutral-100 px-3 py-2.5">
- <div className="flex min-w-0 items-center gap-2.5">
- <Key className="size-4 shrink-0 text-neutral-600" />
- <span className="text-content-subtle text-sm font-medium">
- No publishable key generated
- </span>
- </div>
- <Button
- text="Generate key"
- className="h-8 w-fit px-2.5"
- onClick={() => setShowGenerateModal(true)}
- disabled={disabled}
- disabledTooltip={disabledTooltip}
- />
- </div>
+ <EmptyTrackingCard
+ icon={<Key className="size-[18px] shrink-0 text-neutral-600" />}
+ text="No publishable key generated"
+ action={
+ <Button
+ text="Generate key"
+ className={emptyTrackingActionClassName}
+ textWrapperClassName="overflow-visible"
+ onClick={() => setShowGenerateModal(true)}
+ disabled={disabled}
+ disabledTooltip={disabledTooltip}
+ />
+ }
+ />
)}
{generateModal}
{revokeModal}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/publishable-key-menu.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/publishable-key-menu.tsx
index d4937efcee..c63e8af4f2 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/publishable-key-menu.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/publishable-key-menu.tsx
@@ -37,10 +37,9 @@ function PublishableKeyMenu({
setOpenPopover={setOpenPopover}
>
<Button
- variant="plain"
- color="secondary"
- className="h-9 border-none p-2"
- icon={<ThreeDots className="h-5 w-5 shrink-0 rotate-90" />}
+ variant="outline"
+ className="h-8 w-fit shrink-0 px-1.5 outline-none transition-all duration-200 border-transparent data-[state=open]:border-neutral-500"
+ icon={<ThreeDots className="size-5 shrink-0 rotate-90" />}
onClick={() => {
setOpenPopover(!openPopover);
}}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/section-card.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/section-card.tsx
index e44732ec2d..3bca8a1dc0 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/section-card.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/section-card.tsx
@@ -11,11 +11,11 @@ export function SectionCard({
}>) {
return (
<div className="overflow-hidden rounded-xl border border-neutral-200 bg-white">
- <div className="flex items-center gap-3.5 px-5 py-5">
- <div className="text-content-emphasis flex size-[42px] shrink-0 items-center justify-center rounded-full bg-neutral-100 text-base font-semibold">
+ <div className="flex items-center gap-3 p-6">
+ <div className="text-content-emphasis flex size-7 shrink-0 items-center justify-center rounded-full bg-neutral-100 text-sm font-semibold">
{number}
</div>
- <h2 className="text-content-emphasis text-base font-semibold">
+ <h2 className="text-content-emphasis text-lg font-semibold leading-7 tracking-[-0.02em]">
{title}
</h2>
</div>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/site-visit-tracking-field.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/site-visit-tracking-field.tsx
index 8198ca899a..4a8492e927 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/site-visit-tracking-field.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/site-visit-tracking-field.tsx
@@ -280,7 +280,7 @@ function SitemapRowMenu({
loading ? (
<LoadingSpinner className="size-4 shrink-0" />
) : (
- <ThreeDots className="size-5 shrink-0" />
+ <ThreeDots className="size-5 shrink-0 rotate-90" />
)
}
onClick={() => setOpenPopover(!openPopover)}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/stack-picker.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/stack-picker.tsx
index 0fb29d3d68..ac4e1bd8a8 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/stack-picker.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/stack-picker.tsx
@@ -1,7 +1,7 @@
"use client";
import { StackItem } from "@/ui/guides/integrations";
-import { StackY3 } from "@dub/ui/icons";
+import { Layers3 } from "@dub/ui/icons";
import { cn } from "@dub/utils";
function StackItemIcon({
@@ -24,10 +24,36 @@ function StackItemIcon({
return <Icon className="size-5 shrink-0" />;
}
+const stackItemTitleClassName =
+ "text-xs font-semibold leading-4 tracking-[-0.02em] text-neutral-800";
+
+function StackItemTitle({ title }: { title: string }) {
+ const stripeSuffix = title.startsWith("Stripe ")
+ ? title.slice("Stripe ".length)
+ : null;
+
+ if (!stripeSuffix) {
+ return (
+ <span className={cn("min-w-0 flex-1 truncate", stackItemTitleClassName)}>
+ {title}
+ </span>
+ );
+ }
+
+ return (
+ <span className="flex min-w-0 flex-1 items-baseline gap-1 truncate">
+ <span className={stackItemTitleClassName}>Stripe</span>
+ <span className="text-content-subtle text-xs font-medium leading-4 tracking-[-0.02em]">
+ {stripeSuffix}
+ </span>
+ </span>
+ );
+}
+
export function StackSelectionStatus({ count }: { count: number }) {
return (
<p className="text-content-subtle flex items-center gap-1.5 text-xs font-medium">
- <StackY3 className="size-3.5 shrink-0" />
+ <Layers3 className="size-3.5 shrink-0" />
{count} item{count === 1 ? "" : "s"} selected
</p>
);
@@ -55,7 +81,7 @@ export function StackPicker({
};
return (
- <div className="grid grid-cols-2 gap-2 sm:grid-cols-3">
+ <div className="grid w-full grid-cols-2 gap-3 sm:grid-cols-3">
{items.map((item) => {
const selected = value.includes(item.id);
@@ -67,19 +93,19 @@ export function StackPicker({
aria-pressed={selected}
onClick={() => toggleItem(item.id)}
className={cn(
- "relative flex items-center gap-2 rounded-lg border-2 bg-white px-3 py-2 text-left transition-[border-color,transform] duration-150 ease-out",
+ "relative flex h-[42px] items-center gap-2.5 rounded-lg border p-2 text-left transition-[border-color,background-color,transform] duration-150 ease-out",
"focus-visible:ring-2 focus-visible:ring-black/50 focus-visible:outline-none",
"active:scale-[0.98]",
- selected ? "border-neutral-900" : "border-neutral-200",
+ selected
+ ? "border-neutral-600 bg-neutral-50"
+ : "border-neutral-200 bg-white",
!disabled &&
- "[@media(hover:hover)_and_(pointer:fine)]:hover:border-neutral-900",
+ "[@media(hover:hover)_and_(pointer:fine)]:hover:border-neutral-600",
disabled && "cursor-not-allowed opacity-50",
)}
>
<StackItemIcon icon={item.icon} fullSize={item.iconProps?.fullSize} />
- <span className="min-w-0 flex-1 truncate text-sm font-medium text-neutral-800">
- {item.title}
- </span>
+ <StackItemTitle title={item.title} />
</button>
);
})}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/tracking-settings-row.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/tracking-settings-row.tsx
index 20a8eb2c2c..8a81ba2028 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/tracking-settings-row.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/tracking/tracking-settings-row.tsx
@@ -21,16 +21,16 @@ export function TrackingSettingsRow({
return (
<div
className={cn(
- "grid grid-cols-1 gap-4 px-5 py-6 sm:grid-cols-3 sm:gap-8",
+ "grid grid-cols-1 gap-10 p-6 sm:grid-cols-2",
align === "center" && "sm:items-center",
className,
)}
>
- <div className="flex h-full flex-col gap-1">
- <h3 className="text-content-emphasis text-sm font-semibold leading-none">
+ <div className="flex h-full min-w-0 flex-col gap-1">
+ <h3 className="text-content-emphasis text-base font-semibold leading-6 tracking-[-0.02em]">
{heading}
</h3>
- <MarkdownDescription className="text-content-subtle text-sm">
+ <MarkdownDescription className="text-content-subtle text-sm font-normal leading-5 tracking-[-0.02em] [&_a]:text-content-subtle [&_a]:decoration-solid [&_a]:underline-offset-auto">
{description}
</MarkdownDescription>
{leftExtra && (
@@ -39,7 +39,7 @@ export function TrackingSettingsRow({
</div>
)}
</div>
- <div className="min-w-0 sm:col-span-2">{children}</div>
+ <div className="min-w-0">{children}</div>
</div>
);
}
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index 0023550cb2..117f1f97e2 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -141,6 +141,7 @@ export * from "./input-search";
export * from "./invoice-dollar";
export * from "./key";
export * from "./layout-sidebar";
+export * from "./layers-3";
export * from "./license";
export * from "./life-ring";
export * from "./lines-y";
diff --git a/packages/ui/src/icons/nucleo/layers-3.tsx b/packages/ui/src/icons/nucleo/layers-3.tsx
new file mode 100644
index 0000000000..7a05d9a1d8
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/layers-3.tsx
@@ -0,0 +1,28 @@
+import { SVGProps } from "react";
+
+export function Layers3(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">
+ <path
+ d="M15.685,4.423L9.816,1.333c-.511-.271-1.121-.27-1.631,0L2.315,4.423c-.494,.26-.801,.769-.801,1.327s.307,1.067,.801,1.327l5.869,3.09c.255,.135,.536,.203,.816,.203s.56-.067,.815-.202l5.87-3.091c.494-.26,.801-.769,.801-1.327s-.307-1.067-.801-1.327Z"
+ fill="currentColor"
+ />
+ <path
+ d="M15.736,8.25c-.414,0-.75,.336-.75,.75l-5.87,3.091c-.072,.038-.158,.038-.232,0l-5.87-3.091c0-.414-.336-.75-.75-.75s-.75,.336-.75,.75c0,.559,.307,1.067,.801,1.327l5.869,3.09c.255,.135,.536,.203,.816,.203s.56-.067,.815-.202l5.87-3.091c.494-.26,.801-.769,.801-1.327,0-.414-.336-.75-.75-.75Z"
+ fill="currentColor"
+ />
+ <path
+ d="M15.736,11.5c-.414,0-.75,.336-.75,.75l-5.87,3.091c-.072,.038-.158,.038-.232,0l-5.87-3.091c0-.414-.336-.75-.75-.75s-.75,.336-.75,.75c0,.559,.307,1.067,.801,1.327l5.869,3.09c.255,.135,.536,.203,.816,.203s.56-.067,.815-.202l5.87-3.091c.494-.26,.801-.769,.801-1.327,0-.414-.336-.75-.75-.75Z"
+ fill="currentColor"
+ />
+ </g>
+ </svg>
+ );
+}