Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: added analitics
dev_wandrya836c2ef1fce
diff --git a/app/(home)/components/sections/bento-registry.tsx b/app/(home)/components/sections/bento-registry.tsxindex 6e10576c..de3234cc 100644--- a/app/(home)/components/sections/bento-registry.tsx+++ b/app/(home)/components/sections/bento-registry.tsx@@ -7,6 +7,7 @@ import Link from "next/link";import { type CSSProperties, useCallback, useRef, useState } from "react";import { Button } from "@/components/ui/button";import { SECTION, SPRING_SOFT } from "@/config/landing";+import { trackEvent } from "@/lib/analytics";import registry from "@/registry/__index__";import { FadeUp } from "../fade-up";@@ -26,10 +27,19 @@ function BentoCard({const entry = registry[name];const playerRef = useRef<PlayerRef>(null);const [playing, setPlaying] = useState(false);+ const hoverTracked = useRef(false);const handleEnter = () => {playerRef.current?.play();setPlaying(true);+ if (!hoverTracked.current) {+ hoverTracked.current = true;+ trackEvent("preview_played", {+ component: name,+ surface: "bento",+ trigger: "hover",+ });+ }};const handleLeave = () => {playerRef.current?.pause();@@ -41,11 +51,17 @@ function BentoCard({if (p.isPlaying()) {p.pause();setPlaying(false);+ trackEvent("preview_paused", { component: name, surface: "bento" });} else {p.play();setPlaying(true);+ trackEvent("preview_played", {+ component: name,+ surface: "bento",+ trigger: "click",+ });}- }, []);+ }, [name]);return (// biome-ignore lint/a11y/noStaticElementInteractions: hover-to-play is decorative video preview@@ -150,7 +166,16 @@ export function BentoRegistry() {size="lg"className="h-11 rounded-full border-white/10 bg-white/4 px-5 text-[#EDEDED] backdrop-blur-xl hover:border-white/20 hover:bg-white/6 hover:text-[#EDEDED]">- <Link href="/docs/getting-started/introduction" className="inline-flex items-center gap-2">+ <Link+ href="/docs/getting-started/introduction"+ className="inline-flex items-center gap-2"+ onClick={() =>+ trackEvent("cta_clicked", {+ cta: "bento_browse",+ destination: "/docs/getting-started/introduction",+ })+ }+ >Browse components<ArrowRight className="size-4" aria-hidden="true" /></Link>diff --git a/app/(home)/components/sections/final-cta.tsx b/app/(home)/components/sections/final-cta.tsxindex 6811d311..d05d8156 100644--- a/app/(home)/components/sections/final-cta.tsx+++ b/app/(home)/components/sections/final-cta.tsx@@ -12,6 +12,7 @@ import {SPRING_BOUNCE,SPRING_SOFT,} from "@/config/landing";+import { trackEvent } from "@/lib/analytics";import { FadeUp } from "../fade-up";export function FinalCTA() {@@ -56,6 +57,12 @@ export function FinalCTA() {><Linkhref="/docs/getting-started/introduction"+ onClick={() =>+ trackEvent("cta_clicked", {+ cta: "final_cta",+ destination: "/docs/getting-started/introduction",+ })+ }className="mt-12 inline-flex h-14 items-center gap-2 rounded-full bg-white px-8 text-base font-medium text-[#141318] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/40 focus-visible:ring-offset-2 focus-visible:ring-offset-[#141318]"style={{boxShadow: `0 0 0 1px rgba(255,255,255,0.2), 0 12px 50px ${LAVENDER}40, inset 0 1px 0 rgba(255,255,255,0.6)`,diff --git a/app/(home)/components/sections/hero.tsx b/app/(home)/components/sections/hero.tsxindex 5e08d2ac..dad98e29 100644--- a/app/(home)/components/sections/hero.tsx+++ b/app/(home)/components/sections/hero.tsx@@ -8,6 +8,7 @@ import { useCallback, useRef, useState } from "react";import Dither from "@/components/Dither";import { Button } from "@/components/ui/button";import { SECTION, SPRING_BOUNCE, SPRING_SOFT } from "@/config/landing";+import { trackEvent } from "@/lib/analytics";import registry from "@/registry/__index__";import { FadeUp } from "../fade-up";@@ -22,9 +23,18 @@ export function Hero() {if (p.isPlaying()) {p.pause();setPlaying(false);+ trackEvent("preview_paused", {+ component: "browser-flow",+ surface: "hero",+ });} else {p.play();setPlaying(true);+ trackEvent("preview_played", {+ component: "browser-flow",+ surface: "hero",+ trigger: "click",+ });}}, []);@@ -74,7 +84,16 @@ export function Hero() {transition={SPRING_SOFT}><Button className="hover:bg-white h-14 px-10">- <Link href="/docs/getting-started/introduction" className="inline-flex items-center gap-2">+ <Link+ href="/docs/getting-started/introduction"+ className="inline-flex items-center gap-2"+ onClick={() =>+ trackEvent("cta_clicked", {+ cta: "hero_browse",+ destination: "/docs/getting-started/introduction",+ })+ }+ >Browse components<ArrowRight className="size-4" aria-hidden="true" /></Link>diff --git a/app/(home)/components/sections/landing-code-showcase.tsx b/app/(home)/components/sections/landing-code-showcase.tsxindex 7e70985f..b643ed0d 100644--- a/app/(home)/components/sections/landing-code-showcase.tsx+++ b/app/(home)/components/sections/landing-code-showcase.tsx@@ -5,6 +5,7 @@ import { Pause, Play } from "lucide-react";import { motion } from "motion/react";import { useCallback, useRef, useState } from "react";import { PEACH, SECTION, SPRING_SOFT } from "@/config/landing";+import { trackEvent } from "@/lib/analytics";import registry from "@/registry/__index__";import { FadeUp } from "../fade-up";@@ -22,9 +23,18 @@ export function LandingCodeShowcase() {if (p.isPlaying()) {p.pause();setPlaying(false);+ trackEvent("preview_paused", {+ component: "landing-code-showcase",+ surface: "landing_code_showcase",+ });} else {p.play();setPlaying(true);+ trackEvent("preview_played", {+ component: "landing-code-showcase",+ surface: "landing_code_showcase",+ trigger: "click",+ });}}, []);diff --git a/app/(home)/components/site-header.tsx b/app/(home)/components/site-header.tsxindex e7efc521..8a45564b 100644--- a/app/(home)/components/site-header.tsx+++ b/app/(home)/components/site-header.tsx@@ -12,6 +12,14 @@ import {SheetTrigger,} from "@/components/ui/sheet";import { type NavLink, SECTION } from "@/config/landing";+import { trackEvent } from "@/lib/analytics";++const GITHUB_URL = "https://github.com/kapishdima/remocn";+const trackGitHubClick = () =>+ trackEvent("cta_clicked", {+ cta: "github_header",+ destination: GITHUB_URL,+ });const GitHubIcon = ({ className }: { className?: string }) => (<svg@@ -58,9 +66,10 @@ export function SiteHeader({ navLinks }: { navLinks: NavLink[] }) {</Link>))}<Link- href="https://github.com/kapishdima/remocn"+ href={GITHUB_URL}target="_blank"rel="noreferrer noopener"+ onClick={trackGitHubClick}className="flex items-center gap-1.5 transition-colors hover:text-white focus-visible:text-white focus-visible:outline-none"><GitHubIcon className="size-4" />@@ -100,10 +109,13 @@ export function SiteHeader({ navLinks }: { navLinks: NavLink[] }) {</Link>))}<Link- href="https://github.com/kapishdima/remocn"+ href={GITHUB_URL}target="_blank"rel="noreferrer noopener"- onClick={() => setOpen(false)}+ onClick={() => {+ setOpen(false);+ trackGitHubClick();+ }}className="mt-2 inline-flex items-center gap-2 py-3 text-[#EDEDED]/90 transition-colors hover:text-white focus-visible:text-white focus-visible:outline-none"><GitHubIcon className="size-4" />diff --git a/components/docs/code-block-command.tsx b/components/docs/code-block-command.tsxindex 0cdcd7a4..15e6817a 100644--- a/components/docs/code-block-command.tsx+++ b/components/docs/code-block-command.tsx@@ -5,6 +5,7 @@ import { useAtom } from "jotai";import { atomWithStorage } from "jotai/utils";import { TerminalIcon, TextAlignStartIcon } from "lucide-react";import { useMemo } from "react";+import { trackEvent } from "@/lib/analytics";import { cn } from "@/lib/utils";import { CopyButton } from "./copy-button";@@ -25,6 +26,7 @@ export interface CodeBlockCommandProps {yarn?: string;npm?: string;bun?: string;+ component?: string;}export function CodeBlockCommand({@@ -33,6 +35,7 @@ export function CodeBlockCommand({yarn,npm,bun,+ component,}: CodeBlockCommandProps) {const [packageManager, setPackageManager] = usePackageManager();@@ -105,6 +108,14 @@ export function CodeBlockCommand({<CopyButtonvalue={activeCommand}className="absolute top-2 right-2 z-10"+ onCopy={() => {+ if (!component) return;+ trackEvent("install_command_copied", {+ component,+ package_manager: packageManager,+ surface: "docs",+ });+ }}/></div>);diff --git a/components/docs/component-preview.tsx b/components/docs/component-preview.tsxindex d93ff7f3..1d11ef35 100644--- a/components/docs/component-preview.tsx+++ b/components/docs/component-preview.tsx@@ -10,8 +10,9 @@ import {parseAsStringLiteral,useQueryStates,} from "nuqs";-import { Suspense, useMemo, useState } from "react";+import { Suspense, useEffect, useMemo, useRef, useState } from "react";import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";+import { trackEvent } from "@/lib/analytics";import {type ComponentConfig,type ControlConfig,@@ -103,11 +104,40 @@ function Preview({if (typeof window === "undefined") return;navigator.clipboard.writeText(window.location.href);setCopied(true);+ trackEvent("customized_link_shared", { component: name });setTimeout(() => setCopied(false), 1500);};const handleReset = () => {setValues(null);+ trackEvent("customizer_reset", { component: name });+ };++ useEffect(() => {+ trackEvent("docs_component_viewed", { component: name });+ }, [name]);++ const customizeTimers = useRef<Map<string, ReturnType<typeof setTimeout>>>(+ new Map(),+ );+ useEffect(() => {+ const timers = customizeTimers.current;+ return () => {+ for (const timer of timers.values()) clearTimeout(timer);+ timers.clear();+ };+ }, []);+ const handleCustomizeChange = (key: string, value: unknown) => {+ setValues((prev) => ({ ...prev, [key]: value }));+ const existing = customizeTimers.current.get(key);+ if (existing) clearTimeout(existing);+ customizeTimers.current.set(+ key,+ setTimeout(() => {+ trackEvent("component_customized", { component: name, prop: key });+ customizeTimers.current.delete(key);+ }, 500),+ );};return (@@ -185,9 +215,7 @@ function Preview({<ComponentCustomizercontrols={config.controls}values={values as Record<string, unknown>}- onChange={(key, value) =>- setValues((prev) => ({ ...prev, [key]: value }))- }+ onChange={handleCustomizeChange}/></div></div>diff --git a/components/docs/copy-button.tsx b/components/docs/copy-button.tsxindex 4cbc327a..e2c3aeb7 100644--- a/components/docs/copy-button.tsx+++ b/components/docs/copy-button.tsx@@ -7,9 +7,11 @@ import { cn } from "@/lib/utils";export function CopyButton({value,className,+ onCopy,}: {value: string;className?: string;+ onCopy?: () => void;}) {const [copied, setCopied] = useState(false);@@ -20,6 +22,7 @@ export function CopyButton({onClick={() => {navigator.clipboard.writeText(value);setCopied(true);+ onCopy?.();setTimeout(() => setCopied(false), 1500);}}className={cn(diff --git a/components/docs/install-block.tsx b/components/docs/install-block.tsxindex 466f6646..ee50fed1 100644--- a/components/docs/install-block.tsx+++ b/components/docs/install-block.tsx@@ -6,6 +6,7 @@ export function InstallBlock({ name }: { name: string }) {return (<div className="my-6"><CodeBlockCommand+ component={name}prompt={`Add the @remocn/${name} component to my project.`}{...convertNpmCommand(npmCommand)}/>diff --git a/lib/analytics.ts b/lib/analytics.tsnew file mode 100644index 00000000..e5db08c1--- /dev/null+++ b/lib/analytics.ts@@ -0,0 +1,54 @@+import { track } from "@vercel/analytics";++export type PreviewSurface =+ | "hero"+ | "bento"+ | "landing_code_showcase"+ | "docs";++export type CtaId =+ | "hero_browse"+ | "bento_browse"+ | "final_cta"+ | "github_header";++type EventMap = {+ install_command_copied: {+ component: string;+ package_manager: "pnpm" | "npm" | "yarn" | "bun" | "prompt";+ surface: "docs" | "landing";+ };+ preview_played: {+ component: string;+ surface: PreviewSurface;+ trigger: "click" | "hover";+ };+ preview_paused: {+ component: string;+ surface: PreviewSurface;+ };+ component_customized: {+ component: string;+ prop: string;+ };+ customized_link_shared: {+ component: string;+ };+ customizer_reset: {+ component: string;+ };+ cta_clicked: {+ cta: CtaId;+ destination: string;+ };+ docs_component_viewed: {+ component: string;+ };+};++export function trackEvent<K extends keyof EventMap>(+ name: K,+ properties: EventMap[K],+) {+ track(name, properties as Record<string, string>);+}