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.

fixed stuff

Steven Teybb4c076006f9
diff --git a/apps/web/ui/stats/clicks.tsx b/apps/web/ui/stats/clicks.tsx
index 0ffd70e56d..0279ca35aa 100644
--- a/apps/web/ui/stats/clicks.tsx
+++ b/apps/web/ui/stats/clicks.tsx
@@ -10,14 +10,13 @@ import {
import { useContext } from "react";
import { StatsContext } from ".";
import BarChart from "./bar-chart";
-import { useSearchParams, useParams } from "next/navigation";
+import { useSearchParams } from "next/navigation";
import { X } from "lucide-react";
import { VALID_STATS_FILTERS } from "@/lib/stats";
import Link from "next/link";
export default function Clicks() {
const { totalClicks } = useContext(StatsContext);
- const { slug } = useParams() as { slug?: string };
const searchParams = useSearchParams();
const domain = searchParams?.get("domain");
const key = searchParams?.get("key");
diff --git a/apps/web/ui/stats/toggle.tsx b/apps/web/ui/stats/toggle.tsx
index d0e4d73d3a..8b92902468 100644
--- a/apps/web/ui/stats/toggle.tsx
+++ b/apps/web/ui/stats/toggle.tsx
@@ -150,16 +150,12 @@ export default function Toggle() {
) : (
<Link
key={value}
- href={`${basePath}?${
- isPublicStatsPage
- ? `interval=${value}`
- : `${new URLSearchParams({
- ...(domain && { domain }),
- ...(key && { key }),
- interval: value,
- }).toString()}`
- }`}
- scroll={false}
+ href={
+ queryParams({
+ set: { interval: value },
+ getNewPath: true,
+ }) as string
+ }
className="flex w-full items-center justify-between space-x-2 rounded-md p-2 hover:bg-gray-100 active:bg-gray-200"
>
<p className="text-sm">{display}</p>
diff --git a/apps/web/ui/stats/top-links.tsx b/apps/web/ui/stats/top-links.tsx
index 78f1fba1da..8abe24196e 100644
--- a/apps/web/ui/stats/top-links.tsx
+++ b/apps/web/ui/stats/top-links.tsx
@@ -12,7 +12,8 @@ import Link from "next/link";
export default function TopLinks() {
const [tab, setTab] = useState<TopLinksTabs>("link");
- const { baseApiPath, queryString, domain, key } = useContext(StatsContext);
+ const { basePath, baseApiPath, queryString, domain, key } =
+ useContext(StatsContext);
useEffect(() => {
if (domain && key) {
@@ -74,20 +75,22 @@ export default function TopLinks() {
Top {tab === "link" ? "Links" : "URLs"}
</h1>
{domain && key ? (
- <Link
- className="flex items-center space-x-1 rounded-lg border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-500 transition-all hover:bg-gray-100"
- href={
- queryParams({
- del: ["domain", "key"],
- getNewPath: true,
- }) as string
- }
- >
- <strong className="text-gray-800">
- {linkConstructor({ domain, key, pretty: true })}
- </strong>
- <X className="h-4 w-4" />
- </Link>
+ !basePath.startsWith("/stats") && (
+ <Link
+ className="flex items-center space-x-1 rounded-lg border border-gray-200 bg-gray-50 px-3 py-1 text-sm text-gray-500 transition-all hover:bg-gray-100"
+ href={
+ queryParams({
+ del: ["domain", "key"],
+ getNewPath: true,
+ }) as string
+ }
+ >
+ <strong className="text-gray-800">
+ {linkConstructor({ domain, key, pretty: true })}
+ </strong>
+ <X className="h-4 w-4" />
+ </Link>
+ )
) : (
<Link
href={