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.

add customer to leads table

Steven Teya8458a12b6fb
diff --git a/apps/web/app/inspect/[domain]/[key]/card.tsx b/apps/web/app/inspect/[domain]/[key]/card.tsx
index f849e78260..ae85d34f06 100644
--- a/apps/web/app/inspect/[domain]/[key]/card.tsx
+++ b/apps/web/app/inspect/[domain]/[key]/card.tsx
@@ -1,5 +1,4 @@
-import LinkLogo from "@/ui/links/link-logo";
-import { CopyButton } from "@dub/ui";
+import { CopyButton, LinkLogo } from "@dub/ui";
import { getApexDomain, linkConstructor } from "@dub/utils";
import Script from "next/script";
import ReportButton from "./report";
diff --git a/apps/web/lib/analytics/get-events.ts b/apps/web/lib/analytics/get-events.ts
index 6f2756b2dc..73d5512f31 100644
--- a/apps/web/lib/analytics/get-events.ts
+++ b/apps/web/lib/analytics/get-events.ts
@@ -55,5 +55,10 @@ export const getEvents = async (params: EventsFilters) => {
key: d.key,
url: d.url,
},
+ customer: {
+ name: d.customer_name,
+ email: d.customer_email,
+ avatar: d.customer_avatar,
+ },
}));
};
diff --git a/apps/web/ui/analytics/events/events-table.tsx b/apps/web/ui/analytics/events/events-table.tsx
index 7499827adc..fbf099cbce 100644
--- a/apps/web/ui/analytics/events/events-table.tsx
+++ b/apps/web/ui/analytics/events/events-table.tsx
@@ -24,13 +24,12 @@ import {
} from "@dub/utils";
import {
ColumnDef,
- VisibilityState,
flexRender,
getCoreRowModel,
useReactTable,
} from "@tanstack/react-table";
import { AnimatePresence, motion } from "framer-motion";
-import { useContext, useEffect, useMemo, useState } from "react";
+import { useContext, useMemo } from "react";
import useSWR from "swr";
import z from "zod";
import { AnalyticsContext } from "../analytics-provider";
@@ -57,8 +56,15 @@ const eventColumns: Record<
defaultVisible: ["trigger", "link", "country", "device", "timestamp"],
},
leads: {
- all: ["event", "link", "country", "device", "timestamp"],
- defaultVisible: ["event", "link", "country", "device", "timestamp"],
+ all: ["event", "link", "customer", "country", "device", "timestamp"],
+ defaultVisible: [
+ "event",
+ "link",
+ "customer",
+ "country",
+ "device",
+ "timestamp",
+ ],
},
sales: {
all: ["saleType", "link", "country", "device", "amount", "timestamp"],
@@ -129,6 +135,24 @@ export default function EventsTable() {
</div>
),
},
+ {
+ id: "customer",
+ header: "Customer",
+ accessorKey: "customer",
+ cell: ({ getValue }) => {
+ const display = getValue().name || getValue().email;
+ return (
+ <div className="flex items-center gap-3">
+ <img
+ alt={display}
+ src={getValue().avatar}
+ className="h-4 w-4 rounded-full"
+ />
+ <span>{display}</span>
+ </div>
+ );
+ },
+ },
{
id: "country",
header: "Country",
@@ -137,8 +161,8 @@ export default function EventsTable() {
<div className="flex items-center gap-3">
<img
alt={getValue()}
- src={`https://flag.vercel.app/m/${getValue()}.svg`}
- className="h-2.5 w-4"
+ src={`https://hatscripts.github.io/circle-flags/flags/${getValue().toLowerCase()}.svg`}
+ className="h-4 w-4"
/>
<span>{COUNTRIES[getValue()] ?? getValue()}</span>
</div>
@@ -220,6 +244,8 @@ export default function EventsTable() {
},
);
+ console.log({ data });
+
const table = useReactTable({
data: data ?? defaultData,
columns,
diff --git a/apps/web/ui/analytics/referer-icon.tsx b/apps/web/ui/analytics/referer-icon.tsx
index 7458a4042f..92a12fa2a7 100644
--- a/apps/web/ui/analytics/referer-icon.tsx
+++ b/apps/web/ui/analytics/referer-icon.tsx
@@ -1,6 +1,6 @@
+import { LinkLogo } from "@dub/ui";
import { cn } from "@dub/utils";
import { Link2 } from "lucide-react";
-import LinkLogo from "../links/link-logo";
export default function RefererIcon({
display,