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.

Revert back to Link Type filter

Steven Tey8754b5c7b7f9
diff --git a/apps/web/ui/analytics/top-links.tsx b/apps/web/ui/analytics/top-links.tsx
index 18546b93ef..c01c32ee81 100644
--- a/apps/web/ui/analytics/top-links.tsx
+++ b/apps/web/ui/analytics/top-links.tsx
@@ -1,6 +1,6 @@
import { LinkLogo, useRouterStuff } from "@dub/ui";
import { getApexDomain } from "@dub/utils";
-import { useContext, useState } from "react";
+import { useContext } from "react";
import { AnalyticsCard } from "./analytics-card";
import { AnalyticsLoadingSpinner } from "./analytics-loading-spinner";
import { AnalyticsContext } from "./analytics-provider";
@@ -10,15 +10,11 @@ import { useAnalyticsFilterOption } from "./utils";
export default function TopLinks() {
const { queryParams } = useRouterStuff();
- const [selectedTabId, setSelectedTabId] = useState<"links" | "domains">(
- "links",
- );
const { domain, key } = useContext(AnalyticsContext);
const showUrls = domain && key;
const data = useAnalyticsFilterOption({
groupBy: `top_${showUrls ? "urls" : "links"}`,
- root: selectedTabId === "domains" ? "true" : "false",
});
return (
@@ -26,17 +22,11 @@ export default function TopLinks() {
tabs={
showUrls
? [{ id: "urls", label: "URLs" }]
- : [
- { id: "links", label: "Links" },
- { id: "domains", label: "Domains" },
- ]
+ : [{ id: "links", label: "Links" }]
}
expandLimit={8}
hasMore={(data?.length ?? 0) > 8}
- selectedTabId={showUrls ? "urls" : selectedTabId}
- onSelectTab={(tabId: "links" | "domains") =>
- showUrls ? null : setSelectedTabId(tabId)
- }
+ selectedTabId={showUrls ? "urls" : "links"}
>
{({ limit, setShowModal }) =>
data ? (