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 the events table

Kiran K551d5bd23108
diff --git a/apps/web/lib/swr/use-customers-count.ts b/apps/web/lib/swr/use-customers-count.ts
index 1e79ede093..f5eeb0113d 100644
--- a/apps/web/lib/swr/use-customers-count.ts
+++ b/apps/web/lib/swr/use-customers-count.ts
@@ -6,7 +6,7 @@ export default function useCustomersCount() {
const { id: workspaceId } = useWorkspace();
const { data, error } = useSWR<number>(
- `/api/customers/count?workspaceId=${workspaceId}`,
+ workspaceId && `/api/customers/count?workspaceId=${workspaceId}`,
fetcher,
);
diff --git a/apps/web/ui/analytics/analytics-provider.tsx b/apps/web/ui/analytics/analytics-provider.tsx
index a6fef72d30..8b524e2458 100644
--- a/apps/web/ui/analytics/analytics-provider.tsx
+++ b/apps/web/ui/analytics/analytics-provider.tsx
@@ -94,7 +94,7 @@ export default function AnalyticsProvider({
}>) {
const searchParams = useSearchParams();
const pathname = usePathname();
- const { id: workspaceId, slug, domains } = useWorkspace();
+ const { id: workspaceId, slug } = useWorkspace();
const [requiresUpgrade, setRequiresUpgrade] = useState(false);
diff --git a/apps/web/ui/analytics/events/events-table.tsx b/apps/web/ui/analytics/events/events-table.tsx
index 39e46f1cef..2943534b68 100644
--- a/apps/web/ui/analytics/events/events-table.tsx
+++ b/apps/web/ui/analytics/events/events-table.tsx
@@ -20,6 +20,7 @@ import {
COUNTRIES,
REGIONS,
capitalize,
+ cn,
currencyFormatter,
fetcher,
getApexDomain,
@@ -28,6 +29,7 @@ import {
import { Cell, ColumnDef } from "@tanstack/react-table";
import { Link2 } from "lucide-react";
import Link from "next/link";
+import { useParams } from "next/navigation";
import { ReactNode, useContext, useEffect, useMemo } from "react";
import useSWR from "swr";
import { AnalyticsContext } from "../analytics-provider";
@@ -63,8 +65,10 @@ export default function EventsTable({
queryString: originalQueryString,
eventsApiPath,
totalEvents,
+ partnerPage,
} = useContext(AnalyticsContext);
+ const { programSlug } = useParams<{ programSlug: string }>();
const { columnVisibility, setColumnVisibility } = useColumnVisibility();
const sortBy = searchParams.get("sortBy") || "timestamp";
@@ -132,21 +136,36 @@ export default function EventsTable({
key: getValue().key,
}),
},
- cell: ({ getValue }) => (
- <Link
- href={`/${slug}/links/${getValue().domain}/${getValue().key}`}
- target="_blank"
- className="flex cursor-alias items-center gap-3 decoration-dotted hover:underline"
- >
- <LinkLogo
- apexDomain={getApexDomain(getValue().url)}
- className="size-4 shrink-0 sm:size-4"
- />
- <span className="truncate" title={getValue().shortLink}>
- {getPrettyUrl(getValue().shortLink)}
- </span>
- </Link>
- ),
+ cell: ({ getValue }) => {
+ const content = (
+ <div
+ className={cn(
+ "flex items-center gap-3",
+ !partnerPage &&
+ "cursor-alias decoration-dotted hover:underline",
+ )}
+ >
+ <LinkLogo
+ apexDomain={getApexDomain(getValue().url)}
+ className="size-4 shrink-0 sm:size-4"
+ />
+ <span className="truncate" title={getValue().shortLink}>
+ {getPrettyUrl(getValue().shortLink)}
+ </span>
+ </div>
+ );
+
+ return partnerPage ? (
+ content
+ ) : (
+ <Link
+ href={`/${slug}/links/${getValue().domain}/${getValue().key}`}
+ target="_blank"
+ >
+ {content}
+ </Link>
+ );
+ },
},
{
id: "customer",
@@ -158,7 +177,11 @@ export default function EventsTable({
cell: ({ getValue }) => (
<CustomerRowItem
customer={getValue()}
- href={`/${slug}/customers/${getValue().id}`}
+ href={
+ partnerPage
+ ? `/programs/${programSlug}/customers/${getValue().id}`
+ : `/${slug}/customers/${getValue().id}`
+ }
className="px-4 py-2.5"
/>
),
@@ -460,7 +483,7 @@ export default function EventsTable({
minSize: col.minSize || 100,
maxSize: col.maxSize || 1000,
})),
- [tab],
+ [tab, partnerPage],
);
const { pagination, setPagination } = usePagination();