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.

update domain card

Steven Tey2e7023508701
diff --git a/apps/web/app/api/edge/stats/route.ts b/apps/web/app/api/edge/stats/route.ts
index c32dbc421a..48a60437cc 100644
--- a/apps/web/app/api/edge/stats/route.ts
+++ b/apps/web/app/api/edge/stats/route.ts
@@ -7,7 +7,7 @@ import { LOCALHOST_IP } from "@dub/utils";
import { ipAddress } from "@vercel/edge";
import { NextResponse, type NextRequest } from "next/server";
-// switch to 'edge' after https://github.com/vercel/next.js/issues/48295 is fixed
+// TODO: switch to 'edge' after https://github.com/vercel/next.js/issues/48295 is fixed
export const runtime = "nodejs";
export const GET = async (req: NextRequest) => {
diff --git a/apps/web/ui/domains/domain-card.tsx b/apps/web/ui/domains/domain-card.tsx
index ea005df436..49b111711c 100644
--- a/apps/web/ui/domains/domain-card.tsx
+++ b/apps/web/ui/domains/domain-card.tsx
@@ -60,7 +60,7 @@ export default function DomainCard({ props }: { props: DomainProps }) {
</a>
<NumberTooltip value={clicks}>
<Link
- href={`/${slug}/${domain}`}
+ href={`/${slug}/analytics?domain=${domain}`}
className="flex items-center space-x-1 rounded-md bg-gray-100 px-2 py-0.5 transition-all duration-75 hover:scale-105 active:scale-100"
>
<Chart className="h-4 w-4" />
diff --git a/apps/web/ui/stats/index.tsx b/apps/web/ui/stats/index.tsx
index 020f11fd73..73c789728c 100644
--- a/apps/web/ui/stats/index.tsx
+++ b/apps/web/ui/stats/index.tsx
@@ -24,6 +24,7 @@ import Toggle from "./toggle";
import Feedback from "./feedback";
import useSWR from "swr";
import { fetcher } from "@dub/utils";
+import useDomains from "@/lib/swr/use-domains";
export const StatsContext = createContext<{
basePath: string;
@@ -57,7 +58,7 @@ export default function Stats({
const pathname = usePathname();
const router = useRouter();
- let { slug, key } = useParams() as {
+ let { slug, key = "_root" } = useParams() as {
slug?: string;
key?: string;
};
diff --git a/apps/web/ui/stats/toggle.tsx b/apps/web/ui/stats/toggle.tsx
index b27284ef7a..1d15ff6335 100644
--- a/apps/web/ui/stats/toggle.tsx
+++ b/apps/web/ui/stats/toggle.tsx
@@ -56,7 +56,7 @@ export default function Toggle() {
>
{linkConstructor({
key,
- domain: punycode.toUnicode(domain),
+ domain: domain ? punycode.toUnicode(domain) : undefined,
pretty: true,
})}
<ExpandingArrow className="h-5 w-5" />