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 detail column, FilterButtonTableRow

Steven Tey673e7f9a6a6c
diff --git a/apps/web/ui/customers/customer-details-column.tsx b/apps/web/ui/customers/customer-details-column.tsx
index 7ba78bebcd..e6bf4e8fdd 100644
--- a/apps/web/ui/customers/customer-details-column.tsx
+++ b/apps/web/ui/customers/customer-details-column.tsx
@@ -1,5 +1,10 @@
import { CustomerActivityResponse, CustomerProps } from "@/lib/types";
-import { CopyButton, TimestampTooltip, UTM_PARAMETERS } from "@dub/ui";
+import {
+ CopyButton,
+ CopyText,
+ TimestampTooltip,
+ UTM_PARAMETERS,
+} from "@dub/ui";
import {
capitalize,
cn,
@@ -106,7 +111,11 @@ export function CustomerDetailsColumn({
.map(({ key, icon, value }) => (
<ConditionalLink
key={key}
- href={`/${programSlug ? `programs/${programSlug}` : slug}/analytics?${key}=${encodeURIComponent(value)}`}
+ href={
+ value === "Unknown"
+ ? undefined
+ : `/${programSlug ? `programs/${programSlug}` : slug}/analytics?${key}=${encodeURIComponent(value)}`
+ }
target="_blank"
>
<span className="flex items-center gap-2">
@@ -146,7 +155,9 @@ export function CustomerDetailsColumn({
<DetailHeading>External ID</DetailHeading>
{
<div className="flex items-center gap-1">
- <span className="truncate">{customer.externalId}</span>
+ <CopyText value={customer.externalId} className="truncate">
+ {customer.externalId}
+ </CopyText>
<CopyButton
value={customer.externalId}
variant="neutral"
diff --git a/apps/web/ui/customers/customer-table/customer-table.tsx b/apps/web/ui/customers/customer-table/customer-table.tsx
index 35598cdb54..054d32dc82 100644
--- a/apps/web/ui/customers/customer-table/customer-table.tsx
+++ b/apps/web/ui/customers/customer-table/customer-table.tsx
@@ -131,9 +131,12 @@ export function CustomerTable() {
header: "Country",
accessorKey: "country",
meta: {
- filterParams: ({ getValue }) => ({
- country: getValue(),
- }),
+ filterParams: ({ getValue }) =>
+ getValue()
+ ? {
+ country: getValue(),
+ }
+ : undefined,
},
minSize: 150,
cell: ({ row }) => {
@@ -190,10 +193,8 @@ export function CustomerTable() {
header: "Link",
accessorKey: "link",
meta: {
- filterParams: ({ getValue }) => {
- const link = getValue();
- return link ? { linkId: link.id } : undefined;
- },
+ filterParams: ({ getValue }) =>
+ getValue() ? { linkId: getValue().id } : undefined,
},
cell: ({ row }) =>
row.original.link ? (
diff --git a/apps/web/ui/shared/filter-button-table-row.tsx b/apps/web/ui/shared/filter-button-table-row.tsx
index 90173f66c5..2c08662230 100644
--- a/apps/web/ui/shared/filter-button-table-row.tsx
+++ b/apps/web/ui/shared/filter-button-table-row.tsx
@@ -7,9 +7,11 @@ export function FilterButtonTableRow({
set,
className,
}: {
- set: Record<string, any>;
+ set?: Record<string, any>;
className?: string;
}) {
+ if (!set) return null;
+
const { queryParams } = useRouterStuff();
return (