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.

Fix customer stats overflow on mobile viewports

Cursor Agent5546c3b567da
diff --git a/apps/web/ui/customers/customer-stats.tsx b/apps/web/ui/customers/customer-stats.tsx
index c3a08c1a66..2655b7f6c1 100644
--- a/apps/web/ui/customers/customer-stats.tsx
+++ b/apps/web/ui/customers/customer-stats.tsx
@@ -63,9 +63,11 @@ export function CustomerStats({
{
label: "Lifetime value",
value: customer ? (
- <div className="flex items-center gap-1">
- {currencyFormatter(customer.saleAmount ?? 0)}
- <span className="text-xs text-neutral-500">
+ <div className="flex min-w-0 flex-wrap items-baseline gap-x-1 gap-y-0.5">
+ <span className="truncate">
+ {currencyFormatter(customer.saleAmount ?? 0)}
+ </span>
+ <span className="text-xs font-normal text-neutral-500">
({nFormatter(customer.sales ?? 0, { full: true })}{" "}
{pluralize("sale", customer.sales ?? 0)})
</span>
@@ -97,7 +99,8 @@ export function CustomerStats({
<div className="@container/stats">
<div
className={cn(
- "@xs/stats:grid-cols-[repeat(var(--cols),1fr)] grid grid-cols-1 ring-4 ring-black/5",
+ // 2x2 on narrow viewports; 4-up only when each cell has room for labels
+ "@[560px]/stats:grid-cols-[repeat(var(--cols),minmax(0,1fr))] grid grid-cols-2 ring-4 ring-black/5",
"gap-px overflow-hidden rounded-xl border border-neutral-200 bg-neutral-200",
)}
style={
@@ -114,18 +117,20 @@ export function CustomerStats({
href={href ?? "#"}
target="_blank"
className={cn(
- "group relative flex flex-col bg-white p-3",
- href && "transition-colors duration-150 hover:bg-neutral-50",
+ "group relative flex min-w-0 flex-col gap-0.5 bg-white p-3",
+ href && "pr-8 transition-colors duration-150 hover:bg-neutral-50",
)}
>
{href && (
<ArrowUpRight2 className="text-content-subtle absolute right-3 top-3 size-3.5 opacity-50 transition-opacity duration-150 group-hover:opacity-100" />
)}
- <span className="text-xs text-neutral-500">{label}</span>
+ <span className="text-xs leading-tight text-neutral-500">
+ {label}
+ </span>
{value === undefined ? (
<div className="h-5 w-16 animate-pulse rounded-md bg-neutral-200" />
) : (
- <span className="text-content-emphasis text-sm font-medium">
+ <span className="text-content-emphasis min-w-0 text-sm font-medium leading-snug">
{value}
</span>
)}