The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
small partners.dub.co improvements
Steven Teya5d0174f34e4
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/overview/tasks-card.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/overview/tasks-card.tsxindex 46d25dac70..bd5fd81384 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/overview/tasks-card.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/overview/tasks-card.tsx@@ -3,12 +3,15 @@import { testIds } from "@/lib/e2e/test-ids";import { useProgramMessagesCount } from "@/lib/messages/hooks/use-program-messages-count";import useProgramEnrollmentsCount from "@/lib/swr/use-program-enrollments-count";-import { type Icon } from "@dub/ui";+import { useMediaQuery, type Icon } from "@dub/ui";import { Msgs, UserCheck } from "@dub/ui/icons";+import { cn, nFormatter } from "@dub/utils";import Link from "next/link";import { OverviewCard } from "./overview-card";export function TasksCard() {+ const { isMobile } = useMediaQuery();+const { count: unreadMessagesCount } = useProgramMessagesCount({query: { unread: true },});@@ -22,19 +25,22 @@ export function TasksCard() {icon: Msgs,label: "Respond to programs",href: "/messages",- count: unreadMessagesCount,+ count: unreadMessagesCount ?? 0,},{icon: UserCheck,label: "Review new invitations",href: "/programs?tab=invitations",- count: invitationsCount,+ count: invitationsCount ?? 0,},- ].filter((task): task is typeof task & { count: number } => !!task.count);+ ];- // hide the card when no action is needed (and while the counts load), so- // that Recent payouts fills the column- if (tasks.length === 0) {+ // only on mobile: hide the card when no action is needed+ // so that Recent payouts fills the column+ const incompleteTasks = tasks.filter(+ (task): task is typeof task & { count: number } => !!task.count,+ );+ if (incompleteTasks.length === 0 && isMobile) {return null;}@@ -71,8 +77,13 @@ function TaskRow({<span className="text-content-emphasis min-w-0 grow truncate text-sm font-semibold">{label}</span>- <div className="flex h-8 min-w-8 shrink-0 items-center justify-center rounded-lg bg-blue-50 px-1.5 text-sm font-semibold text-blue-600">- {count}+ <div+ className={cn(+ "flex h-8 min-w-8 shrink-0 items-center justify-center rounded-lg bg-blue-50 px-1.5 text-sm font-semibold text-blue-600",+ count === 0 && "bg-neutral-100 text-neutral-500",+ )}+ >+ {nFormatter(count, { full: true })}</div></Link>);diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/program-tabs.ts b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/program-tabs.tsindex 70240a263b..73d8d552e6 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/program-tabs.ts+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/program-tabs.ts@@ -68,7 +68,7 @@ export type ProgramTab = (typeof PROGRAM_TABS)[number];export type ProgramTabId = ProgramTab["id"];-export const PROGRAMS_TABLE_PAGE_SIZE = 10;+export const PROGRAMS_TABLE_PAGE_SIZE = 50;// without a saved view, the page starts on the table for partners with more// active programs than thisdiff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/programs-table.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/programs-table.tsxindex 5d20e35e54..072479ed48 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/programs-table.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/programs-table.tsx@@ -18,8 +18,8 @@ import {useRouterStuff,useTable,} from "@dub/ui";-import { Check, Copy, LinesY, Link4 } from "@dub/ui/icons";-import { cn, currencyFormatter, formatDate, getPrettyUrl } from "@dub/utils";+import { Check, Copy } from "@dub/ui/icons";+import { currencyFormatter, formatDate, getPrettyUrl } from "@dub/utils";import { ColumnDef } from "@tanstack/react-table";import Link from "next/link";import { useRouter } from "next/navigation";@@ -137,7 +137,7 @@ function getColumns(tab: ProgramTab): ProgramColumn[] {},{id: "activity",- header: "Activity",+ header: "Activity (last 12 months)",size: 180,cell: ({ row }) => (<ProgramActivity programEnrollment={row.original} />@@ -247,14 +247,12 @@ function EnrollmentStatusBadge({);}-// the partner's default link: click to copy, or open its analytics. The icons-// show on hover, and always on touch devices, which have no hover.function ProgramLinkChip({programEnrollment,}: {programEnrollment: ProgramEnrollmentProps;}) {- const { program, group } = programEnrollment;+ const { group } = programEnrollment;const link = programEnrollment.links?.[0];const [copied, copyToClipboard] = useCopyToClipboard();@@ -265,8 +263,7 @@ function ProgramLinkChip({const partnerLink = constructPartnerLink({ group, link });return (- <div className="group/chip flex w-fit max-w-full items-center gap-1 rounded-md px-1.5 py-0.5 transition-colors hover:bg-neutral-100">- {/* not hoverable, so that the pointer can move on to the analytics icon */}+ <div className="-ml-1.5 flex w-fit max-w-full items-center gap-1 rounded-md px-1.5 py-0.5 transition-colors hover:bg-neutral-100"><Tooltipcontent={copied ? "Copied" : "Copy link"}disableHoverableContent@@ -279,26 +276,14 @@ function ProgramLinkChip({copyToClipboard(partnerLink);}}>- <Link4 className="size-3.5 shrink-0" /><span className="truncate">{getPrettyUrl(partnerLink)}</span>{copied ? (<Check className="size-3.5 shrink-0" />) : (- <Copy className="size-3.5 shrink-0 transition-opacity [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/chip:opacity-100" />+ <Copy className="size-3.5 shrink-0" />)}</button></Tooltip>- <Tooltip content="View analytics">- <Link- href={`/programs/${program.slug}/analytics?linkId=${link.id}`}- onClick={(e) => e.stopPropagation()}- className={cn(- "shrink-0 rounded p-0.5 text-neutral-500 transition-opacity hover:text-neutral-800 [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/chip:opacity-100",- )}- >- <LinesY className="size-3.5" />- </Link>- </Tooltip></div>);}@@ -311,10 +296,18 @@ function ProgramActivity({const data = usePartnerProgramActivity(programEnrollment.programId);return (- <div className="h-6 w-36">- {data && (- <MiniAreaChart data={data} padding={{ top: 2, bottom: 2 }} fadeIn />- )}- </div>+ <Tooltip content="View analytics">+ <Link+ href={`/programs/${programEnrollment.program.slug}/analytics`}+ onClick={(e) => e.stopPropagation()}+ className="-ml-1.5 block w-fit rounded-md px-1.5 py-0.5 transition-colors hover:bg-neutral-100"+ >+ <div className="h-6 w-36">+ {data && (+ <MiniAreaChart data={data} padding={{ top: 2, bottom: 2 }} fadeIn />+ )}+ </div>+ </Link>+ </Tooltip>);}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsxindex 996b7f3c29..788fbcaf71 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsx@@ -85,9 +85,10 @@ export function OverviewTasks() {<divclassName={cn(- "flex h-8 items-center rounded-lg bg-black/5 px-4 text-neutral-400",+ "flex h-8 min-w-8 shrink-0 items-center justify-center rounded-lg bg-blue-50 px-1.5 text-sm font-semibold text-blue-600",+ !(task.count && task.count > 0) &&+ "bg-neutral-100 text-neutral-500",task.loading && "w-10 animate-pulse",- task.count && task.count > 0 && "bg-blue-100 text-blue-600",)}>{nFormatter(task.count, { full: true }) ??diff --git a/apps/web/lib/swr/use-program-enrollments.ts b/apps/web/lib/swr/use-program-enrollments.tsindex cdc71db759..a2a34cfc57 100644--- a/apps/web/lib/swr/use-program-enrollments.ts+++ b/apps/web/lib/swr/use-program-enrollments.ts@@ -30,6 +30,7 @@ export default function useProgramEnrollments(fetcher,{dedupingInterval: 60000,+ keepPreviousData: true,},);