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.

Check apex domains in link bar lists

Snazzahd0c35939b5b2
diff --git a/apps/web/ui/analytics/bar-list.tsx b/apps/web/ui/analytics/bar-list.tsx
index 05d83003b1..cdb7ae4d63 100644
--- a/apps/web/ui/analytics/bar-list.tsx
+++ b/apps/web/ui/analytics/bar-list.tsx
@@ -160,13 +160,14 @@ export function LineItem({
const { queryParams } = useRouterStuff();
const lineItem = useMemo(() => {
+ const apexDomain = tab === "link" ? data ? getApexDomain(data.url) : null : getApexDomain(title);
return (
<div className="z-10 flex items-center space-x-2 px-2">
- {tab === "link" ? (
+ {tab === "link" && apexDomain ? (
data ? (
<BlurImage
- src={`${GOOGLE_FAVICON_URL}${getApexDomain(data.url)}`}
- alt={getApexDomain(data.url)}
+ src={`${GOOGLE_FAVICON_URL}${apexDomain}`}
+ alt={apexDomain}
className="h-5 w-5 rounded-full"
width={20}
height={20}
@@ -174,10 +175,10 @@ export function LineItem({
) : (
<div className="h-5 w-5 animate-pulse rounded-full bg-gray-100" />
)
- ) : tab === "url" ? (
+ ) : tab === "url" && apexDomain ? (
<BlurImage
- src={`${GOOGLE_FAVICON_URL}${getApexDomain(title)}`}
- alt={getApexDomain(title)}
+ src={`${GOOGLE_FAVICON_URL}${apexDomain}`}
+ alt={apexDomain}
className="h-5 w-5 rounded-full"
width={20}
height={20}
diff --git a/apps/web/ui/analytics/top-links.tsx b/apps/web/ui/analytics/top-links.tsx
index 2b41798781..d78d0fa8d5 100644
--- a/apps/web/ui/analytics/top-links.tsx
+++ b/apps/web/ui/analytics/top-links.tsx
@@ -1,7 +1,7 @@
import { TopLinksTabs } from "@/lib/analytics";
import { LoadingSpinner, Modal, Switch, useRouterStuff } from "@dub/ui";
import { fetcher, linkConstructor } from "@dub/utils";
-import { Maximize, X } from "lucide-react";
+import { Link2, Maximize, X } from "lucide-react";
import Link from "next/link";
import { useSearchParams } from "next/navigation";
import { useContext, useEffect, useState } from "react";
@@ -39,7 +39,7 @@ export default function TopLinks() {
tab={tab}
data={
data?.map((d) => ({
- icon: null,
+ icon: <Link2 className="h-4 w-4" />,
title: d[tab],
href: queryParams({
set: {