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.

WIP review slides

Tim Wilson256cdf99229a
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/page-client.tsx
index c4f2e9b7a9..f46dd472f0 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/page-client.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/page-client.tsx
@@ -27,6 +27,7 @@ export function PartnerRewind2025PageClient({
animate={{ opacity: 1, scale: 1, filter: "blur(0px)" }}
exit={{ opacity: 0, scale: 0.9, filter: "blur(10px)" }}
transition={{ duration: 0.5 }}
+ className="w-full"
>
{state === "intro" && <Intro onStart={() => setState("rewind")} />}
{state === "rewind" && (
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/page.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/page.tsx
index 3a03c2f770..b63d7d4a80 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/page.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/page.tsx
@@ -47,7 +47,7 @@ export default async function PartnerRewind2025Page() {
<Gradient className="absolute right-0 top-0 h-[720px] w-96 -translate-y-1/2 translate-x-1/2 -rotate-[55deg] opacity-20" />
</div>
- <div className="scrollbar-hide flex size-full items-center justify-center overflow-y-auto">
+ <div className="scrollbar-hide flex size-full items-center justify-center overflow-y-auto p-6">
<PartnerRewind2025PageClient partnerRewind={partnerRewind} />
</div>
</div>
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/rewind.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/rewind.tsx
index f8c9df6b5f..a59e3e545b 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/rewind.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/rewind/2025/rewind.tsx
@@ -1,4 +1,46 @@
import { PartnerRewindProps } from "@/lib/types";
+import { ChevronLeft, ChevronRight } from "@dub/ui";
+import { cn } from "@dub/utils/src";
+import { AnimatePresence, motion } from "motion/react";
+import { useEffect, useMemo, useState } from "react";
+
+const ASSETS_PATH = "https://assets.dub.co/misc/partner-rewind-2025";
+
+const STEPS = [
+ {
+ id: "totalEarnings",
+ percentileId: "earningsPercentile",
+ label: "Total earnings",
+ valueType: "currency",
+ video: "revenue.webm",
+ },
+ {
+ id: "totalClicks",
+ percentileId: "clicksPercentile",
+ label: "Total clicks",
+ valueType: "number",
+ video: "clicks.webm",
+ },
+ {
+ id: "totalLeads",
+ percentileId: "leadsPercentile",
+ label: "Total leads",
+ valueType: "number",
+ video: "leads.webm",
+ },
+ {
+ id: "totalRevenue",
+ percentileId: "revenuePercentile",
+ label: "Total revenue",
+ valueType: "currency",
+ video: "revenue.webm",
+ },
+];
+
+const STEP_DELAY_MS = 2000;
+
+const navButtonClassName =
+ "bg-bg-inverted/5 text-content-default hover:bg-bg-inverted/10 flex size-8 items-center justify-center rounded-lg transition-[background-color,transform] active:scale-95";
export function Rewind({
partnerRewind,
@@ -7,5 +49,127 @@ export function Rewind({
partnerRewind: PartnerRewindProps;
onComplete: () => void;
}) {
- return <div>[rewind]</div>;
+ const steps = useMemo(
+ () =>
+ STEPS.map((step) =>
+ partnerRewind[step.id]
+ ? {
+ ...step,
+ value: partnerRewind[step.id],
+ percentile: partnerRewind[step.percentileId],
+ }
+ : null,
+ ).filter((s): s is NonNullable<typeof s> => s !== null),
+ [partnerRewind],
+ );
+
+ const [isPaused, setIsPaused] = useState(false);
+ const [currentStepIndex, setCurrentStepIndex] = useState(0);
+
+ useEffect(() => {
+ if (currentStepIndex > steps.length - 1) {
+ setCurrentStepIndex(steps.length - 1);
+ return;
+ }
+
+ if (isPaused || currentStepIndex === steps.length - 1) return;
+
+ const timeout = setTimeout(() => {
+ setCurrentStepIndex((i) => i + 1);
+ }, STEP_DELAY_MS);
+
+ return () => clearTimeout(timeout);
+ }, [steps, currentStepIndex, isPaused]);
+
+ return (
+ <div className="flex w-full flex-col items-center gap-6">
+ <div className="flex items-center gap-0.5">
+ {steps.map((step, index) => (
+ <button
+ key={step.id}
+ onClick={() => {
+ setIsPaused(true);
+ setCurrentStepIndex(index);
+ }}
+ className="rounded-full p-1 transition-all hover:bg-black/5 active:scale-95"
+ >
+ <div className="bg-bg-emphasis relative h-1.5 w-10 overflow-hidden rounded-full">
+ {index === currentStepIndex && !isPaused ? (
+ <motion.div
+ className="bg-bg-inverted absolute inset-0 rounded-full"
+ initial={{ x: "-100%", opacity: 0.3 }}
+ animate={{ x: 0, opacity: 1 }}
+ transition={{
+ duration: STEP_DELAY_MS / 1000,
+ ease: "linear",
+ }}
+ />
+ ) : (
+ <div
+ className={cn(
+ "bg-bg-inverted size-full rounded-full transition-opacity",
+ index > currentStepIndex && "opacity-0",
+ )}
+ />
+ )}
+ </div>
+ </button>
+ ))}
+ </div>
+
+ <AnimatePresence mode="popLayout">
+ <motion.div
+ key={currentStepIndex}
+ initial={{ opacity: 0, scale: 0.9, filter: "blur(10px)" }}
+ animate={{ opacity: 1, scale: 1, filter: "blur(0px)" }}
+ exit={{ opacity: 0, scale: 0.9, filter: "blur(10px)" }}
+ transition={{ duration: 0.5 }}
+ className="flex w-full flex-col items-center"
+ >
+ <StepSlide title={steps[currentStepIndex].label} />
+ </motion.div>
+ </AnimatePresence>
+
+ <div className="flex items-center gap-2">
+ <button
+ type="button"
+ onClick={() => {
+ setIsPaused(false);
+ setCurrentStepIndex((c) => Math.max(c - 1, 0));
+ }}
+ disabled={currentStepIndex <= 0}
+ className={navButtonClassName}
+ >
+ <ChevronLeft className="size-3" />
+ </button>
+ <button
+ type="button"
+ onClick={() => {
+ setIsPaused(false);
+ setCurrentStepIndex((c) => Math.min(c + 1, steps.length - 1));
+ }}
+ disabled={currentStepIndex >= steps.length - 1}
+ className={navButtonClassName}
+ >
+ <ChevronRight className="size-3" />
+ </button>
+ </div>
+ </div>
+ );
+}
+
+function StepSlide({
+ title,
+ onPrevious,
+ onNext,
+}: {
+ title: string;
+ onPrevious?: () => void;
+ onNext?: () => void;
+}) {
+ return (
+ <div className="bg-bg-default border-border-subtle flex w-full max-w-screen-sm flex-col rounded-2xl border p-10">
+ <div>{title}</div>
+ </div>
+ );
}
diff --git a/apps/web/ui/layout/main-nav.tsx b/apps/web/ui/layout/main-nav.tsx
index a5cdebfbe6..d3eaa561a1 100644
--- a/apps/web/ui/layout/main-nav.tsx
+++ b/apps/web/ui/layout/main-nav.tsx
@@ -79,7 +79,7 @@ export function MainNav({
<Sidebar toolContent={toolContent} newsContent={newsContent} />
</div>
</div>
- <div className="bg-neutral-200 pb-[var(--page-bottom-margin)] pt-[var(--page-top-margin)] [--page-bottom-margin:0px] [--page-top-margin:0px] md:h-screen md:pb-2 md:pr-2 md:[--page-bottom-margin:0.5rem] md:[--page-top-margin:0.5rem]">
+ <div className="h-screen bg-neutral-200 pb-[var(--page-bottom-margin)] pt-[var(--page-top-margin)] [--page-bottom-margin:0px] [--page-top-margin:0px] md:pb-2 md:pr-2 md:[--page-bottom-margin:0.5rem] md:[--page-top-margin:0.5rem]">
<div className="relative h-full overflow-y-auto bg-neutral-100 pt-px md:rounded-xl md:bg-white">
<SideNavContext.Provider value={{ isOpen, setIsOpen }}>
{children}