The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
CustomerTable final touches
Steven Tey2fd849c175c7
diff --git a/apps/web/ui/customers/customer-row-item.tsx b/apps/web/ui/customers/customer-row-item.tsxindex 9533e85995..ec3eccb1bf 100644--- a/apps/web/ui/customers/customer-row-item.tsx+++ b/apps/web/ui/customers/customer-row-item.tsx@@ -8,6 +8,7 @@ export function CustomerRowItem({customer,href,className,+ hideChartActivityOnHover = true,}: {customer: {id: string;@@ -17,6 +18,7 @@ export function CustomerRowItem({};href?: string;className?: string;+ hideChartActivityOnHover?: boolean;}) {const display = customer.email || customer.name || generateRandomName();@@ -39,7 +41,13 @@ export function CustomerRowItem({<span className="truncate">{display}</span></div>{href && (- <ChartActivity2 className="size-3.5 shrink-0 transition-all group-hover:-translate-x-3 group-hover:opacity-0" />+ <ChartActivity2+ className={cn(+ "size-3.5 shrink-0 transition-all",+ hideChartActivityOnHover &&+ "group-hover:-translate-x-3 group-hover:opacity-0",+ )}+ />)}</Wrapper>);diff --git a/apps/web/ui/customers/customer-table/customer-table.tsx b/apps/web/ui/customers/customer-table/customer-table.tsxindex d22f72c820..b5f4a44dac 100644--- a/apps/web/ui/customers/customer-table/customer-table.tsx+++ b/apps/web/ui/customers/customer-table/customer-table.tsx@@ -32,7 +32,6 @@ import {fetcher,formatDate,getPrettyUrl,- isClickOnInteractiveChild,} from "@dub/utils";import { Cell, Row } from "@tanstack/react-table";import { Command } from "cmdk";@@ -58,7 +57,6 @@ export function CustomerTable() {const { canManageCustomers } = getPlanCapabilities(plan);const { queryParams, searchParams, getQueryString } = useRouterStuff();- const router = useRouter();const sortBy = searchParams.get("sortBy") || "createdAt";const sortOrder = searchParams.get("sortOrder") === "asc" ? "asc" : "desc";@@ -109,7 +107,13 @@ export function CustomerTable() {enableHiding: false,minSize: 250,cell: ({ row }) => {- return <CustomerRowItem customer={row.original} />;+ return (+ <CustomerRowItem+ customer={row.original}+ href={`/${workspaceSlug}/customers/${row.original.id}`}+ hideChartActivityOnHover={false}+ />+ );},},{@@ -159,7 +163,7 @@ export function CustomerTable() {},{id: "createdAt",- header: "Created date",+ header: "Created",accessorFn: (d) => formatDate(d.createdAt, { month: "short" }),},{@@ -176,7 +180,7 @@ export function CustomerTable() {<Linkhref={`/${workspaceSlug}/links/${row.original.link.domain}/${row.original.link.key}`}target="_blank"- className="flex items-center gap-3 decoration-dotted underline-offset-2 hover:underline"+ className="flex cursor-alias items-center gap-3 decoration-dotted underline-offset-2 hover:underline"><LinkLogoapexDomain={row.original.link.domain}@@ -227,22 +231,6 @@ export function CustomerTable() {const { table, ...tableProps } = useTable({data: canManageCustomers ? customers || [] : EXAMPLE_CUSTOMER_DATA,columns,- rowProps: (row) => {- const href = `/${workspaceSlug}/customers/${row.original.id}`;- return {- className: "cursor-pointer select-none",- onMouseEnter: () => router.prefetch(href),- onClick: (e) => {- if (isClickOnInteractiveChild(e)) return;- if (e.metaKey || e.ctrlKey) window.open(href, "_blank");- else router.push(href);- },- onAuxClick: (e) => {- if (isClickOnInteractiveChild(e)) return;- window.open(href, "_blank");- },- };- },pagination,onPaginationChange: setPagination,columnVisibility,@@ -269,8 +257,7 @@ export function CustomerTable() {);},thClassName: "border-l-0",- tdClassName:- "border-l-0 group-hover/row:bg-bg-muted transition-colors duration-75",+ tdClassName: "border-l-0",resourceName: (p) => `customer${p ? "s" : ""}`,rowCount: customersCount || 0,loading: isLoading,