The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
changed name and added lock icon
Steven Teya07de4105bce
diff --git a/components/stats/toggle.tsx b/components/stats/toggle.tsxindex 40d02b78ef..5fda79388f 100644--- a/components/stats/toggle.tsx+++ b/components/stats/toggle.tsx@@ -21,6 +21,7 @@ import { StatsContext } from ".";import useProject from "@/lib/swr/use-project";import Tooltip, { TooltipContent } from "#/ui/tooltip";import { ModalContext } from "#/ui/modal-provider";+import { Lock } from "lucide-react";export default function Toggle({ atModalTop }: { atModalTop?: boolean }) {const router = useRouter();@@ -62,14 +63,15 @@ export default function Toggle({ atModalTop }: { atModalTop?: boolean }) {content={<div className="w-full p-2 md:w-48">{INTERVALS.map(({ display, slug }) =>- slug === "eternity" && (!plan || plan === "free") ? (+ (slug === "all" || slug === "90d") &&+ (!plan || plan === "free") ? (<Tooltipcontent={<TooltipContenttitle={projectSlug- ? "All-time stats can only be viewed on a Pro plan or higher. Upgrade now to view all-time stats."- : "All-time stats can only be viewed on a project with a Pro plan. Create a project or navigate to an existing project to upgrade."+ ? `${display} stats can only be viewed on a Pro plan or higher. Upgrade now to view all-time stats.`+ : `${display} stats can only be viewed on a project with a Pro plan. Create a project or navigate to an existing project to upgrade.`}cta={projectSlug ? "Upgrade to Pro" : "Create Project"@@ -86,7 +88,8 @@ export default function Toggle({ atModalTop }: { atModalTop?: boolean }) {}><div className="flex w-full cursor-not-allowed items-center justify-between space-x-2 rounded-md p-2 text-sm text-gray-400">- {display}+ <p>{display}</p>+ <Lock className="h-4 w-4" aria-hidden="true" /></div></Tooltip>) : (diff --git a/lib/constants/index.ts b/lib/constants/index.tsindex 8bcf065b8a..cfe40c61b9 100644--- a/lib/constants/index.ts+++ b/lib/constants/index.ts@@ -30,7 +30,7 @@ export const INTERVALS = [},{display: "All Time",- slug: "eternity",+ slug: "all",},];diff --git a/lib/stats.ts b/lib/stats.tsindex 47ffe6d1a0..ac5abecb0c 100644--- a/lib/stats.ts+++ b/lib/stats.ts@@ -1,6 +1,6 @@import { conn } from "./planetscale";-export type IntervalProps = "1h" | "24h" | "7d" | "30d" | "90d" | "eternity";+export type IntervalProps = "1h" | "24h" | "7d" | "30d" | "90d" | "all";export const intervalData = {"1h": {@@ -56,7 +56,7 @@ export const intervalData = {day: "numeric",}),},- eternity: {+ all: {// difference between now and Sep 22, 2022milliseconds: Date.now() - new Date("2022-09-22").getTime(),interval: 2629746000,diff --git a/pages/api/links/[key]/stats/[endpoint].ts b/pages/api/links/[key]/stats/[endpoint].tsindex af63fa665f..25dc5a323f 100644--- a/pages/api/links/[key]/stats/[endpoint].ts+++ b/pages/api/links/[key]/stats/[endpoint].ts@@ -11,7 +11,10 @@ export default withLinksAuth(interval: IntervalProps;};- if (interval === "eternity" && (!project || project.plan === "free")) {+ if (+ (interval === "all" || interval === "90d") &&+ (!project || project.plan === "free")+ ) {return res.status(403).end("Forbidden: Require higher plan");}