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.

final fixes

Steven Teyeabfa4ef3ef3
diff --git a/apps/web/app/api/customers/count/route.ts b/apps/web/app/api/customers/count/route.ts
index 7ee97e6c9d..23714cb236 100644
--- a/apps/web/app/api/customers/count/route.ts
+++ b/apps/web/app/api/customers/count/route.ts
@@ -68,14 +68,19 @@ export const GET = withWorkspace(async ({ workspace, searchParams }) => {
select: {
id: true,
shortLink: true,
+ url: true,
},
});
return NextResponse.json(
- data.map(({ linkId }) => ({
- ...data.find(({ linkId: id }) => id === linkId)!,
- shortLink: links.find(({ id }) => id === linkId)?.shortLink,
- })),
+ data.map((d) => {
+ const link = links.find(({ id }) => id === d.linkId);
+ return {
+ ...d,
+ shortLink: link?.shortLink,
+ url: link?.url,
+ };
+ }),
);
}
diff --git a/apps/web/ui/customers/customer-table/use-customer-filters.tsx b/apps/web/ui/customers/customer-table/use-customer-filters.tsx
index 48b2666d0d..049b8f67e7 100644
--- a/apps/web/ui/customers/customer-table/use-customer-filters.tsx
+++ b/apps/web/ui/customers/customer-table/use-customer-filters.tsx
@@ -1,8 +1,8 @@
import useCustomersCount from "@/lib/swr/use-customers-count";
import useWorkspace from "@/lib/swr/use-workspace";
-import { useRouterStuff } from "@dub/ui";
+import { LinkLogo, useRouterStuff } from "@dub/ui";
import { FlagWavy, Hyperlink } from "@dub/ui/icons";
-import { COUNTRIES, getPrettyUrl, nFormatter } from "@dub/utils";
+import { COUNTRIES, getApexDomain, getPrettyUrl, nFormatter } from "@dub/utils";
import { useCallback, useMemo } from "react";
export function useCustomerFilters(
@@ -29,6 +29,7 @@ export function useCustomerFilters(
| {
linkId: string;
shortLink: string;
+ url: string;
_count: number;
}[]
| undefined
@@ -72,12 +73,19 @@ export function useCustomerFilters(
key: "linkId",
icon: Hyperlink,
label: "Referral link",
+ getOptionIcon: (_value, props) => (
+ <LinkLogo
+ apexDomain={getApexDomain(props.option?.data?.url)}
+ className="size-4 shrink-0 sm:size-4"
+ />
+ ),
options:
- linksCount?.map(({ linkId, shortLink, _count }) => ({
+ linksCount?.map(({ linkId, shortLink, url, _count }) => ({
value: linkId,
label: getPrettyUrl(shortLink),
right: nFormatter(_count, { full: true }),
permalink: `/${slug}/links/${getPrettyUrl(shortLink)}`,
+ data: { url },
})) ?? [],
meta: {
filterParams: ({ getValue }) => ({