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.

code cleanup

Steven Teye1107f12a795
diff --git a/components/home/about/parallax.tsx b/components/home/about/parallax.tsx
deleted file mode 100644
index 98dd338b53..0000000000
--- a/components/home/about/parallax.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import { useState, useLayoutEffect, useRef, ReactNode } from "react";
-import {
- motion,
- useScroll,
- useTransform,
- useSpring,
- useReducedMotion,
-} from "framer-motion";
-
-type ParallaxProps = {
- children: ReactNode;
- offset?: number;
-};
-
-export default function Parallax({ children, offset = 50 }: ParallaxProps) {
- const prefersReducedMotion = useReducedMotion();
- const [elementTop, setElementTop] = useState(0);
- const [clientHeight, setClientHeight] = useState(0);
- const ref = useRef(null);
-
- const { scrollY } = useScroll();
-
- const initial = elementTop - clientHeight;
- const final = elementTop + offset;
-
- const yRange = useTransform(scrollY, [initial, final], [offset, -offset]);
- const y = useSpring(yRange, { stiffness: 400, damping: 90 });
-
- useLayoutEffect(() => {
- const element = ref.current as any;
- const onResize = () => {
- setElementTop(
- element.getBoundingClientRect().top + window.scrollY ||
- window.pageYOffset
- );
- setClientHeight(window.innerHeight);
- };
- onResize();
- window.addEventListener("resize", onResize);
- return () => window.removeEventListener("resize", onResize);
- }, [ref]);
-
- // Don't parallax if the user has "reduced motion" enabled
- if (prefersReducedMotion) {
- return <>{children}</>;
- }
-
- return (
- <motion.div ref={ref} style={{ y }}>
- {children}
- </motion.div>
- );
-}
diff --git a/components/stats/devices.tsx b/components/stats/devices.tsx
index c0a53388c7..c4b8f4d34c 100644
--- a/components/stats/devices.tsx
+++ b/components/stats/devices.tsx
@@ -56,8 +56,8 @@ export default function Devices({ data: rawData }: { data: StatsProps }) {
{data.deviceData ? (
data.deviceData.length > 0 ? (
<>
- {data.deviceData.map(({ display, count }) => (
- <div className="flex justify-between items-center">
+ {data.deviceData.map(({ display, count }, idx) => (
+ <div key={idx} className="flex justify-between items-center">
<div className="relative flex items-center z-10 w-full max-w-[calc(100%-3rem)]">
<span className="flex space-x-2 px-2 items-center z-10">
<DeviceIcon
diff --git a/components/stats/locations.tsx b/components/stats/locations.tsx
index aea8581259..cbbc88ef2a 100644
--- a/components/stats/locations.tsx
+++ b/components/stats/locations.tsx
@@ -52,8 +52,8 @@ export default function Locations({ data: rawData }: { data: StatsProps }) {
>
{data.locationData ? (
data.locationData.length > 0 ? (
- data.locationData.map(({ display, code, count }) => (
- <div className="flex justify-between items-center">
+ data.locationData.map(({ display, code, count }, idx) => (
+ <div key={idx} className="flex justify-between items-center">
<div className="relative flex items-center z-10 w-full max-w-[calc(100%-3rem)]">
<span className="flex space-x-2 px-2 items-center z-10">
<img
diff --git a/lib/stats.ts b/lib/stats.ts
index 4698dc41b7..aa3c09684d 100644
--- a/lib/stats.ts
+++ b/lib/stats.ts
@@ -225,7 +225,7 @@ export const processDeviceData = (
export const dummyData: StatsProps = {
key: "test",
- totalClicks: 100,
+ totalClicks: 0,
clicksData: getTimeIntervals("7d").timeIntervals.map((interval) => ({
...interval,
count: 0,
diff --git a/pages/about.tsx b/pages/about.tsx
index b9a1bec1e9..032a1ec095 100644
--- a/pages/about.tsx
+++ b/pages/about.tsx
@@ -1,6 +1,5 @@
import HomeLayout from "@/components/layout/home";
import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
-import Parallax from "@/components/home/about/parallax";
import Globe from "@/components/home/about/globe";
export default function About() {
@@ -14,13 +13,11 @@ export default function About() {
</div>
</MaxWidthWrapper>
<Globe />
- <Parallax>
- <div className="py-10 border-t border-black shadow-md w-full h-[500px]">
- <MaxWidthWrapper>
- <div>blah blah blah</div>
- </MaxWidthWrapper>
- </div>
- </Parallax>
+ <div className="py-10 border-t border-black shadow-md w-full h-[500px]">
+ <MaxWidthWrapper>
+ <div>blah blah blah</div>
+ </MaxWidthWrapper>
+ </div>
</HomeLayout>
);
}
diff --git a/tsconfig.json b/tsconfig.json
index 25be0ab75d..e503e9f72c 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -4,7 +4,6 @@
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
- "strict": true,
"baseUrl": ".",
"paths": {
"@/components/*": ["components/*"],