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.

Added pricing section

Steven Tey83b0a9fa6f4f
diff --git a/components/home/globe.tsx b/components/home/globe.tsx
index 11d7ea0f87..82cb7a0482 100644
--- a/components/home/globe.tsx
+++ b/components/home/globe.tsx
@@ -1,8 +1,10 @@
-import { useEffect, useRef } from "react";
+import { useEffect, useRef, useState } from "react";
import createGlobe from "cobe";
import { useSpring } from "react-spring";
import useSWR from "swr";
+import { X } from "@/components/shared/icons";
import { fetcher } from "@/lib/utils";
+import { motion, AnimatePresence } from "framer-motion";
interface MarkerProps {
location: [number, number];
@@ -44,7 +46,7 @@ export default function Globe() {
theta: 0.3,
dark: 0,
diffuse: 3,
- mapSamples: 16000,
+ mapSamples: 20000,
mapBrightness: 4,
baseColor: [1, 1, 1],
markerColor: [249 / 255, 115 / 255, 22 / 255],
@@ -63,57 +65,92 @@ export default function Globe() {
setTimeout(() => (canvasRef.current.style.opacity = "1"));
return () => globe.destroy();
}, [markers]);
+
+ const [showModal, setShowModal] = useState(true);
return (
- <div
- style={{
- width: "100%",
- maxWidth: 1000,
- aspectRatio: "1",
- margin: "auto",
- position: "relative",
- }}
- >
- <canvas
- ref={canvasRef}
- onPointerDown={(e) => {
- pointerInteracting.current =
- e.clientX - pointerInteractionMovement.current;
- canvasRef.current.style.cursor = "grabbing";
- }}
- onPointerUp={() => {
- pointerInteracting.current = null;
- canvasRef.current.style.cursor = "grab";
- }}
- onPointerOut={() => {
- pointerInteracting.current = null;
- canvasRef.current.style.cursor = "grab";
- }}
- onMouseMove={(e) => {
- if (pointerInteracting.current !== null) {
- const delta = e.clientX - pointerInteracting.current;
- pointerInteractionMovement.current = delta;
- api.start({
- r: delta / 200,
- });
- }
- }}
- onTouchMove={(e) => {
- if (pointerInteracting.current !== null && e.touches[0]) {
- const delta = e.touches[0].clientX - pointerInteracting.current;
- pointerInteractionMovement.current = delta;
- api.start({
- r: delta / 100,
- });
- }
- }}
+ <div className="relative flex items-center">
+ <AnimatePresence>
+ {showModal && (
+ <motion.div
+ key="globe-modal"
+ initial={{ scale: 0 }}
+ animate={{ scale: 1 }}
+ exit={{ scale: 0 }}
+ className="group absolute left-0 right-0 mx-auto z-10 max-w-sm px-5 py-7 rounded-md bg-white border border-gray-200 shadow-md"
+ >
+ <button
+ className="visible sm:invisible group-hover:visible absolute top-0 right-0 p-1 m-2 rounded-full float-right group hover:bg-gray-100 focus:outline-none active:scale-75 transition-all duration-75"
+ autoFocus={false}
+ onClick={() => setShowModal(false)}
+ >
+ <X className="w-3 h-3" />
+ </button>
+ <p className="text-center text-gray-700 text-sm sm:text-base">
+ This map shows the locations of the last 30 clicks on{" "}
+ <a
+ className="text-blue-800 font-semibold"
+ href="https://dub.sh/github"
+ target="_blank"
+ rel="noreferrer"
+ >
+ dub.sh/github
+ </a>{" "}
+ in real time.
+ </p>
+ </motion.div>
+ )}
+ </AnimatePresence>
+ <div
style={{
width: "100%",
- height: "100%",
- contain: "layout paint size",
- opacity: 0,
- transition: "opacity 1s ease",
+ maxWidth: 1000,
+ aspectRatio: "1",
+ margin: "auto",
+ position: "relative",
}}
- />
+ >
+ <canvas
+ ref={canvasRef}
+ onPointerDown={(e) => {
+ pointerInteracting.current =
+ e.clientX - pointerInteractionMovement.current;
+ canvasRef.current.style.cursor = "grabbing";
+ }}
+ onPointerUp={() => {
+ pointerInteracting.current = null;
+ canvasRef.current.style.cursor = "grab";
+ }}
+ onPointerOut={() => {
+ pointerInteracting.current = null;
+ canvasRef.current.style.cursor = "grab";
+ }}
+ onMouseMove={(e) => {
+ if (pointerInteracting.current !== null) {
+ const delta = e.clientX - pointerInteracting.current;
+ pointerInteractionMovement.current = delta;
+ api.start({
+ r: delta / 200,
+ });
+ }
+ }}
+ onTouchMove={(e) => {
+ if (pointerInteracting.current !== null && e.touches[0]) {
+ const delta = e.touches[0].clientX - pointerInteracting.current;
+ pointerInteractionMovement.current = delta;
+ api.start({
+ r: delta / 100,
+ });
+ }
+ }}
+ style={{
+ width: "100%",
+ height: "100%",
+ contain: "layout paint size",
+ opacity: 0,
+ transition: "opacity 1s ease",
+ }}
+ />
+ </div>
</div>
);
}
diff --git a/components/home/link-card.tsx b/components/home/link-card.tsx
index 90029c81a6..d7318a25c1 100644
--- a/components/home/link-card.tsx
+++ b/components/home/link-card.tsx
@@ -97,7 +97,7 @@ export default function LinkCard({
};
const sendErrorToast = useDebouncedCallback(
- () => toast.error("Cannot delete root tweet."),
+ () => toast.error("Cannot delete default link."),
100
);
diff --git a/components/shared/counting-numbers.tsx b/components/shared/counting-numbers.tsx
new file mode 100644
index 0000000000..62c6d84185
--- /dev/null
+++ b/components/shared/counting-numbers.tsx
@@ -0,0 +1,46 @@
+import { useInView } from "framer-motion";
+import { useEffect, useRef, useState } from "react";
+
+export default function CountingNumbers({
+ value,
+ className,
+ start = 1000,
+ interval = 10,
+ duration = 800,
+}: {
+ value: number;
+ className: string;
+ start?: number;
+ interval?: number;
+ duration?: number;
+}) {
+ const [number, setNumber] = useState(start);
+ const increment = Math.floor((start - value) / (duration / interval));
+ const ref = useRef(null);
+ const isInView = useInView(ref);
+
+ useEffect(() => {
+ if (isInView) {
+ let timer = setInterval(() => {
+ if (number > value) {
+ setNumber((num) => {
+ let newValue = num - increment;
+ if (newValue < value) {
+ newValue = value;
+ if (timer) clearInterval(timer);
+ }
+ return newValue;
+ });
+ } else if (timer) {
+ clearInterval(timer);
+ }
+ }, interval);
+ }
+ }, [isInView]);
+
+ return (
+ <p className={className} ref={ref}>
+ {number}
+ </p>
+ );
+}
diff --git a/components/shared/max-width-wrapper.tsx b/components/shared/max-width-wrapper.tsx
index 1b85150c80..da65cc2ca5 100644
--- a/components/shared/max-width-wrapper.tsx
+++ b/components/shared/max-width-wrapper.tsx
@@ -1,8 +1,16 @@
import { ReactNode } from "react";
-export default function MaxWidthWrapper({ children }: { children: ReactNode }) {
+export default function MaxWidthWrapper({
+ className,
+ children,
+}: {
+ className?: string;
+ children: ReactNode;
+}) {
return (
- <div className="w-full max-w-screen-xl mx-auto px-2.5 sm:px-20">
+ <div
+ className={`w-full max-w-screen-xl mx-auto px-2.5 sm:px-20 ${className}`}
+ >
{children}
</div>
);
diff --git a/pages/api/edge/coordinates.ts b/pages/api/edge/coordinates.ts
index 0dd64f0f7f..53b78a91eb 100644
--- a/pages/api/edge/coordinates.ts
+++ b/pages/api/edge/coordinates.ts
@@ -8,7 +8,7 @@ export const config = {
export default async function handler(req: NextRequest) {
if (req.method === "GET") {
- const numPoints = 20;
+ const numPoints = 30;
const rawData = await redis.zrange<RawStatsProps[]>(
"dub.sh:clicks:github",
0,
diff --git a/pages/index.tsx b/pages/index.tsx
index 25e9525bc3..78d385d4c4 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -10,20 +10,23 @@ import {
Twitter,
CheckCircleFill,
} from "@/components/shared/icons";
-import { motion, AnimatePresence } from "framer-motion";
+import { motion } from "framer-motion";
import { SimpleLinkProps } from "@/lib/types";
import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
import Globe from "@/components/home/globe";
import Tooltip, { TooltipContent } from "@/components/shared/tooltip";
import { Toaster } from "react-hot-toast";
+import CountingNumbers from "@/components/shared/counting-numbers";
export default function Home() {
return (
<HomeLayout>
<Hero />
<Demo />
- {/* <Globe /> */}
+ <Globe />
<Features />
+ <Pricing />
+ <Footer />
</HomeLayout>
);
}
@@ -56,7 +59,7 @@ const Hero = () => {
</p>
<div className="mt-10 flex space-x-4 max-w-fit mx-auto">
- <Link href="https://app.dub.sh">
+ <Link href="https://app.dub.sh/register">
<a className="py-2 px-5 bg-black hover:bg-white rounded-full border border-black text-sm text-white hover:text-black transition-all">
Start For Free
</a>
@@ -109,7 +112,7 @@ const Demo = () => {
title="Maximum number of links reached. Swipe to delete existing links or
create a free account."
cta="Start For Free"
- ctaLink="https://app.dub.sh"
+ ctaLink="https://app.dub.sh/register"
/>
}
>
@@ -187,44 +190,141 @@ const Demo = () => {
const Features = () => {
return (
- <div className="max-w-md mx-auto sm:px-0 px-2.5">
- <h2 className="text-3xl font-display font-semibold text-black mt-10">
+ <div>
+ {/* <h2 className="text-3xl font-display font-semibold text-black mt-10">
Features
- </h2>
- <ul className="mt-5 space-y-5">
- <li className="flex space-x-5">
- <div className="flex-shrink-0">
- <CheckCircleFill className="w-6 h-6 text-green-500" />
- </div>
- <p className="text-gray-600 text-lg">Free custom domains</p>
- </li>
- <li className="flex space-x-5">
- <div className="flex-shrink-0">
- <CheckCircleFill className="w-6 h-6 text-green-500" />
- </div>
- <p className="text-gray-600 text-lg">Built-in analytics</p>
- </li>
- <li className="flex space-x-5">
- <div className="flex-shrink-0">
- <CheckCircleFill className="w-6 h-6 text-green-500" />
- </div>
- <p className="text-gray-600 text-lg">Open-source</p>
- </li>
- </ul>
+ </h2> */}
</div>
);
};
+const pricingItems = [
+ {
+ plan: "Free",
+ tagline: "For startups & side projects",
+ price: 0,
+ features: [
+ "Free custom domains",
+ "Unlimited links",
+ "Up to 1K link clicks/month",
+ ],
+ cta: "Start for free",
+ ctaLink: "https://app.dub.sh/register",
+ },
+ {
+ plan: "Pro",
+ tagline: "For larger teams with increased usage",
+ isPopular: true,
+ price: 99,
+ features: [
+ "Free custom domains",
+ "Unlimited links",
+ "Up to 1M link clicks/month",
+ ],
+ cta: "Get started",
+ ctaLink: "https://app.dub.sh/register",
+ },
+ {
+ plan: "Enterprise",
+ tagline: "For businesses with custom needs",
+ price: "Custom",
+ features: [
+ "Free custom domains",
+ "Unlimited links",
+ "Unlimited link clicks",
+ ],
+ cta: "Contact us",
+ ctaLink: "mailto:[email protected]?subject=Interested%20in%20Dub%20Enterprise",
+ },
+];
+
const Pricing = () => {
return (
- <div className="max-w-md mx-auto sm:px-0 px-2.5">
- <h2 className="text-3xl font-display font-semibold text-black mt-10">
- Start for free.
- </h2>
- <p className="text-gray-600 text-lg mt-5">
- Dub is completely free to use. You can use it for personal or commercial
- use.
- </p>
+ <MaxWidthWrapper className="my-20 text-center">
+ <div className="max-w-md mx-auto my-10">
+ <h2 className="text-5xl font-display font-extrabold text-black">
+ Simple,{" "}
+ <span className="text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-cyan-600">
+ affordable
+ </span>{" "}
+ pricing
+ </h2>
+ <p className="text-gray-600 text-lg mt-5">
+ Start for free, no credit card required. Upgrade anytime.
+ </p>
+ </div>
+ <div className="grid grid-cols-1 lg:grid-cols-3 gap-10">
+ {pricingItems.map(
+ ({ plan, tagline, isPopular, price, features, cta, ctaLink }) => (
+ <div
+ className={`relative bg-white rounded-2xl ${
+ isPopular
+ ? "border-2 border-blue-600 shadow-blue-200"
+ : "border border-gray-200"
+ } shadow-md`}
+ >
+ {isPopular && (
+ <div className="absolute -top-5 left-0 right-0 mx-auto bg-gradient-to-r from-blue-600 to-cyan-600 text-white text-sm font-medium w-32 px-3 py-2 rounded-full">
+ Popular
+ </div>
+ )}
+ <div className="p-5">
+ <h3 className="text-center text-3xl font-bold font-display my-3">
+ {plan}
+ </h3>
+ <p className="text-gray-500">{tagline}</p>
+ {typeof price === "number" ? (
+ <div className="my-5 flex justify-center">
+ <p className="text-6xl font-display font-semibold">$</p>
+ <CountingNumbers
+ value={price}
+ className="text-6xl font-display font-semibold"
+ />
+ </div>
+ ) : (
+ <p className="my-5 text-6xl font-display font-semibold">
+ {price}
+ </p>
+ )}
+ <p className="text-gray-500">Monthly</p>
+ </div>
+ <div className="border-t border-gray-200" />
+ <ul className="px-10 my-10 space-y-5">
+ {features.map((feature) => (
+ <li key={feature} className="flex space-x-5">
+ <div className="flex-shrink-0">
+ <CheckCircleFill className="w-6 h-6 text-green-500" />
+ </div>
+ <p className="text-gray-600">{feature}</p>
+ </li>
+ ))}
+ </ul>
+ <div className="border-t border-gray-200" />
+ <div className="p-5">
+ <Link href={ctaLink}>
+ <a
+ className={`${
+ isPopular
+ ? "bg-gradient-to-r from-blue-600 to-cyan-600 hover:bg-white text-white hover:text-transparent hover:bg-clip-text border border-transparent hover:border-blue-700"
+ : "bg-black text-white hover:bg-white hover:text-black border border-gray-200 hover:border-black"
+ } block w-full py-2 rounded-full font-medium transition-all`}
+ >
+ {cta}
+ </a>
+ </Link>
+ </div>
+ </div>
+ )
+ )}
+ </div>
+ </MaxWidthWrapper>
+ );
+};
+
+const Footer = () => {
+ return (
+ <div className="border-t border-gray-200 h-20">
+ <MaxWidthWrapper>Footer</MaxWidthWrapper>
</div>
);
};