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.

updated more stuff

Steven Tey6fca481ebfac
diff --git a/apps/web/app/[domain]/stats/[key]/page.tsx b/apps/web/app/[domain]/stats/[key]/page.tsx
index 99531aba42..6334b3fe7b 100644
--- a/apps/web/app/[domain]/stats/[key]/page.tsx
+++ b/apps/web/app/[domain]/stats/[key]/page.tsx
@@ -1,5 +1,5 @@
import { getDomainOrLink } from "@/lib/planetscale";
-import Stats from "@/ui/stats";
+import Stats from "@/ui/analytics";
import { constructMetadata } from "@dub/utils";
import { notFound } from "next/navigation";
import { Suspense } from "react";
diff --git a/apps/web/app/api/analytics/[endpoint]/route.ts b/apps/web/app/api/analytics/[endpoint]/route.ts
index 1f80ab52ed..fae3274ef2 100644
--- a/apps/web/app/api/analytics/[endpoint]/route.ts
+++ b/apps/web/app/api/analytics/[endpoint]/route.ts
@@ -1,9 +1,9 @@
+import { getAnalytics } from "@/lib/analytics";
import { withAuth } from "@/lib/auth";
import { getDomainViaEdge } from "@/lib/planetscale";
-import { getStats } from "@/lib/stats";
import { NextResponse } from "next/server";
-// GET /api/analytics/[endpoint] – get stats for a specific endpoint
+// GET /api/analytics/[endpoint] – get analytics for a specific endpoint
export const GET = withAuth(
async ({ params, searchParams, project, link }) => {
const { endpoint } = params;
@@ -20,10 +20,10 @@ export const GET = withAuth(
const linkId = link
? link.id
: domain && key === "_root"
- ? await getDomainViaEdge(domain).then((d) => d?.id)
- : null;
+ ? await getDomainViaEdge(domain).then((d) => d?.id)
+ : null;
- const response = await getStats({
+ const response = await getAnalytics({
projectId: project.id,
...(linkId && { linkId }),
domain,
diff --git a/apps/web/app/api/analytics/edge/[endpoint]/route.ts b/apps/web/app/api/analytics/edge/[endpoint]/route.ts
index 8a339a9830..f75134b814 100644
--- a/apps/web/app/api/analytics/edge/[endpoint]/route.ts
+++ b/apps/web/app/api/analytics/edge/[endpoint]/route.ts
@@ -1,7 +1,7 @@
+import { getAnalytics } from "@/lib/analytics";
import { exceededLimitError } from "@/lib/api/errors";
import { isBlacklistedReferrer } from "@/lib/edge-config";
import { getDomainOrLink, getProjectViaEdge } from "@/lib/planetscale";
-import { getStats } from "@/lib/stats";
import { ratelimit } from "@/lib/upstash";
import {
DEMO_LINK_ID,
@@ -50,7 +50,7 @@ export const GET = async (
link = await getDomainOrLink({ domain, key });
// if the link is explicitly private (publicStats === false)
if (!link?.publicStats) {
- return new Response(`Stats for this link are not public`, {
+ return new Response(`Analytics for this link are not public`, {
status: 403,
});
}
@@ -74,7 +74,7 @@ export const GET = async (
}
}
- const response = await getStats({
+ const response = await getAnalytics({
// projectId can be undefined (for public links that haven't been claimed/synced to a project)
...(link.projectId && { projectId: link.projectId }),
linkId: link.id,
diff --git a/apps/web/app/api/analytics/route.ts b/apps/web/app/api/analytics/route.ts
index 58dbfc278c..84e82dc61f 100644
--- a/apps/web/app/api/analytics/route.ts
+++ b/apps/web/app/api/analytics/route.ts
@@ -3,7 +3,7 @@ import { getDomainOrLink } from "@/lib/planetscale";
import prisma from "@/lib/prisma";
import { NextResponse } from "next/server";
-// GET /api/stats – get the publicStats setting for a link
+// GET /api/analytics – get the publicStats setting for a link
export const GET = withAuth(async ({ searchParams }) => {
const { domain, key } = searchParams;
if (!domain || !key) {
@@ -13,7 +13,7 @@ export const GET = withAuth(async ({ searchParams }) => {
return NextResponse.json(response);
});
-// PUT /api/stats – update the publicStats setting for a link
+// PUT /api/analytics – update the publicStats setting for a link
export const PUT = withAuth(async ({ req, searchParams }) => {
const { domain, key } = searchParams;
if (!domain || !key) {
diff --git a/apps/web/app/api/cron/links/event/route.ts b/apps/web/app/api/cron/links/event/route.ts
index 53d2992dd1..2b04926d4c 100644
--- a/apps/web/app/api/cron/links/event/route.ts
+++ b/apps/web/app/api/cron/links/event/route.ts
@@ -1,6 +1,6 @@
+import { getAnalytics } from "@/lib/analytics";
import { limiter, qstash, receiver } from "@/lib/cron";
import prisma from "@/lib/prisma";
-import { getStats } from "@/lib/stats";
import { recordLink } from "@/lib/tinybird";
import { ProjectProps } from "@/lib/types";
import { formatRedisLink, redis } from "@/lib/upstash";
@@ -139,7 +139,7 @@ export async function POST(req: Request) {
`transfer:${linkId}:oldProjectId`,
);
- const linkClicks = await getStats({
+ const linkClicks = await getAnalytics({
linkId,
endpoint: "clicks",
interval: "30d",
diff --git a/apps/web/app/api/cron/usage/utils.ts b/apps/web/app/api/cron/usage/utils.ts
index aad4a82322..9f8931c114 100644
--- a/apps/web/app/api/cron/usage/utils.ts
+++ b/apps/web/app/api/cron/usage/utils.ts
@@ -1,6 +1,6 @@
+import { getAnalytics } from "@/lib/analytics";
import { limiter, qstash } from "@/lib/cron";
import prisma from "@/lib/prisma";
-import { getStats } from "@/lib/stats";
import { ProjectProps } from "@/lib/types";
import {
APP_DOMAIN_WITH_NGROK,
@@ -120,7 +120,7 @@ export const updateUsage = async (skip?: number) => {
) {
const topLinks =
project.usage > 0
- ? await getStats({
+ ? await getAnalytics({
projectId: project.id,
endpoint: "top_links",
interval: "30d",
@@ -195,10 +195,10 @@ export const updateUsage = async (skip?: number) => {
plan === "free"
? usage < usageLimit * 2
: plan === "pro"
- ? usage < usageLimit * 1.5
- : plan === "business"
- ? usage < usageLimit * 1.2
- : true;
+ ? usage < usageLimit * 1.5
+ : plan === "business"
+ ? usage < usageLimit * 1.2
+ : true;
return await prisma.project.update({
where: {
diff --git a/apps/web/app/api/og/analytics/route.tsx b/apps/web/app/api/og/analytics/route.tsx
index 14e0966685..3fa90f34b8 100644
--- a/apps/web/app/api/og/analytics/route.tsx
+++ b/apps/web/app/api/og/analytics/route.tsx
@@ -1,5 +1,5 @@
+import { getAnalytics } from "@/lib/analytics";
import { getDomainOrLink } from "@/lib/planetscale";
-import { getStats } from "@/lib/stats";
import { DUB_LOGO, nFormatter, truncate } from "@dub/utils";
import { ImageResponse } from "next/og";
import { NextRequest } from "next/server";
@@ -30,7 +30,7 @@ export async function GET(req: NextRequest) {
});
}
- const timeseries = await getStats({
+ const timeseries = await getAnalytics({
// projectId can be undefined (for public links that haven't been claimed/synced to a project)
...(link.projectId && { projectId: link.projectId }),
linkId: link.id,
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/page.tsx
index 806f155c81..c90ed71088 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/analytics/page.tsx
@@ -1,5 +1,5 @@
+import Stats from "@/ui/analytics";
import LayoutLoader from "@/ui/layout/layout-loader";
-import Stats from "@/ui/stats";
import { Suspense } from "react";
import AnalyticsClient from "./client";
diff --git a/apps/web/lib/stats.ts b/apps/web/lib/analytics.ts
similarity index 95%
rename from apps/web/lib/stats.ts
rename to apps/web/lib/analytics.ts
index 5b807760c7..029f8bc94f 100644
--- a/apps/web/lib/stats.ts
+++ b/apps/web/lib/analytics.ts
@@ -75,7 +75,7 @@ const VALID_TINYBIRD_ENDPOINTS = [
"referer",
];
-export const VALID_STATS_FILTERS = [
+export const VALID_ANALYTICS_FILTERS = [
"country",
"city",
"url",
@@ -87,7 +87,7 @@ export const VALID_STATS_FILTERS = [
"excludeRoot",
];
-export const getStats = async ({
+export const getAnalytics = async ({
projectId,
linkId,
domain,
@@ -101,7 +101,7 @@ export const getStats = async ({
endpoint: string;
interval?: string;
} & {
- [key in typeof VALID_STATS_FILTERS[number]]: string;
+ [key in (typeof VALID_ANALYTICS_FILTERS)[number]]: string;
}) => {
// Note: we're using decodeURIComponent in this function because that's how we store it in MySQL and Tinybird
@@ -160,7 +160,7 @@ export const getStats = async ({
url.searchParams.append("granularity", intervalData[interval].granularity);
}
- VALID_STATS_FILTERS.forEach((filter) => {
+ VALID_ANALYTICS_FILTERS.forEach((filter) => {
if (rest[filter]) {
url.searchParams.append(filter, rest[filter]);
}
diff --git a/apps/web/scripts/download-top-links.ts b/apps/web/scripts/download-top-links.ts
index cfff9cd918..50f55f8f39 100644
--- a/apps/web/scripts/download-top-links.ts
+++ b/apps/web/scripts/download-top-links.ts
@@ -1,12 +1,12 @@
+import { getAnalytics } from "@/lib/analytics";
import prisma from "@/lib/prisma";
-import { getStats } from "@/lib/stats";
import "dotenv-flow/config";
import * as fs from "fs";
import * as Papa from "papaparse";
import { linkConstructor } from "./utils";
async function main() {
- const topLinks = await getStats({
+ const topLinks = await getAnalytics({
projectId: "xxx",
endpoint: "top_links",
interval: "30d",
diff --git a/apps/web/scripts/get-top-links-for-project.ts b/apps/web/scripts/get-top-links-for-project.ts
index 96232026b4..acbc587e45 100644
--- a/apps/web/scripts/get-top-links-for-project.ts
+++ b/apps/web/scripts/get-top-links-for-project.ts
@@ -1,5 +1,5 @@
+import { getAnalytics } from "@/lib/analytics";
import prisma from "@/lib/prisma";
-import { getStats } from "@/lib/stats";
import "dotenv-flow/config";
import { linkConstructor } from "./utils";
@@ -34,7 +34,7 @@ async function main() {
console.log("No project found");
return;
}
- const topLinks = await getStats({
+ const topLinks = await getAnalytics({
projectId: project.id,
endpoint: "top_links",
interval: "30d",
diff --git a/apps/web/ui/stats/bar-chart.module.css b/apps/web/ui/analytics/bar-chart.module.css
similarity index 100%
rename from apps/web/ui/stats/bar-chart.module.css
rename to apps/web/ui/analytics/bar-chart.module.css
diff --git a/apps/web/ui/stats/bar-chart.tsx b/apps/web/ui/analytics/bar-chart.tsx
similarity index 98%
rename from apps/web/ui/stats/bar-chart.tsx
rename to apps/web/ui/analytics/bar-chart.tsx
index 45d6837ec2..f564f9def7 100644
--- a/apps/web/ui/stats/bar-chart.tsx
+++ b/apps/web/ui/analytics/bar-chart.tsx
@@ -8,7 +8,7 @@ import { useTooltip, useTooltipInPortal } from "@visx/tooltip";
import { motion } from "framer-motion";
import { useCallback, useContext, useMemo } from "react";
import useSWR from "swr";
-import { StatsContext } from ".";
+import { AnalyticsContext } from ".";
import styles from "./bar-chart.module.css";
const LEFT_AXIS_WIDTH = 30;
@@ -31,7 +31,7 @@ const rangeFormatter = (maxN: number): number => {
};
export default function BarChart() {
- const { baseApiPath, queryString, interval } = useContext(StatsContext);
+ const { baseApiPath, queryString, interval } = useContext(AnalyticsContext);
const { data } = useSWR<{ start: Date; clicks: number }[]>(
`${baseApiPath}/timeseries?${queryString}`,
diff --git a/apps/web/ui/stats/bar-list.tsx b/apps/web/ui/analytics/bar-list.tsx
similarity index 100%
rename from apps/web/ui/stats/bar-list.tsx
rename to apps/web/ui/analytics/bar-list.tsx
diff --git a/apps/web/ui/stats/clicks.tsx b/apps/web/ui/analytics/clicks.tsx
similarity index 94%
rename from apps/web/ui/stats/clicks.tsx
rename to apps/web/ui/analytics/clicks.tsx
index 0b9bc4ba96..559747ed59 100644
--- a/apps/web/ui/stats/clicks.tsx
+++ b/apps/web/ui/analytics/clicks.tsx
@@ -1,4 +1,4 @@
-import { VALID_STATS_FILTERS } from "@/lib/stats";
+import { VALID_ANALYTICS_FILTERS } from "@/lib/analytics";
import { Chart } from "@/ui/shared/icons";
import { NumberTooltip, useRouterStuff } from "@dub/ui";
import {
@@ -12,11 +12,11 @@ import { X } from "lucide-react";
import Link from "next/link";
import { useSearchParams } from "next/navigation";
import { useContext } from "react";
-import { StatsContext } from ".";
+import { AnalyticsContext } from ".";
import BarChart from "./bar-chart";
export default function Clicks() {
- const { totalClicks } = useContext(StatsContext);
+ const { totalClicks } = useContext(AnalyticsContext);
const searchParams = useSearchParams();
const domain = searchParams?.get("domain");
const key = searchParams?.get("key");
@@ -75,7 +75,7 @@ export default function Clicks() {
<X className="h-4 w-4" />
</Link>
))}
- {VALID_STATS_FILTERS.map((filter) => {
+ {VALID_ANALYTICS_FILTERS.map((filter) => {
const value = searchParams?.get(filter);
if (!value || filter === "excludeRoot") return null;
return (
diff --git a/apps/web/ui/stats/device-icon.tsx b/apps/web/ui/analytics/device-icon.tsx
similarity index 97%
rename from apps/web/ui/stats/device-icon.tsx
rename to apps/web/ui/analytics/device-icon.tsx
index c3c321215f..63427ad133 100644
--- a/apps/web/ui/stats/device-icon.tsx
+++ b/apps/web/ui/analytics/device-icon.tsx
@@ -1,4 +1,4 @@
-import { DeviceTabs } from "@/lib/stats";
+import { DeviceTabs } from "@/lib/analytics";
import { Apple, Chrome, Safari } from "@/ui/shared/icons/devices";
import { BlurImage } from "@dub/ui";
diff --git a/apps/web/ui/stats/devices.tsx b/apps/web/ui/analytics/devices.tsx
similarity index 95%
rename from apps/web/ui/stats/devices.tsx
rename to apps/web/ui/analytics/devices.tsx
index 62d29f4699..374894edb6 100644
--- a/apps/web/ui/stats/devices.tsx
+++ b/apps/web/ui/analytics/devices.tsx
@@ -1,17 +1,17 @@
-import { DeviceTabs } from "@/lib/stats";
+import { DeviceTabs } from "@/lib/analytics";
import { LoadingSpinner, Modal, TabSelect, useRouterStuff } from "@dub/ui";
import { fetcher } from "@dub/utils";
import { Maximize } from "lucide-react";
import { useContext, useState } from "react";
import useSWR from "swr";
-import { StatsContext } from ".";
+import { AnalyticsContext } from ".";
import BarList from "./bar-list";
import DeviceIcon from "./device-icon";
export default function Devices() {
const [tab, setTab] = useState<DeviceTabs>("device");
- const { baseApiPath, queryString } = useContext(StatsContext);
+ const { baseApiPath, queryString } = useContext(AnalyticsContext);
const { data } = useSWR<
({
diff --git a/apps/web/ui/stats/feedback/action.ts b/apps/web/ui/analytics/feedback/action.ts
similarity index 100%
rename from apps/web/ui/stats/feedback/action.ts
rename to apps/web/ui/analytics/feedback/action.ts
diff --git a/apps/web/ui/stats/feedback/index.tsx b/apps/web/ui/analytics/feedback/index.tsx
similarity index 100%
rename from apps/web/ui/stats/feedback/index.tsx
rename to apps/web/ui/analytics/feedback/index.tsx
diff --git a/apps/web/ui/stats/index.tsx b/apps/web/ui/analytics/index.tsx
similarity index 89%
rename from apps/web/ui/stats/index.tsx
rename to apps/web/ui/analytics/index.tsx
index aa93be6396..341f21f7c1 100644
--- a/apps/web/ui/stats/index.tsx
+++ b/apps/web/ui/analytics/index.tsx
@@ -8,7 +8,7 @@
We use the `useEndpoint()` hook to get the correct layout
*/
-import { VALID_STATS_FILTERS } from "@/lib/stats";
+import { VALID_ANALYTICS_FILTERS } from "@/lib/analytics";
import { fetcher } from "@dub/utils";
import { useParams, usePathname, useSearchParams } from "next/navigation";
import { createContext, useMemo } from "react";
@@ -20,7 +20,7 @@ import Referer from "./referer";
import Toggle from "./toggle";
import TopLinks from "./top-links";
-export const StatsContext = createContext<{
+export const AnalyticsContext = createContext<{
basePath: string;
baseApiPath: string;
domain?: string;
@@ -37,7 +37,7 @@ export const StatsContext = createContext<{
interval: "",
});
-export default function Stats({ staticDomain }: { staticDomain?: string }) {
+export default function Analytics({ staticDomain }: { staticDomain?: string }) {
const searchParams = useSearchParams();
const pathname = usePathname();
@@ -55,7 +55,7 @@ export default function Stats({ staticDomain }: { staticDomain?: string }) {
if (slug) {
return {
basePath: `/${slug}/analytics`,
- baseApiPath: `/api/projects/${slug}/stats`,
+ baseApiPath: `/api/analytics`,
domain: domainSlug,
};
} else {
@@ -69,7 +69,7 @@ export default function Stats({ staticDomain }: { staticDomain?: string }) {
}, [slug, pathname, staticDomain, domainSlug, key]);
const queryString = useMemo(() => {
- const availableFilterParams = VALID_STATS_FILTERS.reduce(
+ const availableFilterParams = VALID_ANALYTICS_FILTERS.reduce(
(acc, filter) => ({
...acc,
...(searchParams?.get(filter) && {
@@ -79,6 +79,7 @@ export default function Stats({ staticDomain }: { staticDomain?: string }) {
{},
);
return new URLSearchParams({
+ ...(slug && { projectSlug: slug }),
...(domain && { domain }),
...(key && { key }),
...availableFilterParams,
@@ -94,7 +95,7 @@ export default function Stats({ staticDomain }: { staticDomain?: string }) {
const isPublicStatsPage = basePath.startsWith("/stats");
return (
- <StatsContext.Provider
+ <AnalyticsContext.Provider
value={{
basePath, // basePath for the page (e.g. /stats/[key], /links/[key], /[slug]/[domain]/[key])
baseApiPath, // baseApiPath for the API (e.g. /api/links/[key]/stats)
@@ -118,6 +119,6 @@ export default function Stats({ staticDomain }: { staticDomain?: string }) {
</div>
</div>
</div>
- </StatsContext.Provider>
+ </AnalyticsContext.Provider>
);
}
diff --git a/apps/web/ui/stats/link-preview.tsx b/apps/web/ui/analytics/link-preview.tsx
similarity index 100%
rename from apps/web/ui/stats/link-preview.tsx
rename to apps/web/ui/analytics/link-preview.tsx
diff --git a/apps/web/ui/stats/locations.tsx b/apps/web/ui/analytics/locations.tsx
similarity index 95%
rename from apps/web/ui/stats/locations.tsx
rename to apps/web/ui/analytics/locations.tsx
index 059fd226d5..c2e2607e17 100644
--- a/apps/web/ui/stats/locations.tsx
+++ b/apps/web/ui/analytics/locations.tsx
@@ -1,16 +1,16 @@
-import { LocationTabs } from "@/lib/stats";
+import { LocationTabs } from "@/lib/analytics";
import { LoadingSpinner, Modal, TabSelect, useRouterStuff } from "@dub/ui";
import { COUNTRIES, fetcher } from "@dub/utils";
import { Maximize } from "lucide-react";
import { useContext, useState } from "react";
import useSWR from "swr";
-import { StatsContext } from ".";
+import { AnalyticsContext } from ".";
import BarList from "./bar-list";
export default function Locations() {
const [tab, setTab] = useState<LocationTabs>("country");
- const { baseApiPath, queryString } = useContext(StatsContext);
+ const { baseApiPath, queryString } = useContext(AnalyticsContext);
const { data } = useSWR<{ country: string; city: string; clicks: number }[]>(
`${baseApiPath}/${tab}?${queryString}`,
diff --git a/apps/web/ui/stats/referer.tsx b/apps/web/ui/analytics/referer.tsx
similarity index 96%
rename from apps/web/ui/stats/referer.tsx
rename to apps/web/ui/analytics/referer.tsx
index 30dbad96b2..53a4ef7ad9 100644
--- a/apps/web/ui/stats/referer.tsx
+++ b/apps/web/ui/analytics/referer.tsx
@@ -3,11 +3,11 @@ import { GOOGLE_FAVICON_URL, fetcher } from "@dub/utils";
import { Link2, Maximize } from "lucide-react";
import { useContext, useState } from "react";
import useSWR from "swr";
-import { StatsContext } from ".";
+import { AnalyticsContext } from ".";
import BarList from "./bar-list";
export default function Referer() {
- const { baseApiPath, queryString } = useContext(StatsContext);
+ const { baseApiPath, queryString } = useContext(AnalyticsContext);
const { data } = useSWR<{ referer: string; clicks: number }[]>(
`${baseApiPath}/referer?${queryString}`,
diff --git a/apps/web/ui/stats/toggle.tsx b/apps/web/ui/analytics/toggle.tsx
similarity index 98%
rename from apps/web/ui/stats/toggle.tsx
rename to apps/web/ui/analytics/toggle.tsx
index e43c246e68..43b505fa58 100644
--- a/apps/web/ui/stats/toggle.tsx
+++ b/apps/web/ui/analytics/toggle.tsx
@@ -1,4 +1,4 @@
-import { INTERVALS } from "@/lib/stats";
+import { INTERVALS } from "@/lib/analytics";
import useDomains from "@/lib/swr/use-domains";
import useProject from "@/lib/swr/use-project";
import { DomainProps } from "@/lib/types";
@@ -32,13 +32,13 @@ import { useParams, useSearchParams } from "next/navigation";
import punycode from "punycode/";
import { useContext, useMemo, useState } from "react";
import { toast } from "sonner";
-import { StatsContext } from ".";
+import { AnalyticsContext } from ".";
export default function Toggle() {
const { slug } = useParams() as { slug?: string };
const { queryParams } = useRouterStuff();
- const { basePath, domain, key, interval } = useContext(StatsContext);
+ const { basePath, domain, key, interval } = useContext(AnalyticsContext);
const [openDatePopover, setOpenDatePopover] = useState(false);
@@ -236,7 +236,7 @@ const SharePopover = () => {
const [openSharePopover, setopenSharePopoverPopover] = useState(false);
const { baseApiPath, queryString, domain, key } = useContext(
- StatsContext,
+ AnalyticsContext,
) as {
baseApiPath: string;
queryString: string;
diff --git a/apps/web/ui/stats/top-links.tsx b/apps/web/ui/analytics/top-links.tsx
similarity index 97%
rename from apps/web/ui/stats/top-links.tsx
rename to apps/web/ui/analytics/top-links.tsx
index 6c11f83817..2b41798781 100644
--- a/apps/web/ui/stats/top-links.tsx
+++ b/apps/web/ui/analytics/top-links.tsx
@@ -1,4 +1,4 @@
-import { TopLinksTabs } from "@/lib/stats";
+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";
@@ -6,14 +6,14 @@ import Link from "next/link";
import { useSearchParams } from "next/navigation";
import { useContext, useEffect, useState } from "react";
import useSWR from "swr";
-import { StatsContext } from ".";
+import { AnalyticsContext } from ".";
import BarList from "./bar-list";
export default function TopLinks() {
const [tab, setTab] = useState<TopLinksTabs>("link");
const { basePath, baseApiPath, queryString, domain, key } =
- useContext(StatsContext);
+ useContext(AnalyticsContext);
useEffect(() => {
if (domain && key) {