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.

SWR FTW

Steven Tey1d5240d8ccce
diff --git a/components/shared/modal.tsx b/components/shared/modal.tsx
index c13f402de3..e112fee904 100644
--- a/components/shared/modal.tsx
+++ b/components/shared/modal.tsx
@@ -35,6 +35,9 @@ export default function Modal({
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
+ leave="ease-in duration-200"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
>
<Dialog.Overlay className="fixed inset-0 bg-gray-100 dark:bg-black bg-opacity-10 backdrop-blur dark:backdrop-blur-none" />
</Transition.Child>
@@ -50,6 +53,9 @@ export default function Modal({
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
+ leave="ease-in duration-200"
+ leaveFrom="opacity-100 scale-100"
+ leaveTo="opacity-0 scale-95"
>
{children}
</Transition.Child>
diff --git a/components/stats/charts/bar.tsx b/components/stats/charts/bar.tsx
index 7a9a9e8de4..3f7a9f8c42 100644
--- a/components/stats/charts/bar.tsx
+++ b/components/stats/charts/bar.tsx
@@ -100,9 +100,11 @@ const BarChart = ({
scale={yScale}
tickFormat={(d) => nFormatter(d as number)}
tickLabelProps={() => ({
- fill: isValidating ? "transparent" : "#666666",
+ fill: "#666666",
+ filter: isValidating ? "blur(8px)" : "none",
fontSize: 14,
textAnchor: "start",
+ transition: "all 0.4s ease-in-out",
})}
/>
</svg>
@@ -117,9 +119,11 @@ const BarChart = ({
scale={xScale}
tickFormat={intervalData[interval].format}
tickLabelProps={() => ({
- fill: isValidating ? "transparent" : "#666666",
+ fill: "#666666",
+ filter: isValidating ? "blur(8px)" : "none",
fontSize: 12,
textAnchor: "middle",
+ transition: "all 0.4s ease-in-out",
})}
numTicks={6}
top={CHART_HEIGHT - 5}
diff --git a/components/stats/clicks.tsx b/components/stats/clicks.tsx
index 610cbe4d7a..2e6e8a6a6c 100644
--- a/components/stats/clicks.tsx
+++ b/components/stats/clicks.tsx
@@ -15,7 +15,7 @@ export default function Clicks({
<div className="mb-5 text-left">
<div className="flex space-x-1 items-end">
{isValidating ? (
- <div className="h-10 w-16 rounded-md bg-gray-200 dark:bg-gray-700 animate-pulse" />
+ <div className="h-10 w-12 rounded-md bg-gray-200 dark:bg-gray-700 animate-pulse" />
) : (
<h1 className="text-3xl sm:text-4xl dark:text-white font-bold">
{nFormatter(data.totalClicks)}
diff --git a/components/stats/index.tsx b/components/stats/index.tsx
index 3ee8c39693..287d38713d 100644
--- a/components/stats/index.tsx
+++ b/components/stats/index.tsx
@@ -23,7 +23,7 @@ export default function Stats() {
return (
<div className="relative bg-gray-50 dark:bg-black py-20">
- <Toggle />
+ <Toggle data={data!} />
<div className="max-w-4xl mx-auto grid gap-5">
<Clicks data={data!} isValidating={isValidating} />
<div className="grid grid-cols-1 sm:grid-cols-2 gap-5">
diff --git a/components/stats/toggle.tsx b/components/stats/toggle.tsx
index c8c85504af..386578d8c0 100644
--- a/components/stats/toggle.tsx
+++ b/components/stats/toggle.tsx
@@ -4,11 +4,11 @@ import { linkConstructor } from "@/lib/utils";
import useScroll from "@/lib/hooks/use-scroll";
import { useStatsContext } from "@/components/stats/context";
import { ExpandingArrow } from "@/components/shared/icons";
-import { IntervalProps } from "@/lib/stats";
+import { IntervalProps, StatsProps } from "@/lib/stats";
-export default function Toggle() {
+export default function Toggle({ data }: { data: StatsProps }) {
const router = useRouter();
- const key = router.query.key as string;
+ const key = (router.query.key as string) || data?.key;
const currentInterval = (router.query.interval as IntervalProps) || "24h";
const { atTop: atContextTop } = useStatsContext();